aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorLutz Jänicke <jaenicke@openssl.org>2007-03-02 17:54:51 +0000
committerLutz Jänicke <jaenicke@openssl.org>2007-03-02 17:54:51 +0000
commit1fcfa2222217cfee882e2771411fbfc4cdb348bc (patch)
treeb0401d1c3bfcb5e2baa47b39f96919d9d48d4560 /crypto
parentc9fb4e2c8d2eabe732e1d1aabd9706d55980a4a4 (diff)
downloadopenssl-1fcfa2222217cfee882e2771411fbfc4cdb348bc.tar.gz
Initialize "buf" to 0 to make valgrind happy :-)
Note: the RAND_bytes() manual page says: RAND_bytes() puts num cryptographically strong pseudo-random bytes into buf. It does not talk about using the previous contents of buf so we are working as documented.
Diffstat (limited to 'crypto')
-rw-r--r--crypto/rand/rand_lib.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/crypto/rand/rand_lib.c b/crypto/rand/rand_lib.c
index 513e338985..adfec83b7b 100644
--- a/crypto/rand/rand_lib.c
+++ b/crypto/rand/rand_lib.c
@@ -154,6 +154,7 @@ void RAND_add(const void *buf, int num, double entropy)
int RAND_bytes(unsigned char *buf, int num)
{
const RAND_METHOD *meth = RAND_get_rand_method();
+ memset(buf, 0, num);
if (meth && meth->bytes)
return meth->bytes(buf,num);
return(-1);
@@ -162,6 +163,7 @@ int RAND_bytes(unsigned char *buf, int num)
int RAND_pseudo_bytes(unsigned char *buf, int num)
{
const RAND_METHOD *meth = RAND_get_rand_method();
+ memset(buf, 0, num);
if (meth && meth->pseudorand)
return meth->pseudorand(buf,num);
return(-1);