Work around updating pointers from ILP32
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
diff --git a/library/bn_mul.h b/library/bn_mul.h
index 0af7ecd..93dd4b6 100644
--- a/library/bn_mul.h
+++ b/library/bn_mul.h
@@ -248,10 +248,10 @@
#endif /* AMD64 */
-#if defined(__aarch64__)
+#if defined(__aarch64__) && (UINTPTR_MAX == 0xfffffffful || UINTPTR_MAX == 0xfffffffffffffffful)
#define MULADDC_X1_INIT \
- asm(
+ do { uintptr_t muladdc_d = (uintptr_t) d, muladdc_s = (uintptr_t) s; asm(
#define MULADDC_X1_CORE \
"ldr x4, [%2], #8 \n\t" \
@@ -266,12 +266,12 @@
#define MULADDC_X1_STOP \
: "+r" (c), \
- "+" MBEDTLS_ASM_AARCH64_PTR_CONSTRAINT (d), \
- "+" MBEDTLS_ASM_AARCH64_PTR_CONSTRAINT (s), \
+ "+r" (muladdc_d), \
+ "+r" (muladdc_s), \
"+m" (*(uint64_t (*)[16]) d) \
: "r" (b), "m" (*(const uint64_t (*)[16]) s) \
: "x4", "x5", "x6", "x7", "cc" \
- );
+ ); d = (mbedtls_mpi_uint *)muladdc_d; s = (mbedtls_mpi_uint *)muladdc_s; } while (0);
#endif /* Aarch64 */
diff --git a/library/common.h b/library/common.h
index 4ee183a..ba9cb75 100644
--- a/library/common.h
+++ b/library/common.h
@@ -174,6 +174,9 @@
*
* This is normally the usual "r", but for aarch64_32 (aka ILP32,
* as found in watchos), "p" is required to avoid warnings from clang.
+ *
+ * Note that clang does not recognise '+p' or '=p', and armclang
+ * does not recognise 'p' at all.
*/
#if defined(__aarch64__) && defined(MBEDTLS_HAVE_ASM)
#if UINTPTR_MAX == 0xfffffffful