From 869855122f9b7100adfdcfd2edf690376efaa8f2 Mon Sep 17 00:00:00 2001 From: tb Date: Tue, 20 Apr 2021 17:12:43 +0000 Subject: [PATCH] Simplify after EC_POINT_get_curve() addition ok jsing --- lib/libcrypto/ec/ec_asn1.c | 18 ++++-------------- lib/libcrypto/ec/eck_prn.c | 20 ++++---------------- 2 files changed, 8 insertions(+), 30 deletions(-) diff --git a/lib/libcrypto/ec/ec_asn1.c b/lib/libcrypto/ec/ec_asn1.c index 65bb007cae3..06320b65886 100644 --- a/lib/libcrypto/ec/ec_asn1.c +++ b/lib/libcrypto/ec/ec_asn1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_asn1.c,v 1.32 2021/04/20 17:04:13 tb Exp $ */ +/* $OpenBSD: ec_asn1.c,v 1.33 2021/04/20 17:12:43 tb Exp $ */ /* * Written by Nils Larsch for the OpenSSL project. */ @@ -818,20 +818,10 @@ ec_asn1_group2curve(const EC_GROUP * group, X9_62_CURVE * curve) nid = EC_METHOD_get_field_type(EC_GROUP_method_of(group)); /* get a and b */ - if (nid == NID_X9_62_prime_field) { - if (!EC_GROUP_get_curve(group, NULL, tmp_1, tmp_2, NULL)) { - ECerror(ERR_R_EC_LIB); - goto err; - } - } -#ifndef OPENSSL_NO_EC2M - else { /* nid == NID_X9_62_characteristic_two_field */ - if (!EC_GROUP_get_curve(group, NULL, tmp_1, tmp_2, NULL)) { - ECerror(ERR_R_EC_LIB); - goto err; - } + if (!EC_GROUP_get_curve(group, NULL, tmp_1, tmp_2, NULL)) { + ECerror(ERR_R_EC_LIB); + goto err; } -#endif len_1 = (size_t) BN_num_bytes(tmp_1); len_2 = (size_t) BN_num_bytes(tmp_2); diff --git a/lib/libcrypto/ec/eck_prn.c b/lib/libcrypto/ec/eck_prn.c index b17908d7fa6..c2fd2ebc85b 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.16 2021/04/20 17:04:13 tb Exp $ */ +/* $OpenBSD: eck_prn.c,v 1.17 2021/04/20 17:12:43 tb Exp $ */ /* * Written by Nils Larsch for the OpenSSL project. */ @@ -64,8 +64,6 @@ #include #include -#include - #include #include #include @@ -214,19 +212,9 @@ ECPKParameters_print(BIO * bp, const EC_GROUP * x, int off) reason = ERR_R_MALLOC_FAILURE; goto err; } -#ifndef OPENSSL_NO_EC2M - if (is_char_two) { - if (!EC_GROUP_get_curve(x, p, a, b, ctx)) { - reason = ERR_R_EC_LIB; - goto err; - } - } else /* prime field */ -#endif - { - if (!EC_GROUP_get_curve(x, p, a, b, ctx)) { - reason = ERR_R_EC_LIB; - goto err; - } + if (!EC_GROUP_get_curve(x, p, a, b, ctx)) { + reason = ERR_R_EC_LIB; + goto err; } if ((point = EC_GROUP_get0_generator(x)) == NULL) { -- 2.20.1