diff --git a/os_if/linux/crypto/src/wlan_cfg80211_crypto.c b/os_if/linux/crypto/src/wlan_cfg80211_crypto.c index 0d76068f3a05..30609bb2421a 100644 --- a/os_if/linux/crypto/src/wlan_cfg80211_crypto.c +++ b/os_if/linux/crypto/src/wlan_cfg80211_crypto.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -119,17 +119,17 @@ int wlan_cfg80211_store_key(struct wlan_objmgr_vdev *vdev, crypto_key = qdf_mem_malloc(sizeof(*crypto_key)); if (!crypto_key) return -EINVAL; - status = wlan_crypto_save_key(vdev, key_index, crypto_key); - if (QDF_IS_STATUS_ERROR(status)) { - osif_err("Failed to save key"); - qdf_mem_free(crypto_key); - return -EINVAL; - } } wlan_cfg80211_translate_key(vdev, key_index, key_type, mac_addr, params, crypto_key); + status = wlan_crypto_save_key(vdev, key_index, crypto_key); + if (QDF_IS_STATUS_ERROR(status)) { + osif_err("Failed to save key"); + qdf_mem_free(crypto_key); + return -EINVAL; + } return 0; } diff --git a/umac/cmn_services/crypto/src/wlan_crypto_def_i.h b/umac/cmn_services/crypto/src/wlan_crypto_def_i.h index 79b984c345b4..11240ad0e304 100644 --- a/umac/cmn_services/crypto/src/wlan_crypto_def_i.h +++ b/umac/cmn_services/crypto/src/wlan_crypto_def_i.h @@ -440,7 +440,7 @@ struct wlan_crypto_comp_priv { struct wlan_crypto_key *key[WLAN_CRYPTO_MAX_VLANKEYIX]; struct wlan_crypto_key *igtk_key[WLAN_CRYPTO_MAXIGTKKEYIDX]; struct wlan_crypto_key *bigtk_key[WLAN_CRYPTO_MAXBIGTKKEYIDX]; - uint32_t igtk_key_type; + enum wlan_crypto_cipher_type igtk_key_type; uint8_t def_tx_keyid; uint8_t def_igtk_tx_keyid; uint8_t def_bigtk_tx_keyid; diff --git a/umac/cmn_services/crypto/src/wlan_crypto_global_api.c b/umac/cmn_services/crypto/src/wlan_crypto_global_api.c index faf36aca7c48..cb151db0dce5 100644 --- a/umac/cmn_services/crypto/src/wlan_crypto_global_api.c +++ b/umac/cmn_services/crypto/src/wlan_crypto_global_api.c @@ -4247,14 +4247,21 @@ QDF_STATUS wlan_crypto_save_key(struct wlan_objmgr_vdev *vdev, crypto_err("Invalid Key index %d", key_index); return QDF_STATUS_E_FAILURE; } - if (key_index < WLAN_CRYPTO_MAXKEYIDX) + if (key_index < WLAN_CRYPTO_MAXKEYIDX) { crypto_priv->key[key_index] = crypto_key; - else if (is_igtk(key_index)) + } else if (is_igtk(key_index)) { crypto_priv->igtk_key[key_index - WLAN_CRYPTO_MAXKEYIDX] = crypto_key; - else + crypto_priv->def_igtk_tx_keyid = + key_index - WLAN_CRYPTO_MAXKEYIDX; + crypto_priv->igtk_key_type = crypto_key->cipher_type; + } else { crypto_priv->bigtk_key[key_index - WLAN_CRYPTO_MAXKEYIDX - WLAN_CRYPTO_MAXIGTKKEYIDX] = crypto_key; + crypto_priv->def_bigtk_tx_keyid = + key_index - WLAN_CRYPTO_MAXKEYIDX + - WLAN_CRYPTO_MAXIGTKKEYIDX; + } return QDF_STATUS_SUCCESS; }