Skip to contentSkip to conversation

handshake: fix OWE PTK derivation

PATCH Applied James Prestwood 2 participants 2 messages Mar 24, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 handshake: fix OWE PTK derivation

This bug has been in here since OWE was written, but a similar bug also existed in hostapd which allowed the PTK derivation to be identical. In January 2020 hostapd fixed this bug, which now makes IWD incompatible when using group 20 or 21.

This patch fixes the bug for IWD, so now OWE should be compatible with recent hostapd version. This will break compatibility with old hostapd versions which still have this bug.

---
 src/handshake.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
src/handshake.c +10 -2
index bb376441..1cab48f1 100644
@@ -410,14 +410,22 @@ bool handshake_state_derive_ptk(struct handshake_state *s)
 
 	s->ptk_complete = false;
 
-	if (s->akm_suite & (IE_RSN_AKM_SUITE_FILS_SHA384 |
+	if (s->akm_suite & IE_RSN_AKM_SUITE_OWE) {
+		if (s->pmk_len == 32)
+			type = L_CHECKSUM_SHA256;
+		else if (s->pmk_len == 48)
+			type = L_CHECKSUM_SHA384;
+		else if (s->pmk_len == 64)
+			type = L_CHECKSUM_SHA512;
+		else
+			return false;
+	} else if (s->akm_suite & (IE_RSN_AKM_SUITE_FILS_SHA384 |
 			IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA384))
 		type = L_CHECKSUM_SHA384;
 	else if (s->akm_suite & (IE_RSN_AKM_SUITE_8021X_SHA256 |
 			IE_RSN_AKM_SUITE_PSK_SHA256 |
 			IE_RSN_AKM_SUITE_SAE_SHA256 |
 			IE_RSN_AKM_SUITE_FT_OVER_SAE_SHA256 |
-			IE_RSN_AKM_SUITE_OWE |
 			IE_RSN_AKM_SUITE_FILS_SHA256 |
 			IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA256 |
 			IE_RSN_AKM_SUITE_OSEN))
Signature · 1 line
2.21.1
#1 lore raw

Hi James,

Quoted 5 lines · James Prestwood

This bug has been in here since OWE was written, but a similar bug also existed in hostapd which allowed the PTK derivation to be identical. In January 2020 hostapd fixed this bug, which now makes IWD incompatible when using group 20 or 21.

Quoted 7 lines

This patch fixes the bug for IWD, so now OWE should be compatible with recent hostapd version. This will break compatibility with old hostapd versions which still have this bug.

---
  src/handshake.c | 12 ++++++++++--
  1 file changed, 10 insertions(+), 2 deletions(-)

Applied, thanks.

Regards,
-Denis