[PATCH 1/2] wlantest: support PASN-PTK

Johannes Berg johannes at sipsolutions.net
Wed Mar 4 00:44:54 PST 2026


From: Johannes Berg <johannes.berg at intel.com>

This is 80 octets, 32 KCK/16 KEK/32 TK. Implement splitting
it up this way in wlantest.

Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
 wlantest/wlantest.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/wlantest/wlantest.c b/wlantest/wlantest.c
index b84b4c36b222..02ffadf98f2c 100644
--- a/wlantest/wlantest.c
+++ b/wlantest/wlantest.c
@@ -207,7 +207,7 @@ static int add_pmk_file(struct wlantest *wt, const char *pmk_file)
 static int add_ptk_file(struct wlantest *wt, const char *ptk_file)
 {
 	FILE *f;
-	u8 ptk[64];
+	u8 ptk[80];
 	size_t ptk_len;
 	char buf[300], *pos;
 	struct wlantest_ptk *p;
@@ -228,7 +228,8 @@ static int add_ptk_file(struct wlantest *wt, const char *ptk_file)
 			continue;
 		ptk_len /= 2;
 		if (ptk_len != 16 && ptk_len != 32 &&
-		    ptk_len != 48 && ptk_len != 64)
+		    ptk_len != 48 && ptk_len != 64 &&
+		    ptk_len != 80)
 			continue;
 		if (hexstr2bin(buf, ptk, ptk_len) < 0)
 			continue;
@@ -239,6 +240,14 @@ static int add_ptk_file(struct wlantest *wt, const char *ptk_file)
 			os_memcpy(p->ptk.tk, ptk, ptk_len);
 			p->ptk.tk_len = ptk_len;
 			p->ptk_len = 32 + ptk_len;
+		} else if (ptk_len == 80) {
+			os_memcpy(p->ptk.kck, ptk, 32);
+			p->ptk.kck_len = 32;
+			os_memcpy(p->ptk.kek, ptk + 32, 16);
+			p->ptk.kek_len = 16;
+			os_memcpy(p->ptk.tk, ptk + 32 + 16, ptk_len - 32 - 16);
+			p->ptk.tk_len = ptk_len - 32 - 16;
+			p->ptk_len = ptk_len;
 		} else {
 			os_memcpy(p->ptk.kck, ptk, 16);
 			p->ptk.kck_len = 16;
-- 
2.53.0




More information about the Hostap mailing list