summaryrefslogtreecommitdiff
path: root/crypto/ec/ec2_oct.c
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2021-05-12 19:15:27 +0200
committerTomas Mraz <tomas@openssl.org>2021-05-13 19:26:06 +0200
commitafecd85db1359b5a62c037b8a507b928541c779c (patch)
tree26c1def792b0e9e80a8042ef87e9d5cfbc9093d1 /crypto/ec/ec2_oct.c
parent2bdec3b037264540014120a02217fc67bf355f11 (diff)
downloadopenssl-new-afecd85db1359b5a62c037b8a507b928541c779c.tar.gz
Replace some of the ERR_clear_error() calls with mark calls
Fixes #15219 Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/15253)
Diffstat (limited to 'crypto/ec/ec2_oct.c')
-rw-r--r--crypto/ec/ec2_oct.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/crypto/ec/ec2_oct.c b/crypto/ec/ec2_oct.c
index 1970efd65c..10a4932591 100644
--- a/crypto/ec/ec2_oct.c
+++ b/crypto/ec/ec2_oct.c
@@ -46,9 +46,6 @@ int ossl_ec_GF2m_simple_set_compressed_coordinates(const EC_GROUP *group,
#ifndef FIPS_MODULE
BN_CTX *new_ctx = NULL;
- /* clear error queue */
- ERR_clear_error();
-
if (ctx == NULL) {
ctx = new_ctx = BN_CTX_new();
if (ctx == NULL)
@@ -80,21 +77,24 @@ int ossl_ec_GF2m_simple_set_compressed_coordinates(const EC_GROUP *group,
goto err;
if (!BN_GF2m_add(tmp, x, tmp))
goto err;
+ ERR_set_mark();
if (!BN_GF2m_mod_solve_quad_arr(z, tmp, group->poly, 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_NO_SOLUTION) {
- 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();
z0 = (BN_is_odd(z)) ? 1 : 0;
if (!group->meth->field_mul(group, y, x, z, ctx))
goto err;