diff mbox series

Add support for CCMP-256 and GCMP-256 ciphers

Message ID 20220818094435.189176-1-schreibubi@gmail.com
State Superseded
Delegated to: Hauke Mehrtens
Headers show
Series Add support for CCMP-256 and GCMP-256 ciphers | expand

Commit Message

Joerg Werner Aug. 18, 2022, 9:44 a.m. UTC
Signed-off-by: Joerg Werner <schreibubi@gmail.com>
---
 include/iwinfo.h | 22 ++++++++++++----------
 iwinfo_cli.c     |  6 ++++++
 iwinfo_lua.c     |  6 ++++++
 iwinfo_nl80211.c | 14 ++++++++------
 iwinfo_utils.c   | 10 ++++++++--
 5 files changed, 40 insertions(+), 18 deletions(-)

Comments

Hauke Mehrtens Aug. 18, 2022, 4:29 p.m. UTC | #1
On 8/18/22 11:44, Joerg Werner wrote:
> Signed-off-by: Joerg Werner <schreibubi@gmail.com>
> ---
>   include/iwinfo.h | 22 ++++++++++++----------
>   iwinfo_cli.c     |  6 ++++++
>   iwinfo_lua.c     |  6 ++++++
>   iwinfo_nl80211.c | 14 ++++++++------
>   iwinfo_utils.c   | 10 ++++++++--
>   5 files changed, 40 insertions(+), 18 deletions(-)
> 

Please extend the IWINFO_CIPHER_NAMES table in iwinfo_lib.c too. It also 
misses GCMP.

Hauke
diff mbox series

Patch

diff --git a/include/iwinfo.h b/include/iwinfo.h
index e9b7451..576632d 100644
--- a/include/iwinfo.h
+++ b/include/iwinfo.h
@@ -36,16 +36,18 @@ 
 #define IWINFO_BAND_6        (1 << 2)
 #define IWINFO_BAND_60       (1 << 3)
 
-#define IWINFO_CIPHER_NONE   (1 << 0)
-#define IWINFO_CIPHER_WEP40  (1 << 1)
-#define IWINFO_CIPHER_TKIP   (1 << 2)
-#define IWINFO_CIPHER_WRAP   (1 << 3)
-#define IWINFO_CIPHER_CCMP   (1 << 4)
-#define IWINFO_CIPHER_WEP104 (1 << 5)
-#define IWINFO_CIPHER_AESOCB (1 << 6)
-#define IWINFO_CIPHER_CKIP   (1 << 7)
-#define IWINFO_CIPHER_GCMP   (1 << 8)
-#define IWINFO_CIPHER_COUNT  9
+#define IWINFO_CIPHER_NONE    (1 << 0)
+#define IWINFO_CIPHER_WEP40   (1 << 1)
+#define IWINFO_CIPHER_TKIP    (1 << 2)
+#define IWINFO_CIPHER_WRAP    (1 << 3)
+#define IWINFO_CIPHER_CCMP    (1 << 4)
+#define IWINFO_CIPHER_WEP104  (1 << 5)
+#define IWINFO_CIPHER_AESOCB  (1 << 6)
+#define IWINFO_CIPHER_CKIP    (1 << 7)
+#define IWINFO_CIPHER_GCMP    (1 << 8)
+#define IWINFO_CIPHER_CCMP256 (1 << 9)
+#define IWINFO_CIPHER_GCMP256 (1 << 10)
+#define IWINFO_CIPHER_COUNT  11
 
 #define IWINFO_KMGMT_NONE    (1 << 0)
 #define IWINFO_KMGMT_8021x   (1 << 1)
diff --git a/iwinfo_cli.c b/iwinfo_cli.c
index 456c67a..dca86cf 100644
--- a/iwinfo_cli.c
+++ b/iwinfo_cli.c
@@ -158,9 +158,15 @@  static char * format_enc_ciphers(int ciphers)
 	if (ciphers & IWINFO_CIPHER_CCMP)
 		pos += sprintf(pos, "CCMP, ");
 
+	if (ciphers & IWINFO_CIPHER_CCMP256)
+		pos += sprintf(pos, "CCMP-256, ");
+
 	if (ciphers & IWINFO_CIPHER_GCMP)
 		pos += sprintf(pos, "GCMP, ");
 
+	if (ciphers & IWINFO_CIPHER_GCMP256)
+		pos += sprintf(pos, "GCMP-256, ");
+
 	if (ciphers & IWINFO_CIPHER_WRAP)
 		pos += sprintf(pos, "WRAP, ");
 
diff --git a/iwinfo_lua.c b/iwinfo_lua.c
index e49e454..a2fe9d1 100644
--- a/iwinfo_lua.c
+++ b/iwinfo_lua.c
@@ -61,9 +61,15 @@  static char * iwinfo_crypto_print_ciphers(int ciphers)
 	if (ciphers & IWINFO_CIPHER_CCMP)
 		pos += sprintf(pos, "CCMP, ");
 
+	if (ciphers & IWINFO_CIPHER_CCMP256)
+		pos += sprintf(pos, "CCMP-256, ");
+
 	if (ciphers & IWINFO_CIPHER_GCMP)
 		pos += sprintf(pos, "GCMP, ");
 
+	if (ciphers & IWINFO_CIPHER_GCMP256)
+		pos += sprintf(pos, "GCMP-256, ");
+
 	if (ciphers & IWINFO_CIPHER_WRAP)
 		pos += sprintf(pos, "WRAP, ");
 
diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index adb8c45..30da680 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -1708,12 +1708,14 @@  static struct {
 	const char *match;
 	int cipher;
 } wpa_cipher_strings[] = {
-	{ "WEP-104", IWINFO_CIPHER_WEP104 },
-	{ "WEP-40",  IWINFO_CIPHER_WEP40 },
-	{ "NONE",    IWINFO_CIPHER_NONE },
-	{ "TKIP",    IWINFO_CIPHER_TKIP },
-	{ "CCMP",    IWINFO_CIPHER_CCMP },
-	{ "GCMP",    IWINFO_CIPHER_GCMP }
+	{ "WEP-104", IWINFO_CIPHER_WEP104  },
+	{ "WEP-40",  IWINFO_CIPHER_WEP40   },
+	{ "NONE",    IWINFO_CIPHER_NONE    },
+	{ "TKIP",    IWINFO_CIPHER_TKIP    },
+	{ "CCMP-256",IWINFO_CIPHER_CCMP256 },
+	{ "CCMP",    IWINFO_CIPHER_CCMP    },
+	{ "GCMP-256",IWINFO_CIPHER_GCMP256 },
+	{ "GCMP",    IWINFO_CIPHER_GCMP    }
 };
 
 static void parse_wpa_ciphers(const char *str, uint16_t *ciphers)
diff --git a/iwinfo_utils.c b/iwinfo_utils.c
index d071997..f5eb398 100644
--- a/iwinfo_utils.c
+++ b/iwinfo_utils.c
@@ -316,10 +316,16 @@  static void iwinfo_parse_rsn_cipher(uint8_t idx, uint16_t *ciphers)
 			*ciphers |= IWINFO_CIPHER_GCMP;
 			break;
 
+		case 9:
+			*ciphers |= IWINFO_CIPHER_GCMP256;
+			break;
+
+		case 10:
+			*ciphers |= IWINFO_CIPHER_CCMP256;
+			break;
+
 		case 6:  /* AES-128-CMAC */
 		case 7:  /* No group addressed */
-		case 9:  /* GCMP-256 */
-		case 10: /* CCMP-256 */
 		case 11: /* BIP-GMAC-128 */
 		case 12: /* BIP-GMAC-256 */
 		case 13: /* BIP-CMAC-256 */