Ver Fonte

qcacmn: Add WPA/RSN IE from driver

Add WPA/RSN IE from Driver, when app/daemon does not program it.

Change-Id: I095ff9b46f243fa942cadf305e40cf1c207c13d0
CRs-Fixed: 2133228
Rohan Dutta há 7 anos atrás
pai
commit
192f5be008

+ 6 - 6
umac/cmn_services/crypto/inc/wlan_crypto_global_api.h

@@ -283,26 +283,26 @@ QDF_STATUS wlan_crypto_rsnie_check(struct wlan_crypto_params *, uint8_t *frm);
 /**
  * wlan_crypto_build_wpaie - called by mlme to build wpaie
  *
- * @crypto params: crypto params
+ * @vdev: vdev
  * @iebuf: ie buffer
  *
- * This function gets called by mlme to build wpaie from given crypto params
+ * This function gets called by mlme to build wpaie from given vdev
  *
  * Return: end of buffer
  */
-uint8_t *wlan_crypto_build_wpaie(struct wlan_crypto_params *,
+uint8_t *wlan_crypto_build_wpaie(struct wlan_objmgr_vdev *vdev,
 					uint8_t *iebuf);
 /**
  * wlan_crypto_build_rsnie - called by mlme to build rsnie
  *
- * @crypto params: crypto params
+ * @vdev: vdev
  * @iebuf: ie buffer
  *
- * This function gets called by mlme to build rsnie from given crypto params
+ * This function gets called by mlme to build rsnie from given vdev
  *
  * Return: end of buffer
  */
-uint8_t *wlan_crypto_build_rsnie(struct wlan_crypto_params *,
+uint8_t *wlan_crypto_build_rsnie(struct wlan_objmgr_vdev *vdev,
 					uint8_t *iebuf);
 
 /**

+ 46 - 56
umac/cmn_services/crypto/src/wlan_crypto_def_i.h

@@ -212,67 +212,57 @@ static inline void wlan_crypto_put_be64(u8 *a, u64 val)
 	 (((uint32_t) (c)) << 8) | \
 		(uint32_t) (d))
 
-#define WPA_TYPE_OUI     WLAN_CRYPTO_SELECTOR(0x00, 0x50, 0xf2, 1)
+#define WPA_TYPE_OUI                    WLAN_WPA_SEL(WLAN_WPA_OUI_TYPE)
 
 #define WLAN_CRYPTO_WAPI_IE_LEN      20
 #define WLAN_CRYPTO_WAPI_SMS4_CIPHER 0x01
 
-#define WPA_AUTH_KEY_MGMT_NONE \
-				WLAN_CRYPTO_SELECTOR(0x00, 0x50, 0xf2, 0)
-#define WPA_AUTH_KEY_MGMT_UNSPEC_802_1X \
-				WLAN_CRYPTO_SELECTOR(0x00, 0x50, 0xf2, 1)
+#define WPA_AUTH_KEY_MGMT_NONE          WLAN_WPA_SEL(WLAN_ASE_NONE)
+#define WPA_AUTH_KEY_MGMT_UNSPEC_802_1X WLAN_WPA_SEL(WLAN_ASE_8021X_UNSPEC)
 #define WPA_AUTH_KEY_MGMT_PSK_OVER_802_1X \
-				WLAN_CRYPTO_SELECTOR(0x00, 0x50, 0xf2, 2)
-#define WPA_AUTH_KEY_MGMT_CCKM \
-				WLAN_CRYPTO_SELECTOR(0x00, 0x40, 0x96, 0)
-
-#define WPA_CIPHER_SUITE_NONE   WLAN_CRYPTO_SELECTOR(0x00, 0x50, 0xf2, 0)
-#define WPA_CIPHER_SUITE_WEP40  WLAN_CRYPTO_SELECTOR(0x00, 0x50, 0xf2, 1)
-#define WPA_CIPHER_SUITE_WEP104 WLAN_CRYPTO_SELECTOR(0x00, 0x50, 0xf2, 5)
-#define WPA_CIPHER_SUITE_TKIP   WLAN_CRYPTO_SELECTOR(0x00, 0x50, 0xf2, 2)
-#define WPA_CIPHER_SUITE_CCMP   WLAN_CRYPTO_SELECTOR(0x00, 0x50, 0xf2, 4)
-
-#define RSN_AUTH_KEY_MGMT_NONE  WLAN_CRYPTO_SELECTOR(0x00, 0x0f, 0xac, 0)
-#define RSN_AUTH_KEY_MGMT_UNSPEC_802_1X \
-				WLAN_CRYPTO_SELECTOR(0x00, 0x0f, 0xac, 1)
-#define RSN_AUTH_KEY_MGMT_PSK_OVER_802_1X \
-				WLAN_CRYPTO_SELECTOR(0x00, 0x0f, 0xac, 2)
-#define RSN_AUTH_KEY_MGMT_FT_802_1X \
-				WLAN_CRYPTO_SELECTOR(0x00, 0x0f, 0xac, 3)
-#define RSN_AUTH_KEY_MGMT_FT_PSK \
-				WLAN_CRYPTO_SELECTOR(0x00, 0x0f, 0xac, 4)
-#define RSN_AUTH_KEY_MGMT_802_1X_SHA256 \
-				WLAN_CRYPTO_SELECTOR(0x00, 0x0f, 0xac, 5)
-#define RSN_AUTH_KEY_MGMT_PSK_SHA256 \
-				WLAN_CRYPTO_SELECTOR(0x00, 0x0f, 0xac, 6)
-#define RSN_AUTH_KEY_MGMT_TPK_HANDSHAKE \
-				WLAN_CRYPTO_SELECTOR(0x00, 0x0f, 0xac, 7)
-#define RSN_AUTH_KEY_MGMT_SAE   WLAN_CRYPTO_SELECTOR(0x00, 0x0f, 0xac, 8)
-#define RSN_AUTH_KEY_MGMT_FT_SAE WLAN_CRYPTO_SELECTOR(0x00, 0x0f, 0xac, 9)
-#define RSN_AUTH_KEY_MGMT_802_1X_SUITE_B \
-				WLAN_CRYPTO_SELECTOR(0x00, 0x0f, 0xac, 11)
-#define RSN_AUTH_KEY_MGMT_802_1X_SUITE_B_192 \
-				WLAN_CRYPTO_SELECTOR(0x00, 0x0f, 0xac, 12)
-#define RSN_AUTH_KEY_MGMT_FT_802_1X_SUITE_B_192 \
-				WLAN_CRYPTO_SELECTOR(0x00, 0x0f, 0xac, 13)
-#define RSN_AUTH_KEY_MGMT_CCKM  WLAN_CRYPTO_SELECTOR(0x00, 0x40, 0x96, 0x00)
-#define RSN_AUTH_KEY_MGMT_OSEN  WLAN_CRYPTO_SELECTOR(0x50, 0x6f, 0x9a, 0x01)
-
-#define RSN_CIPHER_SUITE_NONE   WLAN_CRYPTO_SELECTOR(0x00, 0x0f, 0xac, 0)
-#define RSN_CIPHER_SUITE_WEP40  WLAN_CRYPTO_SELECTOR(0x00, 0x0f, 0xac, 1)
-#define RSN_CIPHER_SUITE_TKIP   WLAN_CRYPTO_SELECTOR(0x00, 0x0f, 0xac, 2)
-#define RSN_CIPHER_SUITE_WEP104 WLAN_CRYPTO_SELECTOR(0x00, 0x0f, 0xac, 5)
-#define RSN_CIPHER_SUITE_CCMP   WLAN_CRYPTO_SELECTOR(0x00, 0x0f, 0xac, 4)
-#define RSN_CIPHER_SUITE_AES_CMAC WLAN_CRYPTO_SELECTOR(0x00, 0x0f, 0xac, 6)
-#define RSN_CIPHER_SUITE_GCMP   WLAN_CRYPTO_SELECTOR(0x00, 0x0f, 0xac, 8)
-#define RSN_CIPHER_SUITE_GCMP_256 WLAN_CRYPTO_SELECTOR(0x00, 0x0f, 0xac, 9)
-#define RSN_CIPHER_SUITE_CCMP_256 WLAN_CRYPTO_SELECTOR(0x00, 0x0f, 0xac, 10)
-#define RSN_CIPHER_SUITE_BIP_GMAC_128 \
-				WLAN_CRYPTO_SELECTOR(0x00, 0x0f, 0xac, 11)
-#define RSN_CIPHER_SUITE_BIP_GMAC_256 \
-				WLAN_CRYPTO_SELECTOR(0x00, 0x0f, 0xac, 12)
-#define RSN_CIPHER_SUITE_BIP_CMAC_256 \
-				WLAN_CRYPTO_SELECTOR(0x00, 0x0f, 0xac, 13)
+					WLAN_WPA_SEL(WLAN_ASE_8021X_PSK)
+#define WPA_AUTH_KEY_MGMT_CCKM WLAN_WPA_CCKM_AKM
+
+#define WPA_CIPHER_SUITE_NONE   WLAN_WPA_SEL(WLAN_CSE_NONE)
+#define WPA_CIPHER_SUITE_WEP40  WLAN_WPA_SEL(WLAN_CSE_WEP40)
+#define WPA_CIPHER_SUITE_WEP104 WLAN_WPA_SEL(WLAN_CSE_WEP104)
+#define WPA_CIPHER_SUITE_TKIP   WLAN_WPA_SEL(WLAN_CSE_TKIP)
+#define WPA_CIPHER_SUITE_CCMP   WLAN_WPA_SEL(WLAN_CSE_CCMP)
+
+#define RSN_AUTH_KEY_MGMT_NONE          WLAN_RSN_SEL(0)
+#define RSN_AUTH_KEY_MGMT_UNSPEC_802_1X WLAN_RSN_SEL(1)
+#define RSN_AUTH_KEY_MGMT_PSK_OVER_802_1X\
+					WLAN_RSN_SEL(2)
+#define RSN_AUTH_KEY_MGMT_FT_802_1X     WLAN_RSN_SEL(3)
+#define RSN_AUTH_KEY_MGMT_FT_PSK        WLAN_RSN_SEL(4)
+#define RSN_AUTH_KEY_MGMT_802_1X_SHA256\
+					WLAN_RSN_SEL(5)
+#define RSN_AUTH_KEY_MGMT_PSK_SHA256    WLAN_RSN_SEL(6)
+#define RSN_AUTH_KEY_MGMT_WPS           WLAN_RSN_SEL(7)
+#define RSN_AUTH_KEY_MGMT_SAE           WLAN_RSN_SEL(8)
+#define RSN_AUTH_KEY_MGMT_FT_SAE        WLAN_RSN_SEL(9)
+#define RSN_AUTH_KEY_MGMT_802_1X_SUITE_B\
+					WLAN_RSN_SEL(11)
+#define RSN_AUTH_KEY_MGMT_802_1X_SUITE_B_192\
+					WLAN_RSN_SEL(12)
+#define RSN_AUTH_KEY_MGMT_FT_802_1X_SUITE_B_192\
+					WLAN_RSN_SEL(13)
+
+#define RSN_AUTH_KEY_MGMT_CCKM  WLAN_RSN_CCKM_AKM
+#define RSN_AUTH_KEY_MGMT_OSEN  (0x019a6f50)
+
+#define RSN_CIPHER_SUITE_NONE           WLAN_RSN_SEL(WLAN_CSE_NONE)
+#define RSN_CIPHER_SUITE_WEP40          WLAN_RSN_SEL(WLAN_CSE_WEP40)
+#define RSN_CIPHER_SUITE_TKIP           WLAN_RSN_SEL(WLAN_CSE_TKIP)
+#define RSN_CIPHER_SUITE_WEP104         WLAN_RSN_SEL(WLAN_CSE_WEP104)
+#define RSN_CIPHER_SUITE_CCMP           WLAN_RSN_SEL(WLAN_CSE_CCMP)
+#define RSN_CIPHER_SUITE_AES_CMAC       WLAN_RSN_SEL(WLAN_CSE_AES_CMAC)
+#define RSN_CIPHER_SUITE_GCMP           WLAN_RSN_SEL(WLAN_CSE_GCMP_128)
+#define RSN_CIPHER_SUITE_GCMP_256       WLAN_RSN_SEL(WLAN_CSE_GCMP_256)
+#define RSN_CIPHER_SUITE_CCMP_256       WLAN_RSN_SEL(WLAN_CSE_CCMP_256)
+#define RSN_CIPHER_SUITE_BIP_GMAC_128   WLAN_RSN_SEL(WLAN_CSE_BIP_GMAC_128)
+#define RSN_CIPHER_SUITE_BIP_GMAC_256   WLAN_RSN_SEL(WLAN_CSE_BIP_GMAC_256)
+#define RSN_CIPHER_SUITE_BIP_CMAC_256   WLAN_RSN_SEL(WLAN_CSE_BIP_CMAC_256)
 
 #define RESET_PARAM(__param)         ((__param) = 0)
 #define SET_PARAM(__param, __val)    ((__param) |= (1<<(__val)))

+ 71 - 33
umac/cmn_services/crypto/src/wlan_crypto_global_api.c

@@ -1895,18 +1895,31 @@ QDF_STATUS wlan_crypto_rsnie_check(struct wlan_crypto_params *crypto_params,
 /**
  * wlan_crypto_build_wpaie - called by mlme to build wpaie
  *
- * @crypto params: crypto params
+ * @vdev: vdev
  * @iebuf: ie buffer
  *
- * This function gets called by mlme to build wpaie from given crypto params
+ * This function gets called by mlme to build wpaie from given vdev
  *
  * Return: end of buffer
  */
-uint8_t *wlan_crypto_build_wpaie(struct wlan_crypto_params *crypto_params,
-				uint8_t *iebuf){
+uint8_t *wlan_crypto_build_wpaie(struct wlan_objmgr_vdev *vdev,
+					uint8_t *iebuf){
 	uint8_t *frm = iebuf;
 	uint8_t *selcnt;
-	uint32_t mcastcipher;
+	struct wlan_crypto_comp_priv *crypto_priv;
+	struct wlan_crypto_params *crypto_params;
+
+	if (!frm) {
+		qdf_print("%s[%d] ie buffer NULL\n", __func__, __LINE__);
+		return NULL;
+	}
+
+	crypto_params = wlan_crypto_vdev_get_comp_params(vdev, &crypto_priv);
+
+	if (!crypto_params) {
+		qdf_print("%s[%d] crypto_params NULL\n", __func__, __LINE__);
+		return NULL;
+	}
 
 	*frm++ = WLAN_ELEMID_VENDOR;
 	*frm++ = 0;
@@ -1915,11 +1928,17 @@ uint8_t *wlan_crypto_build_wpaie(struct wlan_crypto_params *crypto_params,
 
 
 	/* multicast cipher */
-	mcastcipher = wlan_crypto_get_mcastcipher(crypto_params);
-	WLAN_CRYPTO_ADDSELECTOR(frm,
-				wlan_crypto_wpa_cipher_to_suite(mcastcipher));
-
+	if (MCIPHER_IS_TKIP(crypto_params)) {
+		WLAN_CRYPTO_ADDSELECTOR(frm,
+					wlan_crypto_wpa_cipher_to_suite(
+						WLAN_CRYPTO_CIPHER_TKIP));
+	} else if (MCIPHER_IS_CCMP128(crypto_params)) {
+		WLAN_CRYPTO_ADDSELECTOR(frm,
+					wlan_crypto_wpa_cipher_to_suite(
+						WLAN_CRYPTO_CIPHER_AES_CCM));
+	}
 	/* unicast cipher list */
+
 	selcnt = frm;
 	WLAN_CRYPTO_ADDSHORT(frm, 0);
 	/* do not use CCMP unicast cipher in WPA mode */
@@ -1935,12 +1954,6 @@ uint8_t *wlan_crypto_build_wpaie(struct wlan_crypto_params *crypto_params,
 			wlan_crypto_wpa_cipher_to_suite(
 						WLAN_CRYPTO_CIPHER_AES_CCM));
 	}
-	if (UCIPHER_IS_CLEAR(crypto_params)) {
-		selcnt[0]++;
-		WLAN_CRYPTO_ADDSELECTOR(frm,
-			wlan_crypto_wpa_cipher_to_suite(
-						WLAN_CRYPTO_CIPHER_AES_CCM));
-	}
 
 	/* authenticator selector list */
 	selcnt = frm;
@@ -1977,18 +1990,31 @@ uint8_t *wlan_crypto_build_wpaie(struct wlan_crypto_params *crypto_params,
 /**
  * wlan_crypto_build_rsnie - called by mlme to build rsnie
  *
- * @crypto params: crypto params
+ * @vdev: vdev
  * @iebuf: ie buffer
  *
- * This function gets called by mlme to build rsnie from given crypto params
+ * This function gets called by mlme to build rsnie from given vdev
  *
  * Return: end of buffer
  */
-uint8_t *wlan_crypto_build_rsnie(struct wlan_crypto_params *crypto_params,
-				uint8_t *iebuf){
+uint8_t *wlan_crypto_build_rsnie(struct wlan_objmgr_vdev *vdev,
+				 uint8_t *iebuf){
 	uint8_t *frm = iebuf;
 	uint8_t *selcnt;
-	uint32_t mcastcipher;
+	struct wlan_crypto_comp_priv *crypto_priv;
+	struct wlan_crypto_params *crypto_params;
+
+	if (!frm) {
+		qdf_print("%s[%d] ie buffer NULL\n", __func__, __LINE__);
+		return NULL;
+	}
+
+	crypto_params = wlan_crypto_vdev_get_comp_params(vdev, &crypto_priv);
+
+	if (!crypto_params) {
+		qdf_print("%s[%d] crypto_params NULL\n", __func__, __LINE__);
+		return NULL;
+	}
 
 	*frm++ = WLAN_ELEMID_RSN;
 	*frm++ = 0;
@@ -1996,9 +2022,27 @@ uint8_t *wlan_crypto_build_rsnie(struct wlan_crypto_params *crypto_params,
 
 
 	/* multicast cipher */
-	mcastcipher = wlan_crypto_get_mcastcipher(crypto_params);
-	WLAN_CRYPTO_ADDSELECTOR(frm,
-				wlan_crypto_rsn_cipher_to_suite(mcastcipher));
+	if (MCIPHER_IS_TKIP(crypto_params)) {
+		WLAN_CRYPTO_ADDSELECTOR(frm,
+					wlan_crypto_rsn_cipher_to_suite(
+					WLAN_CRYPTO_CIPHER_TKIP));
+	} else if (MCIPHER_IS_CCMP128(crypto_params)) {
+		WLAN_CRYPTO_ADDSELECTOR(frm,
+					wlan_crypto_rsn_cipher_to_suite(
+					WLAN_CRYPTO_CIPHER_AES_CCM));
+	} else if (MCIPHER_IS_CCMP256(crypto_params)) {
+		WLAN_CRYPTO_ADDSELECTOR(frm,
+					wlan_crypto_rsn_cipher_to_suite(
+					WLAN_CRYPTO_CIPHER_AES_CCM_256));
+	} else if (MCIPHER_IS_GCMP128(crypto_params)) {
+		WLAN_CRYPTO_ADDSELECTOR(frm,
+					wlan_crypto_rsn_cipher_to_suite(
+					WLAN_CRYPTO_CIPHER_AES_GCM));
+	} else if (MCIPHER_IS_GCMP256(crypto_params)) {
+		WLAN_CRYPTO_ADDSELECTOR(frm,
+					wlan_crypto_rsn_cipher_to_suite(
+					WLAN_CRYPTO_CIPHER_AES_GCM_256));
+	}
 
 	/* unicast cipher list */
 	selcnt = frm;
@@ -2007,13 +2051,13 @@ uint8_t *wlan_crypto_build_rsnie(struct wlan_crypto_params *crypto_params,
 	if (UCIPHER_IS_TKIP(crypto_params)) {
 		selcnt[0]++;
 		WLAN_CRYPTO_ADDSELECTOR(frm,
-			 wlan_crypto_rsn_cipher_to_suite(
+					wlan_crypto_rsn_cipher_to_suite(
 						WLAN_CRYPTO_CIPHER_TKIP));
 	}
 	if (UCIPHER_IS_CCMP128(crypto_params)) {
 		selcnt[0]++;
 		WLAN_CRYPTO_ADDSELECTOR(frm,
-			wlan_crypto_rsn_cipher_to_suite(
+					wlan_crypto_rsn_cipher_to_suite(
 						WLAN_CRYPTO_CIPHER_AES_CCM));
 	}
 	if (UCIPHER_IS_CCMP256(crypto_params)) {
@@ -2035,12 +2079,6 @@ uint8_t *wlan_crypto_build_rsnie(struct wlan_crypto_params *crypto_params,
 			wlan_crypto_rsn_cipher_to_suite(
 					WLAN_CRYPTO_CIPHER_AES_GCM_256));
 	}
-	if (UCIPHER_IS_CLEAR(crypto_params)) {
-		selcnt[0]++;
-		WLAN_CRYPTO_ADDSELECTOR(frm,
-			wlan_crypto_rsn_cipher_to_suite(
-					WLAN_CRYPTO_CIPHER_AES_CCM));
-	}
 
 
 	/* authenticator selector list */
@@ -2100,12 +2138,11 @@ uint8_t *wlan_crypto_build_rsnie(struct wlan_crypto_params *crypto_params,
 		}
 	}
 
+	WLAN_CRYPTO_ADDSHORT(frm, crypto_params->rsn_caps);
 	/* optional capabilities */
 	if (crypto_params->rsn_caps != 0 &&
 		crypto_params->rsn_caps != WLAN_CRYPTO_RSN_CAP_PREAUTH){
 
-		WLAN_CRYPTO_ADDSHORT(frm, crypto_params->rsn_caps);
-
 		if (HAS_MGMT_CIPHER(crypto_params,
 						WLAN_CRYPTO_CIPHER_AES_CMAC)) {
 			selcnt[0]++;
@@ -2136,6 +2173,7 @@ uint8_t *wlan_crypto_build_rsnie(struct wlan_crypto_params *crypto_params,
 					WLAN_CRYPTO_CIPHER_AES_GMAC_256));
 		}
 	}
+
 	/* calculate element length */
 	iebuf[1] = frm - iebuf - 2;