From 6384299167b7c5082e83af505a8f9f0207068606 Mon Sep 17 00:00:00 2001 From: Laukik Hase Date: Wed, 4 Jan 2023 16:54:56 +0530 Subject: [PATCH] wpa_supplicant: Update deprecated API (`mbedtls_pkcs5_pbkdf2_hmac`) - The newer alternative does not require HMAC context for its operation --- .../src/crypto/crypto_mbedtls.c | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls.c b/components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls.c index b6ec692adc..562f076f25 100644 --- a/components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls.c +++ b/components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls.c @@ -744,25 +744,7 @@ cleanup: int pbkdf2_sha1(const char *passphrase, const u8 *ssid, size_t ssid_len, int iterations, u8 *buf, size_t buflen) { - - mbedtls_md_context_t sha1_ctx; - const mbedtls_md_info_t *info_sha1; - int ret; - - mbedtls_md_init(&sha1_ctx); - - info_sha1 = mbedtls_md_info_from_type(MBEDTLS_MD_SHA1); - if (info_sha1 == NULL) { - ret = -1; - goto cleanup; - } - - if ((ret = mbedtls_md_setup(&sha1_ctx, info_sha1, 1)) != 0) { - ret = -1; - goto cleanup; - } - - ret = mbedtls_pkcs5_pbkdf2_hmac(&sha1_ctx, (const u8 *) passphrase, + int ret = mbedtls_pkcs5_pbkdf2_hmac_ext(MBEDTLS_MD_SHA1, (const u8 *) passphrase, os_strlen(passphrase) , ssid, ssid_len, iterations, 32, buf); if (ret != 0) { @@ -771,7 +753,6 @@ int pbkdf2_sha1(const char *passphrase, const u8 *ssid, size_t ssid_len, } cleanup: - mbedtls_md_free(&sha1_ctx); return ret; }