mirror of
https://github.com/openssl/openssl.git
synced 2024-11-28 12:35:22 +08:00
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.
This commit is contained in:
parent
c9fb4e2c8d
commit
1fcfa22222
@ -154,6 +154,7 @@ void RAND_add(const void *buf, int num, double entropy)
|
|||||||
int RAND_bytes(unsigned char *buf, int num)
|
int RAND_bytes(unsigned char *buf, int num)
|
||||||
{
|
{
|
||||||
const RAND_METHOD *meth = RAND_get_rand_method();
|
const RAND_METHOD *meth = RAND_get_rand_method();
|
||||||
|
memset(buf, 0, num);
|
||||||
if (meth && meth->bytes)
|
if (meth && meth->bytes)
|
||||||
return meth->bytes(buf,num);
|
return meth->bytes(buf,num);
|
||||||
return(-1);
|
return(-1);
|
||||||
@ -162,6 +163,7 @@ int RAND_bytes(unsigned char *buf, int num)
|
|||||||
int RAND_pseudo_bytes(unsigned char *buf, int num)
|
int RAND_pseudo_bytes(unsigned char *buf, int num)
|
||||||
{
|
{
|
||||||
const RAND_METHOD *meth = RAND_get_rand_method();
|
const RAND_METHOD *meth = RAND_get_rand_method();
|
||||||
|
memset(buf, 0, num);
|
||||||
if (meth && meth->pseudorand)
|
if (meth && meth->pseudorand)
|
||||||
return meth->pseudorand(buf,num);
|
return meth->pseudorand(buf,num);
|
||||||
return(-1);
|
return(-1);
|
||||||
|
Loading…
Reference in New Issue
Block a user