Skip to content

Commit 408ea84

Browse files
committed
sha256: check no hw accelleartion is enabled with CB_ONLY_SHA256
1 parent 0c8cabe commit 408ea84

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

wolfcrypt/src/sha256.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,42 @@ on the specific device platform.
9797
#undef WOLFSSL_USE_ESP32_CRYPT_HASH_HW
9898
#endif
9999

100+
/* WOLF_CRYPTO_CB_ONLY_SHA256 strips the software SHA-256 implementation and
101+
* routes every operation through the crypto callback. It is mutually exclusive
102+
* with any in-tree SHA-256 hardware/asm backend below: keep this list in sync
103+
* with the #elif chain at the start of the "Hardware Acceleration" section. */
104+
#if defined(WOLF_CRYPTO_CB_ONLY_SHA256) && ( \
105+
defined(WOLFSSL_TI_HASH) || \
106+
defined(WOLFSSL_CRYPTOCELL) || \
107+
defined(MAX3266X_SHA) || \
108+
defined(FREESCALE_LTC_SHA) || \
109+
defined(FREESCALE_MMCAU_SHA) || \
110+
defined(WOLFSSL_PIC32MZ_HASH) || \
111+
defined(STM32_HASH_SHA2) || \
112+
(defined(WOLFSSL_IMX6_CAAM) && !defined(NO_IMX6_CAAM_HASH)) || \
113+
(defined(WOLFSSL_SE050) && defined(WOLFSSL_SE050_HASH)) || \
114+
defined(WOLFSSL_AFALG_HASH) || \
115+
defined(WOLFSSL_DEVCRYPTO_HASH) || \
116+
(defined(WOLFSSL_SCE) && !defined(WOLFSSL_SCE_NO_HASH)) || \
117+
defined(WOLFSSL_USE_ESP32_CRYPT_HASH_HW) || \
118+
defined(WOLFSSL_RENESAS_TSIP_TLS) || \
119+
defined(WOLFSSL_RENESAS_SCEPROTECT) || \
120+
defined(WOLFSSL_RENESAS_RSIP) || \
121+
defined(PSOC6_HASH_SHA2) || \
122+
defined(WOLFSSL_IMXRT_DCP) || \
123+
defined(WOLFSSL_NXP_HASHCRYPT_SHA) || \
124+
defined(WOLFSSL_SILABS_SE_ACCEL) || \
125+
defined(WOLFSSL_KCAPI_HASH) || \
126+
(defined(WOLFSSL_HAVE_PSA) && !defined(WOLFSSL_PSA_NO_HASH)) || \
127+
defined(WOLFSSL_RENESAS_RX64_HASH) || \
128+
defined(WOLFSSL_PPC32_ASM) || \
129+
defined(WOLFSSL_ARMASM) || \
130+
(defined(WOLFSSL_X86_64_BUILD) && defined(USE_INTEL_SPEEDUP) && \
131+
(defined(HAVE_INTEL_AVX1) || defined(HAVE_INTEL_AVX2))))
132+
#error "WOLF_CRYPTO_CB_ONLY_SHA256 is incompatible with SHA-256 hardware" \
133+
" acceleration backends"
134+
#endif
135+
100136
#ifdef WOLFSSL_ESPIDF
101137
/* Define the ESP_LOGx(TAG, WOLFSSL_ESPIDF_BLANKLINE_MESSAGE value for output messages here.
102138
**

0 commit comments

Comments
 (0)