|
@@ -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
|
|
* wlan_crypto_build_wpaie - called by mlme to build wpaie
|
|
*
|
|
*
|
|
- * @crypto params: crypto params
|
|
|
|
|
|
+ * @vdev: vdev
|
|
* @iebuf: ie buffer
|
|
* @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
|
|
* 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 *frm = iebuf;
|
|
uint8_t *selcnt;
|
|
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++ = WLAN_ELEMID_VENDOR;
|
|
*frm++ = 0;
|
|
*frm++ = 0;
|
|
@@ -1915,11 +1928,17 @@ uint8_t *wlan_crypto_build_wpaie(struct wlan_crypto_params *crypto_params,
|
|
|
|
|
|
|
|
|
|
/* multicast cipher */
|
|
/* 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 */
|
|
/* unicast cipher list */
|
|
|
|
+
|
|
selcnt = frm;
|
|
selcnt = frm;
|
|
WLAN_CRYPTO_ADDSHORT(frm, 0);
|
|
WLAN_CRYPTO_ADDSHORT(frm, 0);
|
|
/* do not use CCMP unicast cipher in WPA mode */
|
|
/* 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_wpa_cipher_to_suite(
|
|
WLAN_CRYPTO_CIPHER_AES_CCM));
|
|
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 */
|
|
/* authenticator selector list */
|
|
selcnt = frm;
|
|
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
|
|
* wlan_crypto_build_rsnie - called by mlme to build rsnie
|
|
*
|
|
*
|
|
- * @crypto params: crypto params
|
|
|
|
|
|
+ * @vdev: vdev
|
|
* @iebuf: ie buffer
|
|
* @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
|
|
* 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 *frm = iebuf;
|
|
uint8_t *selcnt;
|
|
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++ = WLAN_ELEMID_RSN;
|
|
*frm++ = 0;
|
|
*frm++ = 0;
|
|
@@ -1996,9 +2022,27 @@ uint8_t *wlan_crypto_build_rsnie(struct wlan_crypto_params *crypto_params,
|
|
|
|
|
|
|
|
|
|
/* multicast cipher */
|
|
/* 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 */
|
|
/* unicast cipher list */
|
|
selcnt = frm;
|
|
selcnt = frm;
|
|
@@ -2007,13 +2051,13 @@ uint8_t *wlan_crypto_build_rsnie(struct wlan_crypto_params *crypto_params,
|
|
if (UCIPHER_IS_TKIP(crypto_params)) {
|
|
if (UCIPHER_IS_TKIP(crypto_params)) {
|
|
selcnt[0]++;
|
|
selcnt[0]++;
|
|
WLAN_CRYPTO_ADDSELECTOR(frm,
|
|
WLAN_CRYPTO_ADDSELECTOR(frm,
|
|
- wlan_crypto_rsn_cipher_to_suite(
|
|
|
|
|
|
+ wlan_crypto_rsn_cipher_to_suite(
|
|
WLAN_CRYPTO_CIPHER_TKIP));
|
|
WLAN_CRYPTO_CIPHER_TKIP));
|
|
}
|
|
}
|
|
if (UCIPHER_IS_CCMP128(crypto_params)) {
|
|
if (UCIPHER_IS_CCMP128(crypto_params)) {
|
|
selcnt[0]++;
|
|
selcnt[0]++;
|
|
WLAN_CRYPTO_ADDSELECTOR(frm,
|
|
WLAN_CRYPTO_ADDSELECTOR(frm,
|
|
- wlan_crypto_rsn_cipher_to_suite(
|
|
|
|
|
|
+ wlan_crypto_rsn_cipher_to_suite(
|
|
WLAN_CRYPTO_CIPHER_AES_CCM));
|
|
WLAN_CRYPTO_CIPHER_AES_CCM));
|
|
}
|
|
}
|
|
if (UCIPHER_IS_CCMP256(crypto_params)) {
|
|
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_rsn_cipher_to_suite(
|
|
WLAN_CRYPTO_CIPHER_AES_GCM_256));
|
|
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 */
|
|
/* 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 */
|
|
/* optional capabilities */
|
|
if (crypto_params->rsn_caps != 0 &&
|
|
if (crypto_params->rsn_caps != 0 &&
|
|
crypto_params->rsn_caps != WLAN_CRYPTO_RSN_CAP_PREAUTH){
|
|
crypto_params->rsn_caps != WLAN_CRYPTO_RSN_CAP_PREAUTH){
|
|
|
|
|
|
- WLAN_CRYPTO_ADDSHORT(frm, crypto_params->rsn_caps);
|
|
|
|
-
|
|
|
|
if (HAS_MGMT_CIPHER(crypto_params,
|
|
if (HAS_MGMT_CIPHER(crypto_params,
|
|
WLAN_CRYPTO_CIPHER_AES_CMAC)) {
|
|
WLAN_CRYPTO_CIPHER_AES_CMAC)) {
|
|
selcnt[0]++;
|
|
selcnt[0]++;
|
|
@@ -2136,6 +2173,7 @@ uint8_t *wlan_crypto_build_rsnie(struct wlan_crypto_params *crypto_params,
|
|
WLAN_CRYPTO_CIPHER_AES_GMAC_256));
|
|
WLAN_CRYPTO_CIPHER_AES_GMAC_256));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
/* calculate element length */
|
|
/* calculate element length */
|
|
iebuf[1] = frm - iebuf - 2;
|
|
iebuf[1] = frm - iebuf - 2;
|
|
|
|
|