-/* $OpenBSD: ec_asn1.c,v 1.76 2024/10/20 10:48:29 tb Exp $ */
+/* $OpenBSD: ec_asn1.c,v 1.77 2024/10/22 12:06:08 tb Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
if (group == NULL || field == NULL)
goto err;
- nid = EC_METHOD_get_field_type(EC_GROUP_method_of(group));
+ nid = ec_group_get_field_type(group);
if (nid == NID_X9_62_characteristic_two_field) {
ECerror(EC_R_GF2M_NOT_SUPPORTED);
goto err;
-/* $OpenBSD: ec_lib.c,v 1.72 2024/10/19 08:29:40 tb Exp $ */
+/* $OpenBSD: ec_lib.c,v 1.73 2024/10/22 12:06:08 tb Exp $ */
/*
* Originally written by Bodo Moeller for the OpenSSL project.
*/
}
LCRYPTO_ALIAS(EC_METHOD_get_field_type);
+int
+ec_group_get_field_type(const EC_GROUP *group)
+{
+ if (group == NULL || group->meth == NULL)
+ return NID_undef;
+
+ return group->meth->field_type;
+}
+
/*
* If there is a user-provided cofactor, sanity check and use it. Otherwise
* try computing the cofactor from generator order n and field cardinality q.
BN_CTX *ctx_new = NULL;
/* compare the field types */
- if (EC_METHOD_get_field_type(EC_GROUP_method_of(a)) !=
- EC_METHOD_get_field_type(EC_GROUP_method_of(b)))
+ if (ec_group_get_field_type(a) != ec_group_get_field_type(b))
return 1;
/* compare the curve name (if present in both) */
if (EC_GROUP_get_curve_name(a) && EC_GROUP_get_curve_name(b) &&
-/* $OpenBSD: ec_local.h,v 1.30 2024/10/18 17:27:07 tb Exp $ */
+/* $OpenBSD: ec_local.h,v 1.31 2024/10/22 12:06:08 tb Exp $ */
/*
* Originally written by Bodo Moeller for the OpenSSL project.
*/
const EC_POINT *p, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx);
int ec_group_is_builtin_curve(const EC_GROUP *group);
+int ec_group_get_field_type(const EC_GROUP *group);
/* Public API in OpenSSL */
const BIGNUM *EC_GROUP_get0_cofactor(const EC_GROUP *group);
-/* $OpenBSD: eck_prn.c,v 1.30 2023/11/21 22:05:33 tb Exp $ */
+/* $OpenBSD: eck_prn.c,v 1.31 2024/10/22 12:06:08 tb Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
if (!BIO_indent(bp, off, 128))
goto err;
- nid = EC_METHOD_get_field_type(EC_GROUP_method_of(group));
+ nid = ec_group_get_field_type(group);
if (BIO_printf(bp, "Field Type: %s\n", OBJ_nid2sn(nid)) <= 0)
goto err;