qcacmn: Move RSNXE IE parsing to crypto module

Move RSNXE IE parsing to crypto module and add entry of RSNXE IE in
util_scan_copy_beacon_data() so that a copy of RSNXE IE remains in
scan entry cache and doesn't get free on scan result update.

Change-Id: I792c8636d7e1f21c6291158188ab2c1d241151ec
CRs-Fixed: 2780832
This commit is contained in:
Abhishek Ambure 2020-09-19 16:00:32 +05:30 • committed by snandini
commit a6c6790b93
6 changed files with 41 additions and 39 deletions

View file

@ -753,7 +753,6 @@ struct wlan_rsn_ie_hdr {
#define WLAN_RSN_IE_MIN_LEN 2
#define WLAN_WAPI_IE_MIN_LEN 20
#define WLAN_RSNX_CAPA_SAE_PK BIT(6)
/**
* struct wlan_wpa_ie_hdr: wpa ie header
@ -1796,42 +1795,6 @@ wlan_parse_oce_reduced_wan_metrics_ie(uint8_t *mbo_oce_ie,
return false;
}
/**
* wlan_parse_rsnxe_ie() - parse oce RSNXE IE
* @rsnxe_ie: RSNXE IE pointer
* @cap_len: pointer to hold len of ext capability
*
* While parsing beacon IEs, util_scan_populate_bcn_ie_list() validates
* length and element ID of RSNXE IE and then stores in scan cache.
* It is a callers responsiblity to get the rsnxe ie pointer
* using util_scan_entry_rsnxe() API, which points to rsnxe ie
* stored in scan cache. Thus caller is responsible for ensuring
* the length of the IE is consistent with the embedded length.
*
* Return: pointer to RSNXE capability or NULL
*/
static inline uint8_t *
wlan_parse_rsnxe_ie(uint8_t *rsnxe_ie, uint8_t *cap_len)
{
uint8_t len;
uint8_t *ie;
if (!rsnxe_ie)
return NULL;
ie = rsnxe_ie;
len = ie[1];
ie += 2;
if (!len)
return NULL;
*cap_len = ie[0] & 0xf;
return ie;
}
/**
* wlan_parse_oce_subnet_id_ie() - parse oce subnet id IE
* @mbo_oce_ie: MBO/OCE IE pointer

View file

@ -712,6 +712,16 @@ bool wlan_crypto_check_wpa_match(struct wlan_objmgr_psoc *psoc,
uint16_t ie_len, struct wlan_crypto_params *
peer_crypto_params);
/**
* wlan_crypto_parse_rsnxe_ie() - parse RSNXE IE
* @rsnxe_ie: RSNXE IE pointer
* @cap_len: pointer to hold len of ext capability
*
* Return: pointer to RSNXE capability or NULL
*/
uint8_t *
wlan_crypto_parse_rsnxe_ie(uint8_t *rsnxe_ie, uint8_t *cap_len);
/**
* wlan_set_vdev_crypto_prarams_from_ie - Sets vdev crypto params from IE info
* @vdev: vdev pointer

View file

@ -184,6 +184,12 @@ typedef enum wlan_crypto_rsn_cap {
WLAN_CRYPTO_RSN_CAP_OCV_SUPPORTED = 0x4000,
} wlan_crypto_rsn_cap;
enum wlan_crypto_rsnx_cap {
WLAN_CRYPTO_RSNX_CAP_PROTECTED_TWT = 0x10,
WLAN_CRYPTO_RSNX_CAP_SAE_H2E = 0x20,
WLAN_CRYPTO_RSNX_CAP_SAE_PK = 0x40,
};
typedef enum wlan_crypto_key_mgmt {
WLAN_CRYPTO_KEY_MGMT_IEEE8021X = 0,
WLAN_CRYPTO_KEY_MGMT_PSK = 1,

View file

@ -4261,6 +4261,27 @@ wlan_crypto_reset_prarams(struct wlan_crypto_params *params)
params->rsn_caps = 0;
}
uint8_t *
wlan_crypto_parse_rsnxe_ie(uint8_t *rsnxe_ie, uint8_t *cap_len)
{
uint8_t len;
uint8_t *ie;
if (!rsnxe_ie)
return NULL;
ie = rsnxe_ie;
len = ie[1];
ie += 2;
if (!len)
return NULL;
*cap_len = ie[0] & 0xf;
return ie;
}
QDF_STATUS wlan_set_vdev_crypto_prarams_from_ie(struct wlan_objmgr_vdev *vdev,
uint8_t *ie_ptr,
uint16_t ie_len)

View file

@ -26,6 +26,7 @@
#include "cfg_ucfg_api.h"
#include "wlan_cm_bss_score_param.h"
#include "wlan_scan_api.h"
#include "wlan_crypto_global_api.h"
#define CM_20MHZ_BW_INDEX 0
#define CM_40MHZ_BW_INDEX 1
@ -675,12 +676,12 @@ cm_calculate_sae_pk_ap_weightage(struct scan_cache_entry *entry,
rsnxe_ie = util_scan_entry_rsnxe(entry);
rsnxe_cap = wlan_parse_rsnxe_ie(rsnxe_ie, &cap_len);
rsnxe_cap = wlan_crypto_parse_rsnxe_ie(rsnxe_ie, &cap_len);
if (!rsnxe_cap)
return 0;
*sae_pk_cap_present = *rsnxe_cap & WLAN_RSNX_CAPA_SAE_PK;
*sae_pk_cap_present = *rsnxe_cap & WLAN_CRYPTO_RSNX_CAP_SAE_PK;
if (*sae_pk_cap_present)
return score_params->weight_config.sae_pk_ap_weightage *
CM_MAX_PCT_SCORE;

View file

@ -723,6 +723,7 @@ util_scan_copy_beacon_data(struct scan_cache_entry *new_entry,
ie_lst->extender = conv_ptr(ie_lst->extender, old_ptr, new_ptr);
ie_lst->adaptive_11r = conv_ptr(ie_lst->adaptive_11r, old_ptr, new_ptr);
ie_lst->single_pmk = conv_ptr(ie_lst->single_pmk, old_ptr, new_ptr);
ie_lst->rsnxe = conv_ptr(ie_lst->rsnxe, old_ptr, new_ptr);
return QDF_STATUS_SUCCESS;
}