diff --git a/include/mbedtls/sha256.h b/include/mbedtls/sha256.h index 979ad29a01..3d3e3fc6be 100644 --- a/include/mbedtls/sha256.h +++ b/include/mbedtls/sha256.h @@ -178,6 +178,7 @@ int mbedtls_sha256( const unsigned char *input, #if defined(MBEDTLS_SELF_TEST) +#if defined(MBEDTLS_SHA224_C) /** * \brief The SHA-224 checkup routine. * @@ -185,7 +186,9 @@ int mbedtls_sha256( const unsigned char *input, * \return \c 1 on failure. */ int mbedtls_sha224_self_test( int verbose ); +#endif /* MBEDTLS_SHA224_C */ +#if defined(MBEDTLS_SHA256_C) /** * \brief The SHA-256 checkup routine. * @@ -193,6 +196,7 @@ int mbedtls_sha224_self_test( int verbose ); * \return \c 1 on failure. */ int mbedtls_sha256_self_test( int verbose ); +#endif /* MBEDTLS_SHA256_C */ #endif /* MBEDTLS_SELF_TEST */ diff --git a/include/mbedtls/sha512.h b/include/mbedtls/sha512.h index 545c81c4d8..eb5cef5293 100644 --- a/include/mbedtls/sha512.h +++ b/include/mbedtls/sha512.h @@ -195,6 +195,7 @@ int mbedtls_sha512( const unsigned char *input, #if defined(MBEDTLS_SELF_TEST) +#if defined(MBEDTLS_SHA384_C) /** * \brief The SHA-384 checkup routine. * @@ -202,7 +203,9 @@ int mbedtls_sha512( const unsigned char *input, * \return \c 1 on failure. */ int mbedtls_sha384_self_test( int verbose ); +#endif /* MBEDTLS_SHA384_C */ +#if defined(MBEDTLS_SHA512_C) /** * \brief The SHA-512 checkup routine. * @@ -210,6 +213,8 @@ int mbedtls_sha384_self_test( int verbose ); * \return \c 1 on failure. */ int mbedtls_sha512_self_test( int verbose ); +#endif /* MBEDTLS_SHA512_C */ + #endif /* MBEDTLS_SELF_TEST */ #ifdef __cplusplus diff --git a/programs/fuzz/fuzz_dtlsserver.c b/programs/fuzz/fuzz_dtlsserver.c index 1ef4190fc2..17caab211c 100644 --- a/programs/fuzz/fuzz_dtlsserver.c +++ b/programs/fuzz/fuzz_dtlsserver.c @@ -18,7 +18,7 @@ defined(MBEDTLS_CTR_DRBG_C) && \ defined(MBEDTLS_TIMING_C) && \ ( defined(MBEDTLS_HAS_ALG_SHA_384_VIA_MD_OR_PSA_BASED_ON_USE_PSA) || \ - defined(MBEDTLS_HAS_ALG_SHA_224_VIA_MD_OR_PSA_BASED_ON_USE_PSA) ) + defined(MBEDTLS_HAS_ALG_SHA_256_VIA_MD_OR_PSA_BASED_ON_USE_PSA) ) const char *pers = "fuzz_dtlsserver"; const unsigned char client_ip[4] = {0x7F, 0, 0, 1}; static int initialized = 0; @@ -36,7 +36,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { defined(MBEDTLS_CTR_DRBG_C) && \ defined(MBEDTLS_TIMING_C) && \ ( defined(MBEDTLS_HAS_ALG_SHA_384_VIA_MD_OR_PSA_BASED_ON_USE_PSA) || \ - defined(MBEDTLS_HAS_ALG_SHA_224_VIA_MD_OR_PSA_BASED_ON_USE_PSA) ) + defined(MBEDTLS_HAS_ALG_SHA_256_VIA_MD_OR_PSA_BASED_ON_USE_PSA) ) int ret; size_t len; mbedtls_ssl_context ssl; diff --git a/programs/test/selftest.c b/programs/test/selftest.c index de1ee0fdb5..b4701cbe67 100644 --- a/programs/test/selftest.c +++ b/programs/test/selftest.c @@ -244,13 +244,13 @@ const selftest_t selftests[] = {"sha1", mbedtls_sha1_self_test}, #endif #if defined(MBEDTLS_SHA224_C) - {"sha256", mbedtls_sha224_self_test}, + {"sha224", mbedtls_sha224_self_test}, #endif #if defined(MBEDTLS_SHA256_C) {"sha256", mbedtls_sha256_self_test}, #endif #if defined(MBEDTLS_SHA384_C) - {"sha512", mbedtls_sha384_self_test}, + {"sha384", mbedtls_sha384_self_test}, #endif #if defined(MBEDTLS_SHA512_C) {"sha512", mbedtls_sha512_self_test},