feat(sha): add sha_hal_is_sm3_supported()

Report whether the SHA peripheral can run the SM3 mode. The LL function
sha_ll_is_sm3_supported() exists on every chip. ESP32-S31 reads the
DIS_SM_CRYPT eFuse, which disables SM2 and SM3 permanently. ESP32-C5 and
ESP32-H4 have SM3 but no such eFuse. All other chips have no SM3.
This commit is contained in:
Ashish Sharma
2026-09-04 14:26:23 +08:00
parent 7f413c914d
commit 8956f3b86c
15 changed files with 185 additions and 13 deletions
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -73,6 +73,14 @@ void sha_hal_write_digest(esp_sha_type sha_type, void *digest_state);
void sha_hal_hash_dma(size_t num_blocks, bool first_block);
#endif
/**
* @brief Check whether the SHA peripheral can run the SM3 mode.
*
* @return true if SM3 is available. false if the chip has no SM3 hardware
* or if an eFuse disables it.
*/
bool sha_hal_is_sm3_supported(void);
#if SOC_SHA_SUPPORT_SHA512_T
/**
* @brief Calculates and sets the initial digiest for SHA512_t