2 * WPA Supplicant / PC/SC smartcard interface for USIM, GSM SIM
3 * Copyright (c) 2004-2006, Jouni Malinen <jkmaline@cc.hut.fi>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
19 * File type in first octet:
22 * 2F = Elementary File under the Master File
23 * 6F = Elementary File under a Dedicated File
25 #define SCARD_FILE_MF 0x3F00
26 #define SCARD_FILE_GSM_DF 0x7F20
27 #define SCARD_FILE_UMTS_DF 0x7F50
28 #define SCARD_FILE_GSM_EF_IMSI 0x6F07
29 #define SCARD_FILE_EF_ICCID 0x2FE2
30 #define SCARD_FILE_EF_CK 0x6FE1
31 #define SCARD_FILE_EF_IK 0x6FE2
33 #define SCARD_CHV1_OFFSET 13
34 #define SCARD_CHV1_FLAG 0x80
44 struct scard_data
* scard_init(scard_sim_type sim_type
);
45 void scard_deinit(struct scard_data
*scard
);
47 int scard_set_pin(struct scard_data
*scard
, const char *pin
);
48 int scard_get_imsi(struct scard_data
*scard
, char *imsi
, size_t *len
);
49 int scard_gsm_auth(struct scard_data
*scard
, const unsigned char *rand
,
50 unsigned char *sres
, unsigned char *kc
);
51 int scard_umts_auth(struct scard_data
*scard
, const unsigned char *rand
,
52 const unsigned char *autn
,
53 unsigned char *res
, size_t *res_len
,
54 unsigned char *ik
, unsigned char *ck
, unsigned char *auts
);
56 #else /* PCSC_FUNCS */
58 #define scard_init(s) NULL
59 #define scard_deinit(s) do { } while (0)
60 #define scard_set_pin(s, p) -1
61 #define scard_get_imsi(s, i, l) -1
62 #define scard_gsm_auth(s, r, s2, k) -1
63 #define scard_umts_auth(s, r, a, r2, rl, i, c, a2) -1
65 #endif /* PCSC_FUNCS */
67 #endif /* PCSC_FUNCS_H */