From a301c8343ddab483e0a264612795fed44702dd05 Mon Sep 17 00:00:00 2001 From: Rohan Dutta Date: Thu, 30 Nov 2017 20:29:26 +0530 Subject: [PATCH] Revert "qcacmn: Add WPA/RSN IE from driver" This reverts Change-Id 2088888. Change-Id: I12fd8ad77a36d6c7e1247ec29fa08c7caa68ce91 --- .../crypto/inc/wlan_crypto_global_api.h | 12 +- .../crypto/src/wlan_crypto_def_i.h | 96 ++++++++-------- .../crypto/src/wlan_crypto_global_api.c | 104 ++++++------------ 3 files changed, 92 insertions(+), 120 deletions(-) diff --git a/umac/cmn_services/crypto/inc/wlan_crypto_global_api.h b/umac/cmn_services/crypto/inc/wlan_crypto_global_api.h index 0cc96a6bd1e1..1abe076462a9 100644 --- a/umac/cmn_services/crypto/inc/wlan_crypto_global_api.h +++ b/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 * - * @vdev: vdev + * @crypto params: crypto params * @iebuf: ie buffer * - * This function gets called by mlme to build wpaie from given vdev + * This function gets called by mlme to build wpaie from given crypto params * * Return: end of buffer */ -uint8_t *wlan_crypto_build_wpaie(struct wlan_objmgr_vdev *vdev, +uint8_t *wlan_crypto_build_wpaie(struct wlan_crypto_params *, uint8_t *iebuf); /** * wlan_crypto_build_rsnie - called by mlme to build rsnie * - * @vdev: vdev + * @crypto params: crypto params * @iebuf: ie buffer * - * This function gets called by mlme to build rsnie from given vdev + * This function gets called by mlme to build rsnie from given crypto params * * Return: end of buffer */ -uint8_t *wlan_crypto_build_rsnie(struct wlan_objmgr_vdev *vdev, +uint8_t *wlan_crypto_build_rsnie(struct wlan_crypto_params *, uint8_t *iebuf); /** diff --git a/umac/cmn_services/crypto/src/wlan_crypto_def_i.h b/umac/cmn_services/crypto/src/wlan_crypto_def_i.h index 4ddd127320e1..6da06c537ed3 100644 --- a/umac/cmn_services/crypto/src/wlan_crypto_def_i.h +++ b/umac/cmn_services/crypto/src/wlan_crypto_def_i.h @@ -212,57 +212,67 @@ static inline void wlan_crypto_put_be64(u8 *a, u64 val) (((uint32_t) (c)) << 8) | \ (uint32_t) (d)) -#define WPA_TYPE_OUI WLAN_WPA_SEL(WLAN_WPA_OUI_TYPE) +#define WPA_TYPE_OUI WLAN_CRYPTO_SELECTOR(0x00, 0x50, 0xf2, 1) #define WLAN_CRYPTO_WAPI_IE_LEN 20 #define WLAN_CRYPTO_WAPI_SMS4_CIPHER 0x01 -#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_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_PSK_OVER_802_1X \ - WLAN_WPA_SEL(WLAN_ASE_8021X_PSK) -#define WPA_AUTH_KEY_MGMT_CCKM WLAN_WPA_CCKM_AKM + 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_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 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_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_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_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 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) #define RESET_PARAM(__param) ((__param) = 0) #define SET_PARAM(__param, __val) ((__param) |= (1<<(__val))) diff --git a/umac/cmn_services/crypto/src/wlan_crypto_global_api.c b/umac/cmn_services/crypto/src/wlan_crypto_global_api.c index 2b8671090915..474f6b22a82c 100644 --- a/umac/cmn_services/crypto/src/wlan_crypto_global_api.c +++ b/umac/cmn_services/crypto/src/wlan_crypto_global_api.c @@ -1895,31 +1895,18 @@ QDF_STATUS wlan_crypto_rsnie_check(struct wlan_crypto_params *crypto_params, /** * wlan_crypto_build_wpaie - called by mlme to build wpaie * - * @vdev: vdev + * @crypto params: crypto params * @iebuf: ie buffer * - * This function gets called by mlme to build wpaie from given vdev + * This function gets called by mlme to build wpaie from given crypto params * * Return: end of buffer */ -uint8_t *wlan_crypto_build_wpaie(struct wlan_objmgr_vdev *vdev, - uint8_t *iebuf){ +uint8_t *wlan_crypto_build_wpaie(struct wlan_crypto_params *crypto_params, + uint8_t *iebuf){ uint8_t *frm = iebuf; uint8_t *selcnt; - 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; - } + uint32_t mcastcipher; *frm++ = WLAN_ELEMID_VENDOR; *frm++ = 0; @@ -1928,17 +1915,11 @@ uint8_t *wlan_crypto_build_wpaie(struct wlan_objmgr_vdev *vdev, /* multicast cipher */ - 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 */ + mcastcipher = wlan_crypto_get_mcastcipher(crypto_params); + WLAN_CRYPTO_ADDSELECTOR(frm, + wlan_crypto_wpa_cipher_to_suite(mcastcipher)); + /* unicast cipher list */ selcnt = frm; WLAN_CRYPTO_ADDSHORT(frm, 0); /* do not use CCMP unicast cipher in WPA mode */ @@ -1954,6 +1935,12 @@ uint8_t *wlan_crypto_build_wpaie(struct wlan_objmgr_vdev *vdev, 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; @@ -1990,31 +1977,18 @@ uint8_t *wlan_crypto_build_wpaie(struct wlan_objmgr_vdev *vdev, /** * wlan_crypto_build_rsnie - called by mlme to build rsnie * - * @vdev: vdev + * @crypto params: crypto params * @iebuf: ie buffer * - * This function gets called by mlme to build rsnie from given vdev + * This function gets called by mlme to build rsnie from given crypto params * * Return: end of buffer */ -uint8_t *wlan_crypto_build_rsnie(struct wlan_objmgr_vdev *vdev, - uint8_t *iebuf){ +uint8_t *wlan_crypto_build_rsnie(struct wlan_crypto_params *crypto_params, + uint8_t *iebuf){ uint8_t *frm = iebuf; uint8_t *selcnt; - 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; - } + uint32_t mcastcipher; *frm++ = WLAN_ELEMID_RSN; *frm++ = 0; @@ -2022,27 +1996,9 @@ uint8_t *wlan_crypto_build_rsnie(struct wlan_objmgr_vdev *vdev, /* multicast cipher */ - 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)); - } + mcastcipher = wlan_crypto_get_mcastcipher(crypto_params); + WLAN_CRYPTO_ADDSELECTOR(frm, + wlan_crypto_rsn_cipher_to_suite(mcastcipher)); /* unicast cipher list */ selcnt = frm; @@ -2051,13 +2007,13 @@ uint8_t *wlan_crypto_build_rsnie(struct wlan_objmgr_vdev *vdev, 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)) { @@ -2079,6 +2035,12 @@ uint8_t *wlan_crypto_build_rsnie(struct wlan_objmgr_vdev *vdev, 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 */ @@ -2138,11 +2100,12 @@ uint8_t *wlan_crypto_build_rsnie(struct wlan_objmgr_vdev *vdev, } } - 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]++; @@ -2173,7 +2136,6 @@ uint8_t *wlan_crypto_build_rsnie(struct wlan_objmgr_vdev *vdev, WLAN_CRYPTO_CIPHER_AES_GMAC_256)); } } - /* calculate element length */ iebuf[1] = frm - iebuf - 2;