diff mbox

SCARD: Fix GSM authentication on USIM

Message ID 1400177439-16218-1-git-send-email-gmbnomis@gmail.com
State Accepted
Headers show

Commit Message

Simon Baatz May 15, 2014, 6:10 p.m. UTC
scard_gsm_auth() used SIM_CMD_GET_RESPONSE for both SIM and USIM. Convert
the command into USIM_CMD_GET_RESPONSE for USIM.

Signed-off-by: Simon Baatz <gmbnomis@gmail.com>
---

Hi,

since commit eb324600295 ("Fix switching from EAP-SIM to
EAP-AKA/AKA'") EAP-SIM is using the USIM if available. This triggers a
probably ancient bug in scard_gsm_auth(), which results in sending the
wrong get response command to the USIM. Thus, EAP-SIM stopped to work
after this change on USIMs that expect the proper command.

- Simon


 src/utils/pcsc_funcs.c |    1 +
 1 file changed, 1 insertion(+)

Comments

Jouni Malinen May 15, 2014, 10:42 p.m. UTC | #1
On Thu, May 15, 2014 at 08:10:39PM +0200, Simon Baatz wrote:
> scard_gsm_auth() used SIM_CMD_GET_RESPONSE for both SIM and USIM. Convert
> the command into USIM_CMD_GET_RESPONSE for USIM.

Thanks, applied.

> since commit eb324600295 ("Fix switching from EAP-SIM to
> EAP-AKA/AKA'") EAP-SIM is using the USIM if available. This triggers a
> probably ancient bug in scard_gsm_auth(), which results in sending the
> wrong get response command to the USIM. Thus, EAP-SIM stopped to work
> after this change on USIMs that expect the proper command.

Though, I included this to the commit message to make it more helpful in
understand what didn't work and since when.
diff mbox

Patch

diff --git a/src/utils/pcsc_funcs.c b/src/utils/pcsc_funcs.c
index ee90d25..ec06556 100644
--- a/src/utils/pcsc_funcs.c
+++ b/src/utils/pcsc_funcs.c
@@ -1237,6 +1237,7 @@  int scard_gsm_auth(struct scard_data *scard, const unsigned char *_rand,
 		cmd[4] = 17;
 		cmd[5] = 16;
 		os_memcpy(cmd + 6, _rand, 16);
+		get_resp[0] = USIM_CLA;
 	}
 	len = sizeof(resp);
 	ret = scard_transmit(scard, cmd, cmdlen, resp, &len);