From c756049dc32d9845ec6b5c1f7b6b8b8467ce0b43 Mon Sep 17 00:00:00 2001 From: Hanno Becker Date: Thu, 20 Dec 2018 10:23:39 +0000 Subject: [PATCH] Move SHA512_VALIDATE[_RET] outside of MBEDTLS_SHA512_ALT guard Somehow, mbedtls_sha512_ret() is defined even if MBEDTLS_SHA512_ALT is set, and it is using SHA512_VALIDATE_RET. The documentation should be enhanced to indicate that MBEDTLS_SHA512_ALT does _not_ replace the entire module, but only the core SHA-512 functions. --- library/sha512.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/sha512.c b/library/sha512.c index e7b2c5093..941ecda76 100644 --- a/library/sha512.c +++ b/library/sha512.c @@ -55,6 +55,10 @@ #endif /* MBEDTLS_PLATFORM_C */ #endif /* MBEDTLS_SELF_TEST */ +#define SHA512_VALIDATE_RET(cond) \ + MBEDTLS_INTERNAL_VALIDATE_RET( cond, MBEDTLS_ERR_SHA512_BAD_INPUT_DATA ) +#define SHA512_VALIDATE(cond) MBEDTLS_INTERNAL_VALIDATE( cond ) + #if !defined(MBEDTLS_SHA512_ALT) /* @@ -88,10 +92,6 @@ } #endif /* PUT_UINT64_BE */ -#define SHA512_VALIDATE_RET(cond) \ - MBEDTLS_INTERNAL_VALIDATE_RET( cond, MBEDTLS_ERR_SHA512_BAD_INPUT_DATA ) -#define SHA512_VALIDATE(cond) MBEDTLS_INTERNAL_VALIDATE( cond ) - void mbedtls_sha512_init( mbedtls_sha512_context *ctx ) { SHA512_VALIDATE( ctx != NULL );