pcsc_funcs.h
Go to the documentation of this file.
00001 /*
00002  * WPA Supplicant / PC/SC smartcard interface for USIM, GSM SIM
00003  * Copyright (c) 2004-2006, Jouni Malinen <j@w1.fi>
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License version 2 as
00007  * published by the Free Software Foundation.
00008  *
00009  * Alternatively, this software may be distributed under the terms of BSD
00010  * license.
00011  *
00012  * See README and COPYING for more details.
00013  */
00014 
00015 #ifndef PCSC_FUNCS_H
00016 #define PCSC_FUNCS_H
00017 
00018 /* GSM files
00019  * File type in first octet:
00020  * 3F = Master File
00021  * 7F = Dedicated File
00022  * 2F = Elementary File under the Master File
00023  * 6F = Elementary File under a Dedicated File
00024  */
00025 #define SCARD_FILE_MF           0x3F00
00026 #define SCARD_FILE_GSM_DF       0x7F20
00027 #define SCARD_FILE_UMTS_DF      0x7F50
00028 #define SCARD_FILE_GSM_EF_IMSI  0x6F07
00029 #define SCARD_FILE_EF_DIR       0x2F00
00030 #define SCARD_FILE_EF_ICCID     0x2FE2
00031 #define SCARD_FILE_EF_CK        0x6FE1
00032 #define SCARD_FILE_EF_IK        0x6FE2
00033 
00034 #define SCARD_CHV1_OFFSET       13
00035 #define SCARD_CHV1_FLAG         0x80
00036 
00037 typedef enum {
00038         SCARD_GSM_SIM_ONLY,
00039         SCARD_USIM_ONLY,
00040         SCARD_TRY_BOTH
00041 } scard_sim_type;
00042 
00043 
00044 #ifdef PCSC_FUNCS
00045 struct scard_data * scard_init(scard_sim_type sim_type);
00046 void scard_deinit(struct scard_data *scard);
00047 
00048 int scard_set_pin(struct scard_data *scard, const char *pin);
00049 int scard_get_imsi(struct scard_data *scard, char *imsi, size_t *len);
00050 int scard_gsm_auth(struct scard_data *scard, const unsigned char *_rand,
00051                    unsigned char *sres, unsigned char *kc);
00052 int scard_umts_auth(struct scard_data *scard, const unsigned char *_rand,
00053                     const unsigned char *autn,
00054                     unsigned char *res, size_t *res_len,
00055                     unsigned char *ik, unsigned char *ck, unsigned char *auts);
00056 
00057 #else /* PCSC_FUNCS */
00058 
00059 #define scard_init(s) NULL
00060 #define scard_deinit(s) do { } while (0)
00061 #define scard_set_pin(s, p) -1
00062 #define scard_get_imsi(s, i, l) -1
00063 #define scard_gsm_auth(s, r, s2, k) -1
00064 #define scard_umts_auth(s, r, a, r2, rl, i, c, a2) -1
00065 
00066 #endif /* PCSC_FUNCS */
00067 
00068 #endif /* PCSC_FUNCS_H */


wpa_supplicant
Author(s): Package maintained by Blaise Gassend
autogenerated on Thu Jan 2 2014 11:26:38