@@ -679,7 +679,10 @@ int esp_sha256_ctx_copy(struct wc_Sha256* src, struct wc_Sha256* dst)
679679} /* esp_sha256_ctx_copy */
680680#endif
681681
682- #if defined(WOLFSSL_SHA384 ) || defined(WOLFSSL_SHA512 )
682+ #if !(defined(NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 ) && \
683+ defined(NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 ) \
684+ ) && \
685+ (defined(WOLFSSL_SHA384 ) || defined(WOLFSSL_SHA512 ))
683686/*
684687** internal sha384 ctx copy for ESP HW
685688*/
@@ -744,7 +747,10 @@ int esp_sha384_ctx_copy(struct wc_Sha512* src, struct wc_Sha512* dst)
744747} /* esp_sha384_ctx_copy */
745748#endif
746749
747- #if defined(WOLFSSL_SHA384 ) || defined(WOLFSSL_SHA512 )
750+ #if !(defined(NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 ) && \
751+ defined(NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 ) \
752+ ) && \
753+ (defined(WOLFSSL_SHA384 ) || defined(WOLFSSL_SHA512 ))
748754/*
749755** Internal sha512 ctx copy for ESP HW.
750756** If HW already active, fall back to SW for this ctx.
@@ -1190,7 +1196,7 @@ int esp_sha_try_hw_lock(WC_ESP32SHA* ctx)
11901196 ESP_LOGE (TAG , "unexpected error in esp_sha_try_hw_lock." );
11911197 return ESP_FAIL ;
11921198 }
1193- #else /* not ESP_FAILfined( SINGLE_THREADED) */
1199+ #else /* not SINGLE_THREADED */
11941200 /*
11951201 ** there's only one SHA engine for all the hash types
11961202 ** so when any hash is in use, no others can use it.
@@ -2013,7 +2019,7 @@ int wc_esp_digest_state(WC_ESP32SHA* ctx, byte* hash)
20132019 pwrd1 [i ] ^= pwrd1 [i + 1 ];
20142020 }
20152021 }
2016- #endif
2022+ #endif /* SHA512 or SHA384*/
20172023#endif /* not CONFIG_IDF_TARGET_ESP32S3, C3, else... */
20182024
20192025 ESP_LOGV (TAG , "leave esp_digest_state" );
@@ -2122,6 +2128,9 @@ int esp_sha256_digest_process(struct wc_Sha256* sha, byte blockprocess)
21222128 }
21232129
21242130 wc_esp_digest_state (& sha -> ctx , (byte * )sha -> digest );
2131+ #else
2132+ ESP_LOGE (TAG , "Call esp_sha256_digest_process with "
2133+ "NO_WOLFSSL_ESP32_CRYPT_HASH_SHA256 " );
21252134#endif
21262135 ESP_LOGV (TAG , "leave esp_sha256_digest_process" );
21272136 return ret ;
@@ -2130,7 +2139,10 @@ int esp_sha256_digest_process(struct wc_Sha256* sha, byte blockprocess)
21302139
21312140#endif /* NO_SHA256 */
21322141
2133- #if defined(WOLFSSL_SHA512 ) || defined(WOLFSSL_SHA384 )
2142+ #if !(defined(NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 ) && \
2143+ defined(NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 ) \
2144+ ) && \
2145+ (defined(WOLFSSL_SHA512 ) || defined(WOLFSSL_SHA384 ))
21342146/*
21352147** sha512 process. this is used for sha384 too.
21362148*/
0 commit comments