00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef PCSC_FUNCS_H
00016 #define PCSC_FUNCS_H
00017
00018
00019
00020
00021
00022
00023
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
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
00067
00068 #endif