mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-25 09:39:25 +01:00
peap: derive and install eap key material
This commit is contained in:
parent
c5ec12e0e4
commit
8c1b175b8b
@ -28,6 +28,7 @@
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <ell/ell.h>
|
||||
#include <ell/tls-private.h>
|
||||
|
||||
#include "eap.h"
|
||||
|
||||
@ -195,6 +196,31 @@ static void eap_peap_tunnel_data_received(const uint8_t *data, size_t data_len,
|
||||
|
||||
static void eap_peap_tunnel_ready(const char *peer_identity, void *user_data)
|
||||
{
|
||||
struct eap_state *eap = user_data;
|
||||
struct eap_peap_state *peap = eap_get_data(eap);
|
||||
|
||||
uint8_t msk_emsk[128];
|
||||
uint8_t random[64];
|
||||
|
||||
/*
|
||||
* PEAP V5, Section 2.1.1
|
||||
*
|
||||
* Cleartext Failure packets MUST be silently discarded once TLS tunnel
|
||||
* has been brought up.
|
||||
*/
|
||||
eap_method_success(eap);
|
||||
|
||||
/* MSK, EMSK and challenge derivation */
|
||||
memcpy(random + 0, peap->tunnel->pending.client_random, 32);
|
||||
memcpy(random + 32, peap->tunnel->pending.server_random, 32);
|
||||
|
||||
tls_prf_get_bytes(peap->tunnel, L_CHECKSUM_SHA256, 32,
|
||||
peap->tunnel->pending.master_secret,
|
||||
sizeof(peap->tunnel->pending.master_secret),
|
||||
"client EAP encryption", random, 64,
|
||||
msk_emsk, 128);
|
||||
|
||||
eap_set_key_material(eap, msk_emsk + 0, 64, NULL, 0, NULL, 0);
|
||||
}
|
||||
|
||||
static void eap_peap_tunnel_disconnected(enum l_tls_alert_desc reason,
|
||||
|
Loading…
Reference in New Issue
Block a user