Migrated eap_aka_3gpp2_card_t to INIT/METHOD macros.
This commit is contained in:
@@ -51,14 +51,10 @@ struct private_eap_aka_3gpp2_card_t {
|
|||||||
bool eap_aka_3gpp2_get_k(identification_t *id, char k[AKA_K_LEN]);
|
bool eap_aka_3gpp2_get_k(identification_t *id, char k[AKA_K_LEN]);
|
||||||
void eap_aka_3gpp2_get_sqn(char sqn[AKA_SQN_LEN], int offset);
|
void eap_aka_3gpp2_get_sqn(char sqn[AKA_SQN_LEN], int offset);
|
||||||
|
|
||||||
/**
|
METHOD(simaka_card_t, get_quintuplet, status_t,
|
||||||
* Implementation of simaka_card_t.get_quintuplet
|
private_eap_aka_3gpp2_card_t *this, identification_t *id,
|
||||||
*/
|
char rand[AKA_RAND_LEN], char autn[AKA_AUTN_LEN], char ck[AKA_CK_LEN],
|
||||||
static status_t get_quintuplet(private_eap_aka_3gpp2_card_t *this,
|
char ik[AKA_IK_LEN], char res[AKA_RES_MAX], int *res_len)
|
||||||
identification_t *id, char rand[AKA_RAND_LEN],
|
|
||||||
char autn[AKA_AUTN_LEN], char ck[AKA_CK_LEN],
|
|
||||||
char ik[AKA_IK_LEN], char res[AKA_RES_MAX],
|
|
||||||
int *res_len)
|
|
||||||
{
|
{
|
||||||
char *amf, *mac;
|
char *amf, *mac;
|
||||||
char k[AKA_K_LEN], ak[AKA_AK_LEN], sqn[AKA_SQN_LEN], xmac[AKA_MAC_LEN];
|
char k[AKA_K_LEN], ak[AKA_AK_LEN], sqn[AKA_SQN_LEN], xmac[AKA_MAC_LEN];
|
||||||
@@ -112,11 +108,9 @@ static status_t get_quintuplet(private_eap_aka_3gpp2_card_t *this,
|
|||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(simaka_card_t, resync, bool,
|
||||||
* Implementation of simaka_card_t.resync
|
private_eap_aka_3gpp2_card_t *this, identification_t *id,
|
||||||
*/
|
char rand[AKA_RAND_LEN], char auts[AKA_AUTS_LEN])
|
||||||
static bool resync(private_eap_aka_3gpp2_card_t *this, identification_t *id,
|
|
||||||
char rand[AKA_RAND_LEN], char auts[AKA_AUTS_LEN])
|
|
||||||
{
|
{
|
||||||
char amf[AKA_AMF_LEN], k[AKA_K_LEN], aks[AKA_AK_LEN], macs[AKA_MAC_LEN];
|
char amf[AKA_AMF_LEN], k[AKA_K_LEN], aks[AKA_AK_LEN], macs[AKA_MAC_LEN];
|
||||||
|
|
||||||
@@ -138,10 +132,8 @@ static bool resync(private_eap_aka_3gpp2_card_t *this, identification_t *id,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(eap_aka_3gpp2_card_t, destroy, void,
|
||||||
* Implementation of eap_aka_3gpp2_card_t.destroy.
|
private_eap_aka_3gpp2_card_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_eap_aka_3gpp2_card_t *this)
|
|
||||||
{
|
{
|
||||||
free(this);
|
free(this);
|
||||||
}
|
}
|
||||||
@@ -151,25 +143,30 @@ static void destroy(private_eap_aka_3gpp2_card_t *this)
|
|||||||
*/
|
*/
|
||||||
eap_aka_3gpp2_card_t *eap_aka_3gpp2_card_create(eap_aka_3gpp2_functions_t *f)
|
eap_aka_3gpp2_card_t *eap_aka_3gpp2_card_create(eap_aka_3gpp2_functions_t *f)
|
||||||
{
|
{
|
||||||
private_eap_aka_3gpp2_card_t *this = malloc_thing(private_eap_aka_3gpp2_card_t);
|
private_eap_aka_3gpp2_card_t *this;
|
||||||
|
|
||||||
this->public.card.get_triplet = (bool(*)(simaka_card_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.card.get_quintuplet = (status_t(*)(simaka_card_t*, identification_t *id, char rand[AKA_RAND_LEN], char autn[AKA_AUTN_LEN], char ck[AKA_CK_LEN], char ik[AKA_IK_LEN], char res[AKA_RES_MAX], int *res_len))get_quintuplet;
|
.public = {
|
||||||
this->public.card.resync = (bool(*)(simaka_card_t*, identification_t *id, char rand[AKA_RAND_LEN], char auts[AKA_AUTS_LEN]))resync;
|
.card = {
|
||||||
this->public.card.get_pseudonym = (identification_t*(*)(simaka_card_t*, identification_t *id))return_null;
|
.get_triplet = (void*)return_false,
|
||||||
this->public.card.set_pseudonym = (void(*)(simaka_card_t*, identification_t *id, identification_t *pseudonym))nop;
|
.get_quintuplet = _get_quintuplet,
|
||||||
this->public.card.get_reauth = (identification_t*(*)(simaka_card_t*, identification_t *id, char mk[HASH_SIZE_SHA1], u_int16_t *counter))return_null;
|
.resync = _resync,
|
||||||
this->public.card.set_reauth = (void(*)(simaka_card_t*, identification_t *id, identification_t* next, char mk[HASH_SIZE_SHA1], u_int16_t counter))nop;
|
.get_pseudonym = (void*)return_null,
|
||||||
this->public.destroy = (void(*)(eap_aka_3gpp2_card_t*))destroy;
|
.set_pseudonym = (void*)nop,
|
||||||
|
.get_reauth = (void*)return_null,
|
||||||
this->f = f;
|
.set_reauth = (void*)nop,
|
||||||
this->seq_check = lib->settings->get_bool(lib->settings,
|
},
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
.f = f,
|
||||||
|
.seq_check = lib->settings->get_bool(lib->settings,
|
||||||
"charon.plugins.eap-aka-3gpp2.seq_check",
|
"charon.plugins.eap-aka-3gpp2.seq_check",
|
||||||
#ifdef SEQ_CHECK /* handle legacy compile time configuration as default */
|
#ifdef SEQ_CHECK /* handle legacy compile time configuration as default */
|
||||||
TRUE);
|
TRUE),
|
||||||
#else /* !SEQ_CHECK */
|
#else /* !SEQ_CHECK */
|
||||||
FALSE);
|
FALSE),
|
||||||
#endif /* SEQ_CHECK */
|
#endif /* SEQ_CHECK */
|
||||||
|
);
|
||||||
|
|
||||||
eap_aka_3gpp2_get_sqn(this->sqn, 0);
|
eap_aka_3gpp2_get_sqn(this->sqn, 0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user