From 1e967055f6a59e70d5bdddbd8f63a1aa63a9c8a1 Mon Sep 17 00:00:00 2001 From: Elena Uziunaite Date: Fri, 31 May 2024 11:34:52 +0100 Subject: [PATCH 1/2] Replace MBEDTLS_MD_CAN_SHA3_224 with PSA_WANT_ALG_SHA3_224 Signed-off-by: Elena Uziunaite --- tests/suites/test_suite_hmac_drbg.misc.data | 8 +++--- tests/suites/test_suite_md.data | 30 ++++++++++----------- tests/suites/test_suite_oid.data | 4 +-- tf-psa-crypto/drivers/builtin/src/md.c | 8 +++--- tf-psa-crypto/drivers/builtin/src/oid.c | 6 ++--- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/tests/suites/test_suite_hmac_drbg.misc.data b/tests/suites/test_suite_hmac_drbg.misc.data index 7738574b6b..1ae59bb6d5 100644 --- a/tests/suites/test_suite_hmac_drbg.misc.data +++ b/tests/suites/test_suite_hmac_drbg.misc.data @@ -19,7 +19,7 @@ depends_on:MBEDTLS_MD_CAN_SHA512 hmac_drbg_entropy_usage:MBEDTLS_MD_SHA512 HMAC_DRBG entropy usage SHA3-224 -depends_on:MBEDTLS_MD_CAN_SHA3_224 +depends_on:PSA_WANT_ALG_SHA3_224 hmac_drbg_entropy_usage:MBEDTLS_MD_SHA3_224 HMAC_DRBG entropy usage SHA3-256 @@ -75,11 +75,11 @@ depends_on:MBEDTLS_MD_CAN_SHA512 hmac_drbg_seed_file:MBEDTLS_MD_SHA512:"no_such_dir/file":MBEDTLS_ERR_HMAC_DRBG_FILE_IO_ERROR HMAC_DRBG write/update seed file SHA3-224 [#1] -depends_on:MBEDTLS_MD_CAN_SHA3_224 +depends_on:PSA_WANT_ALG_SHA3_224 hmac_drbg_seed_file:MBEDTLS_MD_SHA3_224:"../framework/data_files/hmac_drbg_seed":0 HMAC_DRBG write/update seed file SHA3-224 [#2] -depends_on:MBEDTLS_MD_CAN_SHA3_224 +depends_on:PSA_WANT_ALG_SHA3_224 hmac_drbg_seed_file:MBEDTLS_MD_SHA3_224:"no_such_dir/file":MBEDTLS_ERR_HMAC_DRBG_FILE_IO_ERROR HMAC_DRBG write/update seed file SHA3-256 [#1] @@ -127,7 +127,7 @@ depends_on:MBEDTLS_MD_CAN_SHA512 hmac_drbg_buf:MBEDTLS_MD_SHA512 HMAC_DRBG from buffer SHA3-224 -depends_on:MBEDTLS_MD_CAN_SHA3_224 +depends_on:PSA_WANT_ALG_SHA3_224 hmac_drbg_buf:MBEDTLS_MD_SHA3_224 HMAC_DRBG from buffer SHA3-256 diff --git a/tests/suites/test_suite_md.data b/tests/suites/test_suite_md.data index 0c05dfb0ef..6a818035fe 100644 --- a/tests/suites/test_suite_md.data +++ b/tests/suites/test_suite_md.data @@ -37,7 +37,7 @@ depends_on:MBEDTLS_MD_CAN_SHA512 md_info:MBEDTLS_MD_SHA512:"SHA512":64 Information on SHA3-224 -depends_on:MBEDTLS_MD_CAN_SHA3_224 +depends_on:PSA_WANT_ALG_SHA3_224 md_info:MBEDTLS_MD_SHA3_224:"SHA3-224":28 Information on SHA3-256 @@ -113,7 +113,7 @@ depends_on:PSA_WANT_ALG_RIPEMD160 md_text:MBEDTLS_MD_RIPEMD160:"12345678901234567890123456789012345678901234567890123456789012345678901234567890":"9b752e45573d4b39f4dbd3323cab82bf63326bfb" generic mbedtls_sha3 SHA3-224 Test vector from CAVS 19.0 with Len = 8 -depends_on:MBEDTLS_MD_CAN_SHA3_224 +depends_on:PSA_WANT_ALG_SHA3_224 md_hex:MBEDTLS_MD_SHA3_224:"01":"488286d9d32716e5881ea1ee51f36d3660d70f0db03b3f612ce9eda4" generic mbedtls_sha3 SHA3-256 Test vector from CAVS 19.0 with Len = 8 @@ -261,7 +261,7 @@ depends_on:PSA_WANT_ALG_RIPEMD160 md_text_multi:MBEDTLS_MD_RIPEMD160:"12345678901234567890123456789012345678901234567890123456789012345678901234567890":"9b752e45573d4b39f4dbd3323cab82bf63326bfb" generic multi step mbedtls_sha3 SHA3-224 Test vector from CAVS 19.0 with Len = 48 -depends_on:MBEDTLS_MD_CAN_SHA3_224 +depends_on:PSA_WANT_ALG_SHA3_224 md_hex_multi:MBEDTLS_MD_SHA3_224:"e7183e4d89c9":"650618f3b945c07de85b8478d69609647d5e2a432c6b15fbb3db91e4" generic multi step mbedtls_sha3 SHA3-256 Test vector from CAVS 19.0 with Len = 48 @@ -525,19 +525,19 @@ depends_on:MBEDTLS_MD_CAN_SHA512 mbedtls_md_hmac:MBEDTLS_MD_SHA512:48:"8ab783d5acf32efa0d9c0a21abce955e96630d89":"17371e013dce839963d54418e97be4bd9fa3cb2a368a5220f5aa1b8aaddfa3bdefc91afe7c717244fd2fb640f5cb9d9bf3e25f7f0c8bc758883b89dcdce6d749d9672fed222277ece3e84b3ec01b96f70c125fcb3cbee6d19b8ef0873f915f173bdb05d81629ba187cc8ac1934b2f75952fb7616ae6bd812946df694bd2763af":"9ac7ca8d1aefc166b046e4cf7602ebe181a0e5055474bff5b342106731da0d7e48e4d87bc0a6f05871574289a1b099f8" HMAC-SHA3-224: NIST example #1: keylenblocklen -depends_on:MBEDTLS_MD_CAN_SHA3_224 +depends_on:PSA_WANT_ALG_SHA3_224 mbedtls_md_hmac:MBEDTLS_MD_SHA3_224:28:"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaab":"53616d706c65206d65737361676520666f72206b65796c656e3e626c6f636b6c656e":"078695eecc227c636ad31d063a15dd05a7e819a66ec6d8de1e193e59" HMAC-SHA3-224: NIST example #4: keylenblocklen -depends_on:MBEDTLS_MD_CAN_SHA3_224 +depends_on:PSA_WANT_ALG_SHA3_224 md_hmac_multi:MBEDTLS_MD_SHA3_224:28:"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaab":"53616d706c65206d65737361676520666f72206b65796c656e3e626c6f636b6c656e":"078695eecc227c636ad31d063a15dd05a7e819a66ec6d8de1e193e59" HMAC-SHA3-224 multi-step: NIST example #4: keylen Date: Wed, 26 Jun 2024 13:44:06 +0100 Subject: [PATCH 2/2] Replace MBEDTLS_MD_CAN_SHA3_224 in md.h Signed-off-by: Elena Uziunaite --- tf-psa-crypto/drivers/builtin/include/mbedtls/md.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tf-psa-crypto/drivers/builtin/include/mbedtls/md.h b/tf-psa-crypto/drivers/builtin/include/mbedtls/md.h index 1bb9fa93e4..df99e2082c 100644 --- a/tf-psa-crypto/drivers/builtin/include/mbedtls/md.h +++ b/tf-psa-crypto/drivers/builtin/include/mbedtls/md.h @@ -73,14 +73,14 @@ typedef enum { #define MBEDTLS_MD_MAX_SIZE 48 /* longest known is SHA384 */ #elif defined(PSA_WANT_ALG_SHA_256) || defined(PSA_WANT_ALG_SHA3_256) #define MBEDTLS_MD_MAX_SIZE 32 /* longest known is SHA256 */ -#elif defined(PSA_WANT_ALG_SHA_224) || defined(MBEDTLS_MD_CAN_SHA3_224) +#elif defined(PSA_WANT_ALG_SHA_224) || defined(PSA_WANT_ALG_SHA3_224) #define MBEDTLS_MD_MAX_SIZE 28 /* longest known is SHA224 */ #else #define MBEDTLS_MD_MAX_SIZE 20 /* longest known is SHA1 or RIPE MD-160 or smaller (MD5 and earlier) */ #endif -#if defined(MBEDTLS_MD_CAN_SHA3_224) +#if defined(PSA_WANT_ALG_SHA3_224) #define MBEDTLS_MD_MAX_BLOCK_SIZE 144 /* the longest known is SHA3-224 */ #elif defined(PSA_WANT_ALG_SHA3_256) #define MBEDTLS_MD_MAX_BLOCK_SIZE 136