summaryrefslogtreecommitdiffstats
path: root/crypto/rsa
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2002-11-04 13:17:22 +0000
committerBodo Möller <bodo@openssl.org>2002-11-04 13:17:22 +0000
commitb53e44e57259b2b015c54de8ecbcf4e06be23298 (patch)
tree4d06528db2e5e7d8ad1680fc59159a4c689c7b3c /crypto/rsa
parente5f4d8279dccad0f6dde324f52333291739dcca3 (diff)
implement and use new macros BN_get_sign(), BN_set_sign()
Submitted by: Nils Larsch
Diffstat (limited to 'crypto/rsa')
-rw-r--r--crypto/rsa/rsa_eay.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/crypto/rsa/rsa_eay.c b/crypto/rsa/rsa_eay.c
index 0eda816081..963c34a948 100644
--- a/crypto/rsa/rsa_eay.c
+++ b/crypto/rsa/rsa_eay.c
@@ -546,7 +546,7 @@ static int RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa)
if (!BN_sub(r0,r0,&m1)) goto err;
/* This will help stop the size of r0 increasing, which does
* affect the multiply if it optimised for a power of 2 size */
- if (r0->neg)
+ if (BN_get_sign(r0))
if (!BN_add(r0,r0,rsa->p)) goto err;
if (!BN_mul(&r1,r0,rsa->iqmp,ctx)) goto err;
@@ -558,7 +558,7 @@ static int RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa)
* This will *never* happen with OpenSSL generated keys because
* they ensure p > q [steve]
*/
- if (r0->neg)
+ if (BN_get_sign(r0))
if (!BN_add(r0,r0,rsa->p)) goto err;
if (!BN_mul(&r1,r0,rsa->q,ctx)) goto err;
if (!BN_add(r0,&r1,&m1)) goto err;
@@ -572,7 +572,7 @@ static int RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa)
* for absolute equality, just congruency. */
if (!BN_sub(&vrfy, &vrfy, I)) goto err;
if (!BN_mod(&vrfy, &vrfy, rsa->n, ctx)) goto err;
- if (vrfy.neg)
+ if (BN_get_sign(&vrfy))
if (!BN_add(&vrfy, &vrfy, rsa->n)) goto err;
if (!BN_is_zero(&vrfy))
/* 'I' and 'vrfy' aren't congruent mod n. Don't leak