commit f1f826ee816f2db2eddca914b1117bf616be9372
parent b375191c61da7f1cf74ce72d47364d76d4149a7d
Author: Tim Kourt <tim.a.kourt@linux.intel.com>
Date: Tue, 4 Dec 2018 15:41:48 -0800
eap-tls-common: Handle packet payload
Diffstat:
1 file changed, 29 insertions(+), 0 deletions(-)
diff --git a/src/eap-tls-common.c b/src/eap-tls-common.c
@@ -520,6 +520,19 @@ static bool eap_tls_tunnel_init(struct eap_state *eap)
return true;
}
+static void eap_tls_handle_phase2_payload(struct eap_state *eap,
+ const uint8_t *pkt,
+ size_t pkt_len)
+{
+ struct eap_tls_state *eap_tls = eap_get_data(eap);
+
+ if (!eap_tls->variant_ops->tunnel_handle_request)
+ return;
+
+ if (!eap_tls->variant_ops->tunnel_handle_request(eap, pkt, pkt_len))
+ l_tls_close(eap_tls->tunnel);
+}
+
void eap_tls_common_handle_request(struct eap_state *eap,
const uint8_t *pkt, size_t len)
{
@@ -600,6 +613,22 @@ proceed:
goto error;
}
+ if (len)
+ l_tls_handle_rx(eap_tls->tunnel, pkt, len);
+
+ if (eap_tls->plain_buf) {
+ /*
+ * An existence of the plain_buf indicates that the TLS tunnel
+ * has been established and Phase 2 payload was transmitted
+ * through it.
+ */
+ eap_tls_handle_phase2_payload(eap, eap_tls->plain_buf->data,
+ eap_tls->plain_buf->len);
+
+ databuf_free(eap_tls->plain_buf);
+ eap_tls->plain_buf = NULL;
+ }
+
if (eap_tls->rx_pdu_buf) {
databuf_free(eap_tls->rx_pdu_buf);
eap_tls->rx_pdu_buf = NULL;