-/* $OpenBSD: eck_prn.c,v 1.20 2022/11/19 07:29:29 tb Exp $ */
+/* $OpenBSD: eck_prn.c,v 1.21 2023/06/27 07:32:29 tb Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
unsigned char *buffer = NULL;
size_t buf_len = 0, i;
int ret = 0, reason = ERR_R_BIO_LIB;
+ int nid;
BN_CTX *ctx = NULL;
const EC_POINT *point = NULL;
BIGNUM *p = NULL, *a = NULL, *b = NULL, *gen = NULL, *order = NULL,
}
if (EC_GROUP_get_asn1_flag(x)) {
/* the curve parameter are given by an asn1 OID */
- int nid;
-
if (!BIO_indent(bp, off, 128))
goto err;
}
} else {
/* explicit parameters */
- int is_char_two = 0;
point_conversion_form_t form;
- int tmp_nid = EC_METHOD_get_field_type(EC_GROUP_method_of(x));
-
- if (tmp_nid == NID_X9_62_characteristic_two_field)
- is_char_two = 1;
if ((p = BN_new()) == NULL || (a = BN_new()) == NULL ||
(b = BN_new()) == NULL || (order = BN_new()) == NULL ||
if (!BIO_indent(bp, off, 128))
goto err;
+ nid = EC_METHOD_get_field_type(EC_GROUP_method_of(x));
/* print the 'short name' of the field type */
- if (BIO_printf(bp, "Field Type: %s\n", OBJ_nid2sn(tmp_nid))
- <= 0)
+ if (BIO_printf(bp, "Field Type: %s\n", OBJ_nid2sn(nid)) <= 0)
goto err;
- if (is_char_two) {
- /* print the 'short name' of the base type OID */
- int basis_type = EC_GROUP_get_basis_type(x);
- if (basis_type == 0)
- goto err;
-
- if (!BIO_indent(bp, off, 128))
- goto err;
-
- if (BIO_printf(bp, "Basis Type: %s\n",
- OBJ_nid2sn(basis_type)) <= 0)
- goto err;
-
- /* print the polynomial */
- if ((p != NULL) && !ASN1_bn_print(bp, "Polynomial:", p, buffer,
- off))
- goto err;
- } else {
- if ((p != NULL) && !ASN1_bn_print(bp, "Prime:", p, buffer, off))
- goto err;
- }
+ if ((p != NULL) && !ASN1_bn_print(bp, "Prime:", p, buffer, off))
+ goto err;
if ((a != NULL) && !ASN1_bn_print(bp, "A: ", a, buffer, off))
goto err;
if ((b != NULL) && !ASN1_bn_print(bp, "B: ", b, buffer, off))