diff options
author | tb <> | 2023-07-03 09:29:55 +0000 |
---|---|---|
committer | tb <> | 2023-07-03 09:29:55 +0000 |
commit | c7f387cc45a0e4fdf946ae2787d268e9e2756521 (patch) | |
tree | 416c98b3455f463a0bea726e2b7b068c0573bf4d /src | |
parent | 9272465ad9d0c171dae8eff17767348ef73a21bd (diff) | |
download | openbsd-c7f387cc45a0e4fdf946ae2787d268e9e2756521.tar.gz openbsd-c7f387cc45a0e4fdf946ae2787d268e9e2756521.tar.bz2 openbsd-c7f387cc45a0e4fdf946ae2787d268e9e2756521.zip |
Convert EC_GROUP_check() to EC_GROUP_get0_order()
ok beck jsing
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/ec/ec_check.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/lib/libcrypto/ec/ec_check.c b/src/lib/libcrypto/ec/ec_check.c index 4e065c739a..4a38dec539 100644 --- a/src/lib/libcrypto/ec/ec_check.c +++ b/src/lib/libcrypto/ec/ec_check.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_check.c,v 1.13 2023/04/11 18:58:20 jsing Exp $ */ | 1 | /* $OpenBSD: ec_check.c,v 1.14 2023/07/03 09:29:55 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -60,8 +60,8 @@ int | |||
60 | EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx_in) | 60 | EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx_in) |
61 | { | 61 | { |
62 | BN_CTX *ctx; | 62 | BN_CTX *ctx; |
63 | BIGNUM *order; | ||
64 | EC_POINT *point = NULL; | 63 | EC_POINT *point = NULL; |
64 | const BIGNUM *order; | ||
65 | int ret = 0; | 65 | int ret = 0; |
66 | 66 | ||
67 | if ((ctx = ctx_in) == NULL) | 67 | if ((ctx = ctx_in) == NULL) |
@@ -69,11 +69,6 @@ EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx_in) | |||
69 | if (ctx == NULL) | 69 | if (ctx == NULL) |
70 | goto err; | 70 | goto err; |
71 | 71 | ||
72 | BN_CTX_start(ctx); | ||
73 | |||
74 | if ((order = BN_CTX_get(ctx)) == NULL) | ||
75 | goto err; | ||
76 | |||
77 | /* check the discriminant */ | 72 | /* check the discriminant */ |
78 | if (!EC_GROUP_check_discriminant(group, ctx)) { | 73 | if (!EC_GROUP_check_discriminant(group, ctx)) { |
79 | ECerror(EC_R_DISCRIMINANT_IS_ZERO); | 74 | ECerror(EC_R_DISCRIMINANT_IS_ZERO); |
@@ -91,7 +86,7 @@ EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx_in) | |||
91 | /* check the order of the generator */ | 86 | /* check the order of the generator */ |
92 | if ((point = EC_POINT_new(group)) == NULL) | 87 | if ((point = EC_POINT_new(group)) == NULL) |
93 | goto err; | 88 | goto err; |
94 | if (!EC_GROUP_get_order(group, order, ctx)) | 89 | if ((order = EC_GROUP_get0_order(group)) == NULL) |
95 | goto err; | 90 | goto err; |
96 | if (BN_is_zero(order)) { | 91 | if (BN_is_zero(order)) { |
97 | ECerror(EC_R_UNDEFINED_ORDER); | 92 | ECerror(EC_R_UNDEFINED_ORDER); |
@@ -107,8 +102,6 @@ EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx_in) | |||
107 | ret = 1; | 102 | ret = 1; |
108 | 103 | ||
109 | err: | 104 | err: |
110 | BN_CTX_end(ctx); | ||
111 | |||
112 | if (ctx != ctx_in) | 105 | if (ctx != ctx_in) |
113 | BN_CTX_free(ctx); | 106 | BN_CTX_free(ctx); |
114 | 107 | ||