]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
RSNO: Always enable SNonce cookie and RSN Override elements validation
authorVeerendranath Jakkam <quic_vjakkam@quicinc.com>
Tue, 13 Aug 2024 18:12:48 +0000 (23:42 +0530)
committerJouni Malinen <j@w1.fi>
Thu, 15 Aug 2024 17:45:55 +0000 (20:45 +0300)
Always set SNonce cookie and enable RSN Override elements validation
irrespective of the RSN Selection element usage in (Re)Association
Request frame when RSN overriding supported.

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/sme.c
wpa_supplicant/wpa_supplicant.c

index 67bfe7f6071d03331f2b4169fd54f598eebe9f9e..06a0c1774ce47073c3ce3b7f3f1d1e7150d35df7 100644 (file)
@@ -1023,7 +1023,7 @@ static void wpa_supplicant_process_1_of_4(struct wpa_sm *sm,
                                "WPA: Failed to get random data for SNonce");
                        goto failed;
                }
-               if (sm->rsn_override != RSN_OVERRIDE_NOT_USED)
+               if (wpa_sm_rsn_overriding_supported(sm))
                        rsn_set_snonce_cookie(sm->snonce);
                sm->renew_snonce = 0;
                wpa_hexdump(MSG_DEBUG, "WPA: Renewed SNonce",
@@ -2228,8 +2228,7 @@ static int wpa_supplicant_validate_ie(struct wpa_sm *sm,
                return -1;
        }
 
-       if (sm->proto == WPA_PROTO_RSN &&
-           sm->rsn_override != RSN_OVERRIDE_NOT_USED) {
+       if (sm->proto == WPA_PROTO_RSN && wpa_sm_rsn_overriding_supported(sm)) {
                if ((sm->ap_rsne_override && !ie->rsne_override) ||
                    (!sm->ap_rsne_override && ie->rsne_override) ||
                    (sm->ap_rsne_override && ie->rsne_override &&
@@ -2532,7 +2531,7 @@ static int wpa_supplicant_validate_link_kde(struct wpa_sm *sm, u8 link_id,
                goto fail;
        }
 
-       if (sm->rsn_override == RSN_OVERRIDE_NOT_USED)
+       if (!wpa_sm_rsn_overriding_supported(sm))
                return 0;
 
        if (rsn_override_link_kde) {
@@ -4991,6 +4990,9 @@ int wpa_sm_set_param(struct wpa_sm *sm, enum wpa_sm_conf_params param,
        case WPA_PARAM_RSN_OVERRIDE:
                sm->rsn_override = value;
                break;
+       case WPA_PARAM_RSN_OVERRIDE_SUPPORT:
+               sm->rsn_override_support = value;
+               break;
        default:
                break;
        }
@@ -5099,6 +5101,17 @@ int wpa_sm_pmf_enabled(struct wpa_sm *sm)
 }
 
 
+bool wpa_sm_rsn_overriding_supported(struct wpa_sm *sm)
+{
+       const u8 *rsne;
+       size_t rsne_len;
+
+       rsne = wpa_sm_get_ap_rsne(sm, &rsne_len);
+
+       return sm->rsn_override_support && rsne;
+}
+
+
 int wpa_sm_ext_key_id(struct wpa_sm *sm)
 {
        return sm ? sm->ext_key_id : 0;
index d85dd9ac9801bb4e6e0d29cc7cda19116d97706b..9312018c5d32be7be8174efccf1b51e1128534bd 100644 (file)
@@ -138,6 +138,7 @@ enum wpa_sm_conf_params {
        WPA_PARAM_FT_PREPEND_PMKID,
        WPA_PARAM_SSID_PROTECTION,
        WPA_PARAM_RSN_OVERRIDE,
+       WPA_PARAM_RSN_OVERRIDE_SUPPORT,
 };
 
 enum wpa_rsn_override {
index 8ac4fe1eb80af65bcc035849bcdde56d26deb61b..ef26b248f09cb2d80fd8ed75dc02bceb4ec2fc49 100644 (file)
@@ -233,6 +233,7 @@ struct wpa_sm {
        bool driver_bss_selection;
        bool ft_prepend_pmkid;
 
+       bool rsn_override_support;
        enum wpa_rsn_override rsn_override;
 };
 
@@ -547,5 +548,6 @@ int wpa_derive_ptk_ft(struct wpa_sm *sm, const unsigned char *src_addr,
 
 void wpa_tdls_assoc(struct wpa_sm *sm);
 void wpa_tdls_disassoc(struct wpa_sm *sm);
+bool wpa_sm_rsn_overriding_supported(struct wpa_sm *sm);
 
 #endif /* WPA_I_H */
index 443b0b6676f58bd6aeadfb70f48fed5c7fb8471f..9b083cddd85717185c8742765b3a31f8964c8549 100644 (file)
@@ -2467,6 +2467,8 @@ mscs_fail:
                wpa_s->sme.assoc_req_ie_len += multi_ap_ie_len;
        }
 
+       wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_RSN_OVERRIDE_SUPPORT,
+                        wpas_rsn_overriding(wpa_s));
        wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_RSN_OVERRIDE,
                         RSN_OVERRIDE_NOT_USED);
        if (wpas_rsn_overriding(wpa_s) &&
index a15351e53f6ba9cd9f0bac1374687a242cbd7117..81858327b4f27d271e705c1b8232e84ed1ac1dc7 100644 (file)
@@ -3965,6 +3965,8 @@ mscs_end:
                wpa_ie_len += multi_ap_ie_len;
        }
 
+       wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_RSN_OVERRIDE_SUPPORT,
+                        wpas_rsn_overriding(wpa_s));
        wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_RSN_OVERRIDE,
                         RSN_OVERRIDE_NOT_USED);
        if (wpas_rsn_overriding(wpa_s) &&