Wireless Daemon for Linux
 help / color / mirror / Atom feed
* [PATCH 01/16] wscutil: Handle a deprecated network key format
@ 2020-08-13  0:50 Andrew Zaborowski
  2020-08-13  0:50 ` [PATCH 02/16] eapol: Use the require_handshake flag for FILS Andrew Zaborowski
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Andrew Zaborowski @ 2020-08-13  0:50 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 1172 bytes --]

Implement a note from the spec saying that implementations should handle
NUL-terminated Network Keys inside credentials structures.
---
 src/wscutil.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/wscutil.c b/src/wscutil.c
index 6b445ce4..a41702e8 100644
--- a/src/wscutil.c
+++ b/src/wscutil.c
@@ -362,13 +362,25 @@ static bool extract_network_key(struct wsc_attr_iter *iter, void *data)
 {
 	struct iovec *network_key = data;
 	unsigned int len;
+	const uint8_t *key;
 
 	len = wsc_attr_iter_get_length(iter);
 	if (len > 64)
 		return false;
 
+	/*
+	 * WSC 2.0.5, Section 12, Network Key:
+	 * "Some existing implementations based on v1.0h null-terminate the
+	 * passphrase value, i.e., add an extra 0x00 octet into the end of
+	 * the value. For backwards compatibility, implementations shall be
+	 * able to parse such a value"
+	 */
+	key = wsc_attr_iter_get_data(iter);
+	if (len && key[len - 1] == 0x00)
+		len--;
+
 	network_key->iov_len = len;
-	network_key->iov_base = (void *) wsc_attr_iter_get_data(iter);
+	network_key->iov_base = (void *) key;
 
 	return true;
 }
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-08-13 23:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-13  0:50 [PATCH 01/16] wscutil: Handle a deprecated network key format Andrew Zaborowski
2020-08-13  0:50 ` [PATCH 02/16] eapol: Use the require_handshake flag for FILS Andrew Zaborowski
2020-08-13  0:50 ` [PATCH 03/16] eapol: Don't re-build the AP RSNE in authenticator mode Andrew Zaborowski
2020-08-13  0:50 ` [PATCH 04/16] eapol: Don't try setting protocol_version in eapol_rx_auth_packet Andrew Zaborowski
2020-08-13  0:50 ` [PATCH 05/16] eapol: Use eapol_sm_write in authenticator mode Andrew Zaborowski
2020-08-13  0:50 ` [PATCH 06/16] eapol: Basic EAP support " Andrew Zaborowski
2020-08-13 16:23   ` Denis Kenzior
2020-08-13 23:47     ` Andrew Zaborowski
2020-08-13  0:50 ` [PATCH 07/16] eap: Simplify sending EAP method responses Andrew Zaborowski
2020-08-13 15:38   ` Denis Kenzior
2020-08-13 15:31 ` [PATCH 01/16] wscutil: Handle a deprecated network key format Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox