Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4af91837 authored by Abhishek Ambure's avatar Abhishek Ambure Committed by Madan Koyyalamudi
Browse files

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
parent ebce224b
Loading
Loading
Loading
Loading
+0 −37
Original line number Diff line number Diff line
@@ -709,7 +709,6 @@ struct wlan_rsn_ie {
};

#define WLAN_WAPI_IE_MIN_LEN            20
#define WLAN_RSNX_CAPA_SAE_PK BIT(6)

/**
 * struct wlan_wpa_ie_hdr: wpa ie header
@@ -1848,42 +1847,6 @@ static inline QDF_STATUS wlan_parse_rsn_ie(uint8_t *rsn_ie,
	return QDF_STATUS_SUCCESS;
}

/**
 * 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_wpa_ie() - parse wpa ie
 * @wpa_ie: wpa ie ptr
+10 −0
Original line number Diff line number Diff line
@@ -711,6 +711,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
+6 −0
Original line number Diff line number Diff line
@@ -178,6 +178,12 @@ typedef enum wlan_crypto_rsn_cap {
	WLAN_CRYPTO_RSN_CAP_MFP_REQUIRED  = 0x40,
} 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,
+21 −0
Original line number Diff line number Diff line
@@ -4064,6 +4064,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)
+3 −2
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#include "wlan_policy_mgr_api.h"
#endif
#include "wlan_reg_services_api.h"
#include "wlan_crypto_global_api.h"

#define SCM_20MHZ_BW_INDEX                  0
#define SCM_40MHZ_BW_INDEX                  1
@@ -688,12 +689,12 @@ scm_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_cfg.sae_pk_ap_weightage *
			MAX_INDEX_SCORE;
Loading