Merge pull request #9211 from eleuzi01/replace-mbedtls-md-can-sha3-224

Replace MBEDTLS_MD_CAN_SHA3_224 with PSA_WANT_ALG_SHA3_224
This commit is contained in:
Gilles Peskine 2024-07-12 12:11:06 +00:00 committed by GitHub
commit 6a5278b5e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 30 additions and 30 deletions

View File

@ -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

View File

@ -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: keylen<blocklen
depends_on:MBEDTLS_MD_CAN_SHA3_224
depends_on:PSA_WANT_ALG_SHA3_224
mbedtls_md_hmac:MBEDTLS_MD_SHA3_224:28:"000102030405060708090a0b0c0d0e0f101112131415161718191a1b":"53616d706c65206d65737361676520666f72206b65796c656e3c626c6f636b6c656e":"332cfd59347fdb8e576e77260be4aba2d6dc53117b3bfb52c6d18c04"
HMAC-SHA3-224: NIST example #2: keylen=blocklen
depends_on:MBEDTLS_MD_CAN_SHA3_224
depends_on:PSA_WANT_ALG_SHA3_224
mbedtls_md_hmac:MBEDTLS_MD_SHA3_224:28:"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f":"53616d706c65206d65737361676520666f72206b65796c656e3d626c6f636b6c656e":"d8b733bcf66c644a12323d564e24dcf3fc75f231f3b67968359100c7"
HMAC-SHA3-224: NIST example #3: keylen>blocklen
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: keylen<blocklen, with truncated tag
depends_on:MBEDTLS_MD_CAN_SHA3_224
depends_on:PSA_WANT_ALG_SHA3_224
mbedtls_md_hmac:MBEDTLS_MD_SHA3_224:14:"000102030405060708090a0b0c0d0e0f101112131415161718191a1b":"53616d706c65206d65737361676520666f72206b65796c656e3c626c6f636b6c656e2c2077697468207472756e636174656420746167":"8569c54cbb00a9b78ff1b391b0e5"
HMAC-SHA3-256: NIST example #1: keylen<blocklen
@ -733,19 +733,19 @@ depends_on:MBEDTLS_MD_CAN_SHA512
md_hmac_multi:MBEDTLS_MD_SHA512:48:"8ab783d5acf32efa0d9c0a21abce955e96630d89":"17371e013dce839963d54418e97be4bd9fa3cb2a368a5220f5aa1b8aaddfa3bdefc91afe7c717244fd2fb640f5cb9d9bf3e25f7f0c8bc758883b89dcdce6d749d9672fed222277ece3e84b3ec01b96f70c125fcb3cbee6d19b8ef0873f915f173bdb05d81629ba187cc8ac1934b2f75952fb7616ae6bd812946df694bd2763af":"9ac7ca8d1aefc166b046e4cf7602ebe181a0e5055474bff5b342106731da0d7e48e4d87bc0a6f05871574289a1b099f8"
HMAC-SHA3-224 multi-step: NIST example #1: keylen<blocklen
depends_on:MBEDTLS_MD_CAN_SHA3_224
depends_on:PSA_WANT_ALG_SHA3_224
md_hmac_multi:MBEDTLS_MD_SHA3_224:28:"000102030405060708090a0b0c0d0e0f101112131415161718191a1b":"53616d706c65206d65737361676520666f72206b65796c656e3c626c6f636b6c656e":"332cfd59347fdb8e576e77260be4aba2d6dc53117b3bfb52c6d18c04"
HMAC-SHA3-224 multi-step: NIST example #2: keylen=blocklen
depends_on:MBEDTLS_MD_CAN_SHA3_224
depends_on:PSA_WANT_ALG_SHA3_224
md_hmac_multi:MBEDTLS_MD_SHA3_224:28:"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f":"53616d706c65206d65737361676520666f72206b65796c656e3d626c6f636b6c656e":"d8b733bcf66c644a12323d564e24dcf3fc75f231f3b67968359100c7"
HMAC-SHA3-224 multi-step: NIST example #3: keylen>blocklen
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<blocklen, with truncated tag
depends_on:MBEDTLS_MD_CAN_SHA3_224
depends_on:PSA_WANT_ALG_SHA3_224
md_hmac_multi:MBEDTLS_MD_SHA3_224:14:"000102030405060708090a0b0c0d0e0f101112131415161718191a1b":"53616d706c65206d65737361676520666f72206b65796c656e3c626c6f636b6c656e2c2077697468207472756e636174656420746167":"8569c54cbb00a9b78ff1b391b0e5"
HMAC-SHA3-256 multi-step: NIST example #1: keylen<blocklen
@ -929,19 +929,19 @@ depends_on:MBEDTLS_MD_CAN_SHA512
md_hex:MBEDTLS_MD_SHA512:"":"cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e"
generic SHA3-224 Hash file #1
depends_on:MBEDTLS_MD_CAN_SHA3_224
depends_on:PSA_WANT_ALG_SHA3_224
mbedtls_md_file:MBEDTLS_MD_SHA3_224:"../framework/data_files/hash_file_1":"320f1a9257d442178d90fda8987743a5e7bb5ed0b18bc7d66ee3633e"
generic SHA3-224 Hash file #2
depends_on:MBEDTLS_MD_CAN_SHA3_224
depends_on:PSA_WANT_ALG_SHA3_224
mbedtls_md_file:MBEDTLS_MD_SHA3_224:"../framework/data_files/hash_file_2":"db06a96306b43677f0e3592a0fe1d276141fa7458b7be93197550442"
generic SHA3-224 Hash file #3
depends_on:MBEDTLS_MD_CAN_SHA3_224
depends_on:PSA_WANT_ALG_SHA3_224
mbedtls_md_file:MBEDTLS_MD_SHA3_224:"../framework/data_files/hash_file_3":"0d125fdd48b0e322ca845402fbecb827053c9f324c58933be2e474a0"
generic SHA3-224 Hash file #4
depends_on:MBEDTLS_MD_CAN_SHA3_224
depends_on:PSA_WANT_ALG_SHA3_224
mbedtls_md_file:MBEDTLS_MD_SHA3_224:"../framework/data_files/hash_file_4":"6b4e03423667dbb73b6e15454f0eb1abd4597f9a1b078e3f5b5a6bc7"
generic SHA3-256 Hash file #1

View File

@ -83,7 +83,7 @@ depends_on:MBEDTLS_MD_CAN_SHA512
oid_get_md_alg_id:"608648016503040203":MBEDTLS_MD_SHA512
OID hash id - id-sha3-224
depends_on:MBEDTLS_MD_CAN_SHA3_224
depends_on:PSA_WANT_ALG_SHA3_224
oid_get_md_alg_id:"608648016503040207":MBEDTLS_MD_SHA3_224
OID hash id - id-sha3-256
@ -227,7 +227,7 @@ depends_on:MBEDTLS_MD_CAN_SHA512
mbedtls_oid_get_md_hmac:"2A864886F70D020B":MBEDTLS_MD_SHA512
mbedtls_oid_get_md_hmac - SHA3_224
depends_on:MBEDTLS_MD_CAN_SHA3_224
depends_on:PSA_WANT_ALG_SHA3_224
mbedtls_oid_get_md_hmac:"60864801650304020D":MBEDTLS_MD_SHA3_224
mbedtls_oid_get_md_hmac - SHA3_256

View File

@ -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

View File

@ -112,7 +112,7 @@ static const mbedtls_md_info_t mbedtls_sha512_info = {
};
#endif
#if defined(MBEDTLS_MD_CAN_SHA3_224)
#if defined(PSA_WANT_ALG_SHA3_224)
static const mbedtls_md_info_t mbedtls_sha3_224_info = {
MD_INFO(MBEDTLS_MD_SHA3_224, 28, 144)
};
@ -167,7 +167,7 @@ const mbedtls_md_info_t *mbedtls_md_info_from_type(mbedtls_md_type_t md_type)
case MBEDTLS_MD_SHA512:
return &mbedtls_sha512_info;
#endif
#if defined(MBEDTLS_MD_CAN_SHA3_224)
#if defined(PSA_WANT_ALG_SHA3_224)
case MBEDTLS_MD_SHA3_224:
return &mbedtls_sha3_224_info;
#endif
@ -808,7 +808,7 @@ static const int supported_digests[] = {
MBEDTLS_MD_MD5,
#endif
#if defined(MBEDTLS_MD_CAN_SHA3_224)
#if defined(PSA_WANT_ALG_SHA3_224)
MBEDTLS_MD_SHA3_224,
#endif
@ -860,7 +860,7 @@ static const md_name_entry md_names[] = {
#if defined(MBEDTLS_MD_CAN_SHA512)
{ "SHA512", MBEDTLS_MD_SHA512 },
#endif
#if defined(MBEDTLS_MD_CAN_SHA3_224)
#if defined(PSA_WANT_ALG_SHA3_224)
{ "SHA3-224", MBEDTLS_MD_SHA3_224 },
#endif
#if defined(PSA_WANT_ALG_SHA3_256)

View File

@ -761,7 +761,7 @@ static const oid_md_alg_t oid_md_alg[] =
MBEDTLS_MD_RIPEMD160,
},
#endif
#if defined(MBEDTLS_MD_CAN_SHA3_224)
#if defined(PSA_WANT_ALG_SHA3_224)
{
OID_DESCRIPTOR(MBEDTLS_OID_DIGEST_ALG_SHA3_224, "id-sha3-224", "SHA-3-224"),
MBEDTLS_MD_SHA3_224,
@ -839,12 +839,12 @@ static const oid_md_hmac_t oid_md_hmac[] =
MBEDTLS_MD_SHA512,
},
#endif /* MBEDTLS_MD_CAN_SHA512 */
#if defined(MBEDTLS_MD_CAN_SHA3_224)
#if defined(PSA_WANT_ALG_SHA3_224)
{
OID_DESCRIPTOR(MBEDTLS_OID_HMAC_SHA3_224, "hmacSHA3-224", "HMAC-SHA3-224"),
MBEDTLS_MD_SHA3_224,
},
#endif /* MBEDTLS_MD_CAN_SHA3_224 */
#endif /* PSA_WANT_ALG_SHA3_224 */
#if defined(PSA_WANT_ALG_SHA3_256)
{
OID_DESCRIPTOR(MBEDTLS_OID_HMAC_SHA3_256, "hmacSHA3-256", "HMAC-SHA3-256"),