summaryrefslogtreecommitdiffstats
path: root/apps/speed.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2016-06-18 15:46:13 +0100
committerDr. Stephen Henson <steve@openssl.org>2016-07-15 14:09:05 +0100
commitd166ed8c11e10e9fdaeac182effb9dd318843924 (patch)
treefd47ffb1f5d42b121b04d14c1a8f6bdc659637f6 /apps/speed.c
parent1fc431ba57d12189a9bdacd3999ea2a7b91458d8 (diff)
check return values for EVP_Digest*() APIs
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'apps/speed.c')
-rw-r--r--apps/speed.c43
1 files changed, 28 insertions, 15 deletions
diff --git a/apps/speed.c b/apps/speed.c
index 3b162e1058..f5f3b8cb51 100644
--- a/apps/speed.c
+++ b/apps/speed.c
@@ -601,9 +601,11 @@ static int EVP_Digest_MD2_loop(void *args)
unsigned char *buf = tempargs->buf;
unsigned char md2[MD2_DIGEST_LENGTH];
int count;
- for (count = 0; COND(c[D_MD2][testnum]); count++)
- EVP_Digest(buf, (unsigned long)lengths[testnum], &(md2[0]), NULL,
- EVP_md2(), NULL);
+ for (count = 0; COND(c[D_MD2][testnum]); count++) {
+ if (!EVP_Digest(buf, (unsigned long)lengths[testnum], &(md2[0]), NULL,
+ EVP_md2(), NULL))
+ return -1;
+ }
return count;
}
#endif
@@ -615,9 +617,11 @@ static int EVP_Digest_MDC2_loop(void *args)
unsigned char *buf = tempargs->buf;
unsigned char mdc2[MDC2_DIGEST_LENGTH];
int count;
- for (count = 0; COND(c[D_MDC2][testnum]); count++)
- EVP_Digest(buf, (unsigned long)lengths[testnum], &(mdc2[0]), NULL,
- EVP_mdc2(), NULL);
+ for (count = 0; COND(c[D_MDC2][testnum]); count++) {
+ if (!EVP_Digest(buf, (unsigned long)lengths[testnum], &(mdc2[0]), NULL,
+ EVP_mdc2(), NULL))
+ return -1;
+ }
return count;
}
#endif
@@ -629,9 +633,11 @@ static int EVP_Digest_MD4_loop(void *args)
unsigned char *buf = tempargs->buf;
unsigned char md4[MD4_DIGEST_LENGTH];
int count;
- for (count = 0; COND(c[D_MD4][testnum]); count++)
- EVP_Digest(&(buf[0]), (unsigned long)lengths[testnum], &(md4[0]),
- NULL, EVP_md4(), NULL);
+ for (count = 0; COND(c[D_MD4][testnum]); count++) {
+ if (!EVP_Digest(&(buf[0]), (unsigned long)lengths[testnum], &(md4[0]),
+ NULL, EVP_md4(), NULL))
+ return -1;
+ }
return count;
}
#endif
@@ -717,9 +723,11 @@ static int EVP_Digest_RMD160_loop(void *args)
unsigned char *buf = tempargs->buf;
unsigned char rmd160[RIPEMD160_DIGEST_LENGTH];
int count;
- for (count = 0; COND(c[D_RMD160][testnum]); count++)
- EVP_Digest(buf, (unsigned long)lengths[testnum], &(rmd160[0]), NULL,
- EVP_ripemd160(), NULL);
+ for (count = 0; COND(c[D_RMD160][testnum]); count++) {
+ if (!EVP_Digest(buf, (unsigned long)lengths[testnum], &(rmd160[0]),
+ NULL, EVP_ripemd160(), NULL))
+ return -1;
+ }
return count;
}
#endif
@@ -888,9 +896,10 @@ static int EVP_Digest_loop(void *args)
unsigned char md[EVP_MAX_MD_SIZE];
int count;
for (count = 0;
- COND(save_count * 4 * lengths[0] / lengths[testnum]); count++)
- EVP_Digest(buf, lengths[testnum], &(md[0]), NULL, evp_md, NULL);
-
+ COND(save_count * 4 * lengths[0] / lengths[testnum]); count++) {
+ if (!EVP_Digest(buf, lengths[testnum], &(md[0]), NULL, evp_md, NULL))
+ return -1;
+ }
return count;
}
@@ -2845,6 +2854,10 @@ static void pkey_print_message(const char *str, const char *str2, long num,
static void print_result(int alg, int run_no, int count, double time_used)
{
+ if (count == -1) {
+ BIO_puts(bio_err, "EVP error!\n");
+ exit(1);
+ }
BIO_printf(bio_err,
mr ? "+R:%d:%s:%f\n"
: "%d %s's in %.2fs\n", count, names[alg], time_used);