Skip to content

Commit

Permalink
Move SHA1_VALIDATE[_RET] outside of MBEDTLS_SHA1_ALT guard
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Hanno Becker committed Dec 20, 2018
1 parent 859522a commit b3c7023
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions library/sha1.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)

/*
Expand All @@ -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 );
Expand Down

0 comments on commit b3c7023

Please sign in to comment.