From cfb6560468b1c34e0b628b0d5146112b98b620f9 Mon Sep 17 00:00:00 2001 From: Sean Parkinson Date: Fri, 3 Nov 2023 07:44:39 +1000 Subject: [PATCH] SP int: ARM64 optimization issue Make variables volatile to avoid compiler optimization issues. --- wolfcrypt/src/sp_int.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wolfcrypt/src/sp_int.c b/wolfcrypt/src/sp_int.c index 822d0afdc..6dd4e6a8b 100644 --- a/wolfcrypt/src/sp_int.c +++ b/wolfcrypt/src/sp_int.c @@ -14594,9 +14594,15 @@ static int _sp_sqr(const sp_int* a, sp_int* r) } #endif if (err == MP_OKAY) { + #ifndef WOLFSSL_SP_INT_SQR_VOLATILE sp_int_word w; sp_int_word l; sp_int_word h; + #else + volatile sp_int_word w; + volatile sp_int_word l; + volatile sp_int_word h; + #endif #ifdef SP_WORD_OVERFLOW sp_int_word o; #endif