From patchwork Tue Jan 5 14:45:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 1422512 X-Patchwork-Delegate: daniel@makrotopia.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=makrotopia.org 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=merlin.20170209 header.b=aydkJOVX; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (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 4D9Fkz4NQKz9sVq for ; Wed, 6 Jan 2021 01:49:31 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:To:From:Date: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=oSujCBB5vXTE2/WGWd43CHf0MWWWO6YE9j1Po44xxMk=; b=aydkJOVX5jtX6hVJonvHs369fZ PHda6xWP146YCkngOHgp+nprMEgHNvwBdNiU7CvouMa6qG6fCsrZ54MP0dU+QWuGyllQr/d02Sn59 rjG2Etl/LBJhGKzbOQaflKDkwdO2ZjQQg9QNxR+F1XPn7zKNaRWkDIhYgkmxHm6V1MiViRy8uYt5S jQ9epc+ZxbyzOt9huJUmW6v5Pb+IXEjSUyqCnl5eBomR3Fsvaw39haXNOgbFImP3t+RYXpT+wCuM0 pvlnBbs2F1lurpEABJaHkZP8Bk6k4CsZoGXS7eP2jcweRcYxkrUfa482HomlzZ6LZAMQVqAZA4b5I b/mdnNGA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kwnco-0002Zw-P2; Tue, 05 Jan 2021 14:47:54 +0000 Received: from fudo.makrotopia.org ([185.142.180.71]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kwnck-0002Ya-39 for openwrt-devel@lists.openwrt.org; Tue, 05 Jan 2021 14:47:51 +0000 Received: from local by fudo.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.93.0.4) (envelope-from ) id 1kwnae-000850-7P; Tue, 05 Jan 2021 15:45:40 +0100 Date: Tue, 5 Jan 2021 14:45:27 +0000 From: Daniel Golle To: openwrt-devel@lists.openwrt.org Subject: [PATCH 1/2 iwinfo] iwinfo: add support for GCMP cipher Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210105_094750_176742_F8307F7A X-CRM114-Status: GOOD ( 13.52 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gary Cooper , Jo-Philipp Wich , Paul Fertser , Robert Marko , Alexander Couzens , Adrian Schmutzler Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Extend support for WPA ciphers by GCMP which is required for 802.11ad. Breaks ABI as ciphers now needs to be a field of 16 bits instead of 8. Signed-off-by: Daniel Golle --- include/iwinfo.h | 7 ++++--- include/iwinfo/utils.h | 2 +- iwinfo_cli.c | 3 +++ iwinfo_lua.c | 3 +++ iwinfo_nl80211.c | 5 +++-- iwinfo_utils.c | 9 ++++++--- 6 files changed, 20 insertions(+), 9 deletions(-) diff --git a/include/iwinfo.h b/include/iwinfo.h index 5e64294..ac70997 100644 --- a/include/iwinfo.h +++ b/include/iwinfo.h @@ -38,7 +38,8 @@ #define IWINFO_CIPHER_WEP104 (1 << 5) #define IWINFO_CIPHER_AESOCB (1 << 6) #define IWINFO_CIPHER_CKIP (1 << 7) -#define IWINFO_CIPHER_COUNT 8 +#define IWINFO_CIPHER_GCMP (1 << 8) +#define IWINFO_CIPHER_COUNT 9 #define IWINFO_KMGMT_NONE (1 << 0) #define IWINFO_KMGMT_8021x (1 << 1) @@ -164,8 +165,8 @@ struct iwinfo_freqlist_entry { struct iwinfo_crypto_entry { uint8_t enabled; uint8_t wpa_version; - uint8_t group_ciphers; - uint8_t pair_ciphers; + uint16_t group_ciphers; + uint16_t pair_ciphers; uint8_t auth_suites; uint8_t auth_algs; }; diff --git a/include/iwinfo/utils.h b/include/iwinfo/utils.h index 98b9c89..1fa4f52 100644 --- a/include/iwinfo/utils.h +++ b/include/iwinfo/utils.h @@ -54,7 +54,7 @@ struct iwinfo_hardware_entry * iwinfo_hardware(struct iwinfo_hardware_id *id); int iwinfo_hardware_id_from_mtd(struct iwinfo_hardware_id *id); void iwinfo_parse_rsn(struct iwinfo_crypto_entry *c, uint8_t *data, uint8_t len, - uint8_t defcipher, uint8_t defauth); + uint16_t defcipher, uint8_t defauth); struct uci_section *iwinfo_uci_get_radio(const char *name, const char *type); void iwinfo_uci_free(void); diff --git a/iwinfo_cli.c b/iwinfo_cli.c index 0332bc2..ed62da8 100644 --- a/iwinfo_cli.c +++ b/iwinfo_cli.c @@ -158,6 +158,9 @@ static char * format_enc_ciphers(int ciphers) if (ciphers & IWINFO_CIPHER_CCMP) pos += sprintf(pos, "CCMP, "); + if (ciphers & IWINFO_CIPHER_GCMP) + pos += sprintf(pos, "GCMP, "); + if (ciphers & IWINFO_CIPHER_WRAP) pos += sprintf(pos, "WRAP, "); diff --git a/iwinfo_lua.c b/iwinfo_lua.c index 58a5537..abe848b 100644 --- a/iwinfo_lua.c +++ b/iwinfo_lua.c @@ -61,6 +61,9 @@ static char * iwinfo_crypto_print_ciphers(int ciphers) if (ciphers & IWINFO_CIPHER_CCMP) pos += sprintf(pos, "CCMP, "); + if (ciphers & IWINFO_CIPHER_GCMP) + pos += sprintf(pos, "GCMP, "); + if (ciphers & IWINFO_CIPHER_WRAP) pos += sprintf(pos, "WRAP, "); diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c index 2b2a043..07cd916 100644 --- a/iwinfo_nl80211.c +++ b/iwinfo_nl80211.c @@ -1582,10 +1582,11 @@ static struct { { "WEP-40", IWINFO_CIPHER_WEP40 }, { "NONE", IWINFO_CIPHER_NONE }, { "TKIP", IWINFO_CIPHER_TKIP }, - { "CCMP", IWINFO_CIPHER_CCMP } + { "CCMP", IWINFO_CIPHER_CCMP }, + { "GCMP", IWINFO_CIPHER_GCMP } }; -static void parse_wpa_ciphers(const char *str, uint8_t *ciphers) +static void parse_wpa_ciphers(const char *str, uint16_t *ciphers) { int i; size_t l; diff --git a/iwinfo_utils.c b/iwinfo_utils.c index b4f98a9..d071997 100644 --- a/iwinfo_utils.c +++ b/iwinfo_utils.c @@ -285,7 +285,7 @@ int iwinfo_hardware_id_from_mtd(struct iwinfo_hardware_id *id) return (id->vendor_id && id->device_id) ? 0 : -1; } -static void iwinfo_parse_rsn_cipher(uint8_t idx, uint8_t *ciphers) +static void iwinfo_parse_rsn_cipher(uint8_t idx, uint16_t *ciphers) { switch (idx) { @@ -312,9 +312,12 @@ static void iwinfo_parse_rsn_cipher(uint8_t idx, uint8_t *ciphers) *ciphers |= IWINFO_CIPHER_WEP104; break; + case 8: + *ciphers |= IWINFO_CIPHER_GCMP; + break; + case 6: /* AES-128-CMAC */ case 7: /* No group addressed */ - case 8: /* GCMP */ case 9: /* GCMP-256 */ case 10: /* CCMP-256 */ case 11: /* BIP-GMAC-128 */ @@ -325,7 +328,7 @@ static void iwinfo_parse_rsn_cipher(uint8_t idx, uint8_t *ciphers) } void iwinfo_parse_rsn(struct iwinfo_crypto_entry *c, uint8_t *data, uint8_t len, - uint8_t defcipher, uint8_t defauth) + uint16_t defcipher, uint8_t defauth) { uint16_t i, count; uint8_t wpa_version = 0;