1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-01 10:06:53 +03:00

Fix SHA definitions and their dependencies in library and test suites.

Rework SHA224 and SHA283 documentation.
Define MBEDTLS_SHAxxx_C options in alphabetic order.
Fix SHA224 and SHA384 dependencies in test suites.

Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com>
This commit is contained in:
Mateusz Starzyk
2021-05-10 13:51:53 +02:00
parent e3c48b4a88
commit 6326a8dd37
24 changed files with 269 additions and 266 deletions

View File

@ -1448,17 +1448,6 @@
*/
//#define MBEDTLS_SHA512_SMALLER
/**
* \def MBEDTLS_SHA384_C
*
* Enable the SHA-384 option of the SHA-512 module.
*
* Requires: MBEDTLS_SHA512_C
*
* Comment to disable SHA-384
*/
#define MBEDTLS_SHA384_C
/**
* \def MBEDTLS_SSL_ALL_ALERT_MESSAGES
*
@ -3104,10 +3093,30 @@
*/
#define MBEDTLS_SHA1_C
/**
* \def MBEDTLS_SHA224_C
*
* Enable the SHA-224 cryptographic hash algorithm.
*
* Requires: MBEDTLS_SHA256_C. Library does not support enabling
* SHA-224 without SHA-256. Future version will have
* this option disabled by default.
*
* Module: library/sha256.c
* Caller: library/md.c
* library/ssl_cookie.c
*
* This module adds support for SHA-224.
*/
#define MBEDTLS_SHA224_C
/**
* \def MBEDTLS_SHA256_C
*
* Enable the SHA-256 cryptographic hash algorithms.
* Enable the SHA-256 cryptographic hash algorithm.
*
* Requires: MBEDTLS_SHA224_C. Library does not support enabling
* SHA-256 without SHA-224.
*
* Module: library/sha256.c
* Caller: library/entropy.c
@ -3117,28 +3126,25 @@
* library/ssl_tls.c
*
* This module adds support for SHA-256.
* This module is required for SHA-244.
* This module is required for the SSL/TLS 1.2 PRF function.
*/
#define MBEDTLS_SHA256_C
/**
* \def MBEDTLS_SHA224_C
* \def MBEDTLS_SHA384_C
*
* Enable the SHA-224 cryptographic hash algorithms.
* Enable the SHA-384 cryptographic hash algorithm.
*
* Module: library/sha256.c
* Caller: library/entropy.c
* library/md.c
* Requires: MBEDTLS_SHA512_C
*
* Module: library/sha512.c
* Caller: library/md.c
* library/ssl_cli.c
* library/ssl_srv.c
* library/ssl_tls.c
*
* Requires: MBEDTLS_SHA256_C
* This module adds support for SHA-224.
* This module is required for the SSL/TLS 1.2 PRF function.
* Comment to disable SHA-384
*/
#define MBEDTLS_SHA224_C
#define MBEDTLS_SHA384_C
/**
* \def MBEDTLS_SHA512_C
@ -3148,11 +3154,10 @@
* Module: library/sha512.c
* Caller: library/entropy.c
* library/md.c
* library/ssl_cli.c
* library/ssl_srv.c
* library/ssl_tls.c
* library/ssl_cookie.c
*
* This module adds support for SHA-512.
* This module is required for SHA-384.
*/
#define MBEDTLS_SHA512_C

View File

@ -101,8 +101,8 @@ void mbedtls_sha512_clone( mbedtls_sha512_context *dst,
* \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_SHA384_C is not defined,
* \p is384 must be \c 0, or the function will return
* \note When \c MBEDTLS_SHA384_C is defined,
* \p is384 must be \c 1, or the function will return
* #MBEDTLS_ERR_SHA512_BAD_INPUT_DATA.
*
* \return \c 0 on success.

View File

@ -827,7 +827,7 @@ typedef void mbedtls_ssl_async_cancel_t( mbedtls_ssl_context *ssl );
#if defined(MBEDTLS_SHA256_C)
#define MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_TYPE MBEDTLS_MD_SHA256
#define MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_LEN 32
#elif defined(MBEDTLS_SHA512_C)
#elif defined(MBEDTLS_SHA384_C)
#define MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_TYPE MBEDTLS_MD_SHA384
#define MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_LEN 48
#elif defined(MBEDTLS_SHA1_C)