-
Notifications
You must be signed in to change notification settings - Fork 96
Add option to build SHA-512 without SHA-384 #179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ad6cb11
3df4e60
39ea19a
6ba5a3f
d602084
20f236d
663ee20
792b16d
0b9db44
2d88549
86a39bd
1e6fb01
3a3b5c7
b7f7092
2b9b780
74ca84a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,7 +79,9 @@ extern const mbedtls_md_info_t mbedtls_sha224_info; | |
extern const mbedtls_md_info_t mbedtls_sha256_info; | ||
#endif | ||
#if defined(MBEDTLS_SHA512_C) | ||
#if !defined(MBEDTLS_SHA512_NO_SHA384) | ||
extern const mbedtls_md_info_t mbedtls_sha384_info; | ||
#endif | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is many places when you use this sentence with double negation " There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whether |
||
extern const mbedtls_md_info_t mbedtls_sha512_info; | ||
#endif | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,8 +59,10 @@ typedef struct mbedtls_sha512_context | |
uint64_t total[2]; /*!< The number of Bytes processed. */ | ||
uint64_t state[8]; /*!< The intermediate digest state. */ | ||
unsigned char buffer[128]; /*!< The data block being processed. */ | ||
#if !defined(MBEDTLS_SHA512_NO_SHA384) | ||
int is384; /*!< Determines which function to use: | ||
0: Use SHA-512, or 1: Use SHA-384. */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That would be an ABI change, so I'd rather not do it here. |
||
#endif | ||
} | ||
mbedtls_sha512_context; | ||
|
||
gilles-peskine-arm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
@@ -101,7 +103,11 @@ void mbedtls_sha512_clone( mbedtls_sha512_context *dst, | |
* | ||
* \param ctx The SHA-512 context to use. This must be initialized. | ||
* \param is384 Determines which function to use. This must be | ||
* either \c for SHA-512, or \c 1 for SHA-384. | ||
* either \c 0 for SHA-512, or \c 1 for SHA-384. | ||
* | ||
* \note When \c MBEDTLS_SHA512_NO_SHA384 is defined, \p is384 must | ||
* be \c 0, or the function will return | ||
* #MBEDTLS_ERR_SHA512_BAD_INPUT_DATA. | ||
* | ||
* \return \c 0 on success. | ||
* \return A negative error code on failure. | ||
|
@@ -169,6 +175,9 @@ int mbedtls_internal_sha512_process( mbedtls_sha512_context *ctx, | |
* \param ctx The SHA-512 context to use. This must be initialized. | ||
* \param is384 Determines which function to use. This must be either | ||
* \c 0 for SHA-512 or \c 1 for SHA-384. | ||
* | ||
* \note When \c MBEDTLS_SHA512_NO_SHA384 is defined, \p is384 must | ||
* be \c 0, or the function will fail to work. | ||
*/ | ||
MBEDTLS_DEPRECATED void mbedtls_sha512_starts( mbedtls_sha512_context *ctx, | ||
int is384 ); | ||
|
@@ -239,6 +248,10 @@ MBEDTLS_DEPRECATED void mbedtls_sha512_process( | |
* \param is384 Determines which function to use. This must be either | ||
* \c 0 for SHA-512, or \c 1 for SHA-384. | ||
* | ||
* \note When \c MBEDTLS_SHA512_NO_SHA384 is defined, \p is384 must | ||
* be \c 0, or the function will return | ||
* #MBEDTLS_ERR_SHA512_BAD_INPUT_DATA. | ||
* | ||
* \return \c 0 on success. | ||
* \return A negative error code on failure. | ||
*/ | ||
|
@@ -273,6 +286,9 @@ int mbedtls_sha512_ret( const unsigned char *input, | |
* be a writable buffer of length \c 64 Bytes. | ||
* \param is384 Determines which function to use. This must be either | ||
* \c 0 for SHA-512, or \c 1 for SHA-384. | ||
* | ||
* \note When \c MBEDTLS_SHA512_NO_SHA384 is defined, \p is384 must | ||
* be \c 0, or the function will fail to work. | ||
*/ | ||
MBEDTLS_DEPRECATED void mbedtls_sha512( const unsigned char *input, | ||
size_t ilen, | ||
|
Uh oh!
There was an error while loading. Please reload this page.