[PATCH] PASN: Don't override kek_len if it is pre-configured

Andrei Otcheretianski andrei.otcheretianski at intel.com
Thu May 7 12:11:29 PDT 2026


kek_len may be set outside of PASN module, for example, in P2P2 pairing
flows. Don't override it.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
 src/pasn/pasn_initiator.c | 4 +++-
 src/pasn/pasn_responder.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/pasn/pasn_initiator.c b/src/pasn/pasn_initiator.c
index 0dbc0cd18d..5ea38affa7 100644
--- a/src/pasn/pasn_initiator.c
+++ b/src/pasn/pasn_initiator.c
@@ -1527,7 +1527,9 @@ int wpas_parse_pasn_frame(struct pasn_data *pasn, u16 auth_type,
 
 	if (pasn->derive_kek) {
 		wpa_printf(MSG_DEBUG, "PASN: Derive PTK-KEK");
-		pasn->kek_len = wpa_kek_len(pasn->akmp, pasn->pmk_len);
+		if (!pasn->kek_len)
+			pasn->kek_len = wpa_kek_len(pasn->akmp,
+						    pasn->pmk_len);
 		wpa_printf(MSG_DEBUG, "PASN: kek_len=%zu", pasn->kek_len);
 	}
 
diff --git a/src/pasn/pasn_responder.c b/src/pasn/pasn_responder.c
index f9c37070c6..a46c17485b 100644
--- a/src/pasn/pasn_responder.c
+++ b/src/pasn/pasn_responder.c
@@ -485,7 +485,9 @@ pasn_derive_keys(struct pasn_data *pasn,
 		own_addr = pasn->mld_addr;
 
 	if (pasn->derive_kek) {
-		pasn->kek_len = wpa_kek_len(pasn->akmp, pasn->pmk_len);
+		if (!pasn->kek_len)
+			pasn->kek_len = wpa_kek_len(pasn->akmp,
+						    pasn->pmk_len);
 		wpa_printf(MSG_DEBUG, "PASN: kek_len=%zu", pasn->kek_len);
 	}
 #endif /* CONFIG_ENC_ASSOC */
-- 
2.53.0




More information about the Hostap mailing list