diff --git a/sys/include/psa_crypto/psa/crypto_sizes.h b/sys/include/psa_crypto/psa/crypto_sizes.h index 84e43fbda703..4303ad6bc3ad 100644 --- a/sys/include/psa_crypto/psa/crypto_sizes.h +++ b/sys/include/psa_crypto/psa/crypto_sizes.h @@ -456,7 +456,30 @@ extern "C" { * * See also @ref PSA_MAC_LENGTH(). */ -#define PSA_MAC_MAX_SIZE (PSA_HASH_MAX_SIZE) +#if (IS_USED(MODULE_PSA_MAC_HMAC_SHA_512) || \ + IS_USED(MODULE_PSA_MAC_HMAC_SHA3_512)) +#define PSA_MAC_MAX_SIZE (PSA_HASH_LENGTH(PSA_ALG_SHA3_512)) /* 64 */ +#elif (IS_USED(MODULE_PSA_MAC_HMAC_SHA_384) || \ + IS_USED(MODULE_PSA_MAC_HMAC_SHA3_384)) +#define PSA_MAC_MAX_SIZE (PSA_HASH_LENGTH(PSA_ALG_SHA3_384)) /* 48 */ +#elif (IS_USED(MODULE_PSA_MAC_HMAC_SHA_256) || \ + IS_USED(MODULE_PSA_MAC_HMAC_SHA_512_256) || \ + IS_USED(MODULE_PSA_MAC_HMAC_SHA3_256)) +#define PSA_MAC_MAX_SIZE (PSA_HASH_LENGTH(PSA_ALG_SHA3_256)) /* 32 */ +#elif (IS_USED(MODULE_PSA_MAC_HMAC_SHA_224) || \ + IS_USED(MODULE_PSA_MAC_HMAC_SHA_512_224) || \ + IS_USED(MODULE_PSA_MAC_HMAC_SHA3_224)) +#define PSA_MAC_MAX_SIZE (PSA_HASH_LENGTH(PSA_ALG_SHA3_224)) /* 28 */ +#elif (IS_USED(MODULE_PSA_MAC_HMAC_RIPEMD160) || \ + IS_USED(MODULE_PSA_MAC_HMAC_SHA_1)) +#define PSA_MAC_MAX_SIZE (PSA_HASH_LENGTH(PSA_ALG_SHA_1)) /* 20 */ +#elif (IS_USED(MODULE_PSA_MAC_HMAC_MD2) || \ + IS_USED(MODULE_PSA_MAC_HMAC_MD4) || \ + IS_USED(MODULE_PSA_MAC_HMAC_MD5)) +#define PSA_MAC_MAX_SIZE (PSA_HASH_LENGTH(PSA_ALG_MD5)) /* 16 */ +#else +#define PSA_MAC_MAX_SIZE 0 +#endif /** * @brief The block size of a block cipher.