mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-03 10:30:58 +02:00
Merge branch 'bugfix/protect_sha_hal_api_call' into 'master'
fix(esp_wifi): skip call to esp_fast_psk() when hardware SHA is not supported Closes WIFI-6959 See merge request espressif/esp-idf!40609
This commit is contained in:
@@ -788,7 +788,7 @@ int pbkdf2_sha1(const char *passphrase, const u8 *ssid, size_t ssid_len,
|
|||||||
/* For ESP32: Using pbkdf2_hmac_sha1() because esp_fast_psk() utilizes hardware,
|
/* For ESP32: Using pbkdf2_hmac_sha1() because esp_fast_psk() utilizes hardware,
|
||||||
* but for ESP32, the SHA1 hardware implementation is slower than the software implementation.
|
* but for ESP32, the SHA1 hardware implementation is slower than the software implementation.
|
||||||
*/
|
*/
|
||||||
#if CONFIG_IDF_TARGET_ESP32
|
#if defined(CONFIG_IDF_TARGET_ESP32) || !defined(CONFIG_SOC_SHA_SUPPORTED)
|
||||||
fastpbkdf2_hmac_sha1((const u8 *) passphrase, os_strlen(passphrase),
|
fastpbkdf2_hmac_sha1((const u8 *) passphrase, os_strlen(passphrase),
|
||||||
ssid, ssid_len, iterations, buf, buflen);
|
ssid, ssid_len, iterations, buf, buflen);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -799,13 +799,7 @@ int pbkdf2_sha1(const char *passphrase, const u8 *ssid, size_t ssid_len,
|
|||||||
int ret = mbedtls_pkcs5_pbkdf2_hmac_ext(MBEDTLS_MD_SHA1, (const u8 *) passphrase,
|
int ret = mbedtls_pkcs5_pbkdf2_hmac_ext(MBEDTLS_MD_SHA1, (const u8 *) passphrase,
|
||||||
os_strlen(passphrase), ssid,
|
os_strlen(passphrase), ssid,
|
||||||
ssid_len, iterations, buflen, buf);
|
ssid_len, iterations, buflen, buf);
|
||||||
if (ret != 0) {
|
return ret == 0 ? 0 : -1;
|
||||||
ret = -1;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* defined(CONFIG_MBEDTLS_SHA1_C) || defined(CONFIG_MBEDTLS_HARDWARE_SHA) */
|
#endif /* defined(CONFIG_MBEDTLS_SHA1_C) || defined(CONFIG_MBEDTLS_HARDWARE_SHA) */
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
#include "test_wpa_supplicant_common.h"
|
#include "test_wpa_supplicant_common.h"
|
||||||
|
|
||||||
#define PMK_LEN 32
|
#define PMK_LEN 32
|
||||||
#define NUM_ITERATIONS 15
|
#define NUM_ITERATIONS 5
|
||||||
#define MIN_PASSPHARSE_LEN 8
|
#define MIN_PASSPHARSE_LEN 8
|
||||||
|
|
||||||
void fastpbkdf2_hmac_sha1(const uint8_t *pw, size_t npw,
|
void fastpbkdf2_hmac_sha1(const uint8_t *pw, size_t npw,
|
||||||
|
Reference in New Issue
Block a user