EAP peer: Add Session-Id derivation
This adds a new getSessionId() callback for EAP peer methods to allow EAP Session-Id to be derived. This commits implements this for EAP-FAST, EAP-GPSK, EAP-IKEv2, EAP-PEAP, EAP-TLS, and EAP-TTLS. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
9288e6625b
commit
950c563076
13 changed files with 457 additions and 2 deletions
|
@ -23,8 +23,8 @@ struct eap_gpsk_data {
|
|||
size_t sk_len;
|
||||
u8 pk[EAP_GPSK_MAX_PK_LEN];
|
||||
size_t pk_len;
|
||||
u8 session_id;
|
||||
int session_id_set;
|
||||
u8 session_id[128];
|
||||
size_t id_len;
|
||||
u8 *id_peer;
|
||||
size_t id_peer_len;
|
||||
u8 *id_server;
|
||||
|
@ -354,6 +354,21 @@ static struct wpabuf * eap_gpsk_send_gpsk_2(struct eap_gpsk_data *data,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (eap_gpsk_derive_session_id(data->psk, data->psk_len,
|
||||
data->vendor, data->specifier,
|
||||
data->rand_peer, data->rand_server,
|
||||
data->id_peer, data->id_peer_len,
|
||||
data->id_server, data->id_server_len,
|
||||
EAP_TYPE_GPSK,
|
||||
data->session_id, &data->id_len) < 0) {
|
||||
wpa_printf(MSG_DEBUG, "EAP-GPSK: Failed to derive Session-Id");
|
||||
eap_gpsk_state(data, FAILURE);
|
||||
wpabuf_free(resp);
|
||||
return NULL;
|
||||
}
|
||||
wpa_hexdump(MSG_DEBUG, "EAP-GPSK: Derived Session-Id",
|
||||
data->session_id, data->id_len);
|
||||
|
||||
/* No PD_Payload_1 */
|
||||
wpabuf_put_be16(resp, 0);
|
||||
|
||||
|
@ -708,6 +723,24 @@ static u8 * eap_gpsk_get_emsk(struct eap_sm *sm, void *priv, size_t *len)
|
|||
}
|
||||
|
||||
|
||||
static u8 * eap_gpsk_get_session_id(struct eap_sm *sm, void *priv, size_t *len)
|
||||
{
|
||||
struct eap_gpsk_data *data = priv;
|
||||
u8 *sid;
|
||||
|
||||
if (data->state != SUCCESS)
|
||||
return NULL;
|
||||
|
||||
sid = os_malloc(data->id_len);
|
||||
if (sid == NULL)
|
||||
return NULL;
|
||||
os_memcpy(sid, data->session_id, data->id_len);
|
||||
*len = data->id_len;
|
||||
|
||||
return sid;
|
||||
}
|
||||
|
||||
|
||||
int eap_peer_gpsk_register(void)
|
||||
{
|
||||
struct eap_method *eap;
|
||||
|
@ -724,6 +757,7 @@ int eap_peer_gpsk_register(void)
|
|||
eap->isKeyAvailable = eap_gpsk_isKeyAvailable;
|
||||
eap->getKey = eap_gpsk_getKey;
|
||||
eap->get_emsk = eap_gpsk_get_emsk;
|
||||
eap->getSessionId = eap_gpsk_get_session_id;
|
||||
|
||||
ret = eap_peer_method_register(eap);
|
||||
if (ret)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue