- Add noise floor to stats
[dragonfly.git] / contrib / wpa_supplicant-0.4.9 / pcsc_funcs.h
1 /*
2  * WPA Supplicant / PC/SC smartcard interface for USIM, GSM SIM
3  * Copyright (c) 2004-2006, Jouni Malinen <jkmaline@cc.hut.fi>
4  *
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.
8  *
9  * Alternatively, this software may be distributed under the terms of BSD
10  * license.
11  *
12  * See README and COPYING for more details.
13  */
14
15 #ifndef PCSC_FUNCS_H
16 #define PCSC_FUNCS_H
17
18 /* GSM files
19  * File type in first octet:
20  * 3F = Master File
21  * 7F = Dedicated File
22  * 2F = Elementary File under the Master File
23  * 6F = Elementary File under a Dedicated File
24  */
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
32
33 #define SCARD_CHV1_OFFSET       13
34 #define SCARD_CHV1_FLAG         0x80
35
36 typedef enum {
37         SCARD_GSM_SIM_ONLY,
38         SCARD_USIM_ONLY,
39         SCARD_TRY_BOTH
40 } scard_sim_type;
41
42
43 #ifdef PCSC_FUNCS
44 struct scard_data * scard_init(scard_sim_type sim_type);
45 void scard_deinit(struct scard_data *scard);
46
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);
55
56 #else /* PCSC_FUNCS */
57
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
64
65 #endif /* PCSC_FUNCS */
66
67 #endif /* PCSC_FUNCS_H */