Explorar o código

qcacmn: Add igtk def index and igtk key type in crypto

In wlan_crypto_save_key store igtk def index, bigtk def index and
igtk key type in crypto priv.

Change-Id: I96161a6dd376e7e80f88da00c891d15a5645cfa7
CRs-Fixed: 2661197
Abhishek Singh %!s(int64=5) %!d(string=hai) anos
pai
achega
aadc772e84

+ 7 - 7
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;
 }
 

+ 1 - 1
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;

+ 10 - 3
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;
 }