Add comment on macros that should be kept in sync
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
parent
f76c2208f6
commit
c9d9829533
2 changed files with 12 additions and 2 deletions
|
@ -151,7 +151,16 @@ typedef enum {
|
|||
MBEDTLS_MD_RIPEMD160, /**< The RIPEMD-160 message digest. */
|
||||
} mbedtls_md_type_t;
|
||||
|
||||
/* Note: this should be kept in sync with PSA_HASH_MAX_SIZE */
|
||||
/* Note: this should always be >= PSA_HASH_MAX_SIZE
|
||||
* in all builds with both CRYPTO_C and MD_LIGHT.
|
||||
*
|
||||
* This is to make things easier for modules such as TLS that may define a
|
||||
* buffer size using MD_MAX_SIZE in a part of the code that's common to PSA
|
||||
* and legacy, then assume the buffer's size is PSA_HASH_MAX_SIZE in another
|
||||
* part of the code based on PSA.
|
||||
*
|
||||
* Currently both macros have the same value, avoiding such issues.
|
||||
*/
|
||||
#if defined(MBEDTLS_MD_CAN_SHA512)
|
||||
#define MBEDTLS_MD_MAX_SIZE 64 /* longest known is SHA512 */
|
||||
#elif defined(MBEDTLS_MD_CAN_SHA384)
|
||||
|
|
|
@ -128,7 +128,8 @@
|
|||
/* Note: for HMAC-SHA-3, the block size is 144 bytes for HMAC-SHA3-226,
|
||||
* 136 bytes for HMAC-SHA3-256, 104 bytes for SHA3-384, 72 bytes for
|
||||
* HMAC-SHA3-512. */
|
||||
/* Note: PSA_HASH_MAX_SIZE should be kept in sync with MBEDTLS_MD_MAX_SIZE. */
|
||||
/* Note: PSA_HASH_MAX_SIZE should be kept in sync with MBEDTLS_MD_MAX_SIZE,
|
||||
* see the note on MBEDTLS_MD_MAX_SIZE for details. */
|
||||
#if defined(PSA_WANT_ALG_SHA_512)
|
||||
#define PSA_HASH_MAX_SIZE 64
|
||||
#define PSA_HMAC_MAX_HASH_BLOCK_SIZE 128
|
||||
|
|
Loading…
Reference in a new issue