Check rng return value when generating pseudonym in eap-simaka-pseudonym plugin
This commit is contained in:
committed by
Martin Willi
parent
8beeb8e116
commit
e37f9ac2c9
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include "eap_simaka_pseudonym_provider.h"
|
#include "eap_simaka_pseudonym_provider.h"
|
||||||
|
|
||||||
|
#include <debug.h>
|
||||||
#include <utils/hashtable.h>
|
#include <utils/hashtable.h>
|
||||||
|
|
||||||
typedef struct private_eap_simaka_pseudonym_provider_t private_eap_simaka_pseudonym_provider_t;
|
typedef struct private_eap_simaka_pseudonym_provider_t private_eap_simaka_pseudonym_provider_t;
|
||||||
@@ -82,7 +83,10 @@ static identification_t *gen_identity(
|
|||||||
{
|
{
|
||||||
char buf[8], hex[sizeof(buf) * 2 + 1];
|
char buf[8], hex[sizeof(buf) * 2 + 1];
|
||||||
|
|
||||||
this->rng->get_bytes(this->rng, sizeof(buf), buf);
|
if (!this->rng->get_bytes(this->rng, sizeof(buf), buf))
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
chunk_to_hex(chunk_create(buf, sizeof(buf)), hex, FALSE);
|
chunk_to_hex(chunk_create(buf, sizeof(buf)), hex, FALSE);
|
||||||
|
|
||||||
return identification_create_from_string(hex);
|
return identification_create_from_string(hex);
|
||||||
@@ -106,6 +110,11 @@ METHOD(simaka_provider_t, gen_pseudonym, identification_t*,
|
|||||||
}
|
}
|
||||||
|
|
||||||
pseudonym = gen_identity(this);
|
pseudonym = gen_identity(this);
|
||||||
|
if (!pseudonym)
|
||||||
|
{
|
||||||
|
DBG1(DBG_CFG, "failed to generate pseudonym");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* create new entries */
|
/* create new entries */
|
||||||
id = id->clone(id);
|
id = id->clone(id);
|
||||||
|
|||||||
Reference in New Issue
Block a user