wlan_common/ie/rsn/
fake_rsnes.rs1use crate::ie::rsn::akm::AKM_PSK;
6use crate::ie::rsn::cipher::{CIPHER_CCMP_128, CIPHER_TKIP};
7use crate::ie::rsn::rsne::Rsne;
8use fidl_fuchsia_wlan_common as fidl_common;
9
10pub fn fake_wpa2_a_rsne() -> Rsne {
11 Rsne {
12 group_data_cipher_suite: Some(CIPHER_CCMP_128),
13 pairwise_cipher_suites: vec![CIPHER_CCMP_128, CIPHER_TKIP],
14 akm_suites: vec![AKM_PSK],
15 ..Default::default()
16 }
17}
18
19use std::sync::LazyLock;
20static EMPTY_SECURITY_SUPPORT: LazyLock<fidl_common::SecuritySupport> =
21 LazyLock::new(|| fidl_common::SecuritySupport {
22 mfp: Some(fidl_common::MfpFeature { supported: Some(false), ..Default::default() }),
23 sae: Some(fidl_common::SaeFeature {
24 driver_handler_supported: Some(false),
25 sme_handler_supported: Some(true),
26 ..Default::default()
27 }),
28 ..Default::default()
29 });
30
31pub fn fake_wpa2_s_rsne() -> Rsne {
32 fake_wpa2_a_rsne()
33 .derive_wpa2_s_rsne(&EMPTY_SECURITY_SUPPORT)
34 .expect("Unable to derive supplicant RSNE")
35}
36
37pub fn fake_wpa3_a_rsne() -> Rsne {
38 Rsne::wpa3_rsne()
39}
40
41pub fn fake_wpa3_s_rsne() -> Rsne {
42 let mut security_support = EMPTY_SECURITY_SUPPORT.clone();
43 security_support.mfp.as_mut().unwrap().supported = Some(true);
44 fake_wpa3_a_rsne()
45 .derive_wpa3_s_rsne(&security_support)
46 .expect("Unable to derive supplicant RSNE")
47}