diff options
author | Geoff Thorpe <geoff@openssl.org> | 2004-03-13 23:57:20 +0000 |
---|---|---|
committer | Geoff Thorpe <geoff@openssl.org> | 2004-03-13 23:57:20 +0000 |
commit | b6358c89a10128692875fb92921b663c4d079a1e (patch) | |
tree | d36362a84ee41209484b4b088c2b9d1728bfc613 /crypto/bn/bn_nist.c | |
parent | 5d735465d1b5b7853506979946ad5730cc3615bb (diff) |
Convert openssl code not to assume the deprecated form of BN_zero().
Remove certain redundant BN_zero() initialisations, because BN_CTX_get(),
BN_init(), [etc] already initialise to zero.
Correct error checking in bn_sqr.c, and be less wishy-wash about how/why
the result's 'top' value is set (note also, 'max' is always > 0 at this
point).
Diffstat (limited to 'crypto/bn/bn_nist.c')
-rw-r--r-- | crypto/bn/bn_nist.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/crypto/bn/bn_nist.c b/crypto/bn/bn_nist.c index a29503be25..bbe2cbe749 100644 --- a/crypto/bn/bn_nist.c +++ b/crypto/bn/bn_nist.c @@ -319,7 +319,10 @@ int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, top = BN_ucmp(field, a); if (top == 0) - return BN_zero(r); + { + BN_zero(r); + return 1; + } else if (top > 0) return (r == a)? 1 : (BN_copy(r ,a) != NULL); @@ -394,7 +397,10 @@ int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, tmp_int = BN_ucmp(field, a); if (tmp_int == 0) - return BN_zero(r); + { + BN_zero(r); + return 1; + } else if (tmp_int > 0) return (r == a)? 1 : (BN_copy(r ,a) != NULL); @@ -514,7 +520,10 @@ int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, tmp_int = BN_ucmp(field, a); if (tmp_int == 0) - return BN_zero(r); + { + BN_zero(r); + return 1; + } else if (tmp_int > 0) return (r == a)? 1 : (BN_copy(r ,a) != NULL); @@ -672,7 +681,10 @@ int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, tmp_int = BN_ucmp(field, a); if (tmp_int == 0) - return BN_zero(r); + { + BN_zero(r); + return 1; + } else if (tmp_int > 0) return (r == a)? 1 : (BN_copy(r ,a) != NULL); |