From 09d48b73f4bcf0ceede2329605b3820769df6eb8 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Wed, 8 Jul 2026 20:29:02 +0200 Subject: [PATCH] tls-eap: Only process ACKs on the server after processing an actual packet This prevents us from calling build() before ever calling process() on a server-side EAP method that might not expect that. --- src/libtls/tls_eap.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/libtls/tls_eap.c b/src/libtls/tls_eap.c index c700a7166..d83f4d70a 100644 --- a/src/libtls/tls_eap.c +++ b/src/libtls/tls_eap.c @@ -77,6 +77,11 @@ struct private_tls_eap_t { */ bool first_fragment; + /** + * Can we accept acknowledgements as server? + */ + bool conversation_started; + /** * Maximum size of an outgoing EAP-TLS fragment */ @@ -380,6 +385,12 @@ METHOD(tls_eap_t, process, status_t, * connection, which is interpreted here as an ACK packet */ if (in.len == sizeof(eap_tls_packet_t)) { + if (this->is_server && !this->conversation_started) + { + DBG1(DBG_TLS, "received %N acknowledgment packet before EAP " + "conversation started", eap_type_names, this->type); + return FAILED; + } DBG2(DBG_TLS, "received %N acknowledgment packet", eap_type_names, this->type); status = build_pkt(this, out); @@ -393,6 +404,10 @@ METHOD(tls_eap_t, process, status_t, switch (status) { case NEED_MORE: + if (this->is_server) + { + this->conversation_started = TRUE; + } break; case SUCCESS: return this->tls->is_complete(this->tls) ? SUCCESS : FAILED;