When x32 support was added to this file, the "&" constraint was dropped,
allowing GCC to overlap register assignments for inputs and outputs,
resulting in broken assembler code.
--
Florian Weimer / Red Hat Product Security Team
commit 9dbf28460d10387c819d332b7a5c0397942b75ee
Author: Florian Weimer <[email protected]>
Date: Mon Nov 19 12:52:36 2012 +0100
Fix asm constraints in bn_add_words, bn_sub_words
diff --git a/crypto/bn/asm/x86_64-gcc.c b/crypto/bn/asm/x86_64-gcc.c
index d34d2dc..dfb7506 100644
--- a/crypto/bn/asm/x86_64-gcc.c
+++ b/crypto/bn/asm/x86_64-gcc.c
@@ -199,7 +199,7 @@ BN_ULONG bn_add_words (BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int
" lea 1(%2),%2 \n"
" loop 1b \n"
" sbbq %0,%0 \n"
- : "=r"(ret),"+c"(n),"+r"(i)
+ : "=&r"(ret),"+c"(n),"+r"(i)
: "r"(rp),"r"(ap),"r"(bp)
: "cc"
);
@@ -224,7 +224,7 @@ BN_ULONG bn_sub_words (BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int
" lea 1(%2),%2 \n"
" loop 1b \n"
" sbbq %0,%0 \n"
- : "=r"(ret),"+c"(n),"+r"(i)
+ : "=&r"(ret),"+c"(n),"+r"(i)
: "r"(rp),"r"(ap),"r"(bp)
: "cc"
);