mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
esp32/wpa_supplicant: fix some bugs introduced by wifi os adapter
1. Fix the WiFi/BT coexist bug 2. Fix WPA2 enterprise example crash bug 3. Add size and version check for crypto type struct 4. Add MD5 check for crypto type header file
This commit is contained in:
parent
eeff0ca1fa
commit
4afa5d0d29
@ -36,6 +36,8 @@
|
||||
* we recommend, so as the API in WPS default and WPA2 default.
|
||||
*/
|
||||
const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs = {
|
||||
.size = sizeof(wpa_crypto_funcs_t),
|
||||
.version = ESP_WIFI_CRYPTO_VERSION,
|
||||
.aes_wrap = (esp_aes_wrap_t)fast_aes_wrap,
|
||||
.aes_unwrap = (esp_aes_unwrap_t)fast_aes_unwrap,
|
||||
.hmac_sha256_vector = (esp_hmac_sha256_vector_t)fast_hmac_sha256_vector,
|
||||
@ -58,6 +60,8 @@ const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs = {
|
||||
};
|
||||
|
||||
const wps_crypto_funcs_t g_wifi_default_wps_crypto_funcs = {
|
||||
.size = sizeof(wps_crypto_funcs_t),
|
||||
.version = ESP_WIFI_CRYPTO_VERSION,
|
||||
.aes_128_encrypt = (esp_aes_128_encrypt_t)fast_aes_128_cbc_encrypt,
|
||||
.aes_128_decrypt = (esp_aes_128_decrypt_t)fast_aes_128_cbc_decrypt,
|
||||
.crypto_mod_exp = (esp_crypto_mod_exp_t)fast_crypto_mod_exp,
|
||||
@ -85,6 +89,8 @@ const wps_crypto_funcs_t g_wifi_default_wps_crypto_funcs = {
|
||||
* crypto_hash_finish, so do crypto_cipher.
|
||||
*/
|
||||
const wpa2_crypto_funcs_t g_wifi_default_wpa2_crypto_funcs = {
|
||||
.size = sizeof(wpa2_crypto_funcs_t),
|
||||
.version = ESP_WIFI_CRYPTO_VERSION,
|
||||
.crypto_hash_init = (esp_crypto_hash_init_t)fast_crypto_hash_init,
|
||||
.crypto_hash_update = (esp_crypto_hash_update_t)fast_crypto_hash_update,
|
||||
.crypto_hash_finish = (esp_crypto_hash_finish_t)fast_crypto_hash_finish,
|
||||
@ -100,6 +106,8 @@ const wpa2_crypto_funcs_t g_wifi_default_wpa2_crypto_funcs = {
|
||||
.eap_peer_blob_deinit = (esp_eap_peer_blob_deinit_t)eap_peer_blob_deinit,
|
||||
.eap_peer_config_init = (esp_eap_peer_config_init_t)eap_peer_config_init,
|
||||
.eap_peer_config_deinit = (esp_eap_peer_config_deinit_t)eap_peer_config_deinit,
|
||||
.eap_peer_register_methods = (esp_eap_peer_register_methods_t)eap_peer_register_methods,
|
||||
.eap_peer_unregister_methods = (esp_eap_peer_unregister_methods_t)eap_peer_unregister_methods,
|
||||
.eap_deinit_prev_method = (esp_eap_deinit_prev_method_t)eap_deinit_prev_method,
|
||||
.eap_peer_get_eap_method = (esp_eap_peer_get_eap_method_t)eap_peer_get_eap_method,
|
||||
.eap_sm_abort = (esp_eap_sm_abort_t)eap_sm_abort,
|
||||
|
@ -27,6 +27,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ESP_WIFI_CRYPTO_VERSION 0x00000001
|
||||
|
||||
/*
|
||||
* Enumeration for hash operations.
|
||||
* When WPA2 is connecting, this enum is used to
|
||||
@ -697,6 +699,8 @@ typedef int (*esp_wps_is_selected_pbc_registrar_t)(const void *msg, unsigned cha
|
||||
* hardware.
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t size;
|
||||
uint32_t version;
|
||||
esp_aes_wrap_t aes_wrap; /**< station connect function used when send EAPOL frame */
|
||||
esp_aes_unwrap_t aes_unwrap; /**< station connect function used when decrypt key data */
|
||||
esp_hmac_sha256_vector_t hmac_sha256_vector; /**< station connect function used when check MIC */
|
||||
@ -724,6 +728,8 @@ typedef struct {
|
||||
* hardware.
|
||||
*/
|
||||
typedef struct{
|
||||
uint32_t size;
|
||||
uint32_t version;
|
||||
esp_aes_128_encrypt_t aes_128_encrypt; /**< function used to process message when do WPS */
|
||||
esp_aes_128_decrypt_t aes_128_decrypt; /**< function used to process message when do WPS */
|
||||
esp_crypto_mod_exp_t crypto_mod_exp; /**< function used to calculate public key and private key */
|
||||
@ -750,6 +756,8 @@ typedef struct{
|
||||
* hardware.
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t size;
|
||||
uint32_t version;
|
||||
esp_crypto_hash_init_t crypto_hash_init; /**< function used to initialize a crypto_hash structure when use TLSV1 */
|
||||
esp_crypto_hash_update_t crypto_hash_update; /**< function used to calculate hash data when use TLSV1 */
|
||||
esp_crypto_hash_finish_t crypto_hash_finish; /**< function used to finish the hash calculate when use TLSV1 */
|
||||
@ -765,6 +773,8 @@ typedef struct {
|
||||
esp_eap_peer_blob_deinit_t eap_peer_blob_deinit;
|
||||
esp_eap_peer_config_init_t eap_peer_config_init;
|
||||
esp_eap_peer_config_deinit_t eap_peer_config_deinit;
|
||||
esp_eap_peer_register_methods_t eap_peer_register_methods;
|
||||
esp_eap_peer_unregister_methods_t eap_peer_unregister_methods;
|
||||
esp_eap_deinit_prev_method_t eap_deinit_prev_method;
|
||||
esp_eap_peer_get_eap_method_t eap_peer_get_eap_method;
|
||||
esp_eap_sm_abort_t eap_sm_abort;
|
||||
|
@ -138,6 +138,17 @@ esp_err_t esp_wifi_internal_set_sta_ip(void);
|
||||
*/
|
||||
esp_err_t esp_wifi_internal_osi_funcs_md5_check(const char *md5);
|
||||
|
||||
/**
|
||||
* @brief Check the MD5 values of the crypto types header files in IDF and WiFi library
|
||||
*
|
||||
* @attention 1. It is used for internal CI version check
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : succeed
|
||||
* - ESP_WIFI_INVALID_ARG : MD5 check fail
|
||||
*/
|
||||
esp_err_t esp_wifi_internal_crypto_funcs_md5_check(const char *md5);
|
||||
|
||||
/**
|
||||
* @brief Allocate a chunk of memory for WiFi driver
|
||||
*
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 13a07ae99e83c2781c1bfd322e131226c688a4e9
|
||||
Subproject commit 37f7289daf5aacbd4c789f9e01f451f5e3f45f76
|
@ -133,6 +133,8 @@ esp_err_t esp_phy_rf_init(const esp_phy_init_data_t* init_data, esp_phy_calibrat
|
||||
extern esp_err_t wifi_osi_funcs_register(wifi_osi_funcs_t *osi_funcs);
|
||||
status = wifi_osi_funcs_register(&g_wifi_osi_funcs);
|
||||
if(status != ESP_OK) {
|
||||
ESP_LOGE(TAG, "failed to register wifi os adapter, ret(%d)", status);
|
||||
_lock_release(&s_phy_rf_init_lock);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
coex_bt_high_prio();
|
||||
|
@ -12,6 +12,11 @@ COMPONENT_SRCDIRS := . test_vectors
|
||||
WIFI_OS_ADAPTER_MD5_VAL=\"$(shell md5sum $(IDF_PATH)/components/esp32/include/esp_wifi_os_adapter.h | cut -c 1-7)\"
|
||||
CFLAGS+=-DWIFI_OS_ADAPTER_MD5=$(WIFI_OS_ADAPTER_MD5_VAL)
|
||||
|
||||
# Calculate MD5 value of header file esp_wifi_crypto_types.h
|
||||
WIFI_CRYPTO_MD5_VAL=\"$(shell md5sum $(IDF_PATH)/components/esp32/include/esp_wifi_crypto_types.h | cut -c 1-7)\"
|
||||
CFLAGS+=-DWIFI_CRYPTO_MD5=$(WIFI_CRYPTO_MD5_VAL)
|
||||
|
||||
|
||||
test_tjpgd.o: test_tjpgd_logo.h
|
||||
|
||||
test_tjpgd_logo.h: $(COMPONENT_PATH)/logo.jpg
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "esp_log.h"
|
||||
#include "esp_wifi_internal.h"
|
||||
|
||||
static const char* TAG = "test_os_adapter_md5";
|
||||
static const char* TAG = "test_header_files_md5";
|
||||
|
||||
TEST_CASE("wifi os adapter MD5","[wifi]")
|
||||
{
|
||||
@ -16,3 +16,13 @@ TEST_CASE("wifi os adapter MD5","[wifi]")
|
||||
|
||||
ESP_LOGI(TAG, "test passed...");
|
||||
}
|
||||
|
||||
TEST_CASE("wifi crypto types MD5","[wifi]")
|
||||
{
|
||||
const char *test_wifi_crypto_funcs_md5 = WIFI_CRYPTO_MD5;
|
||||
|
||||
ESP_LOGI(TAG, "test wifi crypto adapter MD5...");
|
||||
TEST_ESP_OK(esp_wifi_internal_crypto_funcs_md5_check(test_wifi_crypto_funcs_md5));
|
||||
|
||||
ESP_LOGI(TAG, "test passed...");
|
||||
}
|
@ -33,4 +33,7 @@ int eap_peer_peap_register(void);
|
||||
int eap_peer_ttls_register(void);
|
||||
int eap_peer_mschapv2_register(void);
|
||||
|
||||
void eap_peer_unregister_methods(void);
|
||||
int eap_peer_register_methods(void);
|
||||
|
||||
#endif /* EAP_METHODS_H */
|
||||
|
Loading…
Reference in New Issue
Block a user