mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-30 06:33:06 +00:00
Fix pointer constraint in bn_mul.h
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
c54f25e26c
commit
0400ae2f9b
@ -265,7 +265,10 @@
|
||||
"str x5, [%1], #8 \n\t"
|
||||
|
||||
#define MULADDC_X1_STOP \
|
||||
: "+r" (c), "+r" (d), "+r" (s), "+m" (*(uint64_t (*)[16]) d) \
|
||||
: "+r" (c), \
|
||||
"+" MBEDTLS_ASM_AARCH64_PTR_CONSTRAINT (d), \
|
||||
"+" MBEDTLS_ASM_AARCH64_PTR_CONSTRAINT (s), \
|
||||
"+m" (*(uint64_t (*)[16]) d) \
|
||||
: "r" (b), "m" (*(const uint64_t (*)[16]) s) \
|
||||
: "x4", "x5", "x6", "x7", "cc" \
|
||||
);
|
||||
|
@ -169,6 +169,24 @@ inline void mbedtls_xor(unsigned char *r, const unsigned char *a, const unsigned
|
||||
#endif
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/*
|
||||
* Define the constraint used for pointer operands to asm.
|
||||
*
|
||||
* This is normally the usual "r", but for aarch64_32 (aka ILP32,
|
||||
* as found in watchos), "p" is required to avoid warnings from clang.
|
||||
*/
|
||||
#if defined(__aarch64__) && defined(MBEDTLS_HAVE_ASM)
|
||||
#if UINTPTR_MAX == 0xfffffffful
|
||||
/* ILP32: Specify the pointer operand slightly differently, as per #7787. */
|
||||
#define MBEDTLS_ASM_AARCH64_PTR_CONSTRAINT "p"
|
||||
#elif UINTPTR_MAX == 0xfffffffffffffffful
|
||||
/* Normal case (64-bit pointers): use "r" as the constraint for pointer operands to asm */
|
||||
#define MBEDTLS_ASM_AARCH64_PTR_CONSTRAINT "r"
|
||||
#else
|
||||
#error Unrecognised pointer size for aarch64
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Always provide a static assert macro, so it can be used unconditionally.
|
||||
* It will expand to nothing on some systems.
|
||||
* Can be used outside functions (but don't add a trailing ';' in that case:
|
||||
|
@ -83,13 +83,7 @@ static inline uint32_t mbedtls_get_unaligned_volatile_uint32(volatile const unsi
|
||||
#if defined(__arm__) || defined(__thumb__) || defined(__thumb2__)
|
||||
asm volatile ("ldr %0, [%1]" : "=r" (r) : "r" (p) :);
|
||||
#elif defined(__aarch64__)
|
||||
#if (UINTPTR_MAX == 0xfffffffful)
|
||||
/* ILP32: Specify the pointer operand slightly differently, as per #7787. */
|
||||
asm volatile ("ldr %w0, [%1]" : "=r" (r) : "p" (p) :);
|
||||
#elif (UINTPTR_MAX == 0xffffffffffffffffull)
|
||||
/* aarch64 with 64-bit pointers */
|
||||
asm volatile ("ldr %w0, [%1]" : "=r" (r) : "r" (p) :);
|
||||
#endif
|
||||
asm volatile ("ldr %w0, [%1]" : "=r" (r) : MBEDTLS_ASM_AARCH64_PTR_CONSTRAINT (p) :);
|
||||
#endif
|
||||
return r;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user