|
@@ -1641,14 +1641,13 @@ wlan_crypto_wpa_keymgmt_to_suite(uint32_t keymgmt)
|
|
|
return status;
|
|
|
}
|
|
|
/**
|
|
|
- *
|
|
|
* Convert a WPA cipher selector OUI to an internal
|
|
|
* cipher algorithm. Where appropriate we also
|
|
|
* record any key length.
|
|
|
*/
|
|
|
static int32_t wlan_crypto_wpa_suite_to_cipher(uint8_t *sel)
|
|
|
{
|
|
|
- uint32_t w = BE_READ_4(sel);
|
|
|
+ uint32_t w = LE_READ_4(sel);
|
|
|
int32_t status = -1;
|
|
|
|
|
|
switch (w) {
|
|
@@ -1669,7 +1668,7 @@ static int32_t wlan_crypto_wpa_suite_to_cipher(uint8_t *sel)
|
|
|
*/
|
|
|
static int32_t wlan_crypto_wpa_suite_to_keymgmt(uint8_t *sel)
|
|
|
{
|
|
|
- uint32_t w = BE_READ_4(sel);
|
|
|
+ uint32_t w = LE_READ_4(sel);
|
|
|
int32_t status = -1;
|
|
|
|
|
|
switch (w) {
|
|
@@ -1692,7 +1691,7 @@ static int32_t wlan_crypto_wpa_suite_to_keymgmt(uint8_t *sel)
|
|
|
*/
|
|
|
static int32_t wlan_crypto_rsn_suite_to_cipher(uint8_t *sel)
|
|
|
{
|
|
|
- uint32_t w = BE_READ_4(sel);
|
|
|
+ uint32_t w = LE_READ_4(sel);
|
|
|
int32_t status = -1;
|
|
|
|
|
|
switch (w) {
|
|
@@ -1726,7 +1725,7 @@ static int32_t wlan_crypto_rsn_suite_to_cipher(uint8_t *sel)
|
|
|
*/
|
|
|
static int32_t wlan_crypto_rsn_suite_to_keymgmt(uint8_t *sel)
|
|
|
{
|
|
|
- uint32_t w = BE_READ_4(sel);
|
|
|
+ uint32_t w = LE_READ_4(sel);
|
|
|
int32_t status = -1;
|
|
|
|
|
|
switch (w) {
|
|
@@ -1938,18 +1937,27 @@ 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)
|
|
|
+ return NULL;
|
|
|
+
|
|
|
+ crypto_params = wlan_crypto_vdev_get_comp_params(vdev, &crypto_priv);
|
|
|
+
|
|
|
+ if (!crypto_params)
|
|
|
+ return NULL;
|
|
|
|
|
|
*frm++ = WLAN_ELEMID_VENDOR;
|
|
|
*frm++ = 0;
|
|
@@ -1958,10 +1966,15 @@ 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);
|
|
@@ -1978,12 +1991,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;
|
|
@@ -2010,7 +2017,6 @@ uint8_t *wlan_crypto_build_wpaie(struct wlan_crypto_params *crypto_params,
|
|
|
wlan_crypto_wpa_keymgmt_to_suite(
|
|
|
WLAN_CRYPTO_KEY_MGMT_NONE));
|
|
|
}
|
|
|
-
|
|
|
/* calculate element length */
|
|
|
iebuf[1] = frm - iebuf - 2;
|
|
|
|
|
@@ -2020,18 +2026,29 @@ 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) {
|
|
|
+ return NULL;
|
|
|
+ }
|
|
|
+
|
|
|
+ crypto_params = wlan_crypto_vdev_get_comp_params(vdev, &crypto_priv);
|
|
|
+
|
|
|
+ if (!crypto_params) {
|
|
|
+ return NULL;
|
|
|
+ }
|
|
|
|
|
|
*frm++ = WLAN_ELEMID_RSN;
|
|
|
*frm++ = 0;
|
|
@@ -2039,9 +2056,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;
|
|
@@ -2050,13 +2085,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)) {
|
|
@@ -2078,12 +2113,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 */
|
|
@@ -2143,12 +2172,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]++;
|
|
@@ -2179,6 +2207,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;
|
|
|
|