From patchwork Tue Mar 23 09:05:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaac Chiou X-Patchwork-Id: 1457321 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; helo=desiato.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=dvSdVM0G; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20161025 header.b=mT2ReJdp; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F4c7Q4WKxz9sR4 for ; Wed, 24 Mar 2021 03:21:22 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:Cc:To:Subject: Message-ID:Date:From:MIME-Version:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=d8MkmzUFZERtQSorBxZOVzUNDrdGoLRTq5OZOHN6h+I=; b=dvSdVM0GMhaeZ0MUJHCM22Hb+7 1DWmBKnZPxHrFpoZzbQXyvBolEUcTVpBxv2bv0Y94WUVvWMiIBWlPkluwLdeK1E818X5xHDOYZOD4 KybnzBp3xmcOUsYonBRi1YWLPEHJCOAPeBuAbPcn1jhewNhEcM3CYdMAPUCEaXUd2nhrHlqVekgWE +b2TDjHgS2QVHoWwwyFoI7Fm3pXu+d+anp7b6W10NjEhl5US/Pj2zTZV1y7R4CL9H2zH8g17QqYfw 1g0JDLfsxhXvBU8LAep7GjrZCmYOKDEpOi1SqLOlk4VCUZGIS1OYnEXPBOTLA6royLGAcz4iMoYhv i4horIuA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lOjle-00FIiM-1l; Tue, 23 Mar 2021 16:20:30 +0000 Received: from mail-yb1-xb2a.google.com ([2607:f8b0:4864:20::b2a]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lOcye-00EOH5-1R for hostap@lists.infradead.org; Tue, 23 Mar 2021 09:05:30 +0000 Received: by mail-yb1-xb2a.google.com with SMTP id o66so9574537ybg.10 for ; Tue, 23 Mar 2021 02:05:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=rfV4oKaJCSj3k7W9BCrQ5cUgPVhYKs9YlmGgGt+C/GE=; b=mT2ReJdp+xXp7D53n5at6Hp3GXXVuTY8KCmOP/Pu3iPRY9Sp7aqJKdU3Lzlo34iTjb Vy3bNyC4dYASBjYpUkUD3rcZj00ifK3BfY32vo5L6vidO8WO1+uPtNFql+TCrUlT14N1 qHYHc7yBPM5GDg5E+ZDEr8GrG+1ZETA5qlroqwS8MOkny5yO10JdBB0mw8RynDAQQ48c I9d2+qsC9Xn3fq1wCvyfXGDvDHYIa6Oah9+tsaYVkJlOKrRe9brvRbLVPjdNm1vvE8a1 5K4wKwVVXmWg4yenYsYNorj/K/69d6bwPg7MErKFwAWq4Ir0t2kBYwqpTxROooxY/qwb Ob9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=rfV4oKaJCSj3k7W9BCrQ5cUgPVhYKs9YlmGgGt+C/GE=; b=anQYhhhVTRJMczjwyyOdfddh74Qwhc3rHujRrplEX0y/0ff26kucXPyd0UlFZ2gN4S SUZnKh1B1Eoeuhsd+ywv6qXpV03PNev3QXY8AFLsOyhTSDOcFH6lBDGmcCcIU+3srn18 p6fESOAr9faGt6Sv8hf7Qo1WYjlJ2l3od3bJzmvJAizioKpdeGFBDNBbQKKMw1/fg0oz TR9f2piI7F4j6GkyqLJKutyAq6ywJqd3bODEHttY3OeEgW9ovXn/mTlhjEoIEWtkySsN eZTVb/4izKugeqnQyjrcvvj1jmHfRX+bIUi0kQoQHwcTgIF/h9EgP6rpfw8/xSeuuaqE dGBA== X-Gm-Message-State: AOAM532R4zI4kZwnSHygadxT1SVXqPtO5Ybavpd+9b6tNbbeqkTu4KY1 iLz3U/9mHJlM+4nABSP2sO53KqPr/arz44pAZ6spEGVt5a8Bbg== X-Google-Smtp-Source: ABdhPJxb0N6nr5TO7Tk0yaY7/Fw/QftPToGFoWsb4x5tIc424YKpoFAv3GdnxHmqwKxrVUdSXlo9cOoi4yqFMjSr3uw= X-Received: by 2002:a25:becd:: with SMTP id k13mr3789357ybm.459.1616490326503; Tue, 23 Mar 2021 02:05:26 -0700 (PDT) MIME-Version: 1.0 From: Isaac Chiou Date: Tue, 23 Mar 2021 17:05:15 +0800 Message-ID: Subject: [PATCH] Wifi: Support NVT-ASCII in passphrase To: hostap@lists.infradead.org Cc: Kuma Chang , Jimmy Chen , Etan Cohen , Hai Shalom X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210323_090528_356237_17A99E32 X-CRM114-Status: GOOD ( 12.88 ) X-Spam-Score: -15.7 (---------------) X-Spam-Report: Spam detection software, running on the system "desiato.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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) Content analysis details: (-15.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:b2a listed in] [list.dnswl.org] -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM white-list 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -7.5 USER_IN_DEF_SPF_WL From: address is in the default SPF white-list -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.5 ENV_AND_HDR_SPF_MATCH Env and Hdr From used in default SPF WL Match -0.0 DKIMWL_WL_MED DKIMwl.org - Medium trust sender X-Mailman-Approved-At: Tue, 23 Mar 2021 16:20:27 +0000 X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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 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 --- 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