Skip to content

Commit f2c206b

Browse files
author
Andras Fekete
committed
Simplify code gating
1 parent f1f4ef0 commit f2c206b

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

src/wp_internal.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -291,14 +291,14 @@ int wp_hash_copy(wc_HashAlg* src, wc_HashAlg* dst, enum wc_HashType hashType)
291291
rc = wc_Sha512Copy(&src->sha512, &dst->sha512);
292292
break;
293293
#if LIBWOLFSSL_VERSION_HEX >= 0x05000000
294-
#if !defined(WOLFSSL_NOSHA512_224) && \
295-
(!defined(HAVE_FIPS) || FIPS_VERSION_GE(5, 3)) && !defined(HAVE_SELFTEST)
294+
#if !defined(WOLFSSL_NOSHA512_224) && !defined(HAVE_FIPS) && \
295+
!defined(SELF_TEST)
296296
case WC_HASH_TYPE_SHA512_224:
297297
rc = wc_Sha512_224Copy(&src->sha512, &dst->sha512);
298298
break;
299299
#endif /* !WOLFSSL_NOSHA512_224 */
300-
#if !defined(WOLFSSL_NOSHA512_256) && \
301-
(!defined(HAVE_FIPS) || FIPS_VERSION_GE(5, 3)) && !defined(HAVE_SELFTEST)
300+
#if !defined(WOLFSSL_NOSHA512_256) && !defined(HAVE_FIPS) && \
301+
!defined(SELF_TEST)
302302
case WC_HASH_TYPE_SHA512_256:
303303
rc = wc_Sha512_256Copy(&src->sha512, &dst->sha512);
304304
break;
@@ -338,11 +338,13 @@ int wp_hash_copy(wc_HashAlg* src, wc_HashAlg* dst, enum wc_HashType hashType)
338338
case WC_HASH_TYPE_MD5_SHA:
339339
case WC_HASH_TYPE_BLAKE2B:
340340
case WC_HASH_TYPE_BLAKE2S:
341-
#ifdef WC_HASH_TYPE_SHAKE128
341+
#if LIBWOLFSSL_VERSION_HEX >= 0x05000000
342+
#ifdef WOLFSSL_SHAKE128
342343
case WC_HASH_TYPE_SHAKE128:
343344
#endif
344-
#ifdef WC_HASH_TYPE_SHAKE256
345+
#ifdef WOLFSSL_SHAKE256
345346
case WC_HASH_TYPE_SHAKE256:
347+
#endif
346348
#endif
347349
default:
348350
ok = 0;

0 commit comments

Comments
 (0)