Migrated eap_aka_3gpp2_provider_t to INIT/METHOD macros.
This commit is contained in:
@@ -80,14 +80,10 @@ void eap_aka_3gpp2_get_sqn(char sqn[AKA_SQN_LEN], int offset)
|
|||||||
memcpy(sqn + 4, &time.tv_usec, 2);
|
memcpy(sqn + 4, &time.tv_usec, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(simaka_provider_t, get_quintuplet, bool,
|
||||||
* Implementation of simaka_provider_t.get_quintuplet
|
private_eap_aka_3gpp2_provider_t *this, identification_t *id,
|
||||||
*/
|
char rand[AKA_RAND_LEN], char xres[AKA_RES_MAX], int *xres_len,
|
||||||
static bool get_quintuplet(private_eap_aka_3gpp2_provider_t *this,
|
char ck[AKA_CK_LEN], char ik[AKA_IK_LEN], char autn[AKA_AUTN_LEN])
|
||||||
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])
|
|
||||||
{
|
{
|
||||||
rng_t *rng;
|
rng_t *rng;
|
||||||
char mac[AKA_MAC_LEN], ak[AKA_AK_LEN], k[AKA_K_LEN];
|
char mac[AKA_MAC_LEN], ak[AKA_AK_LEN], k[AKA_K_LEN];
|
||||||
@@ -131,12 +127,9 @@ static bool get_quintuplet(private_eap_aka_3gpp2_provider_t *this,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(simaka_provider_t, resync, bool,
|
||||||
* Implementation of simaka_provider_t.resync
|
private_eap_aka_3gpp2_provider_t *this, identification_t *id,
|
||||||
*/
|
char rand[AKA_RAND_LEN], char auts[AKA_AUTS_LEN])
|
||||||
static bool resync(private_eap_aka_3gpp2_provider_t *this,
|
|
||||||
identification_t *id, char rand[AKA_RAND_LEN],
|
|
||||||
char auts[AKA_AUTS_LEN])
|
|
||||||
{
|
{
|
||||||
char *sqn, *macs;
|
char *sqn, *macs;
|
||||||
char aks[AKA_AK_LEN], k[AKA_K_LEN], amf[AKA_AMF_LEN], xmacs[AKA_MAC_LEN];
|
char aks[AKA_AK_LEN], k[AKA_K_LEN], amf[AKA_AMF_LEN], xmacs[AKA_MAC_LEN];
|
||||||
@@ -169,10 +162,8 @@ static bool resync(private_eap_aka_3gpp2_provider_t *this,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(eap_aka_3gpp2_provider_t, destroy, void,
|
||||||
* Implementation of eap_aka_3gpp2_provider_t.destroy.
|
private_eap_aka_3gpp2_provider_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_eap_aka_3gpp2_provider_t *this)
|
|
||||||
{
|
{
|
||||||
free(this);
|
free(this);
|
||||||
}
|
}
|
||||||
@@ -183,18 +174,23 @@ static void destroy(private_eap_aka_3gpp2_provider_t *this)
|
|||||||
eap_aka_3gpp2_provider_t *eap_aka_3gpp2_provider_create(
|
eap_aka_3gpp2_provider_t *eap_aka_3gpp2_provider_create(
|
||||||
eap_aka_3gpp2_functions_t *f)
|
eap_aka_3gpp2_functions_t *f)
|
||||||
{
|
{
|
||||||
private_eap_aka_3gpp2_provider_t *this = malloc_thing(private_eap_aka_3gpp2_provider_t);
|
private_eap_aka_3gpp2_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]))get_quintuplet;
|
.public = {
|
||||||
this->public.provider.resync = (bool(*)(simaka_provider_t*, identification_t *id, char rand[AKA_RAND_LEN], char auts[AKA_AUTS_LEN]))resync;
|
.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 = _get_quintuplet,
|
||||||
this->public.provider.is_reauth = (identification_t*(*)(simaka_provider_t*, identification_t *id, char [HASH_SIZE_SHA1], u_int16_t *counter))return_null;
|
.resync = _resync,
|
||||||
this->public.provider.gen_reauth = (identification_t*(*)(simaka_provider_t*, identification_t *id, char mk[HASH_SIZE_SHA1]))return_null;
|
.is_pseudonym = (void*)return_null,
|
||||||
this->public.destroy = (void(*)(eap_aka_3gpp2_provider_t*))destroy;
|
.gen_pseudonym = (void*)return_null,
|
||||||
|
.is_reauth = (void*)return_null,
|
||||||
this->f = f;
|
.gen_reauth = (void*)return_null,
|
||||||
|
},
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
.f = f,
|
||||||
|
);
|
||||||
/* use an offset to accept clock skew between client/server without resync */
|
/* use an offset to accept clock skew between client/server without resync */
|
||||||
eap_aka_3gpp2_get_sqn(this->sqn, 180);
|
eap_aka_3gpp2_get_sqn(this->sqn, 180);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user