summaryrefslogtreecommitdiffstats
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:02:34 +0100
commit05200ee5c61ecd38cdcacf9c547b0c3877e8cfef (patch)
treebd2cd4dfc1dc820e0287a289867cc49c8ac38cc7 /apps/passwd.c
parent3681a4558c13198944e6f7f149c4be188e076e14 (diff)
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++)