mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-28 18:28:23 -05:00
Clean up EAP peer PCSC identity functions
Leave out more code if PCSC_FUNCS is not defined since config->pcsc != 0 case cannot be used with such a build. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
b81e50cddb
commit
1314bc11cf
@ -1386,13 +1386,10 @@ static int eap_sm_imsi_identity(struct eap_sm *sm,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* PCSC_FUNCS */
|
||||
|
||||
|
||||
static int eap_sm_set_scard_pin(struct eap_sm *sm,
|
||||
struct eap_peer_config *conf)
|
||||
{
|
||||
#ifdef PCSC_FUNCS
|
||||
if (scard_set_pin(sm->scard_ctx, conf->pin)) {
|
||||
/*
|
||||
* Make sure the same PIN is not tried again in order to avoid
|
||||
@ -1406,24 +1403,20 @@ static int eap_sm_set_scard_pin(struct eap_sm *sm,
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
#else /* PCSC_FUNCS */
|
||||
return -1;
|
||||
#endif /* PCSC_FUNCS */
|
||||
}
|
||||
|
||||
|
||||
static int eap_sm_get_scard_identity(struct eap_sm *sm,
|
||||
struct eap_peer_config *conf)
|
||||
{
|
||||
#ifdef PCSC_FUNCS
|
||||
if (eap_sm_set_scard_pin(sm, conf))
|
||||
return -1;
|
||||
|
||||
return eap_sm_imsi_identity(sm, conf);
|
||||
#else /* PCSC_FUNCS */
|
||||
return -1;
|
||||
#endif /* PCSC_FUNCS */
|
||||
}
|
||||
|
||||
#endif /* PCSC_FUNCS */
|
||||
|
||||
|
||||
/**
|
||||
* eap_sm_buildIdentity - Build EAP-Identity/Response for the current network
|
||||
@ -1466,23 +1459,27 @@ struct wpabuf * eap_sm_buildIdentity(struct eap_sm *sm, int id, int encrypted)
|
||||
identity, identity_len);
|
||||
}
|
||||
|
||||
if (identity == NULL) {
|
||||
wpa_printf(MSG_WARNING, "EAP: buildIdentity: identity "
|
||||
"configuration was not available");
|
||||
if (config->pcsc) {
|
||||
if (config->pcsc) {
|
||||
#ifdef PCSC_FUNCS
|
||||
if (!identity) {
|
||||
if (eap_sm_get_scard_identity(sm, config) < 0)
|
||||
return NULL;
|
||||
identity = config->identity;
|
||||
identity_len = config->identity_len;
|
||||
wpa_hexdump_ascii(MSG_DEBUG, "permanent identity from "
|
||||
"IMSI", identity, identity_len);
|
||||
} else {
|
||||
eap_sm_request_identity(sm);
|
||||
wpa_hexdump_ascii(MSG_DEBUG,
|
||||
"permanent identity from IMSI",
|
||||
identity, identity_len);
|
||||
} else if (eap_sm_set_scard_pin(sm, config) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
} else if (config->pcsc) {
|
||||
if (eap_sm_set_scard_pin(sm, config) < 0)
|
||||
return NULL;
|
||||
#else /* PCSC_FUNCS */
|
||||
return NULL;
|
||||
#endif /* PCSC_FUNCS */
|
||||
} else if (!identity) {
|
||||
wpa_printf(MSG_WARNING,
|
||||
"EAP: buildIdentity: identity configuration was not available");
|
||||
eap_sm_request_identity(sm);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_IDENTITY, identity_len,
|
||||
|
Loading…
Reference in New Issue
Block a user