crypto/bn/*: x86[_64] division instruction doesn't handle constants, change constrain...
authorAndy Polyakov <appro@openssl.org>
Sat, 27 Aug 2016 18:47:57 +0000 (20:47 +0200)
committerAndy Polyakov <appro@openssl.org>
Wed, 31 Aug 2016 14:46:11 +0000 (16:46 +0200)
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 68b4a6e91f5acd42489bb9d1c580acc5ae457cad)

crypto/bn/asm/x86_64-gcc.c
crypto/bn/bn_div.c

index d77dc433d4055516840c827b2b78721bbefb4577..1729b479d43ece223b14beac8e96358d81a316c3 100644 (file)
@@ -194,7 +194,7 @@ BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d)
     BN_ULONG ret, waste;
 
  asm("divq      %4":"=a"(ret), "=d"(waste)
- :     "a"(l), "d"(h), "g"(d)
+ :     "a"(l), "d"(h), "r"(d)
  :     "cc");
 
     return ret;
index 72e6ce3f74c067acfcda28580b185a6337ba38a0..bc37671cf13868dce6f2470d2ef5e58967859c2c 100644 (file)
@@ -155,7 +155,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
         ({  asm volatile (                      \
                 "divl   %4"                     \
                 : "=a"(q), "=d"(rem)            \
-                : "a"(n1), "d"(n0), "g"(d0)     \
+                : "a"(n1), "d"(n0), "r"(d0)     \
                 : "cc");                        \
             q;                                  \
         })
@@ -170,7 +170,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
         ({  asm volatile (                      \
                 "divq   %4"                     \
                 : "=a"(q), "=d"(rem)            \
-                : "a"(n1), "d"(n0), "g"(d0)     \
+                : "a"(n1), "d"(n0), "r"(d0)     \
                 : "cc");                        \
             q;                                  \
         })