summaryrefslogtreecommitdiff
path: root/src/usr.bin/openssl
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/usr.bin/openssl/apps.c30
-rw-r--r--src/usr.bin/openssl/ca.c33
-rw-r--r--src/usr.bin/openssl/certhash.c22
-rw-r--r--src/usr.bin/openssl/cms.c38
-rw-r--r--src/usr.bin/openssl/gendsa.c5
-rw-r--r--src/usr.bin/openssl/genrsa.c5
-rw-r--r--src/usr.bin/openssl/ocsp.c12
-rw-r--r--src/usr.bin/openssl/openssl.152
-rw-r--r--src/usr.bin/openssl/openssl.c5
-rw-r--r--src/usr.bin/openssl/pkcs12.c5
-rw-r--r--src/usr.bin/openssl/pkcs8.c6
-rw-r--r--src/usr.bin/openssl/smime.c16
-rw-r--r--src/usr.bin/openssl/speed.c290
13 files changed, 204 insertions, 315 deletions
diff --git a/src/usr.bin/openssl/apps.c b/src/usr.bin/openssl/apps.c
index 7c98f1e70c..46197dfd49 100644
--- a/src/usr.bin/openssl/apps.c
+++ b/src/usr.bin/openssl/apps.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: apps.c,v 1.70 2025/01/03 09:14:42 tb Exp $ */ 1/* $OpenBSD: apps.c,v 1.72 2025/03/18 13:03:08 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -1377,10 +1377,10 @@ int
1377save_index(const char *file, const char *suffix, CA_DB *db) 1377save_index(const char *file, const char *suffix, CA_DB *db)
1378{ 1378{
1379 char attrpath[PATH_MAX], dbfile[PATH_MAX]; 1379 char attrpath[PATH_MAX], dbfile[PATH_MAX];
1380 BIO *out = BIO_new(BIO_s_file()); 1380 BIO *out;
1381 int j; 1381 int ret = 0;
1382 1382
1383 if (out == NULL) { 1383 if ((out = BIO_new(BIO_s_file())) == NULL) {
1384 ERR_print_errors(bio_err); 1384 ERR_print_errors(bio_err);
1385 goto err; 1385 goto err;
1386 } 1386 }
@@ -1400,27 +1400,31 @@ save_index(const char *file, const char *suffix, CA_DB *db)
1400 BIO_printf(bio_err, "unable to open '%s'\n", dbfile); 1400 BIO_printf(bio_err, "unable to open '%s'\n", dbfile);
1401 goto err; 1401 goto err;
1402 } 1402 }
1403 j = TXT_DB_write(out, db->db); 1403
1404 if (j <= 0) 1404 if (TXT_DB_write(out, db->db) <= 0)
1405 goto err; 1405 goto err;
1406 1406
1407 BIO_free(out); 1407 BIO_free(out);
1408 1408 if ((out = BIO_new(BIO_s_file())) == NULL) {
1409 out = BIO_new(BIO_s_file()); 1409 ERR_print_errors(bio_err);
1410 goto err;
1411 }
1410 1412
1411 if (BIO_write_filename(out, attrpath) <= 0) { 1413 if (BIO_write_filename(out, attrpath) <= 0) {
1412 perror(attrpath); 1414 perror(attrpath);
1413 BIO_printf(bio_err, "unable to open '%s'\n", attrpath); 1415 BIO_printf(bio_err, "unable to open '%s'\n", attrpath);
1414 goto err; 1416 goto err;
1415 } 1417 }
1416 BIO_printf(out, "unique_subject = %s\n", 1418 if (BIO_printf(out, "unique_subject = %s\n",
1417 db->attributes.unique_subject ? "yes" : "no"); 1419 db->attributes.unique_subject ? "yes" : "no") <= 0)
1418 BIO_free(out); 1420 goto err;
1419 1421
1420 return 1; 1422 ret = 1;
1421 1423
1422 err: 1424 err:
1423 return 0; 1425 BIO_free(out);
1426
1427 return ret;
1424} 1428}
1425 1429
1426int 1430int
diff --git a/src/usr.bin/openssl/ca.c b/src/usr.bin/openssl/ca.c
index d69844620d..b644b746b9 100644
--- a/src/usr.bin/openssl/ca.c
+++ b/src/usr.bin/openssl/ca.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ca.c,v 1.61 2025/02/25 09:49:33 tb Exp $ */ 1/* $OpenBSD: ca.c,v 1.62 2025/04/14 08:39:27 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 *
@@ -104,7 +104,6 @@
104#define ENV_POLICY "policy" 104#define ENV_POLICY "policy"
105#define ENV_EXTENSIONS "x509_extensions" 105#define ENV_EXTENSIONS "x509_extensions"
106#define ENV_CRLEXT "crl_extensions" 106#define ENV_CRLEXT "crl_extensions"
107#define ENV_MSIE_HACK "msie_hack"
108#define ENV_NAMEOPT "name_opt" 107#define ENV_NAMEOPT "name_opt"
109#define ENV_CERTOPT "cert_opt" 108#define ENV_CERTOPT "cert_opt"
110#define ENV_EXTCOPY "copy_extensions" 109#define ENV_EXTCOPY "copy_extensions"
@@ -181,7 +180,6 @@ static struct {
181 int keyform; 180 int keyform;
182 char *md; 181 char *md;
183 int multirdn; 182 int multirdn;
184 int msie_hack;
185 int notext; 183 int notext;
186 char *outdir; 184 char *outdir;
187 char *outfile; 185 char *outfile;
@@ -451,11 +449,6 @@ static const struct option ca_options[] = {
451 .opt.arg = &cfg.md, 449 .opt.arg = &cfg.md,
452 }, 450 },
453 { 451 {
454 .name = "msie_hack",
455 .type = OPTION_FLAG,
456 .opt.flag = &cfg.msie_hack,
457 },
458 {
459 .name = "multivalue-rdn", 452 .name = "multivalue-rdn",
460 .desc = "Enable support for multivalued RDNs", 453 .desc = "Enable support for multivalued RDNs",
461 .type = OPTION_FLAG, 454 .type = OPTION_FLAG,
@@ -827,11 +820,6 @@ ca_main(int argc, char **argv)
827 ERR_clear_error(); 820 ERR_clear_error();
828 if ((f != NULL) && ((*f == 'y') || (*f == 'Y'))) 821 if ((f != NULL) && ((*f == 'y') || (*f == 'Y')))
829 cfg.preserve = 1; 822 cfg.preserve = 1;
830 f = NCONF_get_string(conf, BASE_SECTION, ENV_MSIE_HACK);
831 if (f == NULL)
832 ERR_clear_error();
833 if ((f != NULL) && ((*f == 'y') || (*f == 'Y')))
834 cfg.msie_hack = 1;
835 823
836 f = NCONF_get_string(conf, cfg.section, ENV_NAMEOPT); 824 f = NCONF_get_string(conf, cfg.section, ENV_NAMEOPT);
837 825
@@ -1681,7 +1669,7 @@ do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst,
1681 X509_NAME_ENTRY *ne; 1669 X509_NAME_ENTRY *ne;
1682 X509_NAME_ENTRY *tne, *push; 1670 X509_NAME_ENTRY *tne, *push;
1683 EVP_PKEY *pktmp; 1671 EVP_PKEY *pktmp;
1684 int ok = -1, i, j, last, nid; 1672 int ok = -1, i, j, last;
1685 const char *p; 1673 const char *p;
1686 CONF_VALUE *cv; 1674 CONF_VALUE *cv;
1687 OPENSSL_STRING row[DB_NUMBER]; 1675 OPENSSL_STRING row[DB_NUMBER];
@@ -1723,23 +1711,6 @@ do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst,
1723 if (obj == NULL) 1711 if (obj == NULL)
1724 goto err; 1712 goto err;
1725 1713
1726 if (cfg.msie_hack) {
1727 /* assume all type should be strings */
1728 nid = OBJ_obj2nid(X509_NAME_ENTRY_get_object(ne));
1729 if (nid == NID_undef)
1730 goto err;
1731
1732 if (str->type == V_ASN1_UNIVERSALSTRING)
1733 ASN1_UNIVERSALSTRING_to_string(str);
1734
1735 if ((str->type == V_ASN1_IA5STRING) &&
1736 (nid != NID_pkcs9_emailAddress))
1737 str->type = V_ASN1_T61STRING;
1738
1739 if ((nid == NID_pkcs9_emailAddress) &&
1740 (str->type == V_ASN1_PRINTABLESTRING))
1741 str->type = V_ASN1_IA5STRING;
1742 }
1743 /* If no EMAIL is wanted in the subject */ 1714 /* If no EMAIL is wanted in the subject */
1744 if ((OBJ_obj2nid(obj) == NID_pkcs9_emailAddress) && (!email_dn)) 1715 if ((OBJ_obj2nid(obj) == NID_pkcs9_emailAddress) && (!email_dn))
1745 continue; 1716 continue;
diff --git a/src/usr.bin/openssl/certhash.c b/src/usr.bin/openssl/certhash.c
index 5ee29b8d01..1ee1165516 100644
--- a/src/usr.bin/openssl/certhash.c
+++ b/src/usr.bin/openssl/certhash.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: certhash.c,v 1.21 2023/03/06 14:32:05 tb Exp $ */ 1/* $OpenBSD: certhash.c,v 1.22 2025/07/27 14:46:20 joshua Exp $ */
2/* 2/*
3 * Copyright (c) 2014, 2015 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2014, 2015 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -297,11 +297,10 @@ hashinfo_from_linkname(const char *linkname, const char *target)
297} 297}
298 298
299static struct hashinfo * 299static struct hashinfo *
300certhash_cert(BIO *bio, const char *filename) 300certhash_cert(BIO *bio, const char *filename, const EVP_MD *digest)
301{ 301{
302 unsigned char fingerprint[EVP_MAX_MD_SIZE]; 302 unsigned char fingerprint[EVP_MAX_MD_SIZE];
303 struct hashinfo *hi = NULL; 303 struct hashinfo *hi = NULL;
304 const EVP_MD *digest;
305 X509 *cert = NULL; 304 X509 *cert = NULL;
306 unsigned long hash; 305 unsigned long hash;
307 unsigned int len; 306 unsigned int len;
@@ -311,7 +310,6 @@ certhash_cert(BIO *bio, const char *filename)
311 310
312 hash = X509_subject_name_hash(cert); 311 hash = X509_subject_name_hash(cert);
313 312
314 digest = EVP_sha256();
315 if (X509_digest(cert, digest, fingerprint, &len) != 1) { 313 if (X509_digest(cert, digest, fingerprint, &len) != 1) {
316 fprintf(stderr, "out of memory\n"); 314 fprintf(stderr, "out of memory\n");
317 goto err; 315 goto err;
@@ -326,11 +324,10 @@ certhash_cert(BIO *bio, const char *filename)
326} 324}
327 325
328static struct hashinfo * 326static struct hashinfo *
329certhash_crl(BIO *bio, const char *filename) 327certhash_crl(BIO *bio, const char *filename, const EVP_MD *digest)
330{ 328{
331 unsigned char fingerprint[EVP_MAX_MD_SIZE]; 329 unsigned char fingerprint[EVP_MAX_MD_SIZE];
332 struct hashinfo *hi = NULL; 330 struct hashinfo *hi = NULL;
333 const EVP_MD *digest;
334 X509_CRL *crl = NULL; 331 X509_CRL *crl = NULL;
335 unsigned long hash; 332 unsigned long hash;
336 unsigned int len; 333 unsigned int len;
@@ -340,7 +337,6 @@ certhash_crl(BIO *bio, const char *filename)
340 337
341 hash = X509_NAME_hash(X509_CRL_get_issuer(crl)); 338 hash = X509_NAME_hash(X509_CRL_get_issuer(crl));
342 339
343 digest = EVP_sha256();
344 if (X509_CRL_digest(crl, digest, fingerprint, &len) != 1) { 340 if (X509_CRL_digest(crl, digest, fingerprint, &len) != 1) {
345 fprintf(stderr, "out of memory\n"); 341 fprintf(stderr, "out of memory\n");
346 goto err; 342 goto err;
@@ -509,7 +505,7 @@ certhash_link(struct dirent *dep, struct hashinfo **links)
509 505
510static int 506static int
511certhash_file(struct dirent *dep, struct hashinfo **certs, 507certhash_file(struct dirent *dep, struct hashinfo **certs,
512 struct hashinfo **crls) 508 struct hashinfo **crls, const EVP_MD *digest)
513{ 509{
514 struct hashinfo *hi = NULL; 510 struct hashinfo *hi = NULL;
515 int has_cert, has_crl; 511 int has_cert, has_crl;
@@ -529,7 +525,7 @@ certhash_file(struct dirent *dep, struct hashinfo **certs,
529 goto err; 525 goto err;
530 } 526 }
531 527
532 if ((hi = certhash_cert(bio, dep->d_name)) != NULL) { 528 if ((hi = certhash_cert(bio, dep->d_name, digest)) != NULL) {
533 has_cert = 1; 529 has_cert = 1;
534 *certs = hashinfo_chain(*certs, hi); 530 *certs = hashinfo_chain(*certs, hi);
535 } 531 }
@@ -539,7 +535,7 @@ certhash_file(struct dirent *dep, struct hashinfo **certs,
539 goto err; 535 goto err;
540 } 536 }
541 537
542 if ((hi = certhash_crl(bio, dep->d_name)) != NULL) { 538 if ((hi = certhash_crl(bio, dep->d_name, digest)) != NULL) {
543 has_crl = hi->is_crl = 1; 539 has_crl = hi->is_crl = 1;
544 *crls = hashinfo_chain(*crls, hi); 540 *crls = hashinfo_chain(*crls, hi);
545 } 541 }
@@ -557,7 +553,7 @@ certhash_file(struct dirent *dep, struct hashinfo **certs,
557} 553}
558 554
559static int 555static int
560certhash_directory(const char *path) 556certhash_directory(const char *path, const EVP_MD *digest)
561{ 557{
562 struct hashinfo *links = NULL, *certs = NULL, *crls = NULL, *link; 558 struct hashinfo *links = NULL, *certs = NULL, *crls = NULL, *link;
563 int ret = 0; 559 int ret = 0;
@@ -579,7 +575,7 @@ certhash_directory(const char *path)
579 goto err; 575 goto err;
580 } 576 }
581 if (filename_is_pem(dep->d_name)) { 577 if (filename_is_pem(dep->d_name)) {
582 if (certhash_file(dep, &certs, &crls) == -1) 578 if (certhash_file(dep, &certs, &crls, digest) == -1)
583 goto err; 579 goto err;
584 } 580 }
585 } 581 }
@@ -678,7 +674,7 @@ certhash_main(int argc, char **argv)
678 ret = 1; 674 ret = 1;
679 continue; 675 continue;
680 } 676 }
681 ret |= certhash_directory(argv[i]); 677 ret |= certhash_directory(argv[i], EVP_sha256());
682 if (fchdir(cwdfd) == -1) { 678 if (fchdir(cwdfd) == -1) {
683 perror("failed to restore current directory"); 679 perror("failed to restore current directory");
684 ret = 1; 680 ret = 1;
diff --git a/src/usr.bin/openssl/cms.c b/src/usr.bin/openssl/cms.c
index 7420d0ab8c..458ddb0e3b 100644
--- a/src/usr.bin/openssl/cms.c
+++ b/src/usr.bin/openssl/cms.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cms.c,v 1.36 2024/08/12 15:34:58 job Exp $ */ 1/* $OpenBSD: cms.c,v 1.38 2025/06/07 08:24:15 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project. 3 * project.
4 */ 4 */
@@ -193,15 +193,33 @@ get_cipher_by_name(char *name)
193static int 193static int
194cms_opt_cipher(int argc, char **argv, int *argsused) 194cms_opt_cipher(int argc, char **argv, int *argsused)
195{ 195{
196 const EVP_CIPHER *cipher;
196 char *name = argv[0]; 197 char *name = argv[0];
197 198
198 if (*name++ != '-') 199 if (*name++ != '-')
199 return (1); 200 return (1);
200 201
201 if ((cfg.cipher = get_cipher_by_name(name)) == NULL) 202 if ((cipher = get_cipher_by_name(name)) == NULL)
202 if ((cfg.cipher = EVP_get_cipherbyname(name)) == NULL) 203 if ((cipher = EVP_get_cipherbyname(name)) == NULL)
203 return (1); 204 return (1);
204 205
206 /*
207 * XXX - this should really be done in CMS_{encrypt,decrypt}() until
208 * we have proper support for AuthEnvelopedData (RFC 5084), but this
209 * is good enough for now to avoid outputting garbage with this rusty
210 * swiss army knife.
211 */
212 if ((EVP_CIPHER_flags(cipher) & EVP_CIPH_FLAG_AEAD_CIPHER) != 0) {
213 BIO_printf(bio_err, "AuthEnvelopedData is not supported\n");
214 return (1);
215 }
216 if (EVP_CIPHER_mode(cipher) == EVP_CIPH_XTS_MODE) {
217 BIO_printf(bio_err, "XTS mode not supported\n");
218 return (1);
219 }
220
221 cfg.cipher = cipher;
222
205 *argsused = 1; 223 *argsused = 1;
206 return (0); 224 return (0);
207} 225}
@@ -475,7 +493,7 @@ static const struct option cms_options[] = {
475 }, 493 },
476 { 494 {
477 .name = "aes256", 495 .name = "aes256",
478 .desc = "Encrypt PEM output with CBC AES", 496 .desc = "Encrypt PEM output with CBC AES (default)",
479 .type = OPTION_ARGV_FUNC, 497 .type = OPTION_ARGV_FUNC,
480 .opt.argvfunc = cms_opt_cipher, 498 .opt.argvfunc = cms_opt_cipher,
481 }, 499 },
@@ -509,7 +527,7 @@ static const struct option cms_options[] = {
509 }, 527 },
510 { 528 {
511 .name = "des3", 529 .name = "des3",
512 .desc = "Encrypt with triple DES (default)", 530 .desc = "Encrypt with triple DES",
513 .type = OPTION_ARGV_FUNC, 531 .type = OPTION_ARGV_FUNC,
514 .opt.argvfunc = cms_opt_cipher, 532 .opt.argvfunc = cms_opt_cipher,
515 }, 533 },
@@ -1291,14 +1309,8 @@ cms_main(int argc, char **argv)
1291 } 1309 }
1292 1310
1293 if (cfg.operation == SMIME_ENCRYPT) { 1311 if (cfg.operation == SMIME_ENCRYPT) {
1294 if (cfg.cipher == NULL) { 1312 if (cfg.cipher == NULL)
1295#ifndef OPENSSL_NO_DES 1313 cfg.cipher = EVP_aes_256_cbc();
1296 cfg.cipher = EVP_des_ede3_cbc();
1297#else
1298 BIO_printf(bio_err, "No cipher selected\n");
1299 goto end;
1300#endif
1301 }
1302 if (cfg.secret_key != NULL && 1314 if (cfg.secret_key != NULL &&
1303 cfg.secret_keyid == NULL) { 1315 cfg.secret_keyid == NULL) {
1304 BIO_printf(bio_err, "No secret key id\n"); 1316 BIO_printf(bio_err, "No secret key id\n");
diff --git a/src/usr.bin/openssl/gendsa.c b/src/usr.bin/openssl/gendsa.c
index 00635c4551..69a7994da7 100644
--- a/src/usr.bin/openssl/gendsa.c
+++ b/src/usr.bin/openssl/gendsa.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: gendsa.c,v 1.17 2023/03/06 14:32:06 tb Exp $ */ 1/* $OpenBSD: gendsa.c,v 1.18 2025/06/07 08:33:58 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 *
@@ -80,7 +80,8 @@ static struct {
80 char *passargout; 80 char *passargout;
81} cfg; 81} cfg;
82 82
83static const EVP_CIPHER *get_cipher_by_name(char *name) 83static const EVP_CIPHER *
84get_cipher_by_name(char *name)
84{ 85{
85 if (name == NULL || strcmp(name, "") == 0) 86 if (name == NULL || strcmp(name, "") == 0)
86 return (NULL); 87 return (NULL);
diff --git a/src/usr.bin/openssl/genrsa.c b/src/usr.bin/openssl/genrsa.c
index 0b5323fa5f..647780d8fa 100644
--- a/src/usr.bin/openssl/genrsa.c
+++ b/src/usr.bin/openssl/genrsa.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: genrsa.c,v 1.22 2023/03/06 14:32:06 tb Exp $ */ 1/* $OpenBSD: genrsa.c,v 1.23 2025/06/07 08:33:58 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 *
@@ -108,7 +108,8 @@ set_public_exponent(int argc, char **argv, int *argsused)
108 return (0); 108 return (0);
109} 109}
110 110
111static const EVP_CIPHER *get_cipher_by_name(char *name) 111static const EVP_CIPHER *
112get_cipher_by_name(char *name)
112{ 113{
113 if (name == NULL || strcmp(name, "") == 0) 114 if (name == NULL || strcmp(name, "") == 0)
114 return (NULL); 115 return (NULL);
diff --git a/src/usr.bin/openssl/ocsp.c b/src/usr.bin/openssl/ocsp.c
index d35940a7ae..01d28aa1f0 100644
--- a/src/usr.bin/openssl/ocsp.c
+++ b/src/usr.bin/openssl/ocsp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ocsp.c,v 1.26 2024/08/31 18:39:25 tb Exp $ */ 1/* $OpenBSD: ocsp.c,v 1.27 2025/05/09 12:50:59 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -194,18 +194,18 @@ x509v3_add_value(const char *name, const char *value,
194 int ret = 0; 194 int ret = 0;
195 195
196 if ((conf_value = calloc(1, sizeof(*conf_value))) == NULL) { 196 if ((conf_value = calloc(1, sizeof(*conf_value))) == NULL) {
197 X509V3error(ERR_R_MALLOC_FAILURE); 197 perror("calloc");
198 goto err; 198 goto err;
199 } 199 }
200 if (name != NULL) { 200 if (name != NULL) {
201 if ((conf_value->name = strdup(name)) == NULL) { 201 if ((conf_value->name = strdup(name)) == NULL) {
202 X509V3error(ERR_R_MALLOC_FAILURE); 202 perror("strdup");
203 goto err; 203 goto err;
204 } 204 }
205 } 205 }
206 if (value != NULL) { 206 if (value != NULL) {
207 if ((conf_value->value = strdup(value)) == NULL) { 207 if ((conf_value->value = strdup(value)) == NULL) {
208 X509V3error(ERR_R_MALLOC_FAILURE); 208 perror("strdup");
209 goto err; 209 goto err;
210 } 210 }
211 } 211 }
@@ -213,12 +213,12 @@ x509v3_add_value(const char *name, const char *value,
213 if ((extlist = *out_extlist) == NULL) 213 if ((extlist = *out_extlist) == NULL)
214 extlist = sk_CONF_VALUE_new_null(); 214 extlist = sk_CONF_VALUE_new_null();
215 if (extlist == NULL) { 215 if (extlist == NULL) {
216 X509V3error(ERR_R_MALLOC_FAILURE); 216 perror("sk_CONF_VALUE_new_null");
217 goto err; 217 goto err;
218 } 218 }
219 219
220 if (!sk_CONF_VALUE_push(extlist, conf_value)) { 220 if (!sk_CONF_VALUE_push(extlist, conf_value)) {
221 X509V3error(ERR_R_MALLOC_FAILURE); 221 perror("sk_CONF_VALUE_push");
222 goto err; 222 goto err;
223 } 223 }
224 conf_value = NULL; 224 conf_value = NULL;
diff --git a/src/usr.bin/openssl/openssl.1 b/src/usr.bin/openssl/openssl.1
index 6ceb53ef5c..40defdc38b 100644
--- a/src/usr.bin/openssl/openssl.1
+++ b/src/usr.bin/openssl/openssl.1
@@ -1,4 +1,4 @@
1.\" $OpenBSD: openssl.1,v 1.162 2025/01/19 10:24:17 tb Exp $ 1.\" $OpenBSD: openssl.1,v 1.167 2025/06/07 08:29:20 tb Exp $
2.\" ==================================================================== 2.\" ====================================================================
3.\" Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. 3.\" Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
4.\" 4.\"
@@ -110,7 +110,7 @@
110.\" copied and put under another distribution licence 110.\" copied and put under another distribution licence
111.\" [including the GNU Public Licence.] 111.\" [including the GNU Public Licence.]
112.\" 112.\"
113.Dd $Mdocdate: January 19 2025 $ 113.Dd $Mdocdate: June 7 2025 $
114.Dt OPENSSL 1 114.Dt OPENSSL 1
115.Os 115.Os
116.Sh NAME 116.Sh NAME
@@ -325,7 +325,6 @@ into a nested structure.
325.Op Fl keyfile Ar file 325.Op Fl keyfile Ar file
326.Op Fl keyform Cm pem | der 326.Op Fl keyform Cm pem | der
327.Op Fl md Ar alg 327.Op Fl md Ar alg
328.Op Fl msie_hack
329.Op Fl multivalue-rdn 328.Op Fl multivalue-rdn
330.Op Fl name Ar section 329.Op Fl name Ar section
331.Op Fl noemailDN 330.Op Fl noemailDN
@@ -422,17 +421,6 @@ Possible values include
422and 421and
423.Ar sha1 . 422.Ar sha1 .
424This option also applies to CRLs. 423This option also applies to CRLs.
425.It Fl msie_hack
426This is a legacy option to make
427.Nm ca
428work with very old versions of the IE certificate enrollment control
429.Qq certenr3 .
430It used UniversalStrings for almost everything.
431Since the old control has various security bugs,
432its use is strongly discouraged.
433The newer control
434.Qq Xenroll
435does not need this option.
436.It Fl multivalue-rdn 424.It Fl multivalue-rdn
437This option causes the 425This option causes the
438.Fl subj 426.Fl subj
@@ -629,11 +617,9 @@ specified using
629.Cm default_ca 617.Cm default_ca
630or 618or
631.Fl name . 619.Fl name .
632The options 620The
633.Cm preserve 621.Cm preserve
634and 622option is read directly from the
635.Cm msie_hack
636are read directly from the
637.Cm ca 623.Cm ca
638section. 624section.
639.Pp 625.Pp
@@ -746,9 +732,6 @@ simply set this to
746.Qq no . 732.Qq no .
747If not present, the default is to allow for the EMAIL field in the 733If not present, the default is to allow for the EMAIL field in the
748certificate's DN. 734certificate's DN.
749.It Cm msie_hack
750The same as
751.Fl msie_hack .
752.It Cm name_opt , cert_opt 735.It Cm name_opt , cert_opt
753These options allow the format used to display the certificate details 736These options allow the format used to display the certificate details
754when asking the user to confirm signing. 737when asking the user to confirm signing.
@@ -1108,7 +1091,7 @@ The encryption algorithm to use.
1108128-, 192-, or 256-bit AES, 128-, 192-, or 256-bit CAMELLIA, 1091128-, 192-, or 256-bit AES, 128-, 192-, or 256-bit CAMELLIA,
1109DES (56 bits), triple DES (168 bits), 1092DES (56 bits), triple DES (168 bits),
1110or 40-, 64-, or 128-bit RC2, respectively; 1093or 40-, 64-, or 128-bit RC2, respectively;
1111if not specified, triple DES is 1094if not specified, 256-bit AES is
1112used. 1095used.
1113Only used with 1096Only used with
1114.Fl encrypt 1097.Fl encrypt
@@ -2990,9 +2973,6 @@ command processes private keys
2990(both encrypted and unencrypted) 2973(both encrypted and unencrypted)
2991in PKCS#8 format 2974in PKCS#8 format
2992with a variety of PKCS#5 (v1.5 and v2.0) and PKCS#12 algorithms. 2975with a variety of PKCS#5 (v1.5 and v2.0) and PKCS#12 algorithms.
2993The default encryption is only 56 bits;
2994keys encrypted using PKCS#5 v2.0 algorithms and high iteration counts
2995are more secure.
2996.Pp 2976.Pp
2997The options are as follows: 2977The options are as follows:
2998.Bl -tag -width Ds 2978.Bl -tag -width Ds
@@ -3038,16 +3018,12 @@ which allow strong encryption algorithms like triple DES or 128-bit RC2.
3038.El 3018.El
3039.It Fl v2 Ar alg 3019.It Fl v2 Ar alg
3040Use PKCS#5 v2.0 algorithms. 3020Use PKCS#5 v2.0 algorithms.
3041Supports algorithms such as 168-bit triple DES or 128-bit RC2, 3021These are block ciphers used in CBC mode.
3042however not many implementations support PKCS#5 v2.0 yet 3022The default is AES-256-CBC.
3043(if using private keys with 3023With the exception of AES, the choices available in RFC 8018
3044.Nm openssl 3024are considered decrepit.
3045this doesn't matter). 3025They can be enabled with des, des3, and rc2
3046.Pp 3026(rc5 is no longer supported).
3047.Ar alg
3048is the encryption algorithm to use;
3049valid values include des, des3, and rc2.
3050It is recommended that des3 is used.
3051.El 3027.El
3052.Tg pkcs12 3028.Tg pkcs12
3053.Sh PKCS12 3029.Sh PKCS12
@@ -5122,7 +5098,7 @@ The remaining options are as follows:
5122The encryption algorithm to use. 5098The encryption algorithm to use.
5123128-, 192-, or 256-bit AES, DES (56 bits), triple DES (168 bits), 5099128-, 192-, or 256-bit AES, DES (56 bits), triple DES (168 bits),
5124or 40-, 64-, or 128-bit RC2, respectively; 5100or 40-, 64-, or 128-bit RC2, respectively;
5125if not specified, 40-bit RC2 is 5101if not specified, 256-bit AES is
5126used. 5102used.
5127Only used with 5103Only used with
5128.Fl encrypt . 5104.Fl encrypt .
@@ -6165,7 +6141,7 @@ either using a list of comma-separated options or by specifying
6165.Fl nameopt 6141.Fl nameopt
6166multiple times. 6142multiple times.
6167The default behaviour is to use the 6143The default behaviour is to use the
6168.Cm oneline 6144.Cm compat
6169format. 6145format.
6170The options, 6146The options,
6171which can be preceded by a dash to turn them off, 6147which can be preceded by a dash to turn them off,
@@ -6247,7 +6223,7 @@ A one line format which is more readable than
6247.Cm RFC2253 . 6223.Cm RFC2253 .
6248Equivalent to 6224Equivalent to
6249.Cm esc_2253 , esc_ctrl , esc_msb , utf8 , 6225.Cm esc_2253 , esc_ctrl , esc_msb , utf8 ,
6250.Cm dump_nostr , dump_der , use_quote , sep_comma_plus_spc , 6226.Cm dump_nostr , dump_der , use_quote , sep_comma_plus_space ,
6251.Cm space_eq , 6227.Cm space_eq ,
6252and 6228and
6253.Cm sname . 6229.Cm sname .
diff --git a/src/usr.bin/openssl/openssl.c b/src/usr.bin/openssl/openssl.c
index 75a0e4d266..a1ef139009 100644
--- a/src/usr.bin/openssl/openssl.c
+++ b/src/usr.bin/openssl/openssl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: openssl.c,v 1.39 2025/01/02 13:10:03 tb Exp $ */ 1/* $OpenBSD: openssl.c,v 1.40 2025/05/25 04:54:41 joshua 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 *
@@ -235,9 +235,6 @@ FUNCTION functions[] = {
235 { FUNC_TYPE_MD, "sm3", dgst_main }, 235 { FUNC_TYPE_MD, "sm3", dgst_main },
236 { FUNC_TYPE_MD, "sm3WithRSAEncryption", dgst_main }, 236 { FUNC_TYPE_MD, "sm3WithRSAEncryption", dgst_main },
237#endif 237#endif
238#ifndef OPENSSL_NO_WHIRLPOOL
239 { FUNC_TYPE_MD, "whirlpool", dgst_main },
240#endif
241 238
242 /* Ciphers. */ 239 /* Ciphers. */
243 { FUNC_TYPE_CIPHER, "base64", enc_main }, 240 { FUNC_TYPE_CIPHER, "base64", enc_main },
diff --git a/src/usr.bin/openssl/pkcs12.c b/src/usr.bin/openssl/pkcs12.c
index 1407a96e03..efd6d59163 100644
--- a/src/usr.bin/openssl/pkcs12.c
+++ b/src/usr.bin/openssl/pkcs12.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pkcs12.c,v 1.29 2024/12/26 14:10:48 tb Exp $ */ 1/* $OpenBSD: pkcs12.c,v 1.30 2025/06/07 08:33:58 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project. 3 * project.
4 */ 4 */
@@ -152,7 +152,8 @@ pkcs12_opt_passarg(char *arg)
152 return (0); 152 return (0);
153} 153}
154 154
155static const EVP_CIPHER *get_cipher_by_name(char *name) 155static const EVP_CIPHER *
156get_cipher_by_name(char *name)
156{ 157{
157 if (name == NULL || strcmp(name, "") == 0) 158 if (name == NULL || strcmp(name, "") == 0)
158 return (NULL); 159 return (NULL);
diff --git a/src/usr.bin/openssl/pkcs8.c b/src/usr.bin/openssl/pkcs8.c
index 10fad7aed1..5d7c52f865 100644
--- a/src/usr.bin/openssl/pkcs8.c
+++ b/src/usr.bin/openssl/pkcs8.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pkcs8.c,v 1.18 2025/01/02 12:31:44 tb Exp $ */ 1/* $OpenBSD: pkcs8.c,v 1.19 2025/05/24 02:35:25 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999-2004. 3 * project 1999-2004.
4 */ 4 */
@@ -224,8 +224,8 @@ pkcs8_main(int argc, char **argv)
224 BIO_printf(bio_err, "Error getting passwords\n"); 224 BIO_printf(bio_err, "Error getting passwords\n");
225 goto end; 225 goto end;
226 } 226 }
227 if ((cfg.pbe_nid == -1) && !cfg.cipher) 227 if (cfg.pbe_nid == -1 && cfg.cipher == NULL)
228 cfg.pbe_nid = NID_pbeWithMD5AndDES_CBC; 228 cfg.cipher = EVP_aes_256_cbc();
229 229
230 if (cfg.infile) { 230 if (cfg.infile) {
231 if (!(in = BIO_new_file(cfg.infile, "rb"))) { 231 if (!(in = BIO_new_file(cfg.infile, "rb"))) {
diff --git a/src/usr.bin/openssl/smime.c b/src/usr.bin/openssl/smime.c
index 46bfa08679..f9d7049ff9 100644
--- a/src/usr.bin/openssl/smime.c
+++ b/src/usr.bin/openssl/smime.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: smime.c,v 1.20 2023/04/14 15:27:13 tb Exp $ */ 1/* $OpenBSD: smime.c,v 1.21 2025/06/07 08:28:49 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project. 3 * project.
4 */ 4 */
@@ -271,7 +271,7 @@ static const struct option smime_options[] = {
271 }, 271 },
272 { 272 {
273 .name = "aes256", 273 .name = "aes256",
274 .desc = "Encrypt PEM output with CBC AES", 274 .desc = "Encrypt PEM output with CBC AES (default)",
275 .type = OPTION_ARGV_FUNC, 275 .type = OPTION_ARGV_FUNC,
276 .opt.argvfunc = smime_opt_cipher, 276 .opt.argvfunc = smime_opt_cipher,
277 }, 277 },
@@ -313,7 +313,7 @@ static const struct option smime_options[] = {
313#ifndef OPENSSL_NO_RC2 313#ifndef OPENSSL_NO_RC2
314 { 314 {
315 .name = "rc2-40", 315 .name = "rc2-40",
316 .desc = "Encrypt with RC2-40 (default)", 316 .desc = "Encrypt with RC2-40",
317 .type = OPTION_ARGV_FUNC, 317 .type = OPTION_ARGV_FUNC,
318 .opt.argvfunc = smime_opt_cipher, 318 .opt.argvfunc = smime_opt_cipher,
319 }, 319 },
@@ -825,14 +825,8 @@ smime_main(int argc, char **argv)
825 } 825 }
826 826
827 if (cfg.operation == SMIME_ENCRYPT) { 827 if (cfg.operation == SMIME_ENCRYPT) {
828 if (cfg.cipher == NULL) { 828 if (cfg.cipher == NULL)
829#ifndef OPENSSL_NO_RC2 829 cfg.cipher = EVP_aes_256_cbc();
830 cfg.cipher = EVP_rc2_40_cbc();
831#else
832 BIO_printf(bio_err, "No cipher selected\n");
833 goto end;
834#endif
835 }
836 if ((encerts = sk_X509_new_null()) == NULL) 830 if ((encerts = sk_X509_new_null()) == NULL)
837 goto end; 831 goto end;
838 while (*args != NULL) { 832 while (*args != NULL) {
diff --git a/src/usr.bin/openssl/speed.c b/src/usr.bin/openssl/speed.c
index 9d03c6516e..3e9b4faa9d 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.41 2025/01/02 13:37:43 tb Exp $ */ 1/* $OpenBSD: speed.c,v 1.46 2025/05/25 05:05:30 joshua 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 *
@@ -142,9 +142,6 @@
142#ifndef OPENSSL_NO_SHA 142#ifndef OPENSSL_NO_SHA
143#include <openssl/sha.h> 143#include <openssl/sha.h>
144#endif 144#endif
145#ifndef OPENSSL_NO_WHIRLPOOL
146#include <openssl/whrlpool.h>
147#endif
148 145
149#define BUFSIZE (1024*8+64) 146#define BUFSIZE (1024*8+64)
150volatile sig_atomic_t run; 147volatile sig_atomic_t run;
@@ -152,7 +149,6 @@ volatile sig_atomic_t run;
152static int mr = 0; 149static int mr = 0;
153static int usertime = 1; 150static int usertime = 1;
154 151
155static double Time_F(int s);
156static void print_message(const char *s, long num, int length); 152static void print_message(const char *s, long num, int length);
157static void 153static void
158pkey_print_message(const char *str, const char *str2, 154pkey_print_message(const char *str, const char *str2,
@@ -160,7 +156,7 @@ pkey_print_message(const char *str, const char *str2,
160static void print_result(int alg, int run_no, int count, double time_used); 156static void print_result(int alg, int run_no, int count, double time_used);
161static int do_multi(int multi); 157static int do_multi(int multi);
162 158
163#define ALGOR_NUM 32 159#define ALGOR_NUM 31
164#define SIZE_NUM 5 160#define SIZE_NUM 5
165#define RSA_NUM 4 161#define RSA_NUM 4
166#define DSA_NUM 3 162#define DSA_NUM 3
@@ -174,7 +170,7 @@ static const char *names[ALGOR_NUM] = {
174 "rc2 cbc", "rc5-32/12 cbc", "blowfish cbc", "cast cbc", 170 "rc2 cbc", "rc5-32/12 cbc", "blowfish cbc", "cast cbc",
175 "aes-128 cbc", "aes-192 cbc", "aes-256 cbc", 171 "aes-128 cbc", "aes-192 cbc", "aes-256 cbc",
176 "camellia-128 cbc", "camellia-192 cbc", "camellia-256 cbc", 172 "camellia-128 cbc", "camellia-192 cbc", "camellia-256 cbc",
177 "evp", "sha256", "sha512", "whirlpool", 173 "evp", "sha256", "sha512",
178 "aes-128 ige", "aes-192 ige", "aes-256 ige", "ghash", 174 "aes-128 ige", "aes-192 ige", "aes-256 ige", "ghash",
179 "aes-128 gcm", "aes-256 gcm", "chacha20 poly1305", 175 "aes-128 gcm", "aes-256 gcm", "chacha20 poly1305",
180}; 176};
@@ -895,6 +891,22 @@ static const unsigned char test4096[] = {
895 0xaf, 0xf8, 0x2a, 0x91, 0x9d, 0x50, 0x44, 0x21, 0x17, 891 0xaf, 0xf8, 0x2a, 0x91, 0x9d, 0x50, 0x44, 0x21, 0x17,
896}; 892};
897 893
894static const unsigned char key16[] = {
895 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
896 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12,
897};
898static const unsigned char key24[] = {
899 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
900 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12,
901 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34,
902};
903static const unsigned char key32[] = {
904 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
905 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12,
906 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34,
907 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x56,
908};
909
898static void 910static void
899sig_done(int sig) 911sig_done(int sig)
900{ 912{
@@ -904,16 +916,14 @@ sig_done(int sig)
904#define START TM_RESET 916#define START TM_RESET
905#define STOP TM_GET 917#define STOP TM_GET
906 918
907
908static double 919static double
909Time_F(int s) 920time_f(int s)
910{ 921{
911 if (usertime) 922 if (usertime)
912 return app_timer_user(s); 923 return app_timer_user(s);
913 else
914 return app_timer_real(s);
915}
916 924
925 return app_timer_real(s);
926}
917 927
918static const int KDF1_SHA1_len = 20; 928static const int KDF1_SHA1_len = 20;
919static void * 929static void *
@@ -942,28 +952,7 @@ speed_main(int argc, char **argv)
942 long rsa_count; 952 long rsa_count;
943 unsigned rsa_num; 953 unsigned rsa_num;
944 unsigned char md[EVP_MAX_MD_SIZE]; 954 unsigned char md[EVP_MAX_MD_SIZE];
945#ifndef OPENSSL_NO_MD4 955
946 unsigned char md4[MD4_DIGEST_LENGTH];
947#endif
948#ifndef OPENSSL_NO_MD5
949 unsigned char md5[MD5_DIGEST_LENGTH];
950 unsigned char hmac[MD5_DIGEST_LENGTH];
951#endif
952#ifndef OPENSSL_NO_SHA
953 unsigned char sha[SHA_DIGEST_LENGTH];
954#ifndef OPENSSL_NO_SHA256
955 unsigned char sha256[SHA256_DIGEST_LENGTH];
956#endif
957#ifndef OPENSSL_NO_SHA512
958 unsigned char sha512[SHA512_DIGEST_LENGTH];
959#endif
960#endif
961#ifndef OPENSSL_NO_WHIRLPOOL
962 unsigned char whirlpool[WHIRLPOOL_DIGEST_LENGTH];
963#endif
964#ifndef OPENSSL_NO_RIPEMD
965 unsigned char rmd160[RIPEMD160_DIGEST_LENGTH];
966#endif
967#ifndef OPENSSL_NO_RC4 956#ifndef OPENSSL_NO_RC4
968 RC4_KEY rc4_ks; 957 RC4_KEY rc4_ks;
969#endif 958#endif
@@ -979,38 +968,8 @@ speed_main(int argc, char **argv)
979#ifndef OPENSSL_NO_CAST 968#ifndef OPENSSL_NO_CAST
980 CAST_KEY cast_ks; 969 CAST_KEY cast_ks;
981#endif 970#endif
982 static const unsigned char key16[16] =
983 {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
984 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12};
985#ifndef OPENSSL_NO_AES
986 static const unsigned char key24[24] =
987 {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
988 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12,
989 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34};
990 static const unsigned char key32[32] =
991 {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
992 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12,
993 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34,
994 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x56};
995#endif
996#ifndef OPENSSL_NO_CAMELLIA
997 static const unsigned char ckey24[24] =
998 {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
999 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12,
1000 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34};
1001 static const unsigned char ckey32[32] =
1002 {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
1003 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12,
1004 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34,
1005 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x56};
1006#endif
1007#ifndef OPENSSL_NO_AES
1008#define MAX_BLOCK_SIZE 128
1009#else
1010#define MAX_BLOCK_SIZE 64
1011#endif
1012 unsigned char DES_iv[8]; 971 unsigned char DES_iv[8];
1013 unsigned char iv[2 * MAX_BLOCK_SIZE / 8]; 972 unsigned char iv[2 * 16];
1014#ifndef OPENSSL_NO_DES 973#ifndef OPENSSL_NO_DES
1015 static DES_cblock key = {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0}; 974 static DES_cblock key = {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0};
1016 static DES_cblock key2 = {0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12}; 975 static DES_cblock key2 = {0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12};
@@ -1049,14 +1008,13 @@ speed_main(int argc, char **argv)
1049#define D_EVP 21 1008#define D_EVP 21
1050#define D_SHA256 22 1009#define D_SHA256 22
1051#define D_SHA512 23 1010#define D_SHA512 23
1052#define D_WHIRLPOOL 24 1011#define D_IGE_128_AES 24
1053#define D_IGE_128_AES 25 1012#define D_IGE_192_AES 25
1054#define D_IGE_192_AES 26 1013#define D_IGE_256_AES 26
1055#define D_IGE_256_AES 27 1014#define D_GHASH 27
1056#define D_GHASH 28 1015#define D_AES_128_GCM 28
1057#define D_AES_128_GCM 29 1016#define D_AES_256_GCM 29
1058#define D_AES_256_GCM 30 1017#define D_CHACHA20_POLY1305 30
1059#define D_CHACHA20_POLY1305 31
1060 double d = 0.0; 1018 double d = 0.0;
1061 long c[ALGOR_NUM][SIZE_NUM]; 1019 long c[ALGOR_NUM][SIZE_NUM];
1062#define R_DSA_512 0 1020#define R_DSA_512 0
@@ -1275,11 +1233,6 @@ speed_main(int argc, char **argv)
1275 else 1233 else
1276#endif 1234#endif
1277#endif 1235#endif
1278#ifndef OPENSSL_NO_WHIRLPOOL
1279 if (strcmp(*argv, "whirlpool") == 0)
1280 doit[D_WHIRLPOOL] = 1;
1281 else
1282#endif
1283#ifndef OPENSSL_NO_RIPEMD 1236#ifndef OPENSSL_NO_RIPEMD
1284 if (strcmp(*argv, "ripemd") == 0) 1237 if (strcmp(*argv, "ripemd") == 0)
1285 doit[D_RMD160] = 1; 1238 doit[D_RMD160] = 1;
@@ -1462,16 +1415,12 @@ speed_main(int argc, char **argv)
1462#ifndef OPENSSL_NO_SHA512 1415#ifndef OPENSSL_NO_SHA512
1463 BIO_printf(bio_err, "sha512 "); 1416 BIO_printf(bio_err, "sha512 ");
1464#endif 1417#endif
1465#ifndef OPENSSL_NO_WHIRLPOOL
1466 BIO_printf(bio_err, "whirlpool");
1467#endif
1468#ifndef OPENSSL_NO_RIPEMD160 1418#ifndef OPENSSL_NO_RIPEMD160
1469 BIO_printf(bio_err, "rmd160"); 1419 BIO_printf(bio_err, "rmd160");
1470#endif 1420#endif
1471#if !defined(OPENSSL_NO_MD2) || \ 1421#if !defined(OPENSSL_NO_MD2) || \
1472 !defined(OPENSSL_NO_MD4) || !defined(OPENSSL_NO_MD5) || \ 1422 !defined(OPENSSL_NO_MD4) || !defined(OPENSSL_NO_MD5) || \
1473 !defined(OPENSSL_NO_SHA1) || !defined(OPENSSL_NO_RIPEMD160) || \ 1423 !defined(OPENSSL_NO_SHA1) || !defined(OPENSSL_NO_RIPEMD160)
1474 !defined(OPENSSL_NO_WHIRLPOOL)
1475 BIO_printf(bio_err, "\n"); 1424 BIO_printf(bio_err, "\n");
1476#endif 1425#endif
1477 1426
@@ -1602,8 +1551,8 @@ speed_main(int argc, char **argv)
1602#endif 1551#endif
1603#ifndef OPENSSL_NO_CAMELLIA 1552#ifndef OPENSSL_NO_CAMELLIA
1604 Camellia_set_key(key16, 128, &camellia_ks1); 1553 Camellia_set_key(key16, 128, &camellia_ks1);
1605 Camellia_set_key(ckey24, 192, &camellia_ks2); 1554 Camellia_set_key(key24, 192, &camellia_ks2);
1606 Camellia_set_key(ckey32, 256, &camellia_ks3); 1555 Camellia_set_key(key32, 256, &camellia_ks3);
1607#endif 1556#endif
1608#ifndef OPENSSL_NO_IDEA 1557#ifndef OPENSSL_NO_IDEA
1609 idea_set_encrypt_key(key16, &idea_ks); 1558 idea_set_encrypt_key(key16, &idea_ks);
@@ -1634,10 +1583,10 @@ speed_main(int argc, char **argv)
1634 if (doit[D_MD4]) { 1583 if (doit[D_MD4]) {
1635 for (j = 0; j < SIZE_NUM; j++) { 1584 for (j = 0; j < SIZE_NUM; j++) {
1636 print_message(names[D_MD4], c[D_MD4][j], lengths[j]); 1585 print_message(names[D_MD4], c[D_MD4][j], lengths[j]);
1637 Time_F(START); 1586 time_f(START);
1638 for (count = 0, run = 1; COND(c[D_MD4][j]); count++) 1587 for (count = 0, run = 1; COND(c[D_MD4][j]); count++)
1639 EVP_Digest(&(buf[0]), (unsigned long) lengths[j], &(md4[0]), NULL, EVP_md4(), NULL); 1588 EVP_Digest(&(buf[0]), (unsigned long) lengths[j], md, NULL, EVP_md4(), NULL);
1640 d = Time_F(STOP); 1589 d = time_f(STOP);
1641 print_result(D_MD4, j, count, d); 1590 print_result(D_MD4, j, count, d);
1642 } 1591 }
1643 } 1592 }
@@ -1647,10 +1596,10 @@ speed_main(int argc, char **argv)
1647 if (doit[D_MD5]) { 1596 if (doit[D_MD5]) {
1648 for (j = 0; j < SIZE_NUM; j++) { 1597 for (j = 0; j < SIZE_NUM; j++) {
1649 print_message(names[D_MD5], c[D_MD5][j], lengths[j]); 1598 print_message(names[D_MD5], c[D_MD5][j], lengths[j]);
1650 Time_F(START); 1599 time_f(START);
1651 for (count = 0, run = 1; COND(c[D_MD5][j]); count++) 1600 for (count = 0, run = 1; COND(c[D_MD5][j]); count++)
1652 EVP_Digest(&(buf[0]), (unsigned long) lengths[j], &(md5[0]), NULL, EVP_get_digestbyname("md5"), NULL); 1601 EVP_Digest(&(buf[0]), (unsigned long) lengths[j], md, NULL, EVP_get_digestbyname("md5"), NULL);
1653 d = Time_F(STOP); 1602 d = time_f(STOP);
1654 print_result(D_MD5, j, count, d); 1603 print_result(D_MD5, j, count, d);
1655 } 1604 }
1656 } 1605 }
@@ -1670,7 +1619,7 @@ speed_main(int argc, char **argv)
1670 1619
1671 for (j = 0; j < SIZE_NUM; j++) { 1620 for (j = 0; j < SIZE_NUM; j++) {
1672 print_message(names[D_HMAC], c[D_HMAC][j], lengths[j]); 1621 print_message(names[D_HMAC], c[D_HMAC][j], lengths[j]);
1673 Time_F(START); 1622 time_f(START);
1674 for (count = 0, run = 1; COND(c[D_HMAC][j]); count++) { 1623 for (count = 0, run = 1; COND(c[D_HMAC][j]); count++) {
1675 if (!HMAC_Init_ex(hctx, NULL, 0, NULL, NULL)) { 1624 if (!HMAC_Init_ex(hctx, NULL, 0, NULL, NULL)) {
1676 HMAC_CTX_free(hctx); 1625 HMAC_CTX_free(hctx);
@@ -1680,12 +1629,12 @@ speed_main(int argc, char **argv)
1680 HMAC_CTX_free(hctx); 1629 HMAC_CTX_free(hctx);
1681 goto end; 1630 goto end;
1682 } 1631 }
1683 if (!HMAC_Final(hctx, &(hmac[0]), NULL)) { 1632 if (!HMAC_Final(hctx, md, NULL)) {
1684 HMAC_CTX_free(hctx); 1633 HMAC_CTX_free(hctx);
1685 goto end; 1634 goto end;
1686 } 1635 }
1687 } 1636 }
1688 d = Time_F(STOP); 1637 d = time_f(STOP);
1689 print_result(D_HMAC, j, count, d); 1638 print_result(D_HMAC, j, count, d);
1690 } 1639 }
1691 HMAC_CTX_free(hctx); 1640 HMAC_CTX_free(hctx);
@@ -1695,10 +1644,10 @@ speed_main(int argc, char **argv)
1695 if (doit[D_SHA1]) { 1644 if (doit[D_SHA1]) {
1696 for (j = 0; j < SIZE_NUM; j++) { 1645 for (j = 0; j < SIZE_NUM; j++) {
1697 print_message(names[D_SHA1], c[D_SHA1][j], lengths[j]); 1646 print_message(names[D_SHA1], c[D_SHA1][j], lengths[j]);
1698 Time_F(START); 1647 time_f(START);
1699 for (count = 0, run = 1; COND(c[D_SHA1][j]); count++) 1648 for (count = 0, run = 1; COND(c[D_SHA1][j]); count++)
1700 EVP_Digest(buf, (unsigned long) lengths[j], &(sha[0]), NULL, EVP_sha1(), NULL); 1649 EVP_Digest(buf, (unsigned long) lengths[j], md, NULL, EVP_sha1(), NULL);
1701 d = Time_F(STOP); 1650 d = time_f(STOP);
1702 print_result(D_SHA1, j, count, d); 1651 print_result(D_SHA1, j, count, d);
1703 } 1652 }
1704 } 1653 }
@@ -1706,10 +1655,10 @@ speed_main(int argc, char **argv)
1706 if (doit[D_SHA256]) { 1655 if (doit[D_SHA256]) {
1707 for (j = 0; j < SIZE_NUM; j++) { 1656 for (j = 0; j < SIZE_NUM; j++) {
1708 print_message(names[D_SHA256], c[D_SHA256][j], lengths[j]); 1657 print_message(names[D_SHA256], c[D_SHA256][j], lengths[j]);
1709 Time_F(START); 1658 time_f(START);
1710 for (count = 0, run = 1; COND(c[D_SHA256][j]); count++) 1659 for (count = 0, run = 1; COND(c[D_SHA256][j]); count++)
1711 SHA256(buf, lengths[j], sha256); 1660 SHA256(buf, lengths[j], md);
1712 d = Time_F(STOP); 1661 d = time_f(STOP);
1713 print_result(D_SHA256, j, count, d); 1662 print_result(D_SHA256, j, count, d);
1714 } 1663 }
1715 } 1664 }
@@ -1719,37 +1668,24 @@ speed_main(int argc, char **argv)
1719 if (doit[D_SHA512]) { 1668 if (doit[D_SHA512]) {
1720 for (j = 0; j < SIZE_NUM; j++) { 1669 for (j = 0; j < SIZE_NUM; j++) {
1721 print_message(names[D_SHA512], c[D_SHA512][j], lengths[j]); 1670 print_message(names[D_SHA512], c[D_SHA512][j], lengths[j]);
1722 Time_F(START); 1671 time_f(START);
1723 for (count = 0, run = 1; COND(c[D_SHA512][j]); count++) 1672 for (count = 0, run = 1; COND(c[D_SHA512][j]); count++)
1724 SHA512(buf, lengths[j], sha512); 1673 SHA512(buf, lengths[j], md);
1725 d = Time_F(STOP); 1674 d = time_f(STOP);
1726 print_result(D_SHA512, j, count, d); 1675 print_result(D_SHA512, j, count, d);
1727 } 1676 }
1728 } 1677 }
1729#endif 1678#endif
1730#endif 1679#endif
1731 1680
1732#ifndef OPENSSL_NO_WHIRLPOOL
1733 if (doit[D_WHIRLPOOL]) {
1734 for (j = 0; j < SIZE_NUM; j++) {
1735 print_message(names[D_WHIRLPOOL], c[D_WHIRLPOOL][j], lengths[j]);
1736 Time_F(START);
1737 for (count = 0, run = 1; COND(c[D_WHIRLPOOL][j]); count++)
1738 WHIRLPOOL(buf, lengths[j], whirlpool);
1739 d = Time_F(STOP);
1740 print_result(D_WHIRLPOOL, j, count, d);
1741 }
1742 }
1743#endif
1744
1745#ifndef OPENSSL_NO_RIPEMD 1681#ifndef OPENSSL_NO_RIPEMD
1746 if (doit[D_RMD160]) { 1682 if (doit[D_RMD160]) {
1747 for (j = 0; j < SIZE_NUM; j++) { 1683 for (j = 0; j < SIZE_NUM; j++) {
1748 print_message(names[D_RMD160], c[D_RMD160][j], lengths[j]); 1684 print_message(names[D_RMD160], c[D_RMD160][j], lengths[j]);
1749 Time_F(START); 1685 time_f(START);
1750 for (count = 0, run = 1; COND(c[D_RMD160][j]); count++) 1686 for (count = 0, run = 1; COND(c[D_RMD160][j]); count++)
1751 EVP_Digest(buf, (unsigned long) lengths[j], &(rmd160[0]), NULL, EVP_ripemd160(), NULL); 1687 EVP_Digest(buf, (unsigned long) lengths[j], md, NULL, EVP_ripemd160(), NULL);
1752 d = Time_F(STOP); 1688 d = time_f(STOP);
1753 print_result(D_RMD160, j, count, d); 1689 print_result(D_RMD160, j, count, d);
1754 } 1690 }
1755 } 1691 }
@@ -1758,11 +1694,11 @@ speed_main(int argc, char **argv)
1758 if (doit[D_RC4]) { 1694 if (doit[D_RC4]) {
1759 for (j = 0; j < SIZE_NUM; j++) { 1695 for (j = 0; j < SIZE_NUM; j++) {
1760 print_message(names[D_RC4], c[D_RC4][j], lengths[j]); 1696 print_message(names[D_RC4], c[D_RC4][j], lengths[j]);
1761 Time_F(START); 1697 time_f(START);
1762 for (count = 0, run = 1; COND(c[D_RC4][j]); count++) 1698 for (count = 0, run = 1; COND(c[D_RC4][j]); count++)
1763 RC4(&rc4_ks, (unsigned int) lengths[j], 1699 RC4(&rc4_ks, (unsigned int) lengths[j],
1764 buf, buf); 1700 buf, buf);
1765 d = Time_F(STOP); 1701 d = time_f(STOP);
1766 print_result(D_RC4, j, count, d); 1702 print_result(D_RC4, j, count, d);
1767 } 1703 }
1768 } 1704 }
@@ -1771,23 +1707,23 @@ speed_main(int argc, char **argv)
1771 if (doit[D_CBC_DES]) { 1707 if (doit[D_CBC_DES]) {
1772 for (j = 0; j < SIZE_NUM; j++) { 1708 for (j = 0; j < SIZE_NUM; j++) {
1773 print_message(names[D_CBC_DES], c[D_CBC_DES][j], lengths[j]); 1709 print_message(names[D_CBC_DES], c[D_CBC_DES][j], lengths[j]);
1774 Time_F(START); 1710 time_f(START);
1775 for (count = 0, run = 1; COND(c[D_CBC_DES][j]); count++) 1711 for (count = 0, run = 1; COND(c[D_CBC_DES][j]); count++)
1776 DES_ncbc_encrypt(buf, buf, lengths[j], &sch, 1712 DES_ncbc_encrypt(buf, buf, lengths[j], &sch,
1777 &DES_iv, DES_ENCRYPT); 1713 &DES_iv, DES_ENCRYPT);
1778 d = Time_F(STOP); 1714 d = time_f(STOP);
1779 print_result(D_CBC_DES, j, count, d); 1715 print_result(D_CBC_DES, j, count, d);
1780 } 1716 }
1781 } 1717 }
1782 if (doit[D_EDE3_DES]) { 1718 if (doit[D_EDE3_DES]) {
1783 for (j = 0; j < SIZE_NUM; j++) { 1719 for (j = 0; j < SIZE_NUM; j++) {
1784 print_message(names[D_EDE3_DES], c[D_EDE3_DES][j], lengths[j]); 1720 print_message(names[D_EDE3_DES], c[D_EDE3_DES][j], lengths[j]);
1785 Time_F(START); 1721 time_f(START);
1786 for (count = 0, run = 1; COND(c[D_EDE3_DES][j]); count++) 1722 for (count = 0, run = 1; COND(c[D_EDE3_DES][j]); count++)
1787 DES_ede3_cbc_encrypt(buf, buf, lengths[j], 1723 DES_ede3_cbc_encrypt(buf, buf, lengths[j],
1788 &sch, &sch2, &sch3, 1724 &sch, &sch2, &sch3,
1789 &DES_iv, DES_ENCRYPT); 1725 &DES_iv, DES_ENCRYPT);
1790 d = Time_F(STOP); 1726 d = time_f(STOP);
1791 print_result(D_EDE3_DES, j, count, d); 1727 print_result(D_EDE3_DES, j, count, d);
1792 } 1728 }
1793 } 1729 }
@@ -1796,72 +1732,72 @@ speed_main(int argc, char **argv)
1796 if (doit[D_CBC_128_AES]) { 1732 if (doit[D_CBC_128_AES]) {
1797 for (j = 0; j < SIZE_NUM; j++) { 1733 for (j = 0; j < SIZE_NUM; j++) {
1798 print_message(names[D_CBC_128_AES], c[D_CBC_128_AES][j], lengths[j]); 1734 print_message(names[D_CBC_128_AES], c[D_CBC_128_AES][j], lengths[j]);
1799 Time_F(START); 1735 time_f(START);
1800 for (count = 0, run = 1; COND(c[D_CBC_128_AES][j]); count++) 1736 for (count = 0, run = 1; COND(c[D_CBC_128_AES][j]); count++)
1801 AES_cbc_encrypt(buf, buf, 1737 AES_cbc_encrypt(buf, buf,
1802 (unsigned long) lengths[j], &aes_ks1, 1738 (unsigned long) lengths[j], &aes_ks1,
1803 iv, AES_ENCRYPT); 1739 iv, AES_ENCRYPT);
1804 d = Time_F(STOP); 1740 d = time_f(STOP);
1805 print_result(D_CBC_128_AES, j, count, d); 1741 print_result(D_CBC_128_AES, j, count, d);
1806 } 1742 }
1807 } 1743 }
1808 if (doit[D_CBC_192_AES]) { 1744 if (doit[D_CBC_192_AES]) {
1809 for (j = 0; j < SIZE_NUM; j++) { 1745 for (j = 0; j < SIZE_NUM; j++) {
1810 print_message(names[D_CBC_192_AES], c[D_CBC_192_AES][j], lengths[j]); 1746 print_message(names[D_CBC_192_AES], c[D_CBC_192_AES][j], lengths[j]);
1811 Time_F(START); 1747 time_f(START);
1812 for (count = 0, run = 1; COND(c[D_CBC_192_AES][j]); count++) 1748 for (count = 0, run = 1; COND(c[D_CBC_192_AES][j]); count++)
1813 AES_cbc_encrypt(buf, buf, 1749 AES_cbc_encrypt(buf, buf,
1814 (unsigned long) lengths[j], &aes_ks2, 1750 (unsigned long) lengths[j], &aes_ks2,
1815 iv, AES_ENCRYPT); 1751 iv, AES_ENCRYPT);
1816 d = Time_F(STOP); 1752 d = time_f(STOP);
1817 print_result(D_CBC_192_AES, j, count, d); 1753 print_result(D_CBC_192_AES, j, count, d);
1818 } 1754 }
1819 } 1755 }
1820 if (doit[D_CBC_256_AES]) { 1756 if (doit[D_CBC_256_AES]) {
1821 for (j = 0; j < SIZE_NUM; j++) { 1757 for (j = 0; j < SIZE_NUM; j++) {
1822 print_message(names[D_CBC_256_AES], c[D_CBC_256_AES][j], lengths[j]); 1758 print_message(names[D_CBC_256_AES], c[D_CBC_256_AES][j], lengths[j]);
1823 Time_F(START); 1759 time_f(START);
1824 for (count = 0, run = 1; COND(c[D_CBC_256_AES][j]); count++) 1760 for (count = 0, run = 1; COND(c[D_CBC_256_AES][j]); count++)
1825 AES_cbc_encrypt(buf, buf, 1761 AES_cbc_encrypt(buf, buf,
1826 (unsigned long) lengths[j], &aes_ks3, 1762 (unsigned long) lengths[j], &aes_ks3,
1827 iv, AES_ENCRYPT); 1763 iv, AES_ENCRYPT);
1828 d = Time_F(STOP); 1764 d = time_f(STOP);
1829 print_result(D_CBC_256_AES, j, count, d); 1765 print_result(D_CBC_256_AES, j, count, d);
1830 } 1766 }
1831 } 1767 }
1832 if (doit[D_IGE_128_AES]) { 1768 if (doit[D_IGE_128_AES]) {
1833 for (j = 0; j < SIZE_NUM; j++) { 1769 for (j = 0; j < SIZE_NUM; j++) {
1834 print_message(names[D_IGE_128_AES], c[D_IGE_128_AES][j], lengths[j]); 1770 print_message(names[D_IGE_128_AES], c[D_IGE_128_AES][j], lengths[j]);
1835 Time_F(START); 1771 time_f(START);
1836 for (count = 0, run = 1; COND(c[D_IGE_128_AES][j]); count++) 1772 for (count = 0, run = 1; COND(c[D_IGE_128_AES][j]); count++)
1837 AES_ige_encrypt(buf, buf2, 1773 AES_ige_encrypt(buf, buf2,
1838 (unsigned long) lengths[j], &aes_ks1, 1774 (unsigned long) lengths[j], &aes_ks1,
1839 iv, AES_ENCRYPT); 1775 iv, AES_ENCRYPT);
1840 d = Time_F(STOP); 1776 d = time_f(STOP);
1841 print_result(D_IGE_128_AES, j, count, d); 1777 print_result(D_IGE_128_AES, j, count, d);
1842 } 1778 }
1843 } 1779 }
1844 if (doit[D_IGE_192_AES]) { 1780 if (doit[D_IGE_192_AES]) {
1845 for (j = 0; j < SIZE_NUM; j++) { 1781 for (j = 0; j < SIZE_NUM; j++) {
1846 print_message(names[D_IGE_192_AES], c[D_IGE_192_AES][j], lengths[j]); 1782 print_message(names[D_IGE_192_AES], c[D_IGE_192_AES][j], lengths[j]);
1847 Time_F(START); 1783 time_f(START);
1848 for (count = 0, run = 1; COND(c[D_IGE_192_AES][j]); count++) 1784 for (count = 0, run = 1; COND(c[D_IGE_192_AES][j]); count++)
1849 AES_ige_encrypt(buf, buf2, 1785 AES_ige_encrypt(buf, buf2,
1850 (unsigned long) lengths[j], &aes_ks2, 1786 (unsigned long) lengths[j], &aes_ks2,
1851 iv, AES_ENCRYPT); 1787 iv, AES_ENCRYPT);
1852 d = Time_F(STOP); 1788 d = time_f(STOP);
1853 print_result(D_IGE_192_AES, j, count, d); 1789 print_result(D_IGE_192_AES, j, count, d);
1854 } 1790 }
1855 } 1791 }
1856 if (doit[D_IGE_256_AES]) { 1792 if (doit[D_IGE_256_AES]) {
1857 for (j = 0; j < SIZE_NUM; j++) { 1793 for (j = 0; j < SIZE_NUM; j++) {
1858 print_message(names[D_IGE_256_AES], c[D_IGE_256_AES][j], lengths[j]); 1794 print_message(names[D_IGE_256_AES], c[D_IGE_256_AES][j], lengths[j]);
1859 Time_F(START); 1795 time_f(START);
1860 for (count = 0, run = 1; COND(c[D_IGE_256_AES][j]); count++) 1796 for (count = 0, run = 1; COND(c[D_IGE_256_AES][j]); count++)
1861 AES_ige_encrypt(buf, buf2, 1797 AES_ige_encrypt(buf, buf2,
1862 (unsigned long) lengths[j], &aes_ks3, 1798 (unsigned long) lengths[j], &aes_ks3,
1863 iv, AES_ENCRYPT); 1799 iv, AES_ENCRYPT);
1864 d = Time_F(STOP); 1800 d = time_f(STOP);
1865 print_result(D_IGE_256_AES, j, count, d); 1801 print_result(D_IGE_256_AES, j, count, d);
1866 } 1802 }
1867 } 1803 }
@@ -1871,10 +1807,10 @@ speed_main(int argc, char **argv)
1871 1807
1872 for (j = 0; j < SIZE_NUM; j++) { 1808 for (j = 0; j < SIZE_NUM; j++) {
1873 print_message(names[D_GHASH], c[D_GHASH][j], lengths[j]); 1809 print_message(names[D_GHASH], c[D_GHASH][j], lengths[j]);
1874 Time_F(START); 1810 time_f(START);
1875 for (count = 0, run = 1; COND(c[D_GHASH][j]); count++) 1811 for (count = 0, run = 1; COND(c[D_GHASH][j]); count++)
1876 CRYPTO_gcm128_aad(ctx, buf, lengths[j]); 1812 CRYPTO_gcm128_aad(ctx, buf, lengths[j]);
1877 d = Time_F(STOP); 1813 d = time_f(STOP);
1878 print_result(D_GHASH, j, count, d); 1814 print_result(D_GHASH, j, count, d);
1879 } 1815 }
1880 CRYPTO_gcm128_release(ctx); 1816 CRYPTO_gcm128_release(ctx);
@@ -1897,11 +1833,11 @@ speed_main(int argc, char **argv)
1897 1833
1898 for (j = 0; j < SIZE_NUM; j++) { 1834 for (j = 0; j < SIZE_NUM; j++) {
1899 print_message(names[D_AES_128_GCM],c[D_AES_128_GCM][j],lengths[j]); 1835 print_message(names[D_AES_128_GCM],c[D_AES_128_GCM][j],lengths[j]);
1900 Time_F(START); 1836 time_f(START);
1901 for (count = 0, run = 1; COND(c[D_AES_128_GCM][j]); count++) 1837 for (count = 0, run = 1; COND(c[D_AES_128_GCM][j]); count++)
1902 EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce, 1838 EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce,
1903 nonce_len, buf, lengths[j], NULL, 0); 1839 nonce_len, buf, lengths[j], NULL, 0);
1904 d=Time_F(STOP); 1840 d = time_f(STOP);
1905 print_result(D_AES_128_GCM,j,count,d); 1841 print_result(D_AES_128_GCM,j,count,d);
1906 } 1842 }
1907 EVP_AEAD_CTX_free(ctx); 1843 EVP_AEAD_CTX_free(ctx);
@@ -1925,11 +1861,11 @@ speed_main(int argc, char **argv)
1925 1861
1926 for (j = 0; j < SIZE_NUM; j++) { 1862 for (j = 0; j < SIZE_NUM; j++) {
1927 print_message(names[D_AES_256_GCM],c[D_AES_256_GCM][j],lengths[j]); 1863 print_message(names[D_AES_256_GCM],c[D_AES_256_GCM][j],lengths[j]);
1928 Time_F(START); 1864 time_f(START);
1929 for (count = 0, run = 1; COND(c[D_AES_256_GCM][j]); count++) 1865 for (count = 0, run = 1; COND(c[D_AES_256_GCM][j]); count++)
1930 EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce, 1866 EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce,
1931 nonce_len, buf, lengths[j], NULL, 0); 1867 nonce_len, buf, lengths[j], NULL, 0);
1932 d=Time_F(STOP); 1868 d = time_f(STOP);
1933 print_result(D_AES_256_GCM, j, count, d); 1869 print_result(D_AES_256_GCM, j, count, d);
1934 } 1870 }
1935 EVP_AEAD_CTX_free(ctx); 1871 EVP_AEAD_CTX_free(ctx);
@@ -1955,11 +1891,11 @@ speed_main(int argc, char **argv)
1955 for (j = 0; j < SIZE_NUM; j++) { 1891 for (j = 0; j < SIZE_NUM; j++) {
1956 print_message(names[D_CHACHA20_POLY1305], 1892 print_message(names[D_CHACHA20_POLY1305],
1957 c[D_CHACHA20_POLY1305][j], lengths[j]); 1893 c[D_CHACHA20_POLY1305][j], lengths[j]);
1958 Time_F(START); 1894 time_f(START);
1959 for (count = 0, run = 1; COND(c[D_CHACHA20_POLY1305][j]); count++) 1895 for (count = 0, run = 1; COND(c[D_CHACHA20_POLY1305][j]); count++)
1960 EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce, 1896 EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce,
1961 nonce_len, buf, lengths[j], NULL, 0); 1897 nonce_len, buf, lengths[j], NULL, 0);
1962 d=Time_F(STOP); 1898 d = time_f(STOP);
1963 print_result(D_CHACHA20_POLY1305, j, count, d); 1899 print_result(D_CHACHA20_POLY1305, j, count, d);
1964 } 1900 }
1965 EVP_AEAD_CTX_free(ctx); 1901 EVP_AEAD_CTX_free(ctx);
@@ -1969,36 +1905,36 @@ speed_main(int argc, char **argv)
1969 if (doit[D_CBC_128_CML]) { 1905 if (doit[D_CBC_128_CML]) {
1970 for (j = 0; j < SIZE_NUM; j++) { 1906 for (j = 0; j < SIZE_NUM; j++) {
1971 print_message(names[D_CBC_128_CML], c[D_CBC_128_CML][j], lengths[j]); 1907 print_message(names[D_CBC_128_CML], c[D_CBC_128_CML][j], lengths[j]);
1972 Time_F(START); 1908 time_f(START);
1973 for (count = 0, run = 1; COND(c[D_CBC_128_CML][j]); count++) 1909 for (count = 0, run = 1; COND(c[D_CBC_128_CML][j]); count++)
1974 Camellia_cbc_encrypt(buf, buf, 1910 Camellia_cbc_encrypt(buf, buf,
1975 (unsigned long) lengths[j], &camellia_ks1, 1911 (unsigned long) lengths[j], &camellia_ks1,
1976 iv, CAMELLIA_ENCRYPT); 1912 iv, CAMELLIA_ENCRYPT);
1977 d = Time_F(STOP); 1913 d = time_f(STOP);
1978 print_result(D_CBC_128_CML, j, count, d); 1914 print_result(D_CBC_128_CML, j, count, d);
1979 } 1915 }
1980 } 1916 }
1981 if (doit[D_CBC_192_CML]) { 1917 if (doit[D_CBC_192_CML]) {
1982 for (j = 0; j < SIZE_NUM; j++) { 1918 for (j = 0; j < SIZE_NUM; j++) {
1983 print_message(names[D_CBC_192_CML], c[D_CBC_192_CML][j], lengths[j]); 1919 print_message(names[D_CBC_192_CML], c[D_CBC_192_CML][j], lengths[j]);
1984 Time_F(START); 1920 time_f(START);
1985 for (count = 0, run = 1; COND(c[D_CBC_192_CML][j]); count++) 1921 for (count = 0, run = 1; COND(c[D_CBC_192_CML][j]); count++)
1986 Camellia_cbc_encrypt(buf, buf, 1922 Camellia_cbc_encrypt(buf, buf,
1987 (unsigned long) lengths[j], &camellia_ks2, 1923 (unsigned long) lengths[j], &camellia_ks2,
1988 iv, CAMELLIA_ENCRYPT); 1924 iv, CAMELLIA_ENCRYPT);
1989 d = Time_F(STOP); 1925 d = time_f(STOP);
1990 print_result(D_CBC_192_CML, j, count, d); 1926 print_result(D_CBC_192_CML, j, count, d);
1991 } 1927 }
1992 } 1928 }
1993 if (doit[D_CBC_256_CML]) { 1929 if (doit[D_CBC_256_CML]) {
1994 for (j = 0; j < SIZE_NUM; j++) { 1930 for (j = 0; j < SIZE_NUM; j++) {
1995 print_message(names[D_CBC_256_CML], c[D_CBC_256_CML][j], lengths[j]); 1931 print_message(names[D_CBC_256_CML], c[D_CBC_256_CML][j], lengths[j]);
1996 Time_F(START); 1932 time_f(START);
1997 for (count = 0, run = 1; COND(c[D_CBC_256_CML][j]); count++) 1933 for (count = 0, run = 1; COND(c[D_CBC_256_CML][j]); count++)
1998 Camellia_cbc_encrypt(buf, buf, 1934 Camellia_cbc_encrypt(buf, buf,
1999 (unsigned long) lengths[j], &camellia_ks3, 1935 (unsigned long) lengths[j], &camellia_ks3,
2000 iv, CAMELLIA_ENCRYPT); 1936 iv, CAMELLIA_ENCRYPT);
2001 d = Time_F(STOP); 1937 d = time_f(STOP);
2002 print_result(D_CBC_256_CML, j, count, d); 1938 print_result(D_CBC_256_CML, j, count, d);
2003 } 1939 }
2004 } 1940 }
@@ -2007,12 +1943,12 @@ speed_main(int argc, char **argv)
2007 if (doit[D_CBC_IDEA]) { 1943 if (doit[D_CBC_IDEA]) {
2008 for (j = 0; j < SIZE_NUM; j++) { 1944 for (j = 0; j < SIZE_NUM; j++) {
2009 print_message(names[D_CBC_IDEA], c[D_CBC_IDEA][j], lengths[j]); 1945 print_message(names[D_CBC_IDEA], c[D_CBC_IDEA][j], lengths[j]);
2010 Time_F(START); 1946 time_f(START);
2011 for (count = 0, run = 1; COND(c[D_CBC_IDEA][j]); count++) 1947 for (count = 0, run = 1; COND(c[D_CBC_IDEA][j]); count++)
2012 idea_cbc_encrypt(buf, buf, 1948 idea_cbc_encrypt(buf, buf,
2013 (unsigned long) lengths[j], &idea_ks, 1949 (unsigned long) lengths[j], &idea_ks,
2014 iv, IDEA_ENCRYPT); 1950 iv, IDEA_ENCRYPT);
2015 d = Time_F(STOP); 1951 d = time_f(STOP);
2016 print_result(D_CBC_IDEA, j, count, d); 1952 print_result(D_CBC_IDEA, j, count, d);
2017 } 1953 }
2018 } 1954 }
@@ -2021,12 +1957,12 @@ speed_main(int argc, char **argv)
2021 if (doit[D_CBC_RC2]) { 1957 if (doit[D_CBC_RC2]) {
2022 for (j = 0; j < SIZE_NUM; j++) { 1958 for (j = 0; j < SIZE_NUM; j++) {
2023 print_message(names[D_CBC_RC2], c[D_CBC_RC2][j], lengths[j]); 1959 print_message(names[D_CBC_RC2], c[D_CBC_RC2][j], lengths[j]);
2024 Time_F(START); 1960 time_f(START);
2025 for (count = 0, run = 1; COND(c[D_CBC_RC2][j]); count++) 1961 for (count = 0, run = 1; COND(c[D_CBC_RC2][j]); count++)
2026 RC2_cbc_encrypt(buf, buf, 1962 RC2_cbc_encrypt(buf, buf,
2027 (unsigned long) lengths[j], &rc2_ks, 1963 (unsigned long) lengths[j], &rc2_ks,
2028 iv, RC2_ENCRYPT); 1964 iv, RC2_ENCRYPT);
2029 d = Time_F(STOP); 1965 d = time_f(STOP);
2030 print_result(D_CBC_RC2, j, count, d); 1966 print_result(D_CBC_RC2, j, count, d);
2031 } 1967 }
2032 } 1968 }
@@ -2035,12 +1971,12 @@ speed_main(int argc, char **argv)
2035 if (doit[D_CBC_BF]) { 1971 if (doit[D_CBC_BF]) {
2036 for (j = 0; j < SIZE_NUM; j++) { 1972 for (j = 0; j < SIZE_NUM; j++) {
2037 print_message(names[D_CBC_BF], c[D_CBC_BF][j], lengths[j]); 1973 print_message(names[D_CBC_BF], c[D_CBC_BF][j], lengths[j]);
2038 Time_F(START); 1974 time_f(START);
2039 for (count = 0, run = 1; COND(c[D_CBC_BF][j]); count++) 1975 for (count = 0, run = 1; COND(c[D_CBC_BF][j]); count++)
2040 BF_cbc_encrypt(buf, buf, 1976 BF_cbc_encrypt(buf, buf,
2041 (unsigned long) lengths[j], &bf_ks, 1977 (unsigned long) lengths[j], &bf_ks,
2042 iv, BF_ENCRYPT); 1978 iv, BF_ENCRYPT);
2043 d = Time_F(STOP); 1979 d = time_f(STOP);
2044 print_result(D_CBC_BF, j, count, d); 1980 print_result(D_CBC_BF, j, count, d);
2045 } 1981 }
2046 } 1982 }
@@ -2049,12 +1985,12 @@ speed_main(int argc, char **argv)
2049 if (doit[D_CBC_CAST]) { 1985 if (doit[D_CBC_CAST]) {
2050 for (j = 0; j < SIZE_NUM; j++) { 1986 for (j = 0; j < SIZE_NUM; j++) {
2051 print_message(names[D_CBC_CAST], c[D_CBC_CAST][j], lengths[j]); 1987 print_message(names[D_CBC_CAST], c[D_CBC_CAST][j], lengths[j]);
2052 Time_F(START); 1988 time_f(START);
2053 for (count = 0, run = 1; COND(c[D_CBC_CAST][j]); count++) 1989 for (count = 0, run = 1; COND(c[D_CBC_CAST][j]); count++)
2054 CAST_cbc_encrypt(buf, buf, 1990 CAST_cbc_encrypt(buf, buf,
2055 (unsigned long) lengths[j], &cast_ks, 1991 (unsigned long) lengths[j], &cast_ks,
2056 iv, CAST_ENCRYPT); 1992 iv, CAST_ENCRYPT);
2057 d = Time_F(STOP); 1993 d = time_f(STOP);
2058 print_result(D_CBC_CAST, j, count, d); 1994 print_result(D_CBC_CAST, j, count, d);
2059 } 1995 }
2060 } 1996 }
@@ -2087,7 +2023,7 @@ speed_main(int argc, char **argv)
2087 EVP_EncryptInit_ex(ctx, evp_cipher, NULL, key16, iv); 2023 EVP_EncryptInit_ex(ctx, evp_cipher, NULL, key16, iv);
2088 EVP_CIPHER_CTX_set_padding(ctx, 0); 2024 EVP_CIPHER_CTX_set_padding(ctx, 0);
2089 2025
2090 Time_F(START); 2026 time_f(START);
2091 if (decrypt) 2027 if (decrypt)
2092 for (count = 0, run = 1; COND(save_count * 4 * lengths[0] / lengths[j]); count++) 2028 for (count = 0, run = 1; COND(save_count * 4 * lengths[0] / lengths[j]); count++)
2093 EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[j]); 2029 EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[j]);
@@ -2098,7 +2034,7 @@ speed_main(int argc, char **argv)
2098 EVP_DecryptFinal_ex(ctx, buf, &outl); 2034 EVP_DecryptFinal_ex(ctx, buf, &outl);
2099 else 2035 else
2100 EVP_EncryptFinal_ex(ctx, buf, &outl); 2036 EVP_EncryptFinal_ex(ctx, buf, &outl);
2101 d = Time_F(STOP); 2037 d = time_f(STOP);
2102 EVP_CIPHER_CTX_free(ctx); 2038 EVP_CIPHER_CTX_free(ctx);
2103 } 2039 }
2104 if (evp_md) { 2040 if (evp_md) {
@@ -2106,11 +2042,11 @@ speed_main(int argc, char **argv)
2106 print_message(names[D_EVP], save_count, 2042 print_message(names[D_EVP], save_count,
2107 lengths[j]); 2043 lengths[j]);
2108 2044
2109 Time_F(START); 2045 time_f(START);
2110 for (count = 0, run = 1; COND(save_count * 4 * lengths[0] / lengths[j]); count++) 2046 for (count = 0, run = 1; COND(save_count * 4 * lengths[0] / lengths[j]); count++)
2111 EVP_Digest(buf, lengths[j], &(md[0]), NULL, evp_md, NULL); 2047 EVP_Digest(buf, lengths[j], &(md[0]), NULL, evp_md, NULL);
2112 2048
2113 d = Time_F(STOP); 2049 d = time_f(STOP);
2114 } 2050 }
2115 print_result(D_EVP, j, count, d); 2051 print_result(D_EVP, j, count, d);
2116 } 2052 }
@@ -2130,7 +2066,7 @@ speed_main(int argc, char **argv)
2130 rsa_c[j][0], rsa_bits[j], 2066 rsa_c[j][0], rsa_bits[j],
2131 RSA_SECONDS); 2067 RSA_SECONDS);
2132/* RSA_blinding_on(rsa_key[j],NULL); */ 2068/* RSA_blinding_on(rsa_key[j],NULL); */
2133 Time_F(START); 2069 time_f(START);
2134 for (count = 0, run = 1; COND(rsa_c[j][0]); count++) { 2070 for (count = 0, run = 1; COND(rsa_c[j][0]); count++) {
2135 ret = RSA_sign(NID_md5_sha1, buf, 36, buf2, 2071 ret = RSA_sign(NID_md5_sha1, buf, 36, buf2,
2136 &rsa_num, rsa_key[j]); 2072 &rsa_num, rsa_key[j]);
@@ -2142,7 +2078,7 @@ speed_main(int argc, char **argv)
2142 break; 2078 break;
2143 } 2079 }
2144 } 2080 }
2145 d = Time_F(STOP); 2081 d = time_f(STOP);
2146 BIO_printf(bio_err, mr ? "+R1:%ld:%d:%.2f\n" 2082 BIO_printf(bio_err, mr ? "+R1:%ld:%d:%.2f\n"
2147 : "%ld %d bit private RSA in %.2fs\n", 2083 : "%ld %d bit private RSA in %.2fs\n",
2148 count, rsa_bits[j], d); 2084 count, rsa_bits[j], d);
@@ -2159,7 +2095,7 @@ speed_main(int argc, char **argv)
2159 pkey_print_message("public", "rsa", 2095 pkey_print_message("public", "rsa",
2160 rsa_c[j][1], rsa_bits[j], 2096 rsa_c[j][1], rsa_bits[j],
2161 RSA_SECONDS); 2097 RSA_SECONDS);
2162 Time_F(START); 2098 time_f(START);
2163 for (count = 0, run = 1; COND(rsa_c[j][1]); count++) { 2099 for (count = 0, run = 1; COND(rsa_c[j][1]); count++) {
2164 ret = RSA_verify(NID_md5_sha1, buf, 36, buf2, 2100 ret = RSA_verify(NID_md5_sha1, buf, 36, buf2,
2165 rsa_num, rsa_key[j]); 2101 rsa_num, rsa_key[j]);
@@ -2171,7 +2107,7 @@ speed_main(int argc, char **argv)
2171 break; 2107 break;
2172 } 2108 }
2173 } 2109 }
2174 d = Time_F(STOP); 2110 d = time_f(STOP);
2175 BIO_printf(bio_err, mr ? "+R2:%ld:%d:%.2f\n" 2111 BIO_printf(bio_err, mr ? "+R2:%ld:%d:%.2f\n"
2176 : "%ld %d bit public RSA in %.2fs\n", 2112 : "%ld %d bit public RSA in %.2fs\n",
2177 count, rsa_bits[j], d); 2113 count, rsa_bits[j], d);
@@ -2204,7 +2140,7 @@ speed_main(int argc, char **argv)
2204 pkey_print_message("sign", "dsa", 2140 pkey_print_message("sign", "dsa",
2205 dsa_c[j][0], dsa_bits[j], 2141 dsa_c[j][0], dsa_bits[j],
2206 DSA_SECONDS); 2142 DSA_SECONDS);
2207 Time_F(START); 2143 time_f(START);
2208 for (count = 0, run = 1; COND(dsa_c[j][0]); count++) { 2144 for (count = 0, run = 1; COND(dsa_c[j][0]); count++) {
2209 ret = DSA_sign(EVP_PKEY_DSA, buf, 20, buf2, 2145 ret = DSA_sign(EVP_PKEY_DSA, buf, 20, buf2,
2210 &kk, dsa_key[j]); 2146 &kk, dsa_key[j]);
@@ -2216,7 +2152,7 @@ speed_main(int argc, char **argv)
2216 break; 2152 break;
2217 } 2153 }
2218 } 2154 }
2219 d = Time_F(STOP); 2155 d = time_f(STOP);
2220 BIO_printf(bio_err, mr ? "+R3:%ld:%d:%.2f\n" 2156 BIO_printf(bio_err, mr ? "+R3:%ld:%d:%.2f\n"
2221 : "%ld %d bit DSA signs in %.2fs\n", 2157 : "%ld %d bit DSA signs in %.2fs\n",
2222 count, dsa_bits[j], d); 2158 count, dsa_bits[j], d);
@@ -2234,7 +2170,7 @@ speed_main(int argc, char **argv)
2234 pkey_print_message("verify", "dsa", 2170 pkey_print_message("verify", "dsa",
2235 dsa_c[j][1], dsa_bits[j], 2171 dsa_c[j][1], dsa_bits[j],
2236 DSA_SECONDS); 2172 DSA_SECONDS);
2237 Time_F(START); 2173 time_f(START);
2238 for (count = 0, run = 1; COND(dsa_c[j][1]); count++) { 2174 for (count = 0, run = 1; COND(dsa_c[j][1]); count++) {
2239 ret = DSA_verify(EVP_PKEY_DSA, buf, 20, buf2, 2175 ret = DSA_verify(EVP_PKEY_DSA, buf, 20, buf2,
2240 kk, dsa_key[j]); 2176 kk, dsa_key[j]);
@@ -2246,7 +2182,7 @@ speed_main(int argc, char **argv)
2246 break; 2182 break;
2247 } 2183 }
2248 } 2184 }
2249 d = Time_F(STOP); 2185 d = time_f(STOP);
2250 BIO_printf(bio_err, mr ? "+R4:%ld:%d:%.2f\n" 2186 BIO_printf(bio_err, mr ? "+R4:%ld:%d:%.2f\n"
2251 : "%ld %d bit DSA verify in %.2fs\n", 2187 : "%ld %d bit DSA verify in %.2fs\n",
2252 count, dsa_bits[j], d); 2188 count, dsa_bits[j], d);
@@ -2287,7 +2223,7 @@ speed_main(int argc, char **argv)
2287 test_curves_bits[j], 2223 test_curves_bits[j],
2288 ECDSA_SECONDS); 2224 ECDSA_SECONDS);
2289 2225
2290 Time_F(START); 2226 time_f(START);
2291 for (count = 0, run = 1; COND(ecdsa_c[j][0]); 2227 for (count = 0, run = 1; COND(ecdsa_c[j][0]);
2292 count++) { 2228 count++) {
2293 ret = ECDSA_sign(0, buf, 20, 2229 ret = ECDSA_sign(0, buf, 20,
@@ -2300,7 +2236,7 @@ speed_main(int argc, char **argv)
2300 break; 2236 break;
2301 } 2237 }
2302 } 2238 }
2303 d = Time_F(STOP); 2239 d = time_f(STOP);
2304 2240
2305 BIO_printf(bio_err, mr ? "+R5:%ld:%d:%.2f\n" : 2241 BIO_printf(bio_err, mr ? "+R5:%ld:%d:%.2f\n" :
2306 "%ld %d bit ECDSA signs in %.2fs \n", 2242 "%ld %d bit ECDSA signs in %.2fs \n",
@@ -2321,7 +2257,7 @@ speed_main(int argc, char **argv)
2321 ecdsa_c[j][1], 2257 ecdsa_c[j][1],
2322 test_curves_bits[j], 2258 test_curves_bits[j],
2323 ECDSA_SECONDS); 2259 ECDSA_SECONDS);
2324 Time_F(START); 2260 time_f(START);
2325 for (count = 0, run = 1; COND(ecdsa_c[j][1]); count++) { 2261 for (count = 0, run = 1; COND(ecdsa_c[j][1]); count++) {
2326 ret = ECDSA_verify(0, buf, 20, ecdsasig, ecdsasiglen, ecdsa[j]); 2262 ret = ECDSA_verify(0, buf, 20, ecdsasig, ecdsasiglen, ecdsa[j]);
2327 if (ret != 1) { 2263 if (ret != 1) {
@@ -2331,7 +2267,7 @@ speed_main(int argc, char **argv)
2331 break; 2267 break;
2332 } 2268 }
2333 } 2269 }
2334 d = Time_F(STOP); 2270 d = time_f(STOP);
2335 BIO_printf(bio_err, mr ? "+R6:%ld:%d:%.2f\n" 2271 BIO_printf(bio_err, mr ? "+R6:%ld:%d:%.2f\n"
2336 : "%ld %d bit ECDSA verify in %.2fs\n", 2272 : "%ld %d bit ECDSA verify in %.2fs\n",
2337 count, test_curves_bits[j], d); 2273 count, test_curves_bits[j], d);
@@ -2408,7 +2344,7 @@ speed_main(int argc, char **argv)
2408 ecdh_c[j][0], 2344 ecdh_c[j][0],
2409 test_curves_bits[j], 2345 test_curves_bits[j],
2410 ECDH_SECONDS); 2346 ECDH_SECONDS);
2411 Time_F(START); 2347 time_f(START);
2412 for (count = 0, run = 1; 2348 for (count = 0, run = 1;
2413 COND(ecdh_c[j][0]); count++) { 2349 COND(ecdh_c[j][0]); count++) {
2414 ECDH_compute_key(secret_a, 2350 ECDH_compute_key(secret_a,
@@ -2416,7 +2352,7 @@ speed_main(int argc, char **argv)
2416 EC_KEY_get0_public_key(ecdh_b[j]), 2352 EC_KEY_get0_public_key(ecdh_b[j]),
2417 ecdh_a[j], kdf); 2353 ecdh_a[j], kdf);
2418 } 2354 }
2419 d = Time_F(STOP); 2355 d = time_f(STOP);
2420 BIO_printf(bio_err, mr 2356 BIO_printf(bio_err, mr
2421 ? "+R7:%ld:%d:%.2f\n" 2357 ? "+R7:%ld:%d:%.2f\n"
2422 : "%ld %d-bit ECDH ops in %.2fs\n", 2358 : "%ld %d-bit ECDH ops in %.2fs\n",