aboutsummaryrefslogtreecommitdiffstats
path: root/src/eap_server/eap_server_psk.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2014-11-29 21:46:45 (GMT)
committerJouni Malinen <j@w1.fi>2014-11-30 13:53:11 (GMT)
commitd1f89dd732ab5f579d2f362c0523912f756c2b2d (patch)
tree14f9f619e422510ca8e109a7692c9fa6b7556157 /src/eap_server/eap_server_psk.c
parentd68f74c5ff681f8d3b0d7d0338857dec81ced106 (diff)
downloadhostap-d1f89dd732ab5f579d2f362c0523912f756c2b2d.zip
hostap-d1f89dd732ab5f579d2f362c0523912f756c2b2d.tar.gz
hostap-d1f89dd732ab5f579d2f362c0523912f756c2b2d.tar.bz2
EAP server: Add getSessionId
This extends EAP server implementation to derive Session-Id similarly to the existing EAP peer implementation. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src/eap_server/eap_server_psk.c')
-rw-r--r--src/eap_server/eap_server_psk.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/eap_server/eap_server_psk.c b/src/eap_server/eap_server_psk.c
index db394e9..12b5d25 100644
--- a/src/eap_server/eap_server_psk.c
+++ b/src/eap_server/eap_server_psk.c
@@ -485,6 +485,28 @@ static Boolean eap_psk_isSuccess(struct eap_sm *sm, void *priv)
}
+static u8 * eap_psk_get_session_id(struct eap_sm *sm, void *priv, size_t *len)
+{
+ struct eap_psk_data *data = priv;
+ u8 *id;
+
+ if (data->state != SUCCESS)
+ return NULL;
+
+ *len = 1 + 2 * EAP_PSK_RAND_LEN;
+ id = os_malloc(*len);
+ if (id == NULL)
+ return NULL;
+
+ id[0] = EAP_TYPE_PSK;
+ os_memcpy(id + 1, data->rand_p, EAP_PSK_RAND_LEN);
+ os_memcpy(id + 1 + EAP_PSK_RAND_LEN, data->rand_s, EAP_PSK_RAND_LEN);
+ wpa_hexdump(MSG_DEBUG, "EAP-PSK: Derived Session-Id", id, *len);
+
+ return id;
+}
+
+
int eap_server_psk_register(void)
{
struct eap_method *eap;
@@ -504,6 +526,7 @@ int eap_server_psk_register(void)
eap->getKey = eap_psk_getKey;
eap->isSuccess = eap_psk_isSuccess;
eap->get_emsk = eap_psk_get_emsk;
+ eap->getSessionId = eap_psk_get_session_id;
ret = eap_server_method_register(eap);
if (ret)