Skip to content

Commit 0bfa206

Browse files
committed
configure.ac: for FIPS v6 setup, explicitly set WOLFSSL_NOSHA512_224 and WOLFSSL_NOSHA512_256;
wolfssl/wolfcrypt/hash.h: when WOLFSSL_NOSHA512_{224,256}, gate out prototypes for wc_Sha512_{224,256}Hash[_ex](), to shift build failures from link-time to compile-time.
1 parent caffc45 commit 0bfa206

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

configure.ac

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6480,7 +6480,8 @@ AS_CASE([$FIPS_VERSION],
64806480
(test "$FIPS_VERSION" != "dev" || test "$enable_sha512" != "no")],
64816481
[ENABLED_SHA512="yes"; AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA512 -DWOLFSSL_SHA384"])
64826482
6483-
# SHA512-224 and SHA512-256 are needed for HashML-DSA (FIPS 204)
6483+
# SHA512-224 and SHA512-256 are not in-boundary in FIPS v6.
6484+
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NOSHA512_224 -DWOLFSSL_NOSHA512_256"
64846485
64856486
# Shake128 because we're testing SHAKE256
64866487
AS_IF([test "x$ENABLED_SHAKE128" = "xno" &&

wolfssl/wolfcrypt/hash.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -310,14 +310,18 @@ WOLFSSL_API int wc_Sha384Hash_ex(const byte* data, word32 len, byte* hash,
310310
#ifdef WOLFSSL_SHA512
311311
#include <wolfssl/wolfcrypt/sha512.h>
312312
WOLFSSL_API int wc_Sha512Hash(const byte* data, word32 len, byte* hash);
313-
WOLFSSL_API int wc_Sha512_224Hash(const byte* data, word32 len, byte* hash);
314-
WOLFSSL_API int wc_Sha512_256Hash(const byte* data, word32 len, byte* hash);
315313
WOLFSSL_API int wc_Sha512Hash_ex(const byte* data, word32 len, byte* hash,
316314
void* heap, int devId);
317-
WOLFSSL_API int wc_Sha512_224Hash_ex(const byte* data, word32 len, byte* hash,
318-
void* heap, int devId);
319-
WOLFSSL_API int wc_Sha512_256Hash_ex(const byte* data, word32 len, byte* hash,
320-
void* heap, int devId);
315+
#ifndef WOLFSSL_NOSHA512_224
316+
WOLFSSL_API int wc_Sha512_224Hash(const byte* data, word32 len, byte* hash);
317+
WOLFSSL_API int wc_Sha512_224Hash_ex(const byte* data, word32 len,
318+
byte* hash, void* heap, int devId);
319+
#endif
320+
#ifndef WOLFSSL_NOSHA512_256
321+
WOLFSSL_API int wc_Sha512_256Hash(const byte* data, word32 len, byte* hash);
322+
WOLFSSL_API int wc_Sha512_256Hash_ex(const byte* data, word32 len,
323+
byte* hash, void* heap, int devId);
324+
#endif
321325
#endif /* WOLFSSL_SHA512 */
322326

323327
#ifdef WOLFSSL_SHA3

0 commit comments

Comments
 (0)