summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/usr.bin/openssl/ecparam.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/usr.bin/openssl/ecparam.c b/src/usr.bin/openssl/ecparam.c
index 933cd3eb69..2d2755acfc 100644
--- a/src/usr.bin/openssl/ecparam.c
+++ b/src/usr.bin/openssl/ecparam.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ecparam.c,v 1.23 2023/03/06 14:32:06 tb Exp $ */ 1/* $OpenBSD: ecparam.c,v 1.24 2025/01/19 07:41:52 tb Exp $ */
2/* 2/*
3 * Written by Nils Larsch for the OpenSSL project. 3 * Written by Nils Larsch for the OpenSSL project.
4 */ 4 */
@@ -406,8 +406,7 @@ ecparam_main(int argc, char **argv)
406 if (cfg.C) { 406 if (cfg.C) {
407 size_t buf_len = 0, tmp_len = 0; 407 size_t buf_len = 0, tmp_len = 0;
408 const EC_POINT *point; 408 const EC_POINT *point;
409 int is_prime, len = 0; 409 int len = 0;
410 const EC_METHOD *meth = EC_GROUP_method_of(group);
411 410
412 if ((ec_p = BN_new()) == NULL || (ec_a = BN_new()) == NULL || 411 if ((ec_p = BN_new()) == NULL || (ec_a = BN_new()) == NULL ||
413 (ec_b = BN_new()) == NULL || (ec_gen = BN_new()) == NULL || 412 (ec_b = BN_new()) == NULL || (ec_gen = BN_new()) == NULL ||
@@ -416,8 +415,6 @@ ecparam_main(int argc, char **argv)
416 perror("malloc"); 415 perror("malloc");
417 goto end; 416 goto end;
418 } 417 }
419 is_prime = (EC_METHOD_get_field_type(meth) ==
420 NID_X9_62_prime_field);
421 418
422 if (!EC_GROUP_get_curve(group, ec_p, ec_a, ec_b, NULL)) 419 if (!EC_GROUP_get_curve(group, ec_p, ec_a, ec_b, NULL))
423 goto end; 420 goto end;
@@ -479,15 +476,8 @@ ecparam_main(int argc, char **argv)
479 BIO_printf(out, "\tif ((tmp_3 = BN_bin2bn(ec_b_%d, " 476 BIO_printf(out, "\tif ((tmp_3 = BN_bin2bn(ec_b_%d, "
480 "sizeof(ec_b_%d), NULL)) == NULL)\n\t\t" 477 "sizeof(ec_b_%d), NULL)) == NULL)\n\t\t"
481 "goto err;\n", len, len); 478 "goto err;\n", len, len);
482 if (is_prime) { 479 BIO_printf(out, "\tif ((group = EC_GROUP_new_curve_GFp"
483 BIO_printf(out, "\tif ((group = EC_GROUP_new_curve_" 480 "(tmp_1, tmp_2, tmp_3, NULL)) == NULL)\n\t\tgoto err;\n\n");
484 "GFp(tmp_1, tmp_2, tmp_3, NULL)) == NULL)"
485 "\n\t\tgoto err;\n\n");
486 } else {
487 BIO_printf(out, "\tif ((group = EC_GROUP_new_curve_"
488 "GF2m(tmp_1, tmp_2, tmp_3, NULL)) == NULL)"
489 "\n\t\tgoto err;\n\n");
490 }
491 BIO_printf(out, "\t/* build generator */\n"); 481 BIO_printf(out, "\t/* build generator */\n");
492 BIO_printf(out, "\tif ((tmp_1 = BN_bin2bn(ec_gen_%d, " 482 BIO_printf(out, "\tif ((tmp_1 = BN_bin2bn(ec_gen_%d, "
493 "sizeof(ec_gen_%d), tmp_1)) == NULL)" 483 "sizeof(ec_gen_%d), tmp_1)) == NULL)"