File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
wolfcrypt/src/port/Espressif Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 5555
5656 #include <hal/sha_ll.h>
5757 #include <hal/clk_gate_ll.h>
58+ #if ESP_IDF_VERSION_MAJOR >= 6
59+ #include "sha/sha_core.h"
60+ #endif
5861#elif defined(CONFIG_IDF_TARGET_ESP32 ) || \
5962 defined(CONFIG_IDF_TARGET_ESP32S2 ) || \
6063 defined(CONFIG_IDF_TARGET_ESP32S3 )
@@ -1928,6 +1931,24 @@ static int wc_esp_process_block(WC_ESP32SHA* ctx, /* see ctx->sha_type */
19281931 }
19291932 if (ctx -> isfirstblock ) {
19301933 ets_sha_enable (); /* will clear initial digest */
1934+ #if ESP_IDF_VERSION_MAJOR >= 6
1935+ /* Beginning ESP-IDF v6, the mode needs to be explictly set. */
1936+ sha_hal_wait_idle ();
1937+ switch (ctx -> sha_type ) {
1938+ case SHA1 :
1939+ sha_hal_set_mode (SHA1 );
1940+ break ;
1941+ case SHA2_224 :
1942+ esp_sha_set_mode (SHA2_224 );
1943+ break ;
1944+ case SHA2_256 :
1945+ esp_sha_set_mode (SHA2_256 );
1946+ break ;
1947+ default :
1948+ /* Unsupported SHA mode. */
1949+ ESP_LOGW (TAG , "Unexpected sha_type" , ctx -> sha_type );
1950+ }
1951+ #endif
19311952 #if defined(DEBUG_WOLFSSL )
19321953 {
19331954 this_block_num = 1 ; /* one-based counter, just for debug info */
You can’t perform that action at this time.
0 commit comments