Migrated eap_aka plugin to INIT/METHOD macros
This commit is contained in:
@@ -453,11 +453,8 @@ static status_t process_notification(private_eap_aka_peer_t *this,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
METHOD(eap_method_t, process, status_t,
|
||||||
* Implementation of eap_method_t.process
|
private_eap_aka_peer_t *this, eap_payload_t *in, eap_payload_t **out)
|
||||||
*/
|
|
||||||
static status_t process(private_eap_aka_peer_t *this,
|
|
||||||
eap_payload_t *in, eap_payload_t **out)
|
|
||||||
{
|
{
|
||||||
simaka_message_t *message;
|
simaka_message_t *message;
|
||||||
status_t status;
|
status_t status;
|
||||||
@@ -499,28 +496,22 @@ static status_t process(private_eap_aka_peer_t *this,
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(eap_method_t, initiate, status_t,
|
||||||
* Implementation of eap_method_t.initiate
|
private_eap_aka_peer_t *this, eap_payload_t **out)
|
||||||
*/
|
|
||||||
static status_t initiate(private_eap_aka_peer_t *this, eap_payload_t **out)
|
|
||||||
{
|
{
|
||||||
/* peer never initiates */
|
/* peer never initiates */
|
||||||
return FAILED;
|
return FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(eap_method_t, get_type, eap_type_t,
|
||||||
* Implementation of eap_method_t.get_type.
|
private_eap_aka_peer_t *this, u_int32_t *vendor)
|
||||||
*/
|
|
||||||
static eap_type_t get_type(private_eap_aka_peer_t *this, u_int32_t *vendor)
|
|
||||||
{
|
{
|
||||||
*vendor = 0;
|
*vendor = 0;
|
||||||
return EAP_AKA;
|
return EAP_AKA;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(eap_method_t, get_msk, status_t,
|
||||||
* Implementation of eap_method_t.get_msk.
|
private_eap_aka_peer_t *this, chunk_t *msk)
|
||||||
*/
|
|
||||||
static status_t get_msk(private_eap_aka_peer_t *this, chunk_t *msk)
|
|
||||||
{
|
{
|
||||||
if (this->msk.ptr)
|
if (this->msk.ptr)
|
||||||
{
|
{
|
||||||
@@ -530,18 +521,14 @@ static status_t get_msk(private_eap_aka_peer_t *this, chunk_t *msk)
|
|||||||
return FAILED;
|
return FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(eap_method_t, is_mutual, bool,
|
||||||
* Implementation of eap_method_t.is_mutual.
|
private_eap_aka_peer_t *this)
|
||||||
*/
|
|
||||||
static bool is_mutual(private_eap_aka_peer_t *this)
|
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(eap_method_t, destroy, void,
|
||||||
* Implementation of eap_method_t.destroy.
|
private_eap_aka_peer_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_eap_aka_peer_t *this)
|
|
||||||
{
|
{
|
||||||
this->crypto->destroy(this->crypto);
|
this->crypto->destroy(this->crypto);
|
||||||
this->permanent->destroy(this->permanent);
|
this->permanent->destroy(this->permanent);
|
||||||
@@ -557,25 +544,29 @@ static void destroy(private_eap_aka_peer_t *this)
|
|||||||
eap_aka_peer_t *eap_aka_peer_create(identification_t *server,
|
eap_aka_peer_t *eap_aka_peer_create(identification_t *server,
|
||||||
identification_t *peer)
|
identification_t *peer)
|
||||||
{
|
{
|
||||||
private_eap_aka_peer_t *this = malloc_thing(private_eap_aka_peer_t);
|
private_eap_aka_peer_t *this;
|
||||||
|
|
||||||
this->public.interface.initiate = (status_t(*)(eap_method_t*,eap_payload_t**))initiate;
|
INIT(this,
|
||||||
this->public.interface.process = (status_t(*)(eap_method_t*,eap_payload_t*,eap_payload_t**))process;
|
.public = {
|
||||||
this->public.interface.get_type = (eap_type_t(*)(eap_method_t*,u_int32_t*))get_type;
|
.interface = {
|
||||||
this->public.interface.is_mutual = (bool(*)(eap_method_t*))is_mutual;
|
.initiate = _initiate,
|
||||||
this->public.interface.get_msk = (status_t(*)(eap_method_t*,chunk_t*))get_msk;
|
.process = _process,
|
||||||
this->public.interface.destroy = (void(*)(eap_method_t*))destroy;
|
.get_type = _get_type,
|
||||||
|
.is_mutual = _is_mutual,
|
||||||
|
.get_msk = _get_msk,
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
.crypto = simaka_crypto_create(),
|
||||||
|
);
|
||||||
|
|
||||||
this->crypto = simaka_crypto_create();
|
|
||||||
if (!this->crypto)
|
if (!this->crypto)
|
||||||
{
|
{
|
||||||
free(this);
|
free(this);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->permanent = peer->clone(peer);
|
this->permanent = peer->clone(peer);
|
||||||
this->pseudonym = NULL;
|
|
||||||
this->reauth = NULL;
|
|
||||||
this->msk = chunk_empty;
|
|
||||||
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -251,10 +251,8 @@ static status_t reauthenticate(private_eap_aka_server_t *this,
|
|||||||
return NEED_MORE;
|
return NEED_MORE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(eap_method_t, initiate, status_t,
|
||||||
* Implementation of eap_method_t.initiate
|
private_eap_aka_server_t *this, eap_payload_t **out)
|
||||||
*/
|
|
||||||
static status_t initiate(private_eap_aka_server_t *this, eap_payload_t **out)
|
|
||||||
{
|
{
|
||||||
if (this->use_permanent || this->use_pseudonym || this->use_reauth)
|
if (this->use_permanent || this->use_pseudonym || this->use_reauth)
|
||||||
{
|
{
|
||||||
@@ -560,11 +558,8 @@ static status_t process_authentication_reject(private_eap_aka_server_t *this,
|
|||||||
return FAILED;
|
return FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(eap_method_t, process, status_t,
|
||||||
* Implementation of eap_method_t.process
|
private_eap_aka_server_t *this, eap_payload_t *in, eap_payload_t **out)
|
||||||
*/
|
|
||||||
static status_t process(private_eap_aka_server_t *this,
|
|
||||||
eap_payload_t *in, eap_payload_t **out)
|
|
||||||
{
|
{
|
||||||
simaka_message_t *message;
|
simaka_message_t *message;
|
||||||
status_t status;
|
status_t status;
|
||||||
@@ -609,19 +604,15 @@ static status_t process(private_eap_aka_server_t *this,
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(eap_method_t, get_type, eap_type_t,
|
||||||
* Implementation of eap_method_t.get_type.
|
private_eap_aka_server_t *this, u_int32_t *vendor)
|
||||||
*/
|
|
||||||
static eap_type_t get_type(private_eap_aka_server_t *this, u_int32_t *vendor)
|
|
||||||
{
|
{
|
||||||
*vendor = 0;
|
*vendor = 0;
|
||||||
return EAP_AKA;
|
return EAP_AKA;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(eap_method_t, get_msk, status_t,
|
||||||
* Implementation of eap_method_t.get_msk.
|
private_eap_aka_server_t *this, chunk_t *msk)
|
||||||
*/
|
|
||||||
static status_t get_msk(private_eap_aka_server_t *this, chunk_t *msk)
|
|
||||||
{
|
{
|
||||||
if (this->msk.ptr)
|
if (this->msk.ptr)
|
||||||
{
|
{
|
||||||
@@ -631,18 +622,14 @@ static status_t get_msk(private_eap_aka_server_t *this, chunk_t *msk)
|
|||||||
return FAILED;
|
return FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(eap_method_t, is_mutual, bool,
|
||||||
* Implementation of eap_method_t.is_mutual.
|
private_eap_aka_server_t *this)
|
||||||
*/
|
|
||||||
static bool is_mutual(private_eap_aka_server_t *this)
|
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(eap_method_t, destroy, void,
|
||||||
* Implementation of eap_method_t.destroy.
|
private_eap_aka_server_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_eap_aka_server_t *this)
|
|
||||||
{
|
{
|
||||||
this->crypto->destroy(this->crypto);
|
this->crypto->destroy(this->crypto);
|
||||||
this->permanent->destroy(this->permanent);
|
this->permanent->destroy(this->permanent);
|
||||||
@@ -662,34 +649,33 @@ static void destroy(private_eap_aka_server_t *this)
|
|||||||
eap_aka_server_t *eap_aka_server_create(identification_t *server,
|
eap_aka_server_t *eap_aka_server_create(identification_t *server,
|
||||||
identification_t *peer)
|
identification_t *peer)
|
||||||
{
|
{
|
||||||
private_eap_aka_server_t *this = malloc_thing(private_eap_aka_server_t);
|
private_eap_aka_server_t *this;
|
||||||
|
|
||||||
this->public.interface.initiate = (status_t(*)(eap_method_t*,eap_payload_t**))initiate;
|
INIT(this,
|
||||||
this->public.interface.process = (status_t(*)(eap_method_t*,eap_payload_t*,eap_payload_t**))process;
|
.public = {
|
||||||
this->public.interface.get_type = (eap_type_t(*)(eap_method_t*,u_int32_t*))get_type;
|
.interface = {
|
||||||
this->public.interface.is_mutual = (bool(*)(eap_method_t*))is_mutual;
|
.initiate = _initiate,
|
||||||
this->public.interface.get_msk = (status_t(*)(eap_method_t*,chunk_t*))get_msk;
|
.process = _process,
|
||||||
this->public.interface.destroy = (void(*)(eap_method_t*))destroy;
|
.get_type = _get_type,
|
||||||
|
.is_mutual = _is_mutual,
|
||||||
|
.get_msk = _get_msk,
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
.crypto = simaka_crypto_create(),
|
||||||
|
);
|
||||||
|
|
||||||
this->crypto = simaka_crypto_create();
|
|
||||||
if (!this->crypto)
|
if (!this->crypto)
|
||||||
{
|
{
|
||||||
free(this);
|
free(this);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->permanent = peer->clone(peer);
|
this->permanent = peer->clone(peer);
|
||||||
this->pseudonym = NULL;
|
|
||||||
this->reauth = NULL;
|
|
||||||
this->xres = chunk_empty;
|
|
||||||
this->rand = chunk_empty;
|
|
||||||
this->nonce = chunk_empty;
|
|
||||||
this->msk = chunk_empty;
|
|
||||||
this->counter = chunk_empty;
|
|
||||||
this->pending = 0;
|
|
||||||
this->synchronized = FALSE;
|
|
||||||
this->use_reauth = this->use_pseudonym = this->use_permanent =
|
this->use_reauth = this->use_pseudonym = this->use_permanent =
|
||||||
lib->settings->get_bool(lib->settings,
|
lib->settings->get_bool(lib->settings,
|
||||||
"charon.plugins.eap-aka.request_identity", TRUE);
|
"charon.plugins.eap-aka.request_identity", TRUE);
|
||||||
|
|
||||||
/* generate a non-zero identifier */
|
/* generate a non-zero identifier */
|
||||||
do {
|
do {
|
||||||
this->identifier = random();
|
this->identifier = random();
|
||||||
|
|||||||
Reference in New Issue
Block a user