mirror of
https://github.com/openssl/openssl.git
synced 2025-04-06 20:20:50 +08:00
Return bignum '0' when BN_rand is asked for a 0 bit random number.
This commit is contained in:
parent
3f2599d97d
commit
904cb691f3
@ -68,6 +68,12 @@ static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)
|
||||
int ret=0,bit,bytes,mask;
|
||||
time_t tim;
|
||||
|
||||
if (bits == 0)
|
||||
{
|
||||
BN_zero(rnd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
bytes=(bits+7)/8;
|
||||
bit=(bits-1)%8;
|
||||
mask=0xff<<bit;
|
||||
|
Loading…
x
Reference in New Issue
Block a user