From 71ee631559cf80255bfe0a30778463e2b736fa21 Mon Sep 17 00:00:00 2001 From: tb Date: Mon, 3 Jul 2023 09:29:55 +0000 Subject: [PATCH] Convert EC_GROUP_check() to EC_GROUP_get0_order() ok beck jsing --- lib/libcrypto/ec/ec_check.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/lib/libcrypto/ec/ec_check.c b/lib/libcrypto/ec/ec_check.c index 4e065c739a5..4a38dec539e 100644 --- a/lib/libcrypto/ec/ec_check.c +++ b/lib/libcrypto/ec/ec_check.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_check.c,v 1.13 2023/04/11 18:58:20 jsing Exp $ */ +/* $OpenBSD: ec_check.c,v 1.14 2023/07/03 09:29:55 tb Exp $ */ /* ==================================================================== * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. * @@ -60,8 +60,8 @@ int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx_in) { BN_CTX *ctx; - BIGNUM *order; EC_POINT *point = NULL; + const BIGNUM *order; int ret = 0; if ((ctx = ctx_in) == NULL) @@ -69,11 +69,6 @@ EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx_in) if (ctx == NULL) goto err; - BN_CTX_start(ctx); - - if ((order = BN_CTX_get(ctx)) == NULL) - goto err; - /* check the discriminant */ if (!EC_GROUP_check_discriminant(group, ctx)) { ECerror(EC_R_DISCRIMINANT_IS_ZERO); @@ -91,7 +86,7 @@ EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx_in) /* check the order of the generator */ if ((point = EC_POINT_new(group)) == NULL) goto err; - if (!EC_GROUP_get_order(group, order, ctx)) + if ((order = EC_GROUP_get0_order(group)) == NULL) goto err; if (BN_is_zero(order)) { ECerror(EC_R_UNDEFINED_ORDER); @@ -107,8 +102,6 @@ EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx_in) ret = 1; err: - BN_CTX_end(ctx); - if (ctx != ctx_in) BN_CTX_free(ctx); -- 2.20.1