diff options
Diffstat (limited to 'crypto/ec/ecp_oct.c')
-rw-r--r-- | crypto/ec/ecp_oct.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/crypto/ec/ecp_oct.c b/crypto/ec/ecp_oct.c index b10947d714..68943e521e 100644 --- a/crypto/ec/ecp_oct.c +++ b/crypto/ec/ecp_oct.c @@ -28,11 +28,6 @@ int ossl_ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *group, BIGNUM *tmp1, *tmp2, *x, *y; int ret = 0; -#ifndef FIPS_MODULE - /* clear error queue */ - ERR_clear_error(); -#endif - if (ctx == NULL) { ctx = new_ctx = BN_CTX_new_ex(group->libctx); if (ctx == NULL) @@ -106,21 +101,24 @@ int ossl_ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *group, goto err; } + ERR_set_mark(); if (!BN_mod_sqrt(y, tmp1, group->field, ctx)) { #ifndef FIPS_MODULE unsigned long err = ERR_peek_last_error(); if (ERR_GET_LIB(err) == ERR_LIB_BN && ERR_GET_REASON(err) == BN_R_NOT_A_SQUARE) { - ERR_clear_error(); + ERR_pop_to_mark(); ERR_raise(ERR_LIB_EC, EC_R_INVALID_COMPRESSED_POINT); } else #endif { + ERR_clear_last_mark(); ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB); } goto err; } + ERR_clear_last_mark(); if (y_bit != BN_is_odd(y)) { if (BN_is_zero(y)) { |