Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/openssl/openssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
author捷成吴 <jasonwood2031@gmail.com>2018-06-24 10:28:33 +0300
committerDr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>2018-06-24 21:26:37 +0300
commit3445872e22735ff864d6b363d2d2b8acde740912 (patch)
treea0662cf2f6e51b54cc06632547247187e5e3d6be /apps
parentdc6c374bdb4872f6d5d727e73a2ed834e972842c (diff)
apps/speed.c: add missing checks for RAND_bytes()
Function RAND_bytes() may return 0 or -1 on error, simply goto end label when it fails. Fixes #6567 Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/6582)
Diffstat (limited to 'apps')
-rw-r--r--apps/speed.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/apps/speed.c b/apps/speed.c
index 768e3a1ad3..181873cca3 100644
--- a/apps/speed.c
+++ b/apps/speed.c
@@ -2557,7 +2557,8 @@ int speed_main(int argc, char **argv)
}
for (i = 0; i < loopargs_len; i++)
- RAND_bytes(loopargs[i].buf, 36);
+ if (RAND_bytes(loopargs[i].buf, 36) <= 0)
+ goto end;
#ifndef OPENSSL_NO_RSA
for (testnum = 0; testnum < RSA_NUM; testnum++) {
@@ -2653,7 +2654,8 @@ int speed_main(int argc, char **argv)
#endif /* OPENSSL_NO_RSA */
for (i = 0; i < loopargs_len; i++)
- RAND_bytes(loopargs[i].buf, 36);
+ if (RAND_bytes(loopargs[i].buf, 36) <= 0)
+ goto end;
#ifndef OPENSSL_NO_DSA
for (testnum = 0; testnum < DSA_NUM; testnum++) {