qcacmn: Add wlan_crypto_is_key_valid check

Add wlan_crypto_is_key_valid to check if key
is valid.

Change-Id: Ica71f56f1739261fff425e793ec8c15d2523e8e7
This commit is contained in:
Disha Das
2019-07-26 10:49:12 +05:30
committed by nshrivas
parent 9447e47cbb
commit 07721fc036
2 changed files with 44 additions and 0 deletions

View File

@@ -244,6 +244,20 @@ bool wlan_crypto_vdev_is_pmf_required(struct wlan_objmgr_vdev *vdev);
bool wlan_crypto_is_pmf_enabled(struct wlan_objmgr_vdev *vdev, bool wlan_crypto_is_pmf_enabled(struct wlan_objmgr_vdev *vdev,
struct wlan_objmgr_peer *peer); struct wlan_objmgr_peer *peer);
/**
* wlan_crypto_is_key_valid - called by mgmt txrx to check if key is valid
* @vdev: vdev
* @peer: peer
* @keyidx : key index
*
* This function gets called by mgmt txrx to check if key is valid
*
* Return: true or false
*/
bool wlan_crypto_is_key_valid(struct wlan_objmgr_vdev *vdev,
struct wlan_objmgr_peer *peer,
uint16_t keyidx);
/** /**
* wlan_crypto_add_mmie - called by mgmt txrx to add mmie in frame * wlan_crypto_add_mmie - called by mgmt txrx to add mmie in frame
* @vdev: vdev * @vdev: vdev

View File

@@ -1724,6 +1724,36 @@ bool wlan_crypto_is_pmf_enabled(struct wlan_objmgr_vdev *vdev,
return false; return false;
} }
/**
* wlan_crypto_is_key_valid - called by mgmt txrx to check if key is valid
* @vdev: vdev
* @peer: peer
* @keyidx : key index
*
* This function gets called by mgmt txrx to check if key is valid
*
* Return: true or false
*/
bool wlan_crypto_is_key_valid(struct wlan_objmgr_vdev *vdev,
struct wlan_objmgr_peer *peer,
uint16_t keyidx)
{
struct wlan_crypto_key *key = NULL;
if (!vdev && !peer)
return false;
if (peer)
key = wlan_crypto_peer_getkey(peer, keyidx);
else if (vdev)
key = wlan_crypto_vdev_getkey(vdev, keyidx);
if ((key) && key->valid)
return true;
return false;
}
static void wlan_crypto_gmac_pn_swap(uint8_t *a, uint8_t *b) static void wlan_crypto_gmac_pn_swap(uint8_t *a, uint8_t *b)
{ {
a[0] = b[5]; a[0] = b[5];