From 60aa9d799e6e532d30a7f3c363a1c6a745296f6f Mon Sep 17 00:00:00 2001 From: tb Date: Tue, 27 Jun 2023 07:32:29 +0000 Subject: [PATCH] Remove some dead code from ECPKParameters_print() This code is unreachable since binary curve support was removed. There is a lot more to clean up in here... ok jsing --- lib/libcrypto/ec/eck_prn.c | 37 ++++++------------------------------- 1 file changed, 6 insertions(+), 31 deletions(-) diff --git a/lib/libcrypto/ec/eck_prn.c b/lib/libcrypto/ec/eck_prn.c index f7ce8debb0a..e1f734cbe7d 100644 --- a/lib/libcrypto/ec/eck_prn.c +++ b/lib/libcrypto/ec/eck_prn.c @@ -1,4 +1,4 @@ -/* $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. */ @@ -163,6 +163,7 @@ ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off) 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, @@ -186,8 +187,6 @@ ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off) } 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; @@ -209,12 +208,7 @@ ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off) } } 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 || @@ -266,32 +260,13 @@ ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off) 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)) -- 2.20.1