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

Commit c99d3d94 authored by Pankaj Singh's avatar Pankaj Singh
Browse files

wlan: Extract and cache PMKID from EXTERNAL_AUTH command

hostapd/wpa_supplicant sends PMKID in EXTERNAL_AUTH command.
Extract and cache the same.

Change-Id: If490c3fb7e0119910e73dffc8701434752aabd6c
CRs-Fixed: 2734672
parent 6e549ab9
Loading
Loading
Loading
Loading
+47 −0
Original line number Diff line number Diff line
@@ -19833,6 +19833,45 @@ static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device
#if defined(WLAN_FEATURE_SAE) && \
         defined(CFG80211_EXTERNAL_AUTH_SUPPORT)
#if defined(CFG80211_EXTERNAL_AUTH_AP_SUPPORT)
/**
 * wlan_hdd_extauth_cache_pmkid() - Extract and cache pmkid
 * @adapter: hdd vdev/net_device context
 * @hHal: Handle to the hal
 * @params: Pointer to external auth params.
 *
 * Extract the PMKID and BSS from external auth params and add to the
 * PMKSA Cache in CSR.
 */
static void
wlan_hdd_extauth_cache_pmkid(hdd_adapter_t *adapter,
                            tHalHandle hHal,
                            struct cfg80211_external_auth_params *params)
{
    tPmkidCacheInfo pmk_cache;
    VOS_STATUS result;
    if (params->pmkid) {
            vos_mem_zero(&pmk_cache, sizeof(pmk_cache));
            vos_mem_copy(pmk_cache.BSSID, params->bssid,
                        VOS_MAC_ADDR_SIZE);
            vos_mem_copy(pmk_cache.PMKID, params->pmkid,
                        CSR_RSN_PMKID_SIZE);
            result = sme_RoamSetPMKIDCache(hHal, adapter->sessionId,
                                        &pmk_cache, 1, false);
            if (!VOS_IS_STATUS_SUCCESS(result))
                    hddLog(VOS_TRACE_LEVEL_ERROR,
                            FL("external_auth: Failed to cache PMKID"));
    }
}
#else
static void
wlan_hdd_extauth_cache_pmkid(hdd_adapter_t *adapter,
                            tHalHandle hHal,
                            struct cfg80211_external_auth_params *params)
{}
#endif
/**
 * __wlan_hdd_cfg80211_external_auth() - Handle external auth
 * @wiphy: Pointer to wireless phy
@@ -19840,6 +19879,12 @@ static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device
 * @params: Pointer to external auth params
 *
 * Return: 0 on success, negative errno on failure
 *
 * Userspace sends status of the external authentication(e.g., SAE) with a peer.
 * The message carries BSSID of the peer and auth status (WLAN_STATUS_SUCCESS/
 * WLAN_STATUS_UNSPECIFIED_FAILURE) in params.
 * Userspace may send PMKID in params, which can be used for
 * further connections.
 */
static int
__wlan_hdd_cfg80211_external_auth(struct wiphy *wiphy, struct net_device *dev,
@@ -19864,6 +19909,8 @@ __wlan_hdd_cfg80211_external_auth(struct wiphy *wiphy, struct net_device *dev,
            params->status, MAC_ADDR_ARRAY(params->bssid));
    vos_mem_copy(peer_mac_addr, params->bssid, VOS_MAC_ADDR_SIZE);
    wlan_hdd_extauth_cache_pmkid(adapter, hdd_ctx->hHal, params);
    sme_handle_sae_msg(hdd_ctx->hHal, adapter->sessionId, params->status,
                        peer_mac_addr);