diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2023-07-03 09:29:56 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2023-07-03 09:29:56 +0000 |
commit | aea5a99233d5e6bfd8264697d6048eee7af30b09 (patch) | |
tree | 6879de16105c3de21be36b61950dbcf233a269cb | |
parent | 231e85e1e9751cbc58f396f3714d5f0010183bf3 (diff) |
Convert EC_GROUP_check() to EC_GROUP_get0_order()
ok beck jsing
-rw-r--r-- | lib/libcrypto/ec/ec_check.c | 13 |
1 files 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); |