aboutsummaryrefslogtreecommitdiffstats
path: root/src/eap_peer
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2008-12-03 17:59:52 (GMT)
committerJouni Malinen <j@w1.fi>2008-12-03 17:59:52 (GMT)
commit73d48dc4b467ddb7f1451269306425c07bcac756 (patch)
tree712146edd892074a3a8627d5d9f363e8264be2c4 /src/eap_peer
parenta17322c345fe4372001b197ffbe19dd34f8af373 (diff)
downloadhostap-06-73d48dc4b467ddb7f1451269306425c07bcac756.zip
hostap-06-73d48dc4b467ddb7f1451269306425c07bcac756.tar.gz
hostap-06-73d48dc4b467ddb7f1451269306425c07bcac756.tar.bz2
EAP-AKA': Allow both AKA AKA' to be registed from eap_aka_prime.c
This allows the same source code file to be shared for both methods. For now, this is only in eap_aka_prime.c, but eventually, changes in eap_aka_prime.c are likely to be merged into eap_aka.c at which point the separate eap_aka_prime.c can be removed.
Diffstat (limited to 'src/eap_peer')
-rw-r--r--src/eap_peer/eap_aka_prime.c42
1 files changed, 38 insertions, 4 deletions
diff --git a/src/eap_peer/eap_aka_prime.c b/src/eap_peer/eap_aka_prime.c
index 544b0b8..b3ff706 100644
--- a/src/eap_peer/eap_aka_prime.c
+++ b/src/eap_peer/eap_aka_prime.c
@@ -100,10 +100,7 @@ static void * eap_aka_init(struct eap_sm *sm)
if (data == NULL)
return NULL;
- if (1)
- data->eap_method = EAP_TYPE_AKA_PRIME;
- else
- data->eap_method = EAP_TYPE_AKA;
+ data->eap_method = EAP_TYPE_AKA;
eap_aka_state(data, CONTINUE);
data->prev_id = -1;
@@ -114,6 +111,16 @@ static void * eap_aka_init(struct eap_sm *sm)
}
+static void * eap_aka_prime_init(struct eap_sm *sm)
+{
+ struct eap_aka_data *data = eap_aka_init(sm);
+ if (data == NULL)
+ return NULL;
+ data->eap_method = EAP_TYPE_AKA_PRIME;
+ return data;
+}
+
+
static void eap_aka_deinit(struct eap_sm *sm, void *priv)
{
struct eap_aka_data *data = priv;
@@ -1177,6 +1184,31 @@ int eap_peer_aka_prime_register(void)
if (eap == NULL)
return -1;
+ eap->init = eap_aka_prime_init;
+ eap->deinit = eap_aka_deinit;
+ eap->process = eap_aka_process;
+ eap->isKeyAvailable = eap_aka_isKeyAvailable;
+ eap->getKey = eap_aka_getKey;
+ eap->has_reauth_data = eap_aka_has_reauth_data;
+ eap->deinit_for_reauth = eap_aka_deinit_for_reauth;
+ eap->init_for_reauth = eap_aka_init_for_reauth;
+ eap->get_identity = eap_aka_get_identity;
+ eap->get_emsk = eap_aka_get_emsk;
+
+ ret = eap_peer_method_register(eap);
+ if (ret)
+ eap_peer_method_free(eap);
+
+#ifdef EAP_AKA_PRIME_BOTH
+ if (ret)
+ return ret;
+
+ eap = eap_peer_method_alloc(EAP_PEER_METHOD_INTERFACE_VERSION,
+ EAP_VENDOR_IETF, EAP_TYPE_AKA,
+ "AKA");
+ if (eap == NULL)
+ return -1;
+
eap->init = eap_aka_init;
eap->deinit = eap_aka_deinit;
eap->process = eap_aka_process;
@@ -1191,5 +1223,7 @@ int eap_peer_aka_prime_register(void)
ret = eap_peer_method_register(eap);
if (ret)
eap_peer_method_free(eap);
+#endif /* EAP_AKA_PRIME_BOTH */
+
return ret;
}