Migrated eap_simaka_reauth_provider_t to INIT/METHOD macros.
This commit is contained in:
parent
fcf37d30c8
commit
ecdbab8a20
|
@ -87,12 +87,9 @@ static identification_t *gen_identity(private_eap_simaka_reauth_provider_t *this
|
|||
return identification_create_from_string(hex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of simaka_provider_t.is_reauth
|
||||
*/
|
||||
static identification_t *is_reauth(private_eap_simaka_reauth_provider_t *this,
|
||||
identification_t *id, char mk[HASH_SIZE_SHA1],
|
||||
u_int16_t *counter)
|
||||
METHOD(simaka_provider_t, is_reauth, identification_t*,
|
||||
private_eap_simaka_reauth_provider_t *this, identification_t *id,
|
||||
char mk[HASH_SIZE_SHA1], u_int16_t *counter)
|
||||
{
|
||||
identification_t *permanent;
|
||||
reauth_data_t *data;
|
||||
|
@ -114,11 +111,9 @@ static identification_t *is_reauth(private_eap_simaka_reauth_provider_t *this,
|
|||
return permanent->clone(permanent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of simaka_provider_t.gen_reauth
|
||||
*/
|
||||
static identification_t *gen_reauth(private_eap_simaka_reauth_provider_t *this,
|
||||
identification_t *id, char mk[HASH_SIZE_SHA1])
|
||||
METHOD(simaka_provider_t, gen_reauth, identification_t*,
|
||||
private_eap_simaka_reauth_provider_t *this, identification_t *id,
|
||||
char mk[HASH_SIZE_SHA1])
|
||||
{
|
||||
reauth_data_t *data;
|
||||
identification_t *permanent;
|
||||
|
@ -136,9 +131,9 @@ static identification_t *gen_reauth(private_eap_simaka_reauth_provider_t *this,
|
|||
}
|
||||
else
|
||||
{ /* generate new entry */
|
||||
data = malloc_thing(reauth_data_t);
|
||||
data->counter = 0;
|
||||
data->id = gen_identity(this);
|
||||
INIT(data,
|
||||
.id = gen_identity(this),
|
||||
);
|
||||
id = id->clone(id);
|
||||
this->reauth->put(this->reauth, id, data);
|
||||
this->permanent->put(this->permanent, data->id, id);
|
||||
|
@ -148,10 +143,8 @@ static identification_t *gen_reauth(private_eap_simaka_reauth_provider_t *this,
|
|||
return data->id->clone(data->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of eap_simaka_reauth_provider_t.destroy.
|
||||
*/
|
||||
static void destroy(private_eap_simaka_reauth_provider_t *this)
|
||||
METHOD(eap_simaka_reauth_provider_t, destroy, void,
|
||||
private_eap_simaka_reauth_provider_t *this)
|
||||
{
|
||||
enumerator_t *enumerator;
|
||||
identification_t *id;
|
||||
|
@ -184,18 +177,23 @@ static void destroy(private_eap_simaka_reauth_provider_t *this)
|
|||
*/
|
||||
eap_simaka_reauth_provider_t *eap_simaka_reauth_provider_create()
|
||||
{
|
||||
private_eap_simaka_reauth_provider_t *this = malloc_thing(private_eap_simaka_reauth_provider_t);
|
||||
private_eap_simaka_reauth_provider_t *this;
|
||||
|
||||
this->public.provider.get_triplet = (bool(*)(simaka_provider_t*, identification_t *id, char rand[SIM_RAND_LEN], char sres[SIM_SRES_LEN], char kc[SIM_KC_LEN]))return_false;
|
||||
this->public.provider.get_quintuplet = (bool(*)(simaka_provider_t*, identification_t *id, char rand[AKA_RAND_LEN], char xres[AKA_RES_MAX], int *xres_len, char ck[AKA_CK_LEN], char ik[AKA_IK_LEN], char autn[AKA_AUTN_LEN]))return_false;
|
||||
this->public.provider.resync = (bool(*)(simaka_provider_t*, identification_t *id, char rand[AKA_RAND_LEN], char auts[AKA_AUTS_LEN]))return_false;
|
||||
this->public.provider.is_pseudonym = (identification_t*(*)(simaka_provider_t*, identification_t *id))return_null;
|
||||
this->public.provider.gen_pseudonym = (identification_t*(*)(simaka_provider_t*, identification_t *id))return_null;
|
||||
this->public.provider.is_reauth = (identification_t*(*)(simaka_provider_t*, identification_t *id, char [HASH_SIZE_SHA1], u_int16_t *counter))is_reauth;
|
||||
this->public.provider.gen_reauth = (identification_t*(*)(simaka_provider_t*, identification_t *id, char mk[HASH_SIZE_SHA1]))gen_reauth;
|
||||
this->public.destroy = (void(*)(eap_simaka_reauth_provider_t*))destroy;
|
||||
|
||||
this->rng = lib->crypto->create_rng(lib->crypto, RNG_WEAK);
|
||||
INIT(this,
|
||||
.public = {
|
||||
.provider = {
|
||||
.get_triplet = (void*)return_false,
|
||||
.get_quintuplet = (void*)return_false,
|
||||
.resync = (void*)return_false,
|
||||
.is_pseudonym = (void*)return_null,
|
||||
.gen_pseudonym = (void*)return_null,
|
||||
.is_reauth = _is_reauth,
|
||||
.gen_reauth = _gen_reauth,
|
||||
},
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.rng = lib->crypto->create_rng(lib->crypto, RNG_WEAK),
|
||||
);
|
||||
if (!this->rng)
|
||||
{
|
||||
free(this);
|
||||
|
|
Loading…
Reference in New Issue