diff options
| author | tb <> | 2023-05-20 05:42:57 +0000 |
|---|---|---|
| committer | tb <> | 2023-05-20 05:42:57 +0000 |
| commit | a396af3f8229fb61b19bc9d2df321f3dcf435229 (patch) | |
| tree | 54fcee104a25174c37159f0cbbc12b2c9adcdcb5 | |
| parent | 78e55acbc99ac02f1fc1a7009196444739574783 (diff) | |
| download | openbsd-a396af3f8229fb61b19bc9d2df321f3dcf435229.tar.gz openbsd-a396af3f8229fb61b19bc9d2df321f3dcf435229.tar.bz2 openbsd-a396af3f8229fb61b19bc9d2df321f3dcf435229.zip | |
openssl speed: remove binary curve remnants
This wasn't properly hidden under OPENSSL_NO_EC2M, and all it does now
is producing ugly errors and useless "statistics". While looking at this,
I found that much of speed "has been pilfered from [Eric A. Young's]
libdes speed.c program". Apparently this was an precursor and ingredient
of SSLeay. Unfortunately, it seems that this piece of the history is lost.
ok miod
PS: If anyone is bored, a rewrite from scratch of the speed 'app' would
be a welcome contribution and may be an instructive rainy day project.
The current code was written in about the most stupid way possible so as
to maximize fragility and unmaintainability.
| -rw-r--r-- | src/usr.bin/openssl/speed.c | 93 |
1 files changed, 5 insertions, 88 deletions
diff --git a/src/usr.bin/openssl/speed.c b/src/usr.bin/openssl/speed.c index ce350aaeba..748fe999d0 100644 --- a/src/usr.bin/openssl/speed.c +++ b/src/usr.bin/openssl/speed.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: speed.c,v 1.30 2023/02/23 14:55:54 tb Exp $ */ | 1 | /* $OpenBSD: speed.c,v 1.31 2023/05/20 05:42:57 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -166,7 +166,7 @@ static int do_multi(int multi); | |||
| 166 | #define RSA_NUM 4 | 166 | #define RSA_NUM 4 |
| 167 | #define DSA_NUM 3 | 167 | #define DSA_NUM 3 |
| 168 | 168 | ||
| 169 | #define EC_NUM 16 | 169 | #define EC_NUM 6 |
| 170 | #define MAX_ECDH_SIZE 256 | 170 | #define MAX_ECDH_SIZE 256 |
| 171 | 171 | ||
| 172 | static const char *names[ALGOR_NUM] = { | 172 | static const char *names[ALGOR_NUM] = { |
| @@ -365,16 +365,6 @@ speed_main(int argc, char **argv) | |||
| 365 | #define R_EC_P256 3 | 365 | #define R_EC_P256 3 |
| 366 | #define R_EC_P384 4 | 366 | #define R_EC_P384 4 |
| 367 | #define R_EC_P521 5 | 367 | #define R_EC_P521 5 |
| 368 | #define R_EC_K163 6 | ||
| 369 | #define R_EC_K233 7 | ||
| 370 | #define R_EC_K283 8 | ||
| 371 | #define R_EC_K409 9 | ||
| 372 | #define R_EC_K571 10 | ||
| 373 | #define R_EC_B163 11 | ||
| 374 | #define R_EC_B233 12 | ||
| 375 | #define R_EC_B283 13 | ||
| 376 | #define R_EC_B409 14 | ||
| 377 | #define R_EC_B571 15 | ||
| 378 | 368 | ||
| 379 | RSA *rsa_key[RSA_NUM]; | 369 | RSA *rsa_key[RSA_NUM]; |
| 380 | long rsa_c[RSA_NUM][2]; | 370 | long rsa_c[RSA_NUM][2]; |
| @@ -394,53 +384,24 @@ speed_main(int argc, char **argv) | |||
| 394 | * name to the following arrays and increase the EC_NUM value | 384 | * name to the following arrays and increase the EC_NUM value |
| 395 | * accordingly. | 385 | * accordingly. |
| 396 | */ | 386 | */ |
| 397 | static unsigned int test_curves[EC_NUM] = | 387 | static unsigned int test_curves[EC_NUM] = { |
| 398 | { | ||
| 399 | /* Prime Curves */ | ||
| 400 | NID_secp160r1, | 388 | NID_secp160r1, |
| 401 | NID_X9_62_prime192v1, | 389 | NID_X9_62_prime192v1, |
| 402 | NID_secp224r1, | 390 | NID_secp224r1, |
| 403 | NID_X9_62_prime256v1, | 391 | NID_X9_62_prime256v1, |
| 404 | NID_secp384r1, | 392 | NID_secp384r1, |
| 405 | NID_secp521r1, | 393 | NID_secp521r1, |
| 406 | /* Binary Curves */ | ||
| 407 | NID_sect163k1, | ||
| 408 | NID_sect233k1, | ||
| 409 | NID_sect283k1, | ||
| 410 | NID_sect409k1, | ||
| 411 | NID_sect571k1, | ||
| 412 | NID_sect163r2, | ||
| 413 | NID_sect233r1, | ||
| 414 | NID_sect283r1, | ||
| 415 | NID_sect409r1, | ||
| 416 | NID_sect571r1 | ||
| 417 | }; | 394 | }; |
| 418 | static const char *test_curves_names[EC_NUM] = | 395 | static const char *test_curves_names[EC_NUM] = { |
| 419 | { | ||
| 420 | /* Prime Curves */ | ||
| 421 | "secp160r1", | 396 | "secp160r1", |
| 422 | "nistp192", | 397 | "nistp192", |
| 423 | "nistp224", | 398 | "nistp224", |
| 424 | "nistp256", | 399 | "nistp256", |
| 425 | "nistp384", | 400 | "nistp384", |
| 426 | "nistp521", | 401 | "nistp521", |
| 427 | /* Binary Curves */ | ||
| 428 | "nistk163", | ||
| 429 | "nistk233", | ||
| 430 | "nistk283", | ||
| 431 | "nistk409", | ||
| 432 | "nistk571", | ||
| 433 | "nistb163", | ||
| 434 | "nistb233", | ||
| 435 | "nistb283", | ||
| 436 | "nistb409", | ||
| 437 | "nistb571" | ||
| 438 | }; | 402 | }; |
| 439 | static int test_curves_bits[EC_NUM] = | 403 | static int test_curves_bits[EC_NUM] = { |
| 440 | { | ||
| 441 | 160, 192, 224, 256, 384, 521, | 404 | 160, 192, 224, 256, 384, 521, |
| 442 | 163, 233, 283, 409, 571, | ||
| 443 | 163, 233, 283, 409, 571 | ||
| 444 | }; | 405 | }; |
| 445 | 406 | ||
| 446 | #endif | 407 | #endif |
| @@ -753,26 +714,6 @@ speed_main(int argc, char **argv) | |||
| 753 | ecdsa_doit[R_EC_P384] = 2; | 714 | ecdsa_doit[R_EC_P384] = 2; |
| 754 | else if (strcmp(*argv, "ecdsap521") == 0) | 715 | else if (strcmp(*argv, "ecdsap521") == 0) |
| 755 | ecdsa_doit[R_EC_P521] = 2; | 716 | ecdsa_doit[R_EC_P521] = 2; |
| 756 | else if (strcmp(*argv, "ecdsak163") == 0) | ||
| 757 | ecdsa_doit[R_EC_K163] = 2; | ||
| 758 | else if (strcmp(*argv, "ecdsak233") == 0) | ||
| 759 | ecdsa_doit[R_EC_K233] = 2; | ||
| 760 | else if (strcmp(*argv, "ecdsak283") == 0) | ||
| 761 | ecdsa_doit[R_EC_K283] = 2; | ||
| 762 | else if (strcmp(*argv, "ecdsak409") == 0) | ||
| 763 | ecdsa_doit[R_EC_K409] = 2; | ||
| 764 | else if (strcmp(*argv, "ecdsak571") == 0) | ||
| 765 | ecdsa_doit[R_EC_K571] = 2; | ||
| 766 | else if (strcmp(*argv, "ecdsab163") == 0) | ||
| 767 | ecdsa_doit[R_EC_B163] = 2; | ||
| 768 | else if (strcmp(*argv, "ecdsab233") == 0) | ||
| 769 | ecdsa_doit[R_EC_B233] = 2; | ||
| 770 | else if (strcmp(*argv, "ecdsab283") == 0) | ||
| 771 | ecdsa_doit[R_EC_B283] = 2; | ||
| 772 | else if (strcmp(*argv, "ecdsab409") == 0) | ||
| 773 | ecdsa_doit[R_EC_B409] = 2; | ||
| 774 | else if (strcmp(*argv, "ecdsab571") == 0) | ||
| 775 | ecdsa_doit[R_EC_B571] = 2; | ||
| 776 | else if (strcmp(*argv, "ecdsa") == 0) { | 717 | else if (strcmp(*argv, "ecdsa") == 0) { |
| 777 | for (i = 0; i < EC_NUM; i++) | 718 | for (i = 0; i < EC_NUM; i++) |
| 778 | ecdsa_doit[i] = 1; | 719 | ecdsa_doit[i] = 1; |
| @@ -789,26 +730,6 @@ speed_main(int argc, char **argv) | |||
| 789 | ecdh_doit[R_EC_P384] = 2; | 730 | ecdh_doit[R_EC_P384] = 2; |
| 790 | else if (strcmp(*argv, "ecdhp521") == 0) | 731 | else if (strcmp(*argv, "ecdhp521") == 0) |
| 791 | ecdh_doit[R_EC_P521] = 2; | 732 | ecdh_doit[R_EC_P521] = 2; |
| 792 | else if (strcmp(*argv, "ecdhk163") == 0) | ||
| 793 | ecdh_doit[R_EC_K163] = 2; | ||
| 794 | else if (strcmp(*argv, "ecdhk233") == 0) | ||
| 795 | ecdh_doit[R_EC_K233] = 2; | ||
| 796 | else if (strcmp(*argv, "ecdhk283") == 0) | ||
| 797 | ecdh_doit[R_EC_K283] = 2; | ||
| 798 | else if (strcmp(*argv, "ecdhk409") == 0) | ||
| 799 | ecdh_doit[R_EC_K409] = 2; | ||
| 800 | else if (strcmp(*argv, "ecdhk571") == 0) | ||
| 801 | ecdh_doit[R_EC_K571] = 2; | ||
| 802 | else if (strcmp(*argv, "ecdhb163") == 0) | ||
| 803 | ecdh_doit[R_EC_B163] = 2; | ||
| 804 | else if (strcmp(*argv, "ecdhb233") == 0) | ||
| 805 | ecdh_doit[R_EC_B233] = 2; | ||
| 806 | else if (strcmp(*argv, "ecdhb283") == 0) | ||
| 807 | ecdh_doit[R_EC_B283] = 2; | ||
| 808 | else if (strcmp(*argv, "ecdhb409") == 0) | ||
| 809 | ecdh_doit[R_EC_B409] = 2; | ||
| 810 | else if (strcmp(*argv, "ecdhb571") == 0) | ||
| 811 | ecdh_doit[R_EC_B571] = 2; | ||
| 812 | else if (strcmp(*argv, "ecdh") == 0) { | 733 | else if (strcmp(*argv, "ecdh") == 0) { |
| 813 | for (i = 0; i < EC_NUM; i++) | 734 | for (i = 0; i < EC_NUM; i++) |
| 814 | ecdh_doit[i] = 1; | 735 | ecdh_doit[i] = 1; |
| @@ -881,11 +802,7 @@ speed_main(int argc, char **argv) | |||
| 881 | 802 | ||
| 882 | BIO_printf(bio_err, "dsa512 dsa1024 dsa2048\n"); | 803 | BIO_printf(bio_err, "dsa512 dsa1024 dsa2048\n"); |
| 883 | BIO_printf(bio_err, "ecdsap160 ecdsap192 ecdsap224 ecdsap256 ecdsap384 ecdsap521\n"); | 804 | BIO_printf(bio_err, "ecdsap160 ecdsap192 ecdsap224 ecdsap256 ecdsap384 ecdsap521\n"); |
| 884 | BIO_printf(bio_err, "ecdsak163 ecdsak233 ecdsak283 ecdsak409 ecdsak571\n"); | ||
| 885 | BIO_printf(bio_err, "ecdsab163 ecdsab233 ecdsab283 ecdsab409 ecdsab571 ecdsa\n"); | ||
| 886 | BIO_printf(bio_err, "ecdhp160 ecdhp192 ecdhp224 ecdhp256 ecdhp384 ecdhp521\n"); | 805 | BIO_printf(bio_err, "ecdhp160 ecdhp192 ecdhp224 ecdhp256 ecdhp384 ecdhp521\n"); |
| 887 | BIO_printf(bio_err, "ecdhk163 ecdhk233 ecdhk283 ecdhk409 ecdhk571\n"); | ||
| 888 | BIO_printf(bio_err, "ecdhb163 ecdhb233 ecdhb283 ecdhb409 ecdhb571 ecdh\n"); | ||
| 889 | 806 | ||
| 890 | #ifndef OPENSSL_NO_IDEA | 807 | #ifndef OPENSSL_NO_IDEA |
| 891 | BIO_printf(bio_err, "idea "); | 808 | BIO_printf(bio_err, "idea "); |
