aboutsummaryrefslogtreecommitdiffstats
path: root/apps/passwd.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-04-25 17:06:56 +0100
committerMatt Caswell <matt@openssl.org>2016-06-27 15:00:08 +0100
commitad64a69e02f7dda422d0f4f53dce7b1278715380 (patch)
tree5c76fd6da6b731a05cbd8559db71e8c821b44f36 /apps/passwd.c
parentf3dbce6634dee43dcb0243544db05e101104fe6b (diff)
downloadopenssl-ad64a69e02f7dda422d0f4f53dce7b1278715380.tar.gz
Change usage of RAND_pseudo_bytes to RAND_bytes
RAND_pseudo_bytes() allows random data to be returned even in low entropy conditions. Sometimes this is ok. Many times it is not. For the avoidance of any doubt, replace existing usage of RAND_pseudo_bytes() with RAND_bytes(). Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'apps/passwd.c')
-rw-r--r--apps/passwd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/apps/passwd.c b/apps/passwd.c
index 5ff53b5743..798a6d5936 100644
--- a/apps/passwd.c
+++ b/apps/passwd.c
@@ -416,7 +416,7 @@ static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p,
if (*salt_malloc_p == NULL)
goto err;
}
- if (RAND_pseudo_bytes((unsigned char *)*salt_p, 2) < 0)
+ if (RAND_bytes((unsigned char *)*salt_p, 2) <= 0)
goto err;
(*salt_p)[0] = cov_2char[(*salt_p)[0] & 0x3f]; /* 6 bits */
(*salt_p)[1] = cov_2char[(*salt_p)[1] & 0x3f]; /* 6 bits */
@@ -437,7 +437,7 @@ static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p,
if (*salt_malloc_p == NULL)
goto err;
}
- if (RAND_pseudo_bytes((unsigned char *)*salt_p, 8) < 0)
+ if (RAND_bytes((unsigned char *)*salt_p, 8) <= 0)
goto err;
for (i = 0; i < 8; i++)