diff options
Diffstat (limited to 'src/usr.bin/openssl/speed.c')
| -rw-r--r-- | src/usr.bin/openssl/speed.c | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/src/usr.bin/openssl/speed.c b/src/usr.bin/openssl/speed.c index d9fe3309b7..292fa28634 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.14 2015/09/13 23:36:21 doug Exp $ */ | 1 | /* $OpenBSD: speed.c,v 1.15 2015/09/14 01:45:03 doug 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 | * |
| @@ -124,6 +124,9 @@ | |||
| 124 | #ifndef OPENSSL_NO_IDEA | 124 | #ifndef OPENSSL_NO_IDEA |
| 125 | #include <openssl/idea.h> | 125 | #include <openssl/idea.h> |
| 126 | #endif | 126 | #endif |
| 127 | #ifndef OPENSSL_NO_MD4 | ||
| 128 | #include <openssl/md4.h> | ||
| 129 | #endif | ||
| 127 | #ifndef OPENSSL_NO_MD5 | 130 | #ifndef OPENSSL_NO_MD5 |
| 128 | #include <openssl/md5.h> | 131 | #include <openssl/md5.h> |
| 129 | #endif | 132 | #endif |
| @@ -170,8 +173,7 @@ static int do_multi(int multi); | |||
| 170 | #define MAX_ECDH_SIZE 256 | 173 | #define MAX_ECDH_SIZE 256 |
| 171 | 174 | ||
| 172 | static const char *names[ALGOR_NUM] = { | 175 | static const char *names[ALGOR_NUM] = { |
| 173 | "md2", NULL /* was mdc2 */, NULL /* was md4 */, "md5", "hmac(md5)", | 176 | "md2", NULL /* was mdc2 */, "md4", "md5", "hmac(md5)", "sha1", "rmd160", |
| 174 | "sha1", "rmd160", | ||
| 175 | "rc4", "des cbc", "des ede3", "idea cbc", "seed cbc", | 177 | "rc4", "des cbc", "des ede3", "idea cbc", "seed cbc", |
| 176 | "rc2 cbc", "rc5-32/12 cbc", "blowfish cbc", "cast cbc", | 178 | "rc2 cbc", "rc5-32/12 cbc", "blowfish cbc", "cast cbc", |
| 177 | "aes-128 cbc", "aes-192 cbc", "aes-256 cbc", | 179 | "aes-128 cbc", "aes-192 cbc", "aes-256 cbc", |
| @@ -232,6 +234,9 @@ speed_main(int argc, char **argv) | |||
| 232 | long rsa_count; | 234 | long rsa_count; |
| 233 | unsigned rsa_num; | 235 | unsigned rsa_num; |
| 234 | unsigned char md[EVP_MAX_MD_SIZE]; | 236 | unsigned char md[EVP_MAX_MD_SIZE]; |
| 237 | #ifndef OPENSSL_NO_MD4 | ||
| 238 | unsigned char md4[MD4_DIGEST_LENGTH]; | ||
| 239 | #endif | ||
| 235 | #ifndef OPENSSL_NO_MD5 | 240 | #ifndef OPENSSL_NO_MD5 |
| 236 | unsigned char md5[MD5_DIGEST_LENGTH]; | 241 | unsigned char md5[MD5_DIGEST_LENGTH]; |
| 237 | unsigned char hmac[MD5_DIGEST_LENGTH]; | 242 | unsigned char hmac[MD5_DIGEST_LENGTH]; |
| @@ -313,6 +318,7 @@ speed_main(int argc, char **argv) | |||
| 313 | CAMELLIA_KEY camellia_ks1, camellia_ks2, camellia_ks3; | 318 | CAMELLIA_KEY camellia_ks1, camellia_ks2, camellia_ks3; |
| 314 | #endif | 319 | #endif |
| 315 | #define D_MD2 0 | 320 | #define D_MD2 0 |
| 321 | #define D_MD4 2 | ||
| 316 | #define D_MD5 3 | 322 | #define D_MD5 3 |
| 317 | #define D_HMAC 4 | 323 | #define D_HMAC 4 |
| 318 | #define D_SHA1 5 | 324 | #define D_SHA1 5 |
| @@ -551,6 +557,11 @@ speed_main(int argc, char **argv) | |||
| 551 | j--; /* Otherwise, -mr gets confused with an | 557 | j--; /* Otherwise, -mr gets confused with an |
| 552 | * algorithm. */ | 558 | * algorithm. */ |
| 553 | } else | 559 | } else |
| 560 | #ifndef OPENSSL_NO_MD4 | ||
| 561 | if (strcmp(*argv, "md4") == 0) | ||
| 562 | doit[D_MD4] = 1; | ||
| 563 | else | ||
| 564 | #endif | ||
| 554 | #ifndef OPENSSL_NO_MD5 | 565 | #ifndef OPENSSL_NO_MD5 |
| 555 | if (strcmp(*argv, "md5") == 0) | 566 | if (strcmp(*argv, "md5") == 0) |
| 556 | doit[D_MD5] = 1; | 567 | doit[D_MD5] = 1; |
| @@ -801,6 +812,9 @@ speed_main(int argc, char **argv) | |||
| 801 | BIO_printf(bio_err, "Error: bad option or value\n"); | 812 | BIO_printf(bio_err, "Error: bad option or value\n"); |
| 802 | BIO_printf(bio_err, "\n"); | 813 | BIO_printf(bio_err, "\n"); |
| 803 | BIO_printf(bio_err, "Available values:\n"); | 814 | BIO_printf(bio_err, "Available values:\n"); |
| 815 | #ifndef OPENSSL_NO_MD4 | ||
| 816 | BIO_printf(bio_err, "md4 "); | ||
| 817 | #endif | ||
| 804 | #ifndef OPENSSL_NO_MD5 | 818 | #ifndef OPENSSL_NO_MD5 |
| 805 | BIO_printf(bio_err, "md5 "); | 819 | BIO_printf(bio_err, "md5 "); |
| 806 | #ifndef OPENSSL_NO_HMAC | 820 | #ifndef OPENSSL_NO_HMAC |
| @@ -823,7 +837,7 @@ speed_main(int argc, char **argv) | |||
| 823 | BIO_printf(bio_err, "rmd160"); | 837 | BIO_printf(bio_err, "rmd160"); |
| 824 | #endif | 838 | #endif |
| 825 | #if !defined(OPENSSL_NO_MD2) || \ | 839 | #if !defined(OPENSSL_NO_MD2) || \ |
| 826 | !defined(OPENSSL_NO_MD5) || \ | 840 | !defined(OPENSSL_NO_MD4) || !defined(OPENSSL_NO_MD5) || \ |
| 827 | !defined(OPENSSL_NO_SHA1) || !defined(OPENSSL_NO_RIPEMD160) || \ | 841 | !defined(OPENSSL_NO_SHA1) || !defined(OPENSSL_NO_RIPEMD160) || \ |
| 828 | !defined(OPENSSL_NO_WHIRLPOOL) | 842 | !defined(OPENSSL_NO_WHIRLPOOL) |
| 829 | BIO_printf(bio_err, "\n"); | 843 | BIO_printf(bio_err, "\n"); |
| @@ -982,6 +996,19 @@ speed_main(int argc, char **argv) | |||
| 982 | #define COUNT(d) (count) | 996 | #define COUNT(d) (count) |
| 983 | signal(SIGALRM, sig_done); | 997 | signal(SIGALRM, sig_done); |
| 984 | 998 | ||
| 999 | #ifndef OPENSSL_NO_MD4 | ||
| 1000 | if (doit[D_MD4]) { | ||
| 1001 | for (j = 0; j < SIZE_NUM; j++) { | ||
| 1002 | print_message(names[D_MD4], c[D_MD4][j], lengths[j]); | ||
| 1003 | Time_F(START); | ||
| 1004 | for (count = 0, run = 1; COND(c[D_MD4][j]); count++) | ||
| 1005 | EVP_Digest(&(buf[0]), (unsigned long) lengths[j], &(md4[0]), NULL, EVP_md4(), NULL); | ||
| 1006 | d = Time_F(STOP); | ||
| 1007 | print_result(D_MD4, j, count, d); | ||
| 1008 | } | ||
| 1009 | } | ||
| 1010 | #endif | ||
| 1011 | |||
| 985 | #ifndef OPENSSL_NO_MD5 | 1012 | #ifndef OPENSSL_NO_MD5 |
| 986 | if (doit[D_MD5]) { | 1013 | if (doit[D_MD5]) { |
| 987 | for (j = 0; j < SIZE_NUM; j++) { | 1014 | for (j = 0; j < SIZE_NUM; j++) { |
