From: Richard Levitte Date: Tue, 12 Sep 2000 08:12:52 +0000 (+0000) Subject: Better error checking for RSA and DSA signature and verification speed X-Git-Tag: OpenSSL-engine-0_9_6-beta2~11^2~18 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=03ea28c985bdc8f1a9747fe9fe4a5faf4927e5a8;p=oweals%2Fopenssl.git Better error checking for RSA and DSA signature and verification speed tests. This was required to not get mysterious errors when they wouldn't quite want to work. --- diff --git a/apps/speed.c b/apps/speed.c index c468e33721..899ad02c39 100644 --- a/apps/speed.c +++ b/apps/speed.c @@ -1133,49 +1133,73 @@ int MAIN(int argc, char **argv) int ret; if (!rsa_doit[j]) continue; ret=RSA_sign(NID_md5_sha1, buf,36, buf2, &rsa_num, rsa_key[j]); - pkey_print_message("private","rsa",rsa_c[j][0],rsa_bits[j], - RSA_SECONDS); -/* RSA_blinding_on(rsa_key[j],NULL); */ - Time_F(START,usertime); - for (count=0,run=1; COND(rsa_c[j][0]); count++) + if (ret == 0) + { + BIO_printf(bio_err,"RSA sign failure. No RSA sign will be done.\n"); + ERR_print_errors(bio_err); + rsa_count=1; + } + else { - ret=RSA_sign(NID_md5_sha1, buf,36, buf2, &rsa_num, - rsa_key[j]); - if (ret <= 0) + pkey_print_message("private","rsa", + rsa_c[j][0],rsa_bits[j], + RSA_SECONDS); +/* RSA_blinding_on(rsa_key[j],NULL); */ + Time_F(START,usertime); + for (count=0,run=1; COND(rsa_c[j][0]); count++) { - BIO_printf(bio_err,"RSA private encrypt failure\n"); - ERR_print_errors(bio_err); - count=1; - break; + ret=RSA_sign(NID_md5_sha1, buf,36, buf2, + &rsa_num, rsa_key[j]); + if (ret == 0) + { + BIO_printf(bio_err, + "RSA sign failure\n"); + ERR_print_errors(bio_err); + count=1; + break; + } } + d=Time_F(STOP,usertime); + BIO_printf(bio_err, + "%ld %d bit private RSA's in %.2fs\n", + count,rsa_bits[j],d); + rsa_results[j][0]=d/(double)count; + rsa_count=count; } - d=Time_F(STOP,usertime); - BIO_printf(bio_err,"%ld %d bit private RSA's in %.2fs\n", - count,rsa_bits[j],d); - rsa_results[j][0]=d/(double)count; - rsa_count=count; #if 1 ret=RSA_verify(NID_md5_sha1, buf,36, buf2, rsa_num, rsa_key[j]); - pkey_print_message("public","rsa",rsa_c[j][1],rsa_bits[j], - RSA_SECONDS); - Time_F(START,usertime); - for (count=0,run=1; COND(rsa_c[j][1]); count++) + if (ret <= 0) { - ret=RSA_verify(NID_md5_sha1, buf,36, buf2, rsa_num, - rsa_key[j]); - if (ret <= 0) + BIO_printf(bio_err,"RSA verify failure. No RSA verify will be done.\n"); + ERR_print_errors(bio_err); + dsa_doit[j] = 0; + } + else + { + pkey_print_message("public","rsa", + rsa_c[j][1],rsa_bits[j], + RSA_SECONDS); + Time_F(START,usertime); + for (count=0,run=1; COND(rsa_c[j][1]); count++) { - BIO_printf(bio_err,"RSA verify failure\n"); - ERR_print_errors(bio_err); - count=1; - break; + ret=RSA_verify(NID_md5_sha1, buf,36, buf2, + rsa_num, rsa_key[j]); + if (ret == 0) + { + BIO_printf(bio_err, + "RSA verify failure\n"); + ERR_print_errors(bio_err); + count=1; + break; + } } + d=Time_F(STOP,usertime); + BIO_printf(bio_err, + "%ld %d bit public RSA's in %.2fs\n", + count,rsa_bits[j],d); + rsa_results[j][1]=d/(double)count; } - d=Time_F(STOP,usertime); - BIO_printf(bio_err,"%ld %d bit public RSA's in %.2fs\n", - count,rsa_bits[j],d); - rsa_results[j][1]=d/(double)count; #endif if (rsa_count <= 1) @@ -1197,54 +1221,77 @@ int MAIN(int argc, char **argv) for (j=0; j