diff options
author | Tobias Brunner <tobias@strongswan.org> | 2012-07-06 10:02:41 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2012-07-16 14:53:36 +0200 |
commit | 18ce1bb721c421ff52abed5a5d850f3ce2551fed (patch) | |
tree | e827aedeaf9d088d1eae3708466056b9b58a95f9 /src | |
parent | cfd824ccdefe1851ef5d1c6c209b3e81e0bb24fc (diff) | |
download | strongswan-18ce1bb721c421ff52abed5a5d850f3ce2551fed.tar.bz2 strongswan-18ce1bb721c421ff52abed5a5d850f3ce2551fed.tar.xz |
Check rng return value when generating nonces in eap-sim plugin
Diffstat (limited to 'src')
-rw-r--r-- | src/libcharon/plugins/eap_sim/eap_sim_peer.c | 5 | ||||
-rw-r--r-- | src/libcharon/plugins/eap_sim/eap_sim_server.c | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/libcharon/plugins/eap_sim/eap_sim_peer.c b/src/libcharon/plugins/eap_sim/eap_sim_peer.c index 479fb95fc..ff96e9279 100644 --- a/src/libcharon/plugins/eap_sim/eap_sim_peer.c +++ b/src/libcharon/plugins/eap_sim/eap_sim_peer.c @@ -242,7 +242,10 @@ static status_t process_start(private_eap_sim_peer_t *this, /* generate AT_NONCE_MT value */ rng = this->crypto->get_rng(this->crypto); 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, SIM_START, this->crypto); diff --git a/src/libcharon/plugins/eap_sim/eap_sim_server.c b/src/libcharon/plugins/eap_sim/eap_sim_server.c index fd4f4c02b..334e2df1d 100644 --- a/src/libcharon/plugins/eap_sim/eap_sim_server.c +++ b/src/libcharon/plugins/eap_sim/eap_sim_server.c @@ -174,7 +174,10 @@ static status_t reauthenticate(private_eap_sim_server_t *this, DBG1(DBG_IKE, "initiating EAP-SIM reauthentication"); 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); counter = htons(counter); |