From 4610d4b7a6310f33d4efe1d7d829c54b641db2d6 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Mon, 30 Jan 2023 09:26:48 +0000 Subject: [PATCH] Inhibit compiler from optimising out const-time asm Signed-off-by: Dave Rodgman --- library/constant_time.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/constant_time.c b/library/constant_time.c index 7f4d509bc3..b3bf8744d3 100644 --- a/library/constant_time.c +++ b/library/constant_time.c @@ -72,9 +72,9 @@ static inline uint32_t mbedtls_get_unaligned_volatile_uint32(volatile const unsi */ uint32_t r; #if defined(__arm__) || defined(__thumb__) || defined(__thumb2__) - asm ("ldr %0, [%1]" : "=r" (r) : "r" (p) :); + asm volatile ("ldr %0, [%1]" : "=r" (r) : "r" (p) :); #elif defined(__aarch64__) - asm ("ldr %w0, [%1]" : "=r" (r) : "r" (p) :); + asm volatile ("ldr %w0, [%1]" : "=r" (r) : "r" (p) :); #endif return r; }