Check rng return value when generating DH secrets and primes in gmp plugin
This commit is contained in:
committed by
Martin Willi
parent
e93bb353d5
commit
5025135f70
@@ -149,7 +149,12 @@ static status_t compute_prime(private_gmp_rsa_private_key_t *this,
|
||||
mpz_init(*prime);
|
||||
do
|
||||
{
|
||||
rng->allocate_bytes(rng, prime_size, &random_bytes);
|
||||
if (!rng->allocate_bytes(rng, prime_size, &random_bytes))
|
||||
{
|
||||
DBG1(DBG_LIB, "failed to allocate random prime");
|
||||
rng->destroy(rng);
|
||||
return FAILED;
|
||||
}
|
||||
/* make sure the two most significant bits are set */
|
||||
random_bytes.ptr[0] = random_bytes.ptr[0] | 0xC0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user