ieee80211: Add support for EAPOL Key MIC lengths other than 16.
authorRichard Sharpe <realrichardsharpe@gmail.com>
Tue, 16 Jan 2018 03:37:56 +0000 (19:37 -0800)
committerAnders Broman <a.broman58@gmail.com>
Tue, 16 Jan 2018 06:08:48 +0000 (06:08 +0000)
This allows the user to override the EAPOL Key MIC length for those
crypto suites where the Key MIC length is greater than 16 bytes.

This works in the DPP case where the Key MIC length is supposed to be the
same as the Nonce length.

Change-Id: I8ef6bc978e0a44ece0e95d76b231a02c7f15c89b
Reviewed-on: https://code.wireshark.org/review/25332
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
epan/dissectors/packet-ieee80211.c

index d74f760705f658135716975f4392e5753ae5afcf..11c90184a347330e208adeec4e0479654877894e 100644 (file)
@@ -126,6 +126,9 @@ static gboolean wlan_ignore_draft_ht = FALSE;
 #define WLAN_IGNORE_PROT_W_IV   2
 static gint wlan_ignore_prot = WLAN_IGNORE_PROT_NO;
 
+/* The Key MIC len has been set by the user */
+static guint wlan_key_mic_len = 0;
+
 /* Table for reassembly of fragments. */
 static reassembly_table wlan_reassembly_table;
 
@@ -19852,11 +19855,21 @@ dissect_wlan_rsna_eapol_wpa_or_rsn_key(tvbuff_t *tvb, packet_info *pinfo, proto_
     &hf_wlan_rsna_eapol_wpa_keydes_keyinfo_smk_message,
     NULL
   };
+  guint16 eapol_data_offset = 76;  /* 92 - 16 */
+  guint16 eapol_key_mic_len = 0;
+
+  if (wlan_key_mic_len) {
+    eapol_data_offset += wlan_key_mic_len;
+    eapol_key_mic_len = wlan_key_mic_len;
+  } else {
+    eapol_data_offset = 92;
+    eapol_key_mic_len = 16;
+  }
 
   /*
    * RSNA key descriptors.
    */
-  eapol_data_len = tvb_get_ntohs(tvb, offset+92);
+  eapol_data_len = tvb_get_ntohs(tvb, offset+eapol_data_offset);
   keyinfo = tvb_get_ntohs(tvb, offset);
   if (keyinfo & KEY_INFO_REQUEST_MASK) {
     col_set_str(pinfo->cinfo, COL_INFO, "Key (Request)");
@@ -19940,8 +19953,8 @@ dissect_wlan_rsna_eapol_wpa_or_rsn_key(tvbuff_t *tvb, packet_info *pinfo, proto_
                       ENC_NA);
   offset += 8;
   proto_tree_add_item(tree, hf_wlan_rsna_eapol_wpa_keydes_mic, tvb, offset,
-                      16, ENC_NA);
-  offset += 16;
+                      eapol_key_mic_len, ENC_NA);
+  offset += eapol_key_mic_len;
   proto_tree_add_item(tree, hf_wlan_rsna_eapol_wpa_keydes_data_len, tvb,
                       offset, 2, ENC_BIG_ENDIAN);
   offset += 2;
@@ -28996,6 +29009,11 @@ proto_register_ieee80211(void)
     "and some also leave the IV (initialization vector).",
     &wlan_ignore_prot, wlan_ignore_prot_options, TRUE);
 
+  prefs_register_uint_preference(wlan_module, "wpa_key_mic_len",
+    "WPA Key MIC Length override",
+    "Some Key MIC lengths are greater than 16 bytes, so set the length you require",
+    10, &wlan_key_mic_len);
+
   prefs_register_obsolete_preference(wlan_module, "wep_keys");
 
   prefs_register_bool_preference(wlan_module, "enable_decryption",