summaryrefslogtreecommitdiff
path: root/usr.bin/openssl
diff options
context:
space:
mode:
authorDoug Hogan <doug@cvs.openbsd.org>2015-07-20 21:55:14 +0000
committerDoug Hogan <doug@cvs.openbsd.org>2015-07-20 21:55:14 +0000
commite3c2554ddaaa11731e2a46ff882565fdd53c04ef (patch)
tree31da5f97844270922769e71f92d0bf58d7cf7086 /usr.bin/openssl
parent16f02053dccd79c4405a6e2a56e61d96234b18f2 (diff)
Don't try to run ECDH if ecdh_checks fails in openssl(1) speed.
Coverity 72744 noticed that rsa_count was overwitten. The underlying issue is that this code is supposed to be in an else block. ok bcook@
Diffstat (limited to 'usr.bin/openssl')
-rw-r--r--usr.bin/openssl/speed.c40
1 files changed, 23 insertions, 17 deletions
diff --git a/usr.bin/openssl/speed.c b/usr.bin/openssl/speed.c
index bf5f946375d..d637eecd49f 100644
--- a/usr.bin/openssl/speed.c
+++ b/usr.bin/openssl/speed.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: speed.c,v 1.7 2015/07/03 21:45:10 miod Exp $ */
+/* $OpenBSD: speed.c,v 1.8 2015/07/20 21:55:13 doug Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -1707,25 +1707,31 @@ speed_main(int argc, char **argv)
}
if (ecdh_checks == 0) {
- BIO_printf(bio_err, "ECDH computations don't match.\n");
+ BIO_printf(bio_err,
+ "ECDH computations don't match.\n");
ERR_print_errors(bio_err);
rsa_count = 1;
+ } else {
+ pkey_print_message("", "ecdh",
+ ecdh_c[j][0],
+ test_curves_bits[j],
+ ECDH_SECONDS);
+ Time_F(START);
+ for (count = 0, run = 1;
+ COND(ecdh_c[j][0]); count++) {
+ ECDH_compute_key(secret_a,
+ outlen,
+ EC_KEY_get0_public_key(ecdh_b[j]),
+ ecdh_a[j], kdf);
+ }
+ d = Time_F(STOP);
+ BIO_printf(bio_err, mr
+ ? "+R7:%ld:%d:%.2f\n"
+ : "%ld %d-bit ECDH ops in %.2fs\n",
+ count, test_curves_bits[j], d);
+ ecdh_results[j][0] = d / (double) count;
+ rsa_count = count;
}
- pkey_print_message("", "ecdh",
- ecdh_c[j][0],
- test_curves_bits[j],
- ECDH_SECONDS);
- Time_F(START);
- for (count = 0, run = 1; COND(ecdh_c[j][0]); count++) {
- ECDH_compute_key(secret_a, outlen,
- EC_KEY_get0_public_key(ecdh_b[j]),
- ecdh_a[j], kdf);
- }
- d = Time_F(STOP);
- BIO_printf(bio_err, mr ? "+R7:%ld:%d:%.2f\n" : "%ld %d-bit ECDH ops in %.2fs\n",
- count, test_curves_bits[j], d);
- ecdh_results[j][0] = d / (double) count;
- rsa_count = count;
}
}