test_suite_psa_crypto_metadata: add test cases for the HKDF-Extract/Expand algorithms

Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
Przemek Stekiel 2022-06-03 08:43:32 +02:00
parent a29b488296
commit f0f0bd068b
2 changed files with 28 additions and 8 deletions

View file

@ -270,6 +270,22 @@ Key derivation: HKDF using SHA-384
depends_on:PSA_WANT_ALG_HKDF:PSA_WANT_ALG_SHA_384 depends_on:PSA_WANT_ALG_HKDF:PSA_WANT_ALG_SHA_384
key_derivation_algorithm:PSA_ALG_HKDF( PSA_ALG_SHA_384 ):ALG_IS_HKDF key_derivation_algorithm:PSA_ALG_HKDF( PSA_ALG_SHA_384 ):ALG_IS_HKDF
Key derivation: HKDF-Extract using SHA-256
depends_on:PSA_WANT_ALG_HKDF_EXTRACT:PSA_WANT_ALG_SHA_256
key_derivation_algorithm:PSA_ALG_HKDF_EXTRACT( PSA_ALG_SHA_256 ):ALG_IS_HKDF_EXTRACT
Key derivation: HKDF-Extract using SHA-384
depends_on:PSA_WANT_ALG_HKDF:PSA_WANT_ALG_SHA_384
key_derivation_algorithm:PSA_ALG_HKDF_EXTRACT( PSA_ALG_SHA_384 ):ALG_IS_HKDF_EXTRACT
Key derivation: HKDF-Expand using SHA-256
depends_on:PSA_WANT_ALG_HKDF_EXPAND:PSA_WANT_ALG_SHA_256
key_derivation_algorithm:PSA_ALG_HKDF_EXPAND( PSA_ALG_SHA_256 ):ALG_IS_HKDF_EXPAND
Key derivation: HKDF-Expand using SHA-384
depends_on:PSA_WANT_ALG_HKDF:PSA_WANT_ALG_SHA_384
key_derivation_algorithm:PSA_ALG_HKDF_EXPAND( PSA_ALG_SHA_384 ):ALG_IS_HKDF_EXPAND
Key derivation: TLS 1.2 PRF using SHA-256 Key derivation: TLS 1.2 PRF using SHA-256
depends_on:PSA_WANT_ALG_SHA_256:PSA_WANT_ALG_TLS12_PRF depends_on:PSA_WANT_ALG_SHA_256:PSA_WANT_ALG_TLS12_PRF
key_derivation_algorithm:PSA_ALG_TLS12_PRF( PSA_ALG_SHA_256 ):ALG_IS_TLS12_PRF key_derivation_algorithm:PSA_ALG_TLS12_PRF( PSA_ALG_SHA_256 ):ALG_IS_TLS12_PRF

View file

@ -37,14 +37,16 @@
#define ALG_IS_HASH_AND_SIGN ( 1u << 18 ) #define ALG_IS_HASH_AND_SIGN ( 1u << 18 )
#define ALG_IS_RSA_OAEP ( 1u << 19 ) #define ALG_IS_RSA_OAEP ( 1u << 19 )
#define ALG_IS_HKDF ( 1u << 20 ) #define ALG_IS_HKDF ( 1u << 20 )
#define ALG_IS_FFDH ( 1u << 21 ) #define ALG_IS_HKDF_EXTRACT ( 1u << 21 )
#define ALG_IS_ECDH ( 1u << 22 ) #define ALG_IS_HKDF_EXPAND ( 1u << 22 )
#define ALG_IS_WILDCARD ( 1u << 23 ) #define ALG_IS_FFDH ( 1u << 23 )
#define ALG_IS_RAW_KEY_AGREEMENT ( 1u << 24 ) #define ALG_IS_ECDH ( 1u << 24 )
#define ALG_IS_AEAD_ON_BLOCK_CIPHER ( 1u << 25 ) #define ALG_IS_WILDCARD ( 1u << 25 )
#define ALG_IS_TLS12_PRF ( 1u << 26 ) #define ALG_IS_RAW_KEY_AGREEMENT ( 1u << 26 )
#define ALG_IS_TLS12_PSK_TO_MS ( 1u << 27 ) #define ALG_IS_AEAD_ON_BLOCK_CIPHER ( 1u << 27 )
#define ALG_FLAG_MASK_PLUS_ONE ( 1u << 28 ) /* must be last! */ #define ALG_IS_TLS12_PRF ( 1u << 28 )
#define ALG_IS_TLS12_PSK_TO_MS ( 1u << 29 )
#define ALG_FLAG_MASK_PLUS_ONE ( 1u << 30 ) /* must be last! */
/* Flags for key type classification macros. There is a flag for every /* Flags for key type classification macros. There is a flag for every
* key type classification macro PSA_KEY_TYPE_IS_xxx except for some that * key type classification macro PSA_KEY_TYPE_IS_xxx except for some that
@ -140,6 +142,8 @@ void algorithm_classification( psa_algorithm_t alg, unsigned flags )
TEST_CLASSIFICATION_MACRO( 1, ALG_IS_HASH_AND_SIGN, alg, flags ); TEST_CLASSIFICATION_MACRO( 1, ALG_IS_HASH_AND_SIGN, alg, flags );
TEST_CLASSIFICATION_MACRO( 1, ALG_IS_RSA_OAEP, alg, flags ); TEST_CLASSIFICATION_MACRO( 1, ALG_IS_RSA_OAEP, alg, flags );
TEST_CLASSIFICATION_MACRO( 1, ALG_IS_HKDF, alg, flags ); TEST_CLASSIFICATION_MACRO( 1, ALG_IS_HKDF, alg, flags );
TEST_CLASSIFICATION_MACRO( 1, ALG_IS_HKDF_EXTRACT, alg, flags );
TEST_CLASSIFICATION_MACRO( 1, ALG_IS_HKDF_EXPAND, alg, flags );
TEST_CLASSIFICATION_MACRO( 1, ALG_IS_WILDCARD, alg, flags ); TEST_CLASSIFICATION_MACRO( 1, ALG_IS_WILDCARD, alg, flags );
TEST_CLASSIFICATION_MACRO( 1, ALG_IS_ECDH, alg, flags ); TEST_CLASSIFICATION_MACRO( 1, ALG_IS_ECDH, alg, flags );
TEST_CLASSIFICATION_MACRO( 1, ALG_IS_FFDH, alg, flags ); TEST_CLASSIFICATION_MACRO( 1, ALG_IS_FFDH, alg, flags );