2008-02-28 02:34:43 +01:00
|
|
|
/*
|
|
|
|
* WPA Supplicant / PC/SC smartcard interface for USIM, GSM SIM
|
2012-03-03 12:51:34 +01:00
|
|
|
* Copyright (c) 2004-2006, 2012, Jouni Malinen <j@w1.fi>
|
2008-02-28 02:34:43 +01:00
|
|
|
*
|
2012-02-11 15:46:35 +01:00
|
|
|
* This software may be distributed under the terms of the BSD license.
|
|
|
|
* See README for more details.
|
2008-02-28 02:34:43 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PCSC_FUNCS_H
|
|
|
|
#define PCSC_FUNCS_H
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
SCARD_GSM_SIM_ONLY,
|
|
|
|
SCARD_USIM_ONLY,
|
|
|
|
SCARD_TRY_BOTH
|
|
|
|
} scard_sim_type;
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef PCSC_FUNCS
|
2012-02-26 12:07:05 +01:00
|
|
|
struct scard_data * scard_init(scard_sim_type sim_type, const char *reader);
|
2008-02-28 02:34:43 +01:00
|
|
|
void scard_deinit(struct scard_data *scard);
|
|
|
|
|
|
|
|
int scard_set_pin(struct scard_data *scard, const char *pin);
|
|
|
|
int scard_get_imsi(struct scard_data *scard, char *imsi, size_t *len);
|
2012-01-22 18:28:24 +01:00
|
|
|
int scard_get_mnc_len(struct scard_data *scard);
|
2008-02-28 02:34:43 +01:00
|
|
|
int scard_gsm_auth(struct scard_data *scard, const unsigned char *_rand,
|
|
|
|
unsigned char *sres, unsigned char *kc);
|
|
|
|
int scard_umts_auth(struct scard_data *scard, const unsigned char *_rand,
|
|
|
|
const unsigned char *autn,
|
|
|
|
unsigned char *res, size_t *res_len,
|
|
|
|
unsigned char *ik, unsigned char *ck, unsigned char *auts);
|
2012-03-03 12:51:34 +01:00
|
|
|
int scard_get_pin_retry_counter(struct scard_data *scard);
|
2008-02-28 02:34:43 +01:00
|
|
|
|
|
|
|
#else /* PCSC_FUNCS */
|
|
|
|
|
|
|
|
#define scard_init(s) NULL
|
|
|
|
#define scard_deinit(s) do { } while (0)
|
|
|
|
#define scard_set_pin(s, p) -1
|
|
|
|
#define scard_get_imsi(s, i, l) -1
|
|
|
|
#define scard_gsm_auth(s, r, s2, k) -1
|
|
|
|
#define scard_umts_auth(s, r, a, r2, rl, i, c, a2) -1
|
2012-03-03 12:51:34 +01:00
|
|
|
#define scard_get_pin_retry_counter(s) -1
|
2008-02-28 02:34:43 +01:00
|
|
|
|
|
|
|
#endif /* PCSC_FUNCS */
|
|
|
|
|
|
|
|
#endif /* PCSC_FUNCS_H */
|