diff options
Diffstat (limited to 'src/lib/libcrypto/ec/ec_lib.c')
-rw-r--r-- | src/lib/libcrypto/ec/ec_lib.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index 1918d0ba52..6da2026662 100644 --- a/src/lib/libcrypto/ec/ec_lib.c +++ b/src/lib/libcrypto/ec/ec_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_lib.c,v 1.72 2024/10/19 08:29:40 tb Exp $ */ | 1 | /* $OpenBSD: ec_lib.c,v 1.73 2024/10/22 12:06:08 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Originally written by Bodo Moeller for the OpenSSL project. | 3 | * Originally written by Bodo Moeller for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -219,6 +219,15 @@ EC_METHOD_get_field_type(const EC_METHOD *meth) | |||
219 | } | 219 | } |
220 | LCRYPTO_ALIAS(EC_METHOD_get_field_type); | 220 | LCRYPTO_ALIAS(EC_METHOD_get_field_type); |
221 | 221 | ||
222 | int | ||
223 | ec_group_get_field_type(const EC_GROUP *group) | ||
224 | { | ||
225 | if (group == NULL || group->meth == NULL) | ||
226 | return NID_undef; | ||
227 | |||
228 | return group->meth->field_type; | ||
229 | } | ||
230 | |||
222 | /* | 231 | /* |
223 | * If there is a user-provided cofactor, sanity check and use it. Otherwise | 232 | * If there is a user-provided cofactor, sanity check and use it. Otherwise |
224 | * try computing the cofactor from generator order n and field cardinality q. | 233 | * try computing the cofactor from generator order n and field cardinality q. |
@@ -663,8 +672,7 @@ EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx) | |||
663 | BN_CTX *ctx_new = NULL; | 672 | BN_CTX *ctx_new = NULL; |
664 | 673 | ||
665 | /* compare the field types */ | 674 | /* compare the field types */ |
666 | if (EC_METHOD_get_field_type(EC_GROUP_method_of(a)) != | 675 | if (ec_group_get_field_type(a) != ec_group_get_field_type(b)) |
667 | EC_METHOD_get_field_type(EC_GROUP_method_of(b))) | ||
668 | return 1; | 676 | return 1; |
669 | /* compare the curve name (if present in both) */ | 677 | /* compare the curve name (if present in both) */ |
670 | if (EC_GROUP_get_curve_name(a) && EC_GROUP_get_curve_name(b) && | 678 | if (EC_GROUP_get_curve_name(a) && EC_GROUP_get_curve_name(b) && |