Migrated eap_simaka_reauth_provider_t to INIT/METHOD macros.

This commit is contained in:
Tobias Brunner
2011-10-04 15:16:02 +02:00
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); return identification_create_from_string(hex);
} }
/** METHOD(simaka_provider_t, is_reauth, identification_t*,
* Implementation of simaka_provider_t.is_reauth private_eap_simaka_reauth_provider_t *this, identification_t *id,
*/ char mk[HASH_SIZE_SHA1], u_int16_t *counter)
static identification_t *is_reauth(private_eap_simaka_reauth_provider_t *this,
identification_t *id, char mk[HASH_SIZE_SHA1],
u_int16_t *counter)
{ {
identification_t *permanent; identification_t *permanent;
reauth_data_t *data; reauth_data_t *data;
@@ -114,11 +111,9 @@ static identification_t *is_reauth(private_eap_simaka_reauth_provider_t *this,
return permanent->clone(permanent); return permanent->clone(permanent);
} }
/** METHOD(simaka_provider_t, gen_reauth, identification_t*,
* Implementation of simaka_provider_t.gen_reauth private_eap_simaka_reauth_provider_t *this, identification_t *id,
*/ char mk[HASH_SIZE_SHA1])
static identification_t *gen_reauth(private_eap_simaka_reauth_provider_t *this,
identification_t *id, char mk[HASH_SIZE_SHA1])
{ {
reauth_data_t *data; reauth_data_t *data;
identification_t *permanent; identification_t *permanent;
@@ -136,9 +131,9 @@ static identification_t *gen_reauth(private_eap_simaka_reauth_provider_t *this,
} }
else else
{ /* generate new entry */ { /* generate new entry */
data = malloc_thing(reauth_data_t); INIT(data,
data->counter = 0; .id = gen_identity(this),
data->id = gen_identity(this); );
id = id->clone(id); id = id->clone(id);
this->reauth->put(this->reauth, id, data); this->reauth->put(this->reauth, id, data);
this->permanent->put(this->permanent, data->id, id); 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); return data->id->clone(data->id);
} }
/** METHOD(eap_simaka_reauth_provider_t, destroy, void,
* Implementation of eap_simaka_reauth_provider_t.destroy. private_eap_simaka_reauth_provider_t *this)
*/
static void destroy(private_eap_simaka_reauth_provider_t *this)
{ {
enumerator_t *enumerator; enumerator_t *enumerator;
identification_t *id; 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() 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; INIT(this,
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; .public = {
this->public.provider.resync = (bool(*)(simaka_provider_t*, identification_t *id, char rand[AKA_RAND_LEN], char auts[AKA_AUTS_LEN]))return_false; .provider = {
this->public.provider.is_pseudonym = (identification_t*(*)(simaka_provider_t*, identification_t *id))return_null; .get_triplet = (void*)return_false,
this->public.provider.gen_pseudonym = (identification_t*(*)(simaka_provider_t*, identification_t *id))return_null; .get_quintuplet = (void*)return_false,
this->public.provider.is_reauth = (identification_t*(*)(simaka_provider_t*, identification_t *id, char [HASH_SIZE_SHA1], u_int16_t *counter))is_reauth; .resync = (void*)return_false,
this->public.provider.gen_reauth = (identification_t*(*)(simaka_provider_t*, identification_t *id, char mk[HASH_SIZE_SHA1]))gen_reauth; .is_pseudonym = (void*)return_null,
this->public.destroy = (void(*)(eap_simaka_reauth_provider_t*))destroy; .gen_pseudonym = (void*)return_null,
.is_reauth = _is_reauth,
this->rng = lib->crypto->create_rng(lib->crypto, RNG_WEAK); .gen_reauth = _gen_reauth,
},
.destroy = _destroy,
},
.rng = lib->crypto->create_rng(lib->crypto, RNG_WEAK),
);
if (!this->rng) if (!this->rng)
{ {
free(this); free(this);