X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fbn%2Fbn_mont.c;h=9ba69859c4a8d3abe9cb507508f119e615fdb5d4;hp=f70f8ab3efaee45508786d280f09364f814ccf94;hb=ca04d7a20842b2de39264b6c1605c3443fc09d16;hpb=40a3c1230543c39d03a06e7b00e726313f9dd262 diff --git a/crypto/bn/bn_mont.c b/crypto/bn/bn_mont.c index f70f8ab3ef..9ba69859c4 100644 --- a/crypto/bn/bn_mont.c +++ b/crypto/bn/bn_mont.c @@ -80,14 +80,13 @@ int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, if (num>1 && a->top==num && b->top==num) { if (bn_wexpand(r,num) == NULL) return 0; - r->neg = a->neg^b->neg; - r->top = num; - if (a==b) - bn_sqr_mont(r->d,a->d,mont->N.d,mont->n0,num); - else - bn_mul_mont(r->d,a->d,b->d,mont->N.d,mont->n0,num); - bn_fix_top(r); - return 1; + if (bn_mul_mont(r->d,a->d,b->d,mont->N.d,mont->n0,num)) + { + r->neg = a->neg^b->neg; + r->top = num; + bn_fix_top(r); + return 1; + } } #endif