From c54da188223f177fe44d8e21603d83c69495cb12 Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Sun, 19 Apr 2026 13:40:51 +0200 Subject: [PATCH] remove pr#3021 --- src/ESP32React/ArduinoJsonJWT.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/ESP32React/ArduinoJsonJWT.cpp b/src/ESP32React/ArduinoJsonJWT.cpp index 7e7676af5..bbc2b11ac 100644 --- a/src/ESP32React/ArduinoJsonJWT.cpp +++ b/src/ESP32React/ArduinoJsonJWT.cpp @@ -70,16 +70,12 @@ void ArduinoJsonJWT::parseJWT(String jwt, JsonDocument & jsonDocument) { */ String ArduinoJsonJWT::sign(String & payload) { std::array hmacResult{}; - { - mbedtls_md_context_t ctx; - mbedtls_md_type_t md_type = MBEDTLS_MD_SHA256; - mbedtls_md_init(&ctx); - mbedtls_md_setup(&ctx, mbedtls_md_info_from_type(md_type), 1); - mbedtls_md_hmac_starts(&ctx, reinterpret_cast(_secret.c_str()), _secret.length()); - mbedtls_md_hmac_update(&ctx, reinterpret_cast(payload.c_str()), payload.length()); - mbedtls_md_hmac_finish(&ctx, hmacResult.data()); - mbedtls_md_free(&ctx); - } + mbedtls_md_hmac(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256), + reinterpret_cast(_secret.c_str()), + _secret.length(), + reinterpret_cast(payload.c_str()), + payload.length(), + hmacResult.data()); return encode(reinterpret_cast(hmacResult.data()), hmacResult.size()); }