mirror of
https://github.com/espressif/esp-idf.git
synced 2025-11-13 08:43:52 +00:00
EAP peer: Clear keying material on deinit
Reduce the amount of time keying material (MSK, EMSK, temporary private data) remains in memory in EAP methods. This provides additional protection should there be any issues that could expose process memory to external observers. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
committed by
Sarvesh Bodakhe
parent
bb16734aa9
commit
f4d7329ae6
@@ -127,6 +127,15 @@ static void eap_ttls_phase2_eap_deinit(struct eap_sm *sm,
|
||||
}
|
||||
|
||||
|
||||
static void eap_ttls_free_key(struct eap_ttls_data *data)
|
||||
{
|
||||
if (data->key_data) {
|
||||
bin_clear_free(data->key_data, EAP_TLS_KEY_LEN);
|
||||
data->key_data = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void eap_ttls_deinit(struct eap_sm *sm, void *priv)
|
||||
{
|
||||
struct eap_ttls_data *data = priv;
|
||||
@@ -135,7 +144,7 @@ static void eap_ttls_deinit(struct eap_sm *sm, void *priv)
|
||||
eap_ttls_phase2_eap_deinit(sm, data);
|
||||
os_free(data->phase2_eap_types);
|
||||
eap_peer_tls_ssl_deinit(sm, &data->ssl);
|
||||
os_free(data->key_data);
|
||||
eap_ttls_free_key(data);
|
||||
os_free(data->session_id);
|
||||
wpabuf_free(data->pending_phase2_req);
|
||||
wpabuf_free(data->pending_resp);
|
||||
@@ -208,7 +217,7 @@ static int eap_ttls_avp_encapsulate(struct wpabuf **resp, u32 avp_code,
|
||||
static int eap_ttls_v0_derive_key(struct eap_sm *sm,
|
||||
struct eap_ttls_data *data)
|
||||
{
|
||||
os_free(data->key_data);
|
||||
eap_ttls_free_key(data);
|
||||
data->key_data = eap_peer_tls_derive_key(sm, &data->ssl,
|
||||
"ttls keying material",
|
||||
EAP_TLS_KEY_LEN);
|
||||
@@ -1607,8 +1616,7 @@ static void eap_ttls_deinit_for_reauth(struct eap_sm *sm, void *priv)
|
||||
static void * eap_ttls_init_for_reauth(struct eap_sm *sm, void *priv)
|
||||
{
|
||||
struct eap_ttls_data *data = priv;
|
||||
os_free(data->key_data);
|
||||
data->key_data = NULL;
|
||||
eap_ttls_free_key(data);
|
||||
os_free(data->session_id);
|
||||
data->session_id = NULL;
|
||||
if (eap_peer_tls_reauth_init(sm, &data->ssl)) {
|
||||
|
||||
Reference in New Issue
Block a user