2
* WPA Supplicant / PC/SC smartcard interface for USIM, GSM SIM
3
* Copyright (c) 2004-2006, Jouni Malinen <j@w1.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_DIR 0x2F00
30
#define SCARD_FILE_EF_ICCID 0x2FE2
31
#define SCARD_FILE_EF_CK 0x6FE1
32
#define SCARD_FILE_EF_IK 0x6FE2
34
#define SCARD_CHV1_OFFSET 13
35
#define SCARD_CHV1_FLAG 0x80
45
struct scard_data * scard_init(scard_sim_type sim_type);
46
void scard_deinit(struct scard_data *scard);
48
int scard_set_pin(struct scard_data *scard, const char *pin);
49
int scard_get_imsi(struct scard_data *scard, char *imsi, size_t *len);
50
int scard_gsm_auth(struct scard_data *scard, const unsigned char *_rand,
51
unsigned char *sres, unsigned char *kc);
52
int scard_umts_auth(struct scard_data *scard, const unsigned char *_rand,
53
const unsigned char *autn,
54
unsigned char *res, size_t *res_len,
55
unsigned char *ik, unsigned char *ck, unsigned char *auts);
57
#else /* PCSC_FUNCS */
59
#define scard_init(s) NULL
60
#define scard_deinit(s) do { } while (0)
61
#define scard_set_pin(s, p) -1
62
#define scard_get_imsi(s, i, l) -1
63
#define scard_gsm_auth(s, r, s2, k) -1
64
#define scard_umts_auth(s, r, a, r2, rl, i, c, a2) -1
66
#endif /* PCSC_FUNCS */
68
#endif /* PCSC_FUNCS_H */