Precautions against using the PRNG uninitialized: RAND_bytes() now
returns int (1 = ok, 0 = not seeded). New function RAND_add() is the same as RAND_seed() but takes an estimate of the entropy as an additional argument.
This commit is contained in:
@@ -89,9 +89,16 @@ void RAND_seed(const void *buf, int num)
|
||||
rand_meth->seed(buf,num);
|
||||
}
|
||||
|
||||
void RAND_bytes(unsigned char *buf, int num)
|
||||
void RAND_add(const void *buf, int num, int entropy)
|
||||
{
|
||||
if (rand_meth != NULL)
|
||||
rand_meth->bytes(buf,num);
|
||||
rand_meth->add(buf,num,entropy);
|
||||
}
|
||||
|
||||
int RAND_bytes(unsigned char *buf, int num)
|
||||
{
|
||||
if (rand_meth != NULL)
|
||||
return rand_meth->bytes(buf,num);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user