Skip to content

Commit 0dfcda1

Browse files
korrancfrantz
authored andcommitted
Fix OT_DISABLE_HARDENING -Werror,-Wundef error
In file included from lib/crypto/crypto_ipc.c:10: In file included from external/lowrisc_opentitan+/sw/device/lib/crypto/include/ecc_p256.h:8: In file included from external/lowrisc_opentitan+/sw/device/lib/crypto/include/datatypes.h:12: external/lowrisc_opentitan+/sw/device/lib/base/hardened.h:244:37: error: 'OT_DISABLE_HARDENING' is not defined, evaluates to 0 [-Werror,-Wundef] Signed-off-by: Kor Nielsen <[email protected]>
1 parent deb6598 commit 0dfcda1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sw/device/lib/base/hardened.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ inline uint32_t launder32(uint32_t val) {
241241

242242
// When we're building for static analysis, reduce false positives by
243243
// short-circuiting the inline assembly block.
244-
#if OT_BUILD_FOR_STATIC_ANALYZER || OT_DISABLE_HARDENING
244+
#if OT_BUILD_FOR_STATIC_ANALYZER || \
245+
(defined(OT_DISABLE_HARDENING) && OT_DISABLE_HARDENING)
245246
return val;
246247
#endif
247248

@@ -263,7 +264,8 @@ inline uint32_t launder32(uint32_t val) {
263264
*/
264265
OT_WARN_UNUSED_RESULT
265266
inline uintptr_t launderw(uintptr_t val) {
266-
#if OT_BUILD_FOR_STATIC_ANALYZER || OT_DISABLE_HARDENING
267+
#if OT_BUILD_FOR_STATIC_ANALYZER || \
268+
(defined(OT_DISABLE_HARDENING) && OT_DISABLE_HARDENING)
267269
return val;
268270
#endif
269271
asm volatile("" : "+r"(val));

0 commit comments

Comments
 (0)