summaryrefslogtreecommitdiff
path: root/crypto/bn
diff options
context:
space:
mode:
authorAdam Langley <agl@chromium.org>2013-06-03 15:45:11 -0400
committerJanusz Kozerski <j.kozerski@samsung.com>2014-10-20 15:25:34 +0200
commita3c7871c616fe3e437064b8d810ef491e7ebfafb (patch)
tree757b08c0d8676e4eec7f3289cd0d1a61167aa8a9 /crypto/bn
parente6f173af94de2ddafd939b29b80c80c43d5dfcd0 (diff)
downloadopenssl-a3c7871c616fe3e437064b8d810ef491e7ebfafb.tar.gz
openssl-a3c7871c616fe3e437064b8d810ef491e7ebfafb.tar.bz2
openssl-a3c7871c616fe3e437064b8d810ef491e7ebfafb.zip
Add volatile qualifications to two blocks of inline asm to stop GCC from
eliminating them as dead code. Both volatile and "memory" are used because of some concern that the compiler may still cache values across the asm block without it, and because this was such a painful debugging session that I wanted to ensure that it's never repeated. (cherry picked from commit 7753a3a68431aa81b82beea4c3f5374b41454679) Conflicts: crypto/bn/asm/x86_64-gcc.c Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/bn')
-rw-r--r--crypto/bn/asm/x86_64-gcc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/crypto/bn/asm/x86_64-gcc.c b/crypto/bn/asm/x86_64-gcc.c
index acb0b40..31476ab 100644
--- a/crypto/bn/asm/x86_64-gcc.c
+++ b/crypto/bn/asm/x86_64-gcc.c
@@ -189,7 +189,7 @@ BN_ULONG bn_add_words (BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int
if (n <= 0) return 0;
- asm (
+ asm volatile (
" subq %2,%2 \n"
".p2align 4 \n"
"1: movq (%4,%2,8),%0 \n"
@@ -200,7 +200,7 @@ BN_ULONG bn_add_words (BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int
" sbbq %0,%0 \n"
: "=&a"(ret),"+c"(n),"=&r"(i)
: "r"(rp),"r"(ap),"r"(bp)
- : "cc"
+ : "cc", "memory"
);
return ret&1;
@@ -212,7 +212,7 @@ BN_ULONG bn_sub_words (BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int
if (n <= 0) return 0;
- asm (
+ asm volatile (
" subq %2,%2 \n"
".p2align 4 \n"
"1: movq (%4,%2,8),%0 \n"
@@ -223,7 +223,7 @@ BN_ULONG bn_sub_words (BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int
" sbbq %0,%0 \n"
: "=&a"(ret),"+c"(n),"=&r"(i)
: "r"(rp),"r"(ap),"r"(bp)
- : "cc"
+ : "cc", "memory"
);
return ret&1;