qcacmn: Introduce crypto API for single pmk AP cache management

Add new crypto API to set the single PMK AP flag in
crypto pmksa entry and to clear the BSSID entries in the
crypto pmk cache with the SAE single pmk flag set.

Clear the entries with Sae single pmk flag on connection
and roaming success case. Mark the BSS as Sae pmk capable
after initial connection and roaming if the AP advertises
the VSIE

Change-Id: I42ca0c3a70945f974eec1065661ac0b781096126
CRs-Fixed: 2652936
This commit is contained in:
Pragaspathi Thilagaraj 2020-04-14 01:11:09 +05:30 • committed by nshrivas
commit 91be4be6de
3 changed files with 107 additions and 0 deletions

View file

@ -923,4 +923,42 @@ QDF_STATUS wlan_crypto_set_del_pmksa(struct wlan_objmgr_vdev *vdev,
struct wlan_crypto_pmksa *pmksa,
bool set);
#if defined(WLAN_SAE_SINGLE_PMK) && defined(WLAN_FEATURE_ROAM_OFFLOAD)
/**
* wlan_crypto_selective_clear_sae_single_pmk_entries - Clear the PMK entries
* for BSS which have the single PMK flag set other than the current connected
* AP
* @vdev: Vdev
* @conn_bssid: Connected bssid
*/
void
wlan_crypto_selective_clear_sae_single_pmk_entries(
struct wlan_objmgr_vdev *vdev, struct qdf_mac_addr *conn_bssid);
/**
* wlan_crypto_set_sae_single_pmk_bss_cap - Set the peer SAE sinlge pmk
* feature supported status
* @vdev: Vdev
* @bssid: BSSID for which the flag is to be set
* @single_pmk_capable_bss: Flag to indicate Sae single pmk supported BSSID or
* not
*/
void wlan_crypto_set_sae_single_pmk_bss_cap(struct wlan_objmgr_vdev *vdev,
struct qdf_mac_addr *bssid,
bool single_pmk_capable_bss);
#else
static inline void
wlan_crypto_selective_clear_sae_single_pmk_entries(
struct wlan_objmgr_vdev *vdev, struct qdf_mac_addr *conn_bssid)
{
}
static inline
void wlan_crypto_set_sae_single_pmk_bss_cap(struct wlan_objmgr_vdev *vdev,
struct qdf_mac_addr *bssid,
bool single_pmk_capable_bss)
{
}
#endif
#endif /* end of _WLAN_CRYPTO_GLOBAL_API_H_ */

View file

@ -226,6 +226,7 @@ enum wlan_crypto_key_type {
* @ssid_len: ssid length
* @ssid: ssid information
* @cache_id: cache id
* @single_pmk_supported: SAE single pmk supported BSS
*/
struct wlan_crypto_pmksa {
struct qdf_mac_addr bssid;
@ -235,6 +236,9 @@ struct wlan_crypto_pmksa {
uint8_t ssid_len;
uint8_t ssid[WLAN_SSID_MAX_LEN];
uint8_t cache_id[WLAN_CACHE_ID_LEN];
#if defined(WLAN_SAE_SINGLE_PMK) && defined(WLAN_FEATURE_ROAM_OFFLOAD)
bool single_pmk_supported;
#endif
};
/**

View file

@ -4320,4 +4320,69 @@ void wlan_crypto_update_set_key_peer(struct wlan_objmgr_vdev *vdev,
qdf_mem_copy(crypto_key->macaddr, peer_mac, QDF_MAC_ADDR_SIZE);
}
#if defined(WLAN_SAE_SINGLE_PMK) && defined(WLAN_FEATURE_ROAM_OFFLOAD)
void wlan_crypto_selective_clear_sae_single_pmk_entries(
struct wlan_objmgr_vdev *vdev,
struct qdf_mac_addr *conn_bssid)
{
struct wlan_crypto_params *crypto_params;
struct wlan_crypto_comp_priv *crypto_priv;
int i;
crypto_priv = (struct wlan_crypto_comp_priv *)
wlan_get_vdev_crypto_obj(vdev);
if (!crypto_priv) {
crypto_err("crypto_priv NULL");
return;
}
crypto_params = &crypto_priv->crypto_params;
for (i = 0; i < WLAN_CRYPTO_MAX_PMKID; i++) {
if (!crypto_params->pmksa[i])
continue;
if (crypto_params->pmksa[i]->single_pmk_supported &&
!qdf_is_macaddr_equal(conn_bssid,
&crypto_params->pmksa[i]->bssid)) {
qdf_mem_zero(crypto_params->pmksa[i],
sizeof(struct wlan_crypto_pmksa));
qdf_mem_free(crypto_params->pmksa[i]);
crypto_params->pmksa[i] = NULL;
}
}
}
void wlan_crypto_set_sae_single_pmk_bss_cap(struct wlan_objmgr_vdev *vdev,
struct qdf_mac_addr *bssid,
bool single_pmk_capable_bss)
{
struct wlan_crypto_params *crypto_params;
struct wlan_crypto_comp_priv *crypto_priv;
int i;
crypto_priv = (struct wlan_crypto_comp_priv *)
wlan_get_vdev_crypto_obj(vdev);
if (!crypto_priv) {
crypto_err("crypto_priv NULL");
return;
}
crypto_params = &crypto_priv->crypto_params;
for (i = 0; i < WLAN_CRYPTO_MAX_PMKID; i++) {
if (!crypto_params->pmksa[i])
continue;
if (qdf_is_macaddr_equal(bssid,
&crypto_params->pmksa[i]->bssid))
crypto_params->pmksa[i]->single_pmk_supported =
single_pmk_capable_bss;
}
}
#endif
#endif