Check rng return value when generating nonces in libpts
This commit is contained in:
committed by
Martin Willi
parent
10b6ca5fb2
commit
cfd824ccde
@@ -226,9 +226,13 @@ METHOD(pts_t, create_dh_nonce, bool,
|
||||
DBG2(DBG_PTS, "nonce length is %d", nonce_len);
|
||||
nonce = this->is_imc ? &this->responder_nonce : &this->initiator_nonce;
|
||||
chunk_free(nonce);
|
||||
rng->allocate_bytes(rng, nonce_len, nonce);
|
||||
if (!rng->allocate_bytes(rng, nonce_len, nonce))
|
||||
{
|
||||
DBG1(DBG_PTS, "failed to allocate nonce");
|
||||
rng->destroy(rng);
|
||||
return FALSE;
|
||||
}
|
||||
rng->destroy(rng);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user