3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 21:22:37 +01:00

eap-tls/ttls/peap: Conditionally enable TLS debugging

Print the TLS debug messages if IWD_TLS_DEBUG is set.
This commit is contained in:
Andrew Zaborowski 2018-11-01 07:03:39 +01:00 committed by Denis Kenzior
parent 558341a689
commit 0b71b034c1
3 changed files with 26 additions and 1 deletions

View File

@ -523,7 +523,13 @@ static void eap_peap_tunnel_ready(const char *peer_identity, void *user_data)
static void eap_peap_tunnel_disconnected(enum l_tls_alert_desc reason, static void eap_peap_tunnel_disconnected(enum l_tls_alert_desc reason,
bool remote, void *user_data) bool remote, void *user_data)
{ {
l_info("PEAP TLS tunnel has disconnected with alert: %d", reason); l_info("PEAP TLS tunnel has disconnected with alert: %s",
l_tls_alert_to_str(reason));
}
static void eap_peap_debug_cb(const char *str, void *user_data)
{
l_info("PEAP TLS %s", str);
} }
static bool eap_peap_tunnel_init(struct eap_state *eap) static bool eap_peap_tunnel_init(struct eap_state *eap)
@ -544,6 +550,9 @@ static bool eap_peap_tunnel_init(struct eap_state *eap)
return false; return false;
} }
if (getenv("IWD_TLS_DEBUG"))
l_tls_set_debug(peap->tunnel, eap_peap_debug_cb, NULL, NULL);
if (!l_tls_set_auth_data(peap->tunnel, peap->client_cert, if (!l_tls_set_auth_data(peap->tunnel, peap->client_cert,
peap->client_key, NULL)) { peap->client_key, NULL)) {
l_error("PEAP: Failed to set authentication data."); l_error("PEAP: Failed to set authentication data.");

View File

@ -161,6 +161,11 @@ static void eap_tls_disconnect_cb(enum l_tls_alert_desc reason,
tls->completed = true; tls->completed = true;
} }
static void eap_tls_debug_cb(const char *str, void *user_data)
{
l_info("EAP-TLS %s", str);
}
static void eap_tls_handle_request(struct eap_state *eap, static void eap_tls_handle_request(struct eap_state *eap,
const uint8_t *pkt, size_t len) const uint8_t *pkt, size_t len)
{ {
@ -300,6 +305,9 @@ static void eap_tls_handle_request(struct eap_state *eap,
goto err; goto err;
} }
if (getenv("IWD_TLS_DEBUG"))
l_tls_set_debug(tls->tls, eap_tls_debug_cb, NULL, NULL);
l_tls_set_auth_data(tls->tls, tls->client_cert, tls->client_key, l_tls_set_auth_data(tls->tls, tls->client_cert, tls->client_key,
tls->passphrase); tls->passphrase);

View File

@ -818,6 +818,11 @@ static void eap_ttls_disconnect_cb(enum l_tls_alert_desc reason,
ttls->completed = true; ttls->completed = true;
} }
static void eap_ttls_debug_cb(const char *str, void *user_data)
{
l_info("EAP-TTLS %s", str);
}
static void eap_ttls_handle_payload(struct eap_state *eap, static void eap_ttls_handle_payload(struct eap_state *eap,
const uint8_t *pkt, const uint8_t *pkt,
size_t pkt_len) size_t pkt_len)
@ -1004,6 +1009,9 @@ add_to_pkt_buf:
goto err; goto err;
} }
if (getenv("IWD_TLS_DEBUG"))
l_tls_set_debug(ttls->tls, eap_ttls_debug_cb, NULL, NULL);
l_tls_set_auth_data(ttls->tls, ttls->client_cert, l_tls_set_auth_data(ttls->tls, ttls->client_cert,
ttls->client_key, ttls->passphrase); ttls->client_key, ttls->passphrase);