When adding positive elements, we can use BN_uadd() instead of BN_add().
Submitted by: Nils Larsch Reviewed by: Geoff Thorpe
This commit is contained in:
parent
dc90f64d56
commit
1b06804491
@ -149,7 +149,7 @@ int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_
|
|||||||
* and less than m */
|
* and less than m */
|
||||||
int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m)
|
int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m)
|
||||||
{
|
{
|
||||||
if (!BN_add(r, a, b)) return 0;
|
if (!BN_uadd(r, a, b)) return 0;
|
||||||
if (BN_ucmp(r, m) >= 0)
|
if (BN_ucmp(r, m) >= 0)
|
||||||
return BN_usub(r, r, m);
|
return BN_usub(r, r, m);
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user