[PATCH] Wifi: Support NVT-ASCII in passphrase

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

In this patch, we create a new function has_non_nvt_ascii_char which
allows the following control characters to be a part of a PSK
passphrase.

7 (Bell)
8 (Backspace)
9 (Horizontal tab)
10 (Line feed)
11 (Vertical tab)
12 (Form feed)
13 (Carriage return)

Best regards,
Isaac
From 09697aa1433abe1e46e4a1b5566d3a17cd4b27a9 Mon Sep 17 00:00:00 2001
From: Isaac Chiou <isaacchiou@xxxxxxxxxx>
Date: Tue, 23 Mar 2021 16:37:48 +0800
Subject: [PATCH] Wifi: Support NVT-ASCII in passphrase

Create a new function has_non_nvt_ascii_char which allows the following
control characters to be a part of a PSK passphrase

7 (Bell)
8 (Backspace)
9 (Horizontal tab)
10 (Line feed)
11 (Vertical tab)
12 (Form feed)
13 (Carriage return)

Signed-off-by: Isaac Chiou <isaacchiou@xxxxxxxxxx>
---
 src/utils/common.c | 14 ++++++++++++++
 src/utils/common.h |  1 +
 2 files changed, 15 insertions(+)

diff --git a/src/utils/common.c b/src/utils/common.c
index 2c1275193..20f1c6c3f 100644
--- a/src/utils/common.c
+++ b/src/utils/common.c
@@ -720,6 +720,20 @@ int has_ctrl_char(const u8 *data, size_t len)
 }
 
 
+int has_non_nvt_ascii_char(const u8 *data, size_t len)
+{
+	size_t i;
+
+	for (i = 0; i < len; i++) {
+		if (data[i] < 7
+			|| (13 < data[i] && data[i] < 32)
+				|| data[i] == 127)
+			return 1;
+	}
+	return 0;
+}
+
+
 int has_newline(const char *str)
 {
 	while (*str) {
diff --git a/src/utils/common.h b/src/utils/common.h
index 45f72bb30..660951ec6 100644
--- a/src/utils/common.h
+++ b/src/utils/common.h
@@ -509,6 +509,7 @@ const char * wpa_ssid_txt(const u8 *ssid, size_t ssid_len);
 char * wpa_config_parse_string(const char *value, size_t *len);
 int is_hex(const u8 *data, size_t len);
 int has_ctrl_char(const u8 *data, size_t len);
+int has_non_nvt_ascii_char(const u8 *data, size_t len);
 int has_newline(const char *str);
 size_t merge_byte_arrays(u8 *res, size_t res_len,
 			 const u8 *src1, size_t src1_len,
-- 
2.31.0.rc2.261.g7f71774620-goog

_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap

[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux