diff --git a/os_if/linux/crypto/inc/wlan_nl_to_crypto_params.h b/os_if/linux/crypto/inc/wlan_nl_to_crypto_params.h index 58e44c21f44a..c55739425631 100644 --- a/os_if/linux/crypto/inc/wlan_nl_to_crypto_params.h +++ b/os_if/linux/crypto/inc/wlan_nl_to_crypto_params.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -30,9 +30,10 @@ * set the crypto auth type for corresponding auth type received * from NL * - * Return: crypto auth type, negative value for failure + * Return: crypto auth type */ -int osif_nl_to_crypto_auth_type(enum nl80211_auth_type auth_type); +wlan_crypto_auth_mode +osif_nl_to_crypto_auth_type(enum nl80211_auth_type auth_type); /** * osif_nl_to_crypto_akm_type() - populate akm type for crypto @@ -41,9 +42,9 @@ int osif_nl_to_crypto_auth_type(enum nl80211_auth_type auth_type); * set the crypto akm type for corresponding akm type received * from NL * - * Return: crypto akm type, negative value for failure + * Return: crypto akm type */ -int osif_nl_to_crypto_akm_type(u32 key_mgmt); +wlan_crypto_key_mgmt osif_nl_to_crypto_akm_type(u32 key_mgmt); /** * osif_nl_to_crypto_cipher_type() - populate cipher type for crypto diff --git a/os_if/linux/crypto/src/wlan_nl_to_crypto_params.c b/os_if/linux/crypto/src/wlan_nl_to_crypto_params.c index 2ecf276048a9..3e8430d5e884 100644 --- a/os_if/linux/crypto/src/wlan_nl_to_crypto_params.c +++ b/os_if/linux/crypto/src/wlan_nl_to_crypto_params.c @@ -276,7 +276,8 @@ static const struct osif_cipher_crypto_mapping #endif }; -int osif_nl_to_crypto_auth_type(enum nl80211_auth_type auth_type) +wlan_crypto_auth_mode +osif_nl_to_crypto_auth_type(enum nl80211_auth_type auth_type) { wlan_crypto_auth_mode crypto_auth_type = WLAN_CRYPTO_AUTH_NONE; @@ -284,15 +285,17 @@ int osif_nl_to_crypto_auth_type(enum nl80211_auth_type auth_type) auth_type >= QDF_ARRAY_SIZE(osif_auth_type_crypto_mapping)) { QDF_TRACE_ERROR(QDF_MODULE_ID_OS_IF, "Unknown type: %d", auth_type); - return -EINVAL; + return crypto_auth_type; } + + crypto_auth_type = osif_auth_type_crypto_mapping[auth_type]; QDF_TRACE_DEBUG(QDF_MODULE_ID_OS_IF, "Auth type, NL: %d, crypto: %d", - auth_type, osif_auth_type_crypto_mapping[auth_type]); + auth_type, crypto_auth_type); return crypto_auth_type; } -int osif_nl_to_crypto_akm_type(u32 key_mgmt) +wlan_crypto_key_mgmt osif_nl_to_crypto_akm_type(u32 key_mgmt) { uint8_t index; wlan_crypto_key_mgmt crypto_akm_type = WLAN_CRYPTO_KEY_MGMT_NONE; @@ -307,13 +310,12 @@ int osif_nl_to_crypto_akm_type(u32 key_mgmt) break; } } - if (!akm_type_crypto_exist) { + if (!akm_type_crypto_exist) QDF_TRACE_ERROR(QDF_MODULE_ID_OS_IF, "Unknown type: %d", key_mgmt); - return -EINVAL; - } - QDF_TRACE_DEBUG(QDF_MODULE_ID_OS_IF, "Akm suite, NL: %d, crypto: %d", - key_mgmt, crypto_akm_type); + else + QDF_TRACE_DEBUG(QDF_MODULE_ID_OS_IF, "Akm suite, NL: %d, crypto: %d", + key_mgmt, crypto_akm_type); return crypto_akm_type; } 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 17e16c8af645..929d12ef1b80 100644 --- a/umac/cmn_services/crypto/src/wlan_crypto_global_api.c +++ b/umac/cmn_services/crypto/src/wlan_crypto_global_api.c @@ -2517,7 +2517,6 @@ QDF_STATUS wlan_crypto_wpaie_check(struct wlan_crypto_params *crypto_params, * version, mcast cipher, and 2 selector counts. * Other, variable-length data, must be checked separately. */ - RESET_AUTHMODE(crypto_params); SET_AUTHMODE(crypto_params, WLAN_CRYPTO_AUTH_WPA); if (len < 14) @@ -2532,7 +2531,6 @@ QDF_STATUS wlan_crypto_wpaie_check(struct wlan_crypto_params *crypto_params, frm += 2, len -= 2; /* multicast/group cipher */ - RESET_MCAST_CIPHERS(crypto_params); w = wlan_crypto_wpa_suite_to_cipher(frm); if (w < 0) return QDF_STATUS_E_INVAL; @@ -2545,7 +2543,6 @@ QDF_STATUS wlan_crypto_wpaie_check(struct wlan_crypto_params *crypto_params, if (len < n*4+2) return QDF_STATUS_E_INVAL; - RESET_UCAST_CIPHERS(crypto_params); for (; n > 0; n--) { w = wlan_crypto_wpa_suite_to_cipher(frm); if (w < 0) @@ -2564,7 +2561,6 @@ QDF_STATUS wlan_crypto_wpaie_check(struct wlan_crypto_params *crypto_params, return QDF_STATUS_E_INVAL; w = 0; - RESET_KEY_MGMT(crypto_params); for (; n > 0; n--) { w = wlan_crypto_wpa_suite_to_keymgmt(frm); if (w < 0) @@ -3136,7 +3132,6 @@ QDF_STATUS wlan_crypto_wapiie_check(struct wlan_crypto_params *crypto_params, * version, mcast cipher, and 2 selector counts. * Other, variable-length data, must be checked separately. */ - RESET_AUTHMODE(crypto_params); SET_AUTHMODE(crypto_params, WLAN_CRYPTO_AUTH_WAPI); if (len < WLAN_CRYPTO_WAPI_IE_LEN) @@ -3155,7 +3150,6 @@ QDF_STATUS wlan_crypto_wapiie_check(struct wlan_crypto_params *crypto_params, if (len < n*4+2) return QDF_STATUS_E_INVAL; - RESET_KEY_MGMT(crypto_params); for (; n > 0; n--) { w = wlan_crypto_wapi_keymgmt(frm); if (w < 0) @@ -3171,7 +3165,6 @@ QDF_STATUS wlan_crypto_wapiie_check(struct wlan_crypto_params *crypto_params, if (len < n*4+2) return QDF_STATUS_E_INVAL; - RESET_UCAST_CIPHERS(crypto_params); for (; n > 0; n--) { w = wlan_crypto_wapi_suite_to_cipher(frm); if (w < 0) @@ -3184,7 +3177,6 @@ QDF_STATUS wlan_crypto_wapiie_check(struct wlan_crypto_params *crypto_params, return QDF_STATUS_E_INVAL; /* multicast/group cipher */ - RESET_MCAST_CIPHERS(crypto_params); w = wlan_crypto_wapi_suite_to_cipher(frm); if (w < 0)