From patchwork Tue Jul 30 02:29:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masashi Honma X-Patchwork-Id: 263165 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "maxx.shmoo.com", Issuer "CA Cert Signing Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id B92E92C00F6 for ; Tue, 30 Jul 2013 12:30:03 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id CECBC17C008; Mon, 29 Jul 2013 22:29:59 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fLO1xHs4EhGA; Mon, 29 Jul 2013 22:29:59 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id BA83117C00A; Mon, 29 Jul 2013 22:29:54 -0400 (EDT) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id B2A1417C003 for ; Mon, 29 Jul 2013 22:29:49 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id G2HPzut4Uhzm for ; Mon, 29 Jul 2013 22:29:43 -0400 (EDT) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com [209.85.217.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id 295D317C008 for ; Mon, 29 Jul 2013 22:29:43 -0400 (EDT) Received: by mail-lb0-f181.google.com with SMTP id o10so3599729lbi.12 for ; Mon, 29 Jul 2013 19:29:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=eFYuRfMCUZmWeUiSTUho6GdotwAg2loHZWSFO/0xuEc=; b=joO/94ibmb8KYHEpc6qr40HJapI/PiS40f3UTbUbGEh+CzeVyh3h6Aq3d9kzMhttlq AU/XKS47jTmMubwxwjjyC6o9wCu1EeTUo0YqCSVXv9uLr/LDyi1JULmKcf8XrxcKc7Wd 7WlwkPNJOoxbXc6c8G5yE+zHp1VBGVmKCFdVxfPJdQ13eh1cm1Y4aR5Y56V18kQc3nt1 iKFlxHeCQSA7C5FTQh8RHKeYf+4Y/pmapP9sLq38MfzBCzBl86+brSVxzV9xQS0ERYol +MTgt4e0Vi/7kjcMQOPNCffb6ZUCUqtcOZXdLXRmD4yiTR31iuwRTAJiX4FJC+RI84E9 y+3Q== MIME-Version: 1.0 X-Received: by 10.152.6.169 with SMTP id c9mr28273928laa.47.1375151381152; Mon, 29 Jul 2013 19:29:41 -0700 (PDT) Received: by 10.114.1.173 with HTTP; Mon, 29 Jul 2013 19:29:41 -0700 (PDT) Date: Tue, 30 Jul 2013 11:29:41 +0900 Message-ID: Subject: [PATCH] EAP: Failed to switch EAP-SIM to EAP-AKA/AKA' From: Masashi Honma To: hostap ML X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com Switching eap method from EAP-SIM to EAP-AKA fails. wpa_cli commands are below. ------------------ sudo wpa_cli add_network sudo wpa_cli set_network 0 ssid '"eap-sim"' sudo wpa_cli set_network 0 key_mgmt WPA-EAP sudo wpa_cli set_network 0 eap SIM sudo wpa_cli set_network 0 pin '"1234"' sudo wpa_cli set_network 0 pcsc '""' sudo wpa_cli select_network 0 sudo wpa_cli disable_network 0 sudo wpa_cli disconnect sudo wpa_cli remove_network 0 sudo wpa_cli add_network sudo wpa_cli set_network 0 ssid '"eap-sim"' sudo wpa_cli set_network 0 key_mgmt WPA-EAP sudo wpa_cli set_network 0 eap AKA sudo wpa_cli set_network 0 pin '"1234"' sudo wpa_cli set_network 0 pcsc '""' sudo wpa_cli select_network 0 ------------------ Then EAP-AKA connection resulted in fail. wpa_supplicant log is below. ------------------ wlan0: CTRL-EVENT-EAP-METHOD EAP vendor 0 method 23 (AKA) selected SCARD: Non-USIM card - cannot do UMTS auth EAP-AKA: UMTS authentication failed (AUTN) wlan0: CTRL-EVENT-EAP-FAILURE EAP authentication failed ------------------ This occurs because on the first EAP-SIM authentication, the SIM/USIM card in the device was recognized as SIM card even if it is USIM card. So this patch changes it to recognize as USIM card even if EAP-SIM authentication was required. I have tested these switching cases. EAP-SIM -> EAP-AKA EAP-SIM -> EAP-AKA' EAP-AKA -> EAP-SIM EAP-AKA -> EAP-AKA' EAP-AKA' -> EAP-SIM EAP-AKA' -> EAP-AKA Regards, Masashi Honma. diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index bcfac21..2474db5 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -272,7 +272,7 @@ int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s, { #ifdef IEEE8021X_EAPOL #ifdef PCSC_FUNCS - int aka = 0, sim = 0, type; + int aka = 0, sim = 0; if (ssid->eap.pcsc == NULL || wpa_s->scard != NULL) return 0; @@ -311,14 +311,9 @@ int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s, wpa_dbg(wpa_s, MSG_DEBUG, "Selected network is configured to use SIM " "(sim=%d aka=%d) - initialize PCSC", sim, aka); - if (sim && aka) - type = SCARD_TRY_BOTH; - else if (aka) - type = SCARD_USIM_ONLY; - else - type = SCARD_GSM_SIM_ONLY; - wpa_s->scard = scard_init(type, NULL); + wpa_s->scard = scard_init((!sim && aka) ? + SCARD_USIM_ONLY : SCARD_TRY_BOTH, NULL); if (wpa_s->scard == NULL) { wpa_msg(wpa_s, MSG_WARNING, "Failed to initialize SIM " "(pcsc-lite)");