qcacld-3.0: Fix igtk index while getting the igt key

While sending tx frame WMA_IGTK_KEY_INDEX_4 is used to get the
igtk key, but the WMA_IGTK_KEY_INDEX_5 is also valid igtk key index
and thus if igtk index passed is WMA_IGTK_KEY_INDEX_5 the get igtk
always fails.

So during set key store the igtk key index and use the same to get
igtk key.

Change-Id: I5c3baf1231472e7d9aeb2f762285befc9100c858
CRs-Fixed: 2661204
This commit is contained in:
Abhishek Singh 2020-04-09 15:51:51 +05:30 • committed by nshrivas
commit 1be145fcbd
3 changed files with 28 additions and 10 deletions

View file

@ -2455,10 +2455,12 @@ void wma_update_set_key(uint8_t session_id, bool pairwise,
* wma_get_igtk() - Get the IGTK that was stored in the session earlier
* @iface: Interface for which the key is being requested
* @key_len: key length
* @igtk_key_idx: igtk key idx
*
* Return: Pointer to the key
*/
uint8_t *wma_get_igtk(struct wma_txrx_node *iface, uint16_t *key_len);
uint8_t *wma_get_igtk(struct wma_txrx_node *iface, uint16_t *key_len,
uint16_t igtk_key_idx);
#ifdef WLAN_FEATURE_MOTION_DETECTION
/**

View file

@ -2352,13 +2352,20 @@ static void wma_update_tx_send_params(struct tx_send_params *tx_param,
}
#ifdef WLAN_FEATURE_11W
uint8_t *wma_get_igtk(struct wma_txrx_node *iface, uint16_t *key_len)
uint8_t *wma_get_igtk(struct wma_txrx_node *iface, uint16_t *key_len,
uint16_t igtk_key_idx)
{
struct wlan_crypto_key *crypto_key;
crypto_key = wlan_crypto_get_key(iface->vdev, WMA_IGTK_KEY_INDEX_4);
if (!(igtk_key_idx == WMA_IGTK_KEY_INDEX_4 ||
igtk_key_idx == WMA_IGTK_KEY_INDEX_5)) {
wma_err("Invalid igtk_key_idx %d", igtk_key_idx);
*key_len = 0;
return NULL;
}
crypto_key = wlan_crypto_get_key(iface->vdev, igtk_key_idx);
if (!crypto_key) {
wma_err("IGTK not found");
wma_err("IGTK not found for igtk_idx %d", igtk_key_idx);
*key_len = 0;
return NULL;
}
@ -2513,6 +2520,8 @@ QDF_STATUS wma_tx_packet(void *wma_context, void *tx_frame, uint16_t frmLen,
(qdf_nbuf_data(tx_frame));
}
} else {
int8_t igtk_key_id;
/* Allocate extra bytes for MMIE */
newFrmLen = frmLen + IEEE80211_MMIE_LEN;
qdf_status = cds_packet_alloc((uint16_t) newFrmLen,
@ -2536,16 +2545,23 @@ QDF_STATUS wma_tx_packet(void *wma_context, void *tx_frame, uint16_t frmLen,
qdf_mem_copy(pFrame, wh, sizeof(*wh));
qdf_mem_copy(pFrame + sizeof(*wh),
pData + sizeof(*wh), frmLen - sizeof(*wh));
igtk = wma_get_igtk(iface, &key_len);
igtk_key_id =
wlan_crypto_get_default_key_idx(iface->vdev,
true);
/* Get actual igtk key id adding 4 */
igtk_key_id += WMA_IGTK_KEY_INDEX_4;
igtk = wma_get_igtk(iface, &key_len, igtk_key_id);
if (!igtk) {
wma_alert("IGTK not present");
wma_err_rl("IGTK not present for igtk_key_id %d",
igtk_key_id);
cds_packet_free((void *)tx_frame);
cds_packet_free((void *)pPacket);
goto error;
}
if (!cds_attach_mmie(igtk,
iface->key.key_id[0].ipn,
WMA_IGTK_KEY_INDEX_4,
if (!cds_attach_mmie(igtk, iface->key.key_id[
igtk_key_id -
WMA_IGTK_KEY_INDEX_4].ipn,
igtk_key_id,
pFrame,
pFrame + newFrmLen, newFrmLen)) {
wma_alert("Failed to attach MMIE");

View file

@ -3138,7 +3138,7 @@ int wma_process_bip(tp_wma_handle wma_handle,
wma_debug("key_cipher %d key_id %d", iface->key.key_cipher, key_id);
igtk = wma_get_igtk(iface, &key_len);
igtk = wma_get_igtk(iface, &key_len, key_id);
switch (iface->key.key_cipher) {
case WMI_CIPHER_AES_CMAC:
if (wmi_service_enabled(wma_handle->wmi_handle,