From 99f0cdc0e0a51ba67da76656643765bc095854bf Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Fri, 8 Sep 2023 17:18:04 +0100 Subject: [PATCH] Remove not-needed mov in x86_64 asm Signed-off-by: Dave Rodgman --- library/constant_time_impl.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/library/constant_time_impl.h b/library/constant_time_impl.h index ab32deee9f..86f7510cb3 100644 --- a/library/constant_time_impl.h +++ b/library/constant_time_impl.h @@ -345,8 +345,7 @@ static inline mbedtls_ct_condition_t mbedtls_ct_uint_lt(mbedtls_ct_uint_t x, mbe "not %[mask] \n\t" "and %[mask], %[x] \n\t" "or %[y], %[x] \n\t" - "mov %[x], %[mask] \n\t" - "sar $63, %[mask] \n\t" + "sar $63, %[x] \n\t" : [mask] "=&a" (mask), [x] "+&S" (x), @@ -354,7 +353,7 @@ static inline mbedtls_ct_condition_t mbedtls_ct_uint_lt(mbedtls_ct_uint_t x, mbe : : ); - return (mbedtls_ct_condition_t) mask; + return (mbedtls_ct_condition_t) x; #elif defined(MBEDTLS_CT_X86_ASM) && defined(MBEDTLS_CT_SIZE_32) uint32_t s; asm volatile ("mov %[x], %[s] \n\t"