Check rng return value when generating nonces in eap-sim plugin
This commit is contained in:
committed by
Martin Willi
parent
cfd824ccde
commit
18ce1bb721
@@ -242,7 +242,10 @@ static status_t process_start(private_eap_sim_peer_t *this,
|
|||||||
/* generate AT_NONCE_MT value */
|
/* generate AT_NONCE_MT value */
|
||||||
rng = this->crypto->get_rng(this->crypto);
|
rng = this->crypto->get_rng(this->crypto);
|
||||||
free(this->nonce.ptr);
|
free(this->nonce.ptr);
|
||||||
rng->allocate_bytes(rng, NONCE_LEN, &this->nonce);
|
if (!rng->allocate_bytes(rng, NONCE_LEN, &this->nonce))
|
||||||
|
{
|
||||||
|
return FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
message = simaka_message_create(FALSE, this->identifier, EAP_SIM,
|
message = simaka_message_create(FALSE, this->identifier, EAP_SIM,
|
||||||
SIM_START, this->crypto);
|
SIM_START, this->crypto);
|
||||||
|
|||||||
@@ -174,7 +174,10 @@ static status_t reauthenticate(private_eap_sim_server_t *this,
|
|||||||
DBG1(DBG_IKE, "initiating EAP-SIM reauthentication");
|
DBG1(DBG_IKE, "initiating EAP-SIM reauthentication");
|
||||||
|
|
||||||
rng = this->crypto->get_rng(this->crypto);
|
rng = this->crypto->get_rng(this->crypto);
|
||||||
rng->allocate_bytes(rng, NONCE_LEN, &this->nonce);
|
if (!rng->allocate_bytes(rng, NONCE_LEN, &this->nonce))
|
||||||
|
{
|
||||||
|
return FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
mkc = chunk_create(mk, HASH_SIZE_SHA1);
|
mkc = chunk_create(mk, HASH_SIZE_SHA1);
|
||||||
counter = htons(counter);
|
counter = htons(counter);
|
||||||
|
|||||||
Reference in New Issue
Block a user