diff options
author | Samuel Weiser <samuel.weiser@iaik.tugraz.at> | 2018-01-31 13:10:55 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2018-03-21 17:37:29 +0000 |
commit | 64eb614ccc7ccf30cc412b736f509f1d82bbf897 (patch) | |
tree | 907156c22b57e8df21ab024aa1f9117e16a754bc /crypto/rsa | |
parent | 0b199a883e9170cdfe8e61c150bbaf8d8951f3e7 (diff) |
used ERR set/pop mark
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5170)
(cherry picked from commit 011f82e66f4bf131c733fd41a8390039859aafb2)
Diffstat (limited to 'crypto/rsa')
-rw-r--r-- | crypto/rsa/rsa_gen.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/rsa/rsa_gen.c b/crypto/rsa/rsa_gen.c index 8553772f06..610d82db66 100644 --- a/crypto/rsa/rsa_gen.c +++ b/crypto/rsa/rsa_gen.c @@ -163,6 +163,7 @@ static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, goto err; if (!BN_sub(r2, rsa->p, BN_value_one())) goto err; + ERR_set_mark(); if (BN_mod_inverse(r1, r2, rsa->e, ctx) != NULL) { /* GCD == 1 since inverse exists */ break; @@ -171,7 +172,7 @@ static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, if (ERR_GET_LIB(error) == ERR_LIB_BN && ERR_GET_REASON(error) == BN_R_NO_INVERSE) { /* GCD != 1 */ - ERR_clear_error(); + ERR_pop_to_mark(); } else { goto err; } @@ -187,6 +188,7 @@ static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, } while (BN_cmp(rsa->p, rsa->q) == 0); if (!BN_sub(r2, rsa->q, BN_value_one())) goto err; + ERR_set_mark(); if (BN_mod_inverse(r1, r2, rsa->e, ctx) != NULL) { /* GCD == 1 since inverse exists */ break; @@ -195,7 +197,7 @@ static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, if (ERR_GET_LIB(error) == ERR_LIB_BN && ERR_GET_REASON(error) == BN_R_NO_INVERSE) { /* GCD != 1 */ - ERR_clear_error(); + ERR_pop_to_mark(); } else { goto err; } |