]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Allow forced enabling of EAPOL-Key msg 2/4 key info bits for testing
authorVeerendranath Jakkam <quic_vjakkam@quicinc.com>
Tue, 10 Sep 2024 21:36:15 +0000 (03:06 +0530)
committerJouni Malinen <j@w1.fi>
Thu, 19 Sep 2024 10:03:59 +0000 (13:03 +0300)
This can be used to increasing AP testing coverage for different 4-way
handshake behavior.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
src/rsn_supp/wpa.c
src/rsn_supp/wpa.h
src/rsn_supp/wpa_i.h
wpa_supplicant/ctrl_iface.c
wpa_supplicant/wpa_supplicant.c
wpa_supplicant/wpa_supplicant_i.h

index 06a0c1774ce47073c3ce3b7f3f1d1e7150d35df7..b7518f9b6f93d29b69ad3a9e7826d5a071d59361 100644 (file)
@@ -649,6 +649,8 @@ int wpa_supplicant_send_2_of_4(struct wpa_sm *sm, const unsigned char *dst,
 #ifdef CONFIG_TESTING_OPTIONS
        if (sm->encrypt_eapol_m2)
                key_info |= WPA_KEY_INFO_ENCR_KEY_DATA;
+       if (sm->eapol_2_key_info_set_mask)
+               key_info |= sm->eapol_2_key_info_set_mask;
 #endif /* CONFIG_TESTING_OPTIONS */
        WPA_PUT_BE16(reply->key_info, key_info);
        if (sm->proto == WPA_PROTO_RSN || sm->proto == WPA_PROTO_OSEN)
@@ -4972,6 +4974,9 @@ int wpa_sm_set_param(struct wpa_sm *sm, enum wpa_sm_conf_params param,
        case WPA_PARAM_ENCRYPT_EAPOL_M4:
                sm->encrypt_eapol_m4 = value;
                break;
+       case WPA_PARAM_EAPOL_2_KEY_INFO_SET_MASK:
+               sm->eapol_2_key_info_set_mask = value;
+               break;
 #endif /* CONFIG_TESTING_OPTIONS */
 #ifdef CONFIG_DPP2
        case WPA_PARAM_DPP_PFS:
index 9312018c5d32be7be8174efccf1b51e1128534bd..d8112c4c22aacb75fd6de0ac09cb55033762abe5 100644 (file)
@@ -139,6 +139,7 @@ enum wpa_sm_conf_params {
        WPA_PARAM_SSID_PROTECTION,
        WPA_PARAM_RSN_OVERRIDE,
        WPA_PARAM_RSN_OVERRIDE_SUPPORT,
+       WPA_PARAM_EAPOL_2_KEY_INFO_SET_MASK,
 };
 
 enum wpa_rsn_override {
index ef26b248f09cb2d80fd8ed75dc02bceb4ec2fc49..c2ea95bb742380b0677fee252ec55cf2b0e85897 100644 (file)
@@ -194,6 +194,7 @@ struct wpa_sm {
        unsigned int oci_freq_override_ft_assoc;
        unsigned int oci_freq_override_fils_assoc;
        unsigned int disable_eapol_g2_tx;
+       unsigned int eapol_2_key_info_set_mask;
        bool encrypt_eapol_m2;
        bool encrypt_eapol_m4;
 #endif /* CONFIG_TESTING_OPTIONS */
index 6dba46898d505f04e232f8eadf790235d907622b..b496ca3e64638cd5f3aab16e1f340354133685e6 100644 (file)
@@ -881,6 +881,8 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s,
        } else if (os_strcasecmp(cmd, "dpp_test") == 0) {
                dpp_test = atoi(value);
 #endif /* CONFIG_DPP */
+       } else if (os_strcasecmp(cmd, "eapol_2_key_info_set_mask") == 0) {
+               wpa_s->eapol_2_key_info_set_mask = strtoul(value, NULL, 0x10);
 #endif /* CONFIG_TESTING_OPTIONS */
 #ifdef CONFIG_FILS
        } else if (os_strcasecmp(cmd, "disable_fils") == 0) {
@@ -8957,6 +8959,7 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s)
        wpa_s->oci_freq_override_fils_assoc = 0;
        wpa_s->oci_freq_override_wnm_sleep = 0;
        wpa_s->disable_eapol_g2_tx = 0;
+       wpa_s->eapol_2_key_info_set_mask = 0;
        wpa_s->test_assoc_comeback_type = -1;
 #ifdef CONFIG_DPP
        os_free(wpa_s->dpp_config_obj_override);
index 81858327b4f27d271e705c1b8232e84ed1ac1dc7..74b113db886ce4f7ec99875e2be30e47668bc8f5 100644 (file)
@@ -2096,6 +2096,9 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
                         wpa_s->oci_freq_override_fils_assoc);
        wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_DISABLE_EAPOL_G2_TX,
                         wpa_s->disable_eapol_g2_tx);
+       wpa_sm_set_param(wpa_s->wpa,
+                        WPA_PARAM_EAPOL_2_KEY_INFO_SET_MASK,
+                        wpa_s->eapol_2_key_info_set_mask);
 #endif /* CONFIG_TESTING_OPTIONS */
 
        /* Extended Key ID is only supported in infrastructure BSS so far */
index 3f704ecfd95dbe682816e8dfd02fc19ad2ff9433..36194c97489908a44d1e9b530037f3cc053c4549 100644 (file)
@@ -1374,6 +1374,7 @@ struct wpa_supplicant {
        unsigned int oci_freq_override_fils_assoc;
        unsigned int oci_freq_override_wnm_sleep;
        unsigned int disable_eapol_g2_tx;
+       unsigned int eapol_2_key_info_set_mask;
        int test_assoc_comeback_type;
 #endif /* CONFIG_TESTING_OPTIONS */