diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2011-01-26 16:59:47 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2011-01-26 16:59:47 +0000 |
commit | 879bd6e38cad7fc932b37ca0b3ceb34d582910f6 (patch) | |
tree | 0c48bef75dad8376876f4d6a1bb8c55a298143ff /crypto/bn/bn_blind.c | |
parent | 6f1a3a310c35b74691c9f91442d204d52b4ddbcb (diff) |
Internal version of BN_mod_inverse allowing checking of no-inverse without
need to inspect error queue.
Diffstat (limited to 'crypto/bn/bn_blind.c')
-rw-r--r-- | crypto/bn/bn_blind.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/crypto/bn/bn_blind.c b/crypto/bn/bn_blind.c index e060592fdc..6e00f43c66 100644 --- a/crypto/bn/bn_blind.c +++ b/crypto/bn/bn_blind.c @@ -331,12 +331,12 @@ BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, ret->m_ctx = m_ctx; do { + int rv; if (!BN_rand_range(ret->A, ret->mod)) goto err; - if (BN_mod_inverse(ret->Ai, ret->A, ret->mod, ctx) == NULL) + if (!int_bn_mod_inverse(ret->Ai, ret->A, ret->mod, ctx, &rv)) { /* this should almost never happen for good RSA keys */ - unsigned long error = ERR_peek_last_error(); - if (ERR_GET_REASON(error) == BN_R_NO_INVERSE) + if (rv) { if (retry_counter-- == 0) { @@ -344,7 +344,6 @@ BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, BN_R_TOO_MANY_ITERATIONS); goto err; } - ERR_clear_error(); } else goto err; |