From 7f41c92bd6561a0d2a436a52b355983386d9366c Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 4 Mar 2012 16:11:02 +0200 Subject: [PATCH] Interworking: Use EAP-AKA if USIM is used Signed-hostap: Jouni Malinen --- src/utils/pcsc_funcs.c | 6 ++++++ src/utils/pcsc_funcs.h | 2 ++ wpa_supplicant/interworking.c | 3 +++ 3 files changed, 11 insertions(+) diff --git a/src/utils/pcsc_funcs.c b/src/utils/pcsc_funcs.c index 5607adc5b..08510d015 100644 --- a/src/utils/pcsc_funcs.c +++ b/src/utils/pcsc_funcs.c @@ -1419,3 +1419,9 @@ int scard_umts_auth(struct scard_data *scard, const unsigned char *_rand, wpa_printf(MSG_DEBUG, "SCARD: Unrecognized response"); return -1; } + + +int scard_supports_umts(struct scard_data *scard) +{ + return scard->sim_type == SCARD_USIM; +} diff --git a/src/utils/pcsc_funcs.h b/src/utils/pcsc_funcs.h index 9b945cc8e..092b14770 100644 --- a/src/utils/pcsc_funcs.h +++ b/src/utils/pcsc_funcs.h @@ -30,6 +30,7 @@ int scard_umts_auth(struct scard_data *scard, const unsigned char *_rand, unsigned char *res, size_t *res_len, unsigned char *ik, unsigned char *ck, unsigned char *auts); int scard_get_pin_retry_counter(struct scard_data *scard); +int scard_supports_umts(struct scard_data *scard); #else /* PCSC_FUNCS */ @@ -40,6 +41,7 @@ int scard_get_pin_retry_counter(struct scard_data *scard); #define scard_gsm_auth(s, r, s2, k) -1 #define scard_umts_auth(s, r, a, r2, rl, i, c, a2) -1 #define scard_get_pin_retry_counter(s) -1 +#define scard_supports_umts(s) 0 #endif /* PCSC_FUNCS */ diff --git a/wpa_supplicant/interworking.c b/wpa_supplicant/interworking.c index a721e5d30..f826791ef 100644 --- a/wpa_supplicant/interworking.c +++ b/wpa_supplicant/interworking.c @@ -12,6 +12,7 @@ #include "common/ieee802_11_defs.h" #include "common/gas.h" #include "common/wpa_ctrl.h" +#include "utils/pcsc_funcs.h" #include "drivers/driver.h" #include "eap_common/eap_defs.h" #include "eap_peer/eap_methods.h" @@ -656,6 +657,8 @@ static int interworking_connect_3gpp(struct wpa_supplicant *wpa_s, wpa_printf(MSG_DEBUG, "EAP-SIM not supported"); goto fail; } + if (cred->pcsc && wpa_s->scard && scard_supports_umts(wpa_s->scard)) + wpa_config_set(ssid, "eap", "AKA", 0); if (!cred->pcsc && set_root_nai(ssid, cred->imsi, '1') < 0) { wpa_printf(MSG_DEBUG, "Failed to set Root NAI"); goto fail;