Преглед на файлове

qcacmn: For PMF return the igtk key in getkey call

Hostapd requests igtk keys with keyix 4,5.
Adding support to wlan_crypto_getkey to send the igtk keys
for keyix 4,5. In absence of the patch, hostapd getkey
call for igtk keys will fail.

Change-Id: I32cd6b417aae92cf3b3ac17bb72e19b581d21bd6
Rohan Dutta преди 6 години
родител
ревизия
613f7920c7
променени са 1 файла, в които са добавени 16 реда и са изтрити 9 реда
  1. 16 9
      umac/cmn_services/crypto/src/wlan_crypto_global_api.c

+ 16 - 9
umac/cmn_services/crypto/src/wlan_crypto_global_api.c

@@ -857,9 +857,15 @@ struct wlan_crypto_key *wlan_crypto_vdev_getkey(struct wlan_objmgr_vdev *vdev,
 		crypto_err("crypto_priv NULL");
 		return NULL;
 	}
-
-	if (keyix == WLAN_CRYPTO_KEYIX_NONE || keyix >= WLAN_CRYPTO_MAXKEYIDX)
+	/* for keyix 4,5 we return the igtk keys for keyix more than 5
+	 * we return the default key, for all other keyix we return the
+	 * key accordingly.
+	 */
+	if (keyix == WLAN_CRYPTO_KEYIX_NONE ||
+	    keyix >= (WLAN_CRYPTO_MAXKEYIDX + WLAN_CRYPTO_MAXIGTKKEYIDX))
 		key = crypto_priv->key[crypto_priv->def_tx_keyid];
+	else if (keyix >= WLAN_CRYPTO_MAXKEYIDX)
+		key = crypto_priv->igtk_key[keyix - WLAN_CRYPTO_MAXKEYIDX];
 	else
 		key = crypto_priv->key[keyix];
 
@@ -892,8 +898,15 @@ struct wlan_crypto_key *wlan_crypto_peer_getkey(struct wlan_objmgr_peer *peer,
 		return NULL;
 	}
 
-	if (keyix == WLAN_CRYPTO_KEYIX_NONE || keyix >= WLAN_CRYPTO_MAXKEYIDX)
+	/* for keyix 4,5 we return the igtk keys for keyix more than 5
+	 * we return the default key, for all other keyix we return the
+	 * key accordingly.
+	 */
+	if (keyix == WLAN_CRYPTO_KEYIX_NONE ||
+	    keyix >= (WLAN_CRYPTO_MAXKEYIDX + WLAN_CRYPTO_MAXIGTKKEYIDX))
 		key = crypto_priv->key[crypto_priv->def_tx_keyid];
+	else if (keyix >= WLAN_CRYPTO_MAXKEYIDX)
+		key = crypto_priv->igtk_key[keyix - WLAN_CRYPTO_MAXKEYIDX];
 	else
 		key = crypto_priv->key[keyix];
 
@@ -924,12 +937,6 @@ QDF_STATUS wlan_crypto_getkey(struct wlan_objmgr_vdev *vdev,
 	uint8_t macaddr[QDF_MAC_ADDR_SIZE] =
 			{0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
 
-	if ((req_key->keyix != WLAN_CRYPTO_KEYIX_NONE) &&
-		(req_key->keyix >= WLAN_CRYPTO_MAXKEYIDX)) {
-		crypto_err("invalid keyix %d", req_key->keyix);
-		return QDF_STATUS_E_INVAL;
-	}
-
 	wlan_vdev_obj_lock(vdev);
 	qdf_mem_copy(macaddr, wlan_vdev_mlme_get_macaddr(vdev),
 		    QDF_MAC_ADDR_SIZE);