Simplify after EC_POINT_get_curve() addition
authortb <tb@openbsd.org>
Tue, 20 Apr 2021 17:12:43 +0000 (17:12 +0000)
committertb <tb@openbsd.org>
Tue, 20 Apr 2021 17:12:43 +0000 (17:12 +0000)
ok jsing

lib/libcrypto/ec/ec_asn1.c
lib/libcrypto/ec/eck_prn.c

index 65bb007..06320b6 100644 (file)
@@ -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);
 
index b17908d..c2fd2eb 100644 (file)
@@ -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 <stdio.h>
 #include <string.h>
 
-#include <openssl/opensslconf.h>
-
 #include <openssl/bn.h>
 #include <openssl/ec.h>
 #include <openssl/err.h>
@@ -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) {