mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-01-26 08:12:19 +01:00
Merge pull request #9225 from gojimmypi/pr-espidf-v6-sha-fix
Add fix for SHA HW on ESP-IDF v6
This commit is contained in:
@@ -55,6 +55,9 @@
|
||||
|
||||
#include <hal/sha_ll.h>
|
||||
#include <hal/clk_gate_ll.h>
|
||||
#if ESP_IDF_VERSION_MAJOR >= 6
|
||||
#include "sha/sha_core.h"
|
||||
#endif
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32) || \
|
||||
defined(CONFIG_IDF_TARGET_ESP32S2) || \
|
||||
defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
@@ -1928,6 +1931,24 @@ static int wc_esp_process_block(WC_ESP32SHA* ctx, /* see ctx->sha_type */
|
||||
}
|
||||
if (ctx->isfirstblock) {
|
||||
ets_sha_enable(); /* will clear initial digest */
|
||||
#if ESP_IDF_VERSION_MAJOR >= 6
|
||||
/* Beginning ESP-IDF v6, the mode needs to be explicitly set. */
|
||||
sha_hal_wait_idle();
|
||||
switch (ctx->sha_type) {
|
||||
case SHA1:
|
||||
sha_hal_set_mode(SHA1);
|
||||
break;
|
||||
case SHA2_224:
|
||||
esp_sha_set_mode(SHA2_224);
|
||||
break;
|
||||
case SHA2_256:
|
||||
esp_sha_set_mode(SHA2_256);
|
||||
break;
|
||||
default:
|
||||
/* Unsupported SHA mode. */
|
||||
ESP_LOGW(TAG, "Unexpected sha_type", ctx->sha_type);
|
||||
}
|
||||
#endif
|
||||
#if defined(DEBUG_WOLFSSL)
|
||||
{
|
||||
this_block_num = 1; /* one-based counter, just for debug info */
|
||||
|
||||
Reference in New Issue
Block a user