From b3c70230d23ae8dff73e552a7f6820ab8335ea12 Mon Sep 17 00:00:00 2001 From: Hanno Becker Date: Thu, 20 Dec 2018 10:18:05 +0000 Subject: [PATCH] Move SHA1_VALIDATE[_RET] outside of MBEDTLS_SHA1_ALT guard Somehow, mbedtls_sha1_ret() is defined even if MBEDTLS_SHA1_ALT is set, and it is using SHA1_VALIDATE_RET. The documentation should be enhanced to indicate that MBEDTLS_SHA1_ALT does _not_ replace the entire module, but only the core SHA-1 functions. --- library/sha1.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/library/sha1.c b/library/sha1.c index 8863ea385..e8d4096fb 100644 --- a/library/sha1.c +++ b/library/sha1.c @@ -46,6 +46,11 @@ #endif /* MBEDTLS_PLATFORM_C */ #endif /* MBEDTLS_SELF_TEST */ +#define SHA1_VALIDATE_RET(cond) \ + MBEDTLS_INTERNAL_VALIDATE_RET( cond, MBEDTLS_ERR_SHA1_BAD_INPUT_DATA ) + +#define SHA1_VALIDATE(cond) MBEDTLS_INTERNAL_VALIDATE( cond ) + #if !defined(MBEDTLS_SHA1_ALT) /* @@ -71,11 +76,6 @@ } #endif -#define SHA1_VALIDATE_RET(cond) \ - MBEDTLS_INTERNAL_VALIDATE_RET( cond, MBEDTLS_ERR_SHA1_BAD_INPUT_DATA ) - -#define SHA1_VALIDATE(cond) MBEDTLS_INTERNAL_VALIDATE( cond ) - void mbedtls_sha1_init( mbedtls_sha1_context *ctx ) { SHA1_VALIDATE( ctx != NULL );