mirror of
https://github.com/espressif/esp-idf.git
synced 2026-08-18 06:35:35 +03:00
fix(wpa_supplicant): guard pbkdf2_sha256 for PSA-provided SHA-256
mbedtls 4.x is PSA-first: CONFIG_MBEDTLS_SHA256_C now maps to PSA_WANT_ALG_SHA_256, and on ESP targets the hardware SHA accelerator serves SHA-256 through PSA, leaving the legacy MBEDTLS_SHA256_C builtin macro undefined. The inner guard on pbkdf2_sha256 was gating on bare MBEDTLS_SHA256_C, so the function was compiled out and NAN ND-PMK derivation (nan_derive_nd_pmk_from_passphrase) failed to link. Guard on (MBEDTLS_SHA256_C || PSA_WANT_ALG_SHA_256) to match the idiom already used elsewhere in the supplicant mbedtls port (tls_mbedtls.c), covering both the legacy builtin and PSA-provided SHA-256.
This commit is contained in:
@@ -1111,7 +1111,7 @@ int pbkdf2_sha1(const char *passphrase, const u8 *ssid, size_t ssid_len,
|
||||
#if defined(MBEDTLS_PKCS5_C) && defined(MBEDTLS_MD_C)
|
||||
#include "mbedtls/private/pkcs5.h"
|
||||
|
||||
#if defined(MBEDTLS_SHA256_C)
|
||||
#if (defined(MBEDTLS_SHA256_C) || defined(PSA_WANT_ALG_SHA_256))
|
||||
int pbkdf2_sha256(const char *passphrase, const u8 *salt, size_t salt_len,
|
||||
int iterations, u8 *buf, size_t buflen)
|
||||
{
|
||||
@@ -1128,7 +1128,7 @@ int pbkdf2_sha256(const char *passphrase, const u8 *salt, size_t salt_len,
|
||||
(unsigned int) iterations, (uint32_t) buflen, buf);
|
||||
return ret == 0 ? 0 : -1;
|
||||
}
|
||||
#endif /* MBEDTLS_SHA256_C */
|
||||
#endif /* MBEDTLS_SHA256_C || PSA_WANT_ALG_SHA_256 */
|
||||
|
||||
#endif /* MBEDTLS_PKCS5_C && MBEDTLS_MD_C */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user