Reset |out_no_inverse| before returning errors in BN_mod_inverse_odd.
This more accurately reflects the documented contract for |BN_mod_inverse_odd|. Change-Id: Iae98dabe3943231859eaa5e798d06ebe0231b9f1 Reviewed-on: https://boringssl-review.googlesource.com/9160 CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org> Reviewed-by: David Benjamin <davidben@google.com> Commit-Queue: David Benjamin <davidben@google.com>
This commit is contained in:
parent
96e1a25943
commit
e4a432687e
@ -231,6 +231,8 @@ static int bn_mod_inverse_general(BIGNUM *out, int *out_no_inverse,
|
||||
|
||||
int BN_mod_inverse_odd(BIGNUM *out, int *out_no_inverse, const BIGNUM *a,
|
||||
const BIGNUM *n, BN_CTX *ctx) {
|
||||
*out_no_inverse = 0;
|
||||
|
||||
if (!BN_is_odd(n)) {
|
||||
OPENSSL_PUT_ERROR(BN, BN_R_CALLED_WITH_EVEN_MODULUS);
|
||||
return 0;
|
||||
@ -245,8 +247,6 @@ int BN_mod_inverse_odd(BIGNUM *out, int *out_no_inverse, const BIGNUM *a,
|
||||
int ret = 0;
|
||||
int sign;
|
||||
|
||||
*out_no_inverse = 0;
|
||||
|
||||
BN_CTX_start(ctx);
|
||||
A = BN_CTX_get(ctx);
|
||||
B = BN_CTX_get(ctx);
|
||||
|
Loading…
Reference in New Issue
Block a user