mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-25 00:38:24 -05:00
Interworking: Read IMSI if not read at supplicant start
It is required to read IMSI from SIM if it has not already been done when comparing HS 2.0 AP 3GPP information with the local credentials. Signed-off-by: Jean Trivelly <jean.trivelly@intel.com>
This commit is contained in:
parent
62f736dd04
commit
72300408d4
@ -1750,6 +1750,31 @@ int interworking_connect(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
|
||||
}
|
||||
|
||||
|
||||
#ifdef PCSC_FUNCS
|
||||
static int interworking_pcsc_read_imsi(struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
if (wpa_s->imsi[0] && wpa_s->mnc_len)
|
||||
return 0;
|
||||
|
||||
len = sizeof(wpa_s->imsi) - 1;
|
||||
if (scard_get_imsi(wpa_s->scard, wpa_s->imsi, &len)) {
|
||||
scard_deinit(wpa_s->scard);
|
||||
wpa_s->scard = NULL;
|
||||
wpa_msg(wpa_s, MSG_ERROR, "Could not read IMSI");
|
||||
return -1;
|
||||
}
|
||||
wpa_s->imsi[len] = '\0';
|
||||
wpa_s->mnc_len = scard_get_mnc_len(wpa_s->scard);
|
||||
wpa_printf(MSG_DEBUG, "SCARD: IMSI %s (MNC length %d)",
|
||||
wpa_s->imsi, wpa_s->mnc_len);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* PCSC_FUNCS */
|
||||
|
||||
|
||||
static struct wpa_cred * interworking_credentials_available_3gpp(
|
||||
struct wpa_supplicant *wpa_s, struct wpa_bss *bss, int ignore_bw,
|
||||
int *excluded)
|
||||
@ -1788,8 +1813,9 @@ static struct wpa_cred * interworking_credentials_available_3gpp(
|
||||
size_t msin_len;
|
||||
|
||||
#ifdef PCSC_FUNCS
|
||||
if (cred->pcsc && wpa_s->conf->pcsc_reader && wpa_s->scard &&
|
||||
wpa_s->imsi[0]) {
|
||||
if (cred->pcsc && wpa_s->scard) {
|
||||
if (interworking_pcsc_read_imsi(wpa_s) < 0)
|
||||
continue;
|
||||
imsi = wpa_s->imsi;
|
||||
mnc_len = wpa_s->mnc_len;
|
||||
goto compare;
|
||||
@ -2046,8 +2072,9 @@ int interworking_home_sp_cred(struct wpa_supplicant *wpa_s,
|
||||
if (cred->imsi)
|
||||
imsi = cred->imsi;
|
||||
#ifdef PCSC_FUNCS
|
||||
else if (cred->pcsc && wpa_s->conf->pcsc_reader &&
|
||||
wpa_s->scard && wpa_s->imsi[0]) {
|
||||
else if (cred->pcsc && wpa_s->scard) {
|
||||
if (interworking_pcsc_read_imsi(wpa_s) < 0)
|
||||
return -1;
|
||||
imsi = wpa_s->imsi;
|
||||
mnc_len = wpa_s->mnc_len;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user