fix(esp_wifi): skip call to esp_fast_psk() when hardware SHA is not supported

This commit is contained in:
Kapil Gupta
2025-07-16 12:10:43 +05:30
committed by BOT
parent a20fc1a717
commit fe9dbc2b1d
2 changed files with 3 additions and 9 deletions

View File

@@ -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) */

View File

@@ -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,