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 hash_to_element_supported: Some(true),
27 ..Default::default()
28 }),
29 owe: Some(fidl_common::OweFeature { supported: Some(false), ..Default::default() }),
30 ..Default::default()
31 });
32
33pub fn fake_wpa2_s_rsne() -> Rsne {
34 fake_wpa2_a_rsne()
35 .derive_wpa2_s_rsne(&EMPTY_SECURITY_SUPPORT)
36 .expect("Unable to derive supplicant RSNE")
37}
38
39pub fn fake_wpa3_a_rsne() -> Rsne {
40 Rsne::wpa3_rsne()
41}
42
43pub fn fake_wpa3_s_rsne() -> Rsne {
44 let mut security_support = EMPTY_SECURITY_SUPPORT.clone();
45 security_support.mfp.as_mut().unwrap().supported = Some(true);
46 fake_wpa3_a_rsne()
47 .derive_wpa3_s_rsne(&security_support)
48 .expect("Unable to derive supplicant RSNE")
49}