Add dependencies to metadata validation tests

If some algorithms are excluded in the build, it's ok for the corresponding
macros not to give the correct results. Therefore the corresponding test cases
should depend on the implementation of the algorithm. For example, it's ok for
PSA_HASH_MAX_SIZE to be less than PSA_HASH_SIZE(PSA_ALG_SHA_512) if we build
without SHA-512 support, and we indeed do this. It's even ok for an
implementation to return 0 for PSA_ALG_IS_HASH(PSA_ALG_SHA_512) if it doesn't
support SHA-512; we return 1 anyway but the tests are less
implementation-specific if we don't enforce it.

This commit adds dependencies on symbols that don't exist in Mbed TLS,
for algorithms that Mbed TLS doesn't implement. These are:
MBEDTLS_SHA512_256 for SHA-512/256, MBEDTLS_SHA3_C for SHA-3,
MBEDTLS_DSA_C and MBEDTLS_DSA_DETERMINISTIC for DSA, and
MBEDTLS_ECP_DP_xxx_ENABLED for elliptic curves that have a PSA
encoding but are not supported in Mbed TLS.
This commit is contained in:
Gilles Peskine 2018-09-17 13:58:36 +02:00
parent 49cd329908
commit d9c8260f23

View file

@ -1,184 +1,245 @@
Hash: MD2
depends_on:MBEDTLS_MD2_C
hash_algorithm:PSA_ALG_MD2:16
Hash: MD4
depends_on:MBEDTLS_MD4_C
hash_algorithm:PSA_ALG_MD4:16
Hash: MD5
depends_on:MBEDTLS_MD5_C
hash_algorithm:PSA_ALG_MD5:16
Hash: RIPEMD160
depends_on:MBEDTLS_RIPEMD160_C
hash_algorithm:PSA_ALG_RIPEMD160:20
Hash: SHA-1
depends_on:MBEDTLS_SHA1_C
hash_algorithm:PSA_ALG_SHA_1:20
Hash: SHA-2 SHA-224
depends_on:MBEDTLS_SHA256_C
hash_algorithm:PSA_ALG_SHA_224:28
Hash: SHA-2 SHA-256
depends_on:MBEDTLS_SHA256_C
hash_algorithm:PSA_ALG_SHA_256:32
Hash: SHA-2 SHA-384
depends_on:MBEDTLS_SHA512_C
hash_algorithm:PSA_ALG_SHA_384:48
Hash: SHA-2 SHA-512
depends_on:MBEDTLS_SHA512_C
hash_algorithm:PSA_ALG_SHA_512:64
Hash: SHA-2 SHA-512/224
depends_on:MBEDTLS_SHA512_C:MBEDTLS_SHA512_256
hash_algorithm:PSA_ALG_SHA_512_224:28
Hash: SHA-2 SHA-512/256
depends_on:MBEDTLS_SHA512_C:MBEDTLS_SHA512_256
hash_algorithm:PSA_ALG_SHA_512_256:32
Hash: SHA-3 SHA3-224
depends_on:MBEDTLS_SHA3_C
hash_algorithm:PSA_ALG_SHA3_224:28
Hash: SHA-3 SHA3-256
depends_on:MBEDTLS_SHA3_C
hash_algorithm:PSA_ALG_SHA3_256:32
Hash: SHA-3 SHA3-384
depends_on:MBEDTLS_SHA3_C
hash_algorithm:PSA_ALG_SHA3_384:48
Hash: SHA-3 SHA3-512
depends_on:MBEDTLS_SHA3_C
hash_algorithm:PSA_ALG_SHA3_512:64
MAC: HMAC-MD2
depends_on:MBEDTLS_MD2_C
mac_algorithm:PSA_ALG_HMAC( PSA_ALG_MD2 ):ALG_IS_HMAC:16:PSA_KEY_TYPE_HMAC:128
MAC: HMAC-MD4
depends_on:MBEDTLS_MD4_C
mac_algorithm:PSA_ALG_HMAC( PSA_ALG_MD4 ):ALG_IS_HMAC:16:PSA_KEY_TYPE_HMAC:128
MAC: HMAC-MD5
depends_on:MBEDTLS_MD5_C
mac_algorithm:PSA_ALG_HMAC( PSA_ALG_MD5 ):ALG_IS_HMAC:16:PSA_KEY_TYPE_HMAC:128
MAC: HMAC-RIPEMD160
depends_on:MBEDTLS_RIPEMD160_C
mac_algorithm:PSA_ALG_HMAC( PSA_ALG_RIPEMD160 ):ALG_IS_HMAC:20:PSA_KEY_TYPE_HMAC:160
MAC: HMAC-SHA-1
depends_on:MBEDTLS_SHA1_C
mac_algorithm:PSA_ALG_HMAC( PSA_ALG_SHA_1 ):ALG_IS_HMAC:20:PSA_KEY_TYPE_HMAC:160
MAC: HMAC-SHA-224
depends_on:MBEDTLS_SHA256_C
mac_algorithm:PSA_ALG_HMAC( PSA_ALG_SHA_224 ):ALG_IS_HMAC:28:PSA_KEY_TYPE_HMAC:224
MAC: HMAC-SHA-256
depends_on:MBEDTLS_SHA256_C
mac_algorithm:PSA_ALG_HMAC( PSA_ALG_SHA_256 ):ALG_IS_HMAC:32:PSA_KEY_TYPE_HMAC:256
MAC: HMAC-SHA-384
depends_on:MBEDTLS_SHA512_C
mac_algorithm:PSA_ALG_HMAC( PSA_ALG_SHA_384 ):ALG_IS_HMAC:48:PSA_KEY_TYPE_HMAC:384
MAC: HMAC-SHA-512
depends_on:MBEDTLS_SHA512_C
mac_algorithm:PSA_ALG_HMAC( PSA_ALG_SHA_512 ):ALG_IS_HMAC:64:PSA_KEY_TYPE_HMAC:512
MAC: HMAC-SHA-512/224
depends_on:MBEDTLS_SHA512_C:MBEDTLS_SHA512_256
mac_algorithm:PSA_ALG_HMAC( PSA_ALG_SHA_512_224 ):ALG_IS_HMAC:28:PSA_KEY_TYPE_HMAC:224
MAC: HMAC-SHA-512/256
depends_on:MBEDTLS_SHA512_C:MBEDTLS_SHA512_256
mac_algorithm:PSA_ALG_HMAC( PSA_ALG_SHA_512_256 ):ALG_IS_HMAC:32:PSA_KEY_TYPE_HMAC:256
MAC: HMAC-SHA3-224
depends_on:MBEDTLS_SHA3_C
mac_algorithm:PSA_ALG_HMAC( PSA_ALG_SHA3_224 ):ALG_IS_HMAC:28:PSA_KEY_TYPE_HMAC:224
MAC: HMAC-SHA3-256
depends_on:MBEDTLS_SHA3_C
mac_algorithm:PSA_ALG_HMAC( PSA_ALG_SHA3_256 ):ALG_IS_HMAC:32:PSA_KEY_TYPE_HMAC:256
MAC: HMAC-SHA3-384
depends_on:MBEDTLS_SHA3_C
mac_algorithm:PSA_ALG_HMAC( PSA_ALG_SHA3_384 ):ALG_IS_HMAC:48:PSA_KEY_TYPE_HMAC:384
MAC: HMAC-SHA3-512
depends_on:MBEDTLS_SHA3_C
mac_algorithm:PSA_ALG_HMAC( PSA_ALG_SHA3_512 ):ALG_IS_HMAC:64:PSA_KEY_TYPE_HMAC:512
MAC: CBC_MAC-AES-128
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_C
mac_algorithm:PSA_ALG_CBC_MAC:ALG_IS_BLOCK_CIPHER_MAC:16:PSA_KEY_TYPE_AES:128
MAC: CBC_MAC-AES-192
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_C
mac_algorithm:PSA_ALG_CBC_MAC:ALG_IS_BLOCK_CIPHER_MAC:16:PSA_KEY_TYPE_AES:192
MAC: CBC_MAC-AES-256
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_C
mac_algorithm:PSA_ALG_CBC_MAC:ALG_IS_BLOCK_CIPHER_MAC:16:PSA_KEY_TYPE_AES:256
MAC: CBC_MAC-3DES
depends_on:MBEDTLS_DES_C:MBEDTLS_CIPHER_C
mac_algorithm:PSA_ALG_CBC_MAC:ALG_IS_BLOCK_CIPHER_MAC:8:PSA_KEY_TYPE_DES:192
MAC: CMAC-AES-128
depends_on:MBEDTLS_AES_C:MBEDTLS_CMAC_C
mac_algorithm:PSA_ALG_CMAC:ALG_IS_BLOCK_CIPHER_MAC:16:PSA_KEY_TYPE_AES:128
MAC: CMAC-AES-192
depends_on:MBEDTLS_AES_C:MBEDTLS_CMAC_C
mac_algorithm:PSA_ALG_CMAC:ALG_IS_BLOCK_CIPHER_MAC:16:PSA_KEY_TYPE_AES:192
MAC: CMAC-AES-256
depends_on:MBEDTLS_AES_C:MBEDTLS_CMAC_C
mac_algorithm:PSA_ALG_CMAC:ALG_IS_BLOCK_CIPHER_MAC:16:PSA_KEY_TYPE_AES:256
MAC: CMAC-3DES
depends_on:MBEDTLS_DES_C:MBEDTLS_CMAC_C
mac_algorithm:PSA_ALG_CMAC:ALG_IS_BLOCK_CIPHER_MAC:8:PSA_KEY_TYPE_DES:192
MAC: GMAC-AES-128
depends_on:MBEDTLS_AES_C:MBEDTLS_GCM_C
mac_algorithm:PSA_ALG_GMAC:ALG_IS_BLOCK_CIPHER_MAC:16:PSA_KEY_TYPE_AES:128
MAC: GMAC-AES-192
depends_on:MBEDTLS_AES_C:MBEDTLS_GCM_C
mac_algorithm:PSA_ALG_GMAC:ALG_IS_BLOCK_CIPHER_MAC:16:PSA_KEY_TYPE_AES:192
MAC: GMAC-AES-256
depends_on:MBEDTLS_AES_C:MBEDTLS_GCM_C
mac_algorithm:PSA_ALG_GMAC:ALG_IS_BLOCK_CIPHER_MAC:16:PSA_KEY_TYPE_AES:256
Cipher: ARC4
depends_on:MBEDTLS_ARC4_C
cipher_algorithm:PSA_ALG_ARC4:ALG_IS_STREAM_CIPHER
Cipher: CTR
depends_on:MBEDTLS_CIPHER_C:MBEDTLS_CIPHER_MODE_CTR
cipher_algorithm:PSA_ALG_CTR:ALG_IS_STREAM_CIPHER
Cipher: CFB
depends_on:MBEDTLS_CIPHER_C:MBEDTLS_CIPHER_MODE_CFB
cipher_algorithm:PSA_ALG_CFB:ALG_IS_STREAM_CIPHER
Cipher: OFB
depends_on:MBEDTLS_CIPHER_C:MBEDTLS_CIPHER_MODE_OFB
cipher_algorithm:PSA_ALG_OFB:ALG_IS_STREAM_CIPHER
Cipher: CBC-nopad
depends_on:MBEDTLS_CIPHER_C:MBEDTLS_CIPHER_MODE_CBC
cipher_algorithm:PSA_ALG_CBC_NO_PADDING:0
Cipher: CBC-PKCS#7
depends_on:MBEDTLS_CIPHER_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
cipher_algorithm:PSA_ALG_CBC_PKCS7:0
Cipher: XTS
depends_on:MBEDTLS_CIPHER_C:MBEDTLS_CIPHER_MODE_XTS
cipher_algorithm:PSA_ALG_XTS:0
AEAD: CCM
depends_on:MBEDTLS_CCM_C
aead_algorithm:PSA_ALG_CCM:0:16
AEAD: GCM
depends_on:MBEDTLS_GCM_C
aead_algorithm:PSA_ALG_GCM:0:16
Asymmetric signature: RSA PKCS#1 v1.5 raw
depends_on:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15
asymmetric_signature_algorithm:PSA_ALG_RSA_PKCS1V15_SIGN_RAW:ALG_IS_RSA_PKCS1V15_SIGN
Asymmetric signature: RSA PKCS#1 v1.5 SHA-256
depends_on:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C
asymmetric_signature_algorithm:PSA_ALG_RSA_PKCS1V15_SIGN( PSA_ALG_SHA_256 ):ALG_IS_RSA_PKCS1V15_SIGN
Asymmetric signature: RSA PSS SHA-256
depends_on:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V21:MBEDTLS_SHA256_C
asymmetric_signature_algorithm:PSA_ALG_RSA_PSS( PSA_ALG_SHA_256 ):ALG_IS_RSA_PSS
Asymmetric signature: SHA-256 + randomized DSA SHA-256 using SHA-256
depends_on:MBEDTLS_DSA_C:MBEDTLS_SHA256_C
asymmetric_signature_algorithm:PSA_ALG_DSA( PSA_ALG_SHA_256 ):ALG_IS_DSA | ALG_IS_RANDOMIZED_DSA
Asymmetric signature: SHA-256 + deterministic DSA using SHA-256
depends_on:MBEDTLS_DSA_C:MBEDTLS_SHA256_C:MBEDTLS_DSA_DETERMINISTIC
asymmetric_signature_algorithm:PSA_ALG_DETERMINISTIC_DSA( PSA_ALG_SHA_256 ):ALG_IS_DSA | ALG_IS_DETERMINISTIC_DSA | ALG_DSA_IS_DETERMINISTIC
Asymmetric signature: randomized ECDSA (no hashing)
depends_on:MBEDTLS_ECDSA_C
asymmetric_signature_algorithm:PSA_ALG_ECDSA_ANY:ALG_IS_ECDSA | ALG_IS_RANDOMIZED_ECDSA
Asymmetric signature: SHA-256 + randomized ECDSA
depends_on:MBEDTLS_ECDSA_C:MBEDTLS_SHA256_C
asymmetric_signature_algorithm:PSA_ALG_ECDSA( PSA_ALG_SHA_256 ):ALG_IS_ECDSA | ALG_IS_RANDOMIZED_ECDSA
Asymmetric signature: SHA-256 + deterministic DSA using SHA-256
depends_on:MBEDTLS_ECDSA_C:MBEDTLS_ECDSA_DETERMINISTIC:MBEDTLS_SHA256_C
asymmetric_signature_algorithm:PSA_ALG_DETERMINISTIC_ECDSA( PSA_ALG_SHA_256 ):ALG_IS_ECDSA | ALG_IS_DETERMINISTIC_ECDSA | ALG_ECDSA_IS_DETERMINISTIC
Asymmetric encryption: RSA PKCS#1 v1.5
depends_on:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15
asymmetric_encryption_algorithm:PSA_ALG_RSA_PKCS1V15_CRYPT:0
Asymmetric encryption: RSA OAEP using SHA-256
depends_on:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V21:MBEDTLS_SHA256_C
asymmetric_encryption_algorithm:PSA_ALG_RSA_OAEP( PSA_ALG_SHA_256 ):ALG_IS_RSA_OAEP
Key derivation: HKDF using SHA-256
depends_on:MBEDTLS_SHA256_C
key_derivation_algorithm:PSA_ALG_HKDF( PSA_ALG_SHA_256 ):ALG_IS_HKDF
Key type: raw data
@ -191,115 +252,153 @@ Key type: secret for key derivation
key_type:PSA_KEY_TYPE_DERIVE:KEY_TYPE_IS_UNSTRUCTURED
Key type: AES
depends_on:MBEDTLS_AES_C
key_type:PSA_KEY_TYPE_AES:KEY_TYPE_IS_UNSTRUCTURED
Key type: DES
depends_on:MBEDTLS_DES_C
key_type:PSA_KEY_TYPE_DES:KEY_TYPE_IS_UNSTRUCTURED
Key type: Camellia
depends_on:MBEDTLS_CAMELLIA_C
key_type:PSA_KEY_TYPE_CAMELLIA:KEY_TYPE_IS_UNSTRUCTURED
Key type: ARC4
depends_on:MBEDTLS_ARC4_C
key_type:PSA_KEY_TYPE_ARC4:KEY_TYPE_IS_UNSTRUCTURED
Key type: RSA public key
depends_on:MBEDTLS_RSA_C
key_type:PSA_KEY_TYPE_RSA_PUBLIC_KEY:KEY_TYPE_IS_PUBLIC_KEY | KEY_TYPE_IS_RSA
Key type: RSA key pair
depends_on:MBEDTLS_RSA_C
key_type:PSA_KEY_TYPE_RSA_KEYPAIR:KEY_TYPE_IS_KEYPAIR | KEY_TYPE_IS_RSA
Key type: DSA public key
depends_on:MBEDTLS_DSA_C
key_type:PSA_KEY_TYPE_DSA_PUBLIC_KEY:KEY_TYPE_IS_PUBLIC_KEY | KEY_TYPE_IS_DSA
Key type: DSA key pair
depends_on:MBEDTLS_DSA_C
key_type:PSA_KEY_TYPE_DSA_KEYPAIR:KEY_TYPE_IS_KEYPAIR | KEY_TYPE_IS_DSA
ECC key types: sect163k1
depends_on:MBEDTLS_ECP_DP_SECT163K1_ENABLED
ecc_key_types:PSA_ECC_CURVE_SECT163K1
ECC key types: sect163r1
depends_on:MBEDTLS_ECP_DP_SECT163R1_ENABLED
ecc_key_types:PSA_ECC_CURVE_SECT163R1
ECC key types: sect163r2
depends_on:MBEDTLS_ECP_DP_SECT163R2_ENABLED
ecc_key_types:PSA_ECC_CURVE_SECT163R2
ECC key types: sect193r1
depends_on:MBEDTLS_ECP_DP_SECT193R1_ENABLED
ecc_key_types:PSA_ECC_CURVE_SECT193R1
ECC key types: sect193r2
depends_on:MBEDTLS_ECP_DP_SECT193R2_ENABLED
ecc_key_types:PSA_ECC_CURVE_SECT193R2
ECC key types: sect233k1
depends_on:MBEDTLS_ECP_DP_SECT233K1_ENABLED
ecc_key_types:PSA_ECC_CURVE_SECT233K1
ECC key types: sect233r1
depends_on:MBEDTLS_ECP_DP_SECT233R1_ENABLED
ecc_key_types:PSA_ECC_CURVE_SECT233R1
ECC key types: sect239k1
depends_on:MBEDTLS_ECP_DP_SECT239K1_ENABLED
ecc_key_types:PSA_ECC_CURVE_SECT239K1
ECC key types: sect283k1
depends_on:MBEDTLS_ECP_DP_SECT283K1_ENABLED
ecc_key_types:PSA_ECC_CURVE_SECT283K1
ECC key types: sect283r1
depends_on:MBEDTLS_ECP_DP_SECT283R1_ENABLED
ecc_key_types:PSA_ECC_CURVE_SECT283R1
ECC key types: sect409k1
depends_on:MBEDTLS_ECP_DP_SECT409K1_ENABLED
ecc_key_types:PSA_ECC_CURVE_SECT409K1
ECC key types: sect409r1
depends_on:MBEDTLS_ECP_DP_SECT409R1_ENABLED
ecc_key_types:PSA_ECC_CURVE_SECT409R1
ECC key types: sect571k1
depends_on:MBEDTLS_ECP_DP_SECT571K1_ENABLED
ecc_key_types:PSA_ECC_CURVE_SECT571K1
ECC key types: sect571r1
depends_on:MBEDTLS_ECP_DP_SECT571R1_ENABLED
ecc_key_types:PSA_ECC_CURVE_SECT571R1
ECC key types: secp160k1
depends_on:MBEDTLS_ECP_DP_SECP160K1_ENABLED
ecc_key_types:PSA_ECC_CURVE_SECP160K1
ECC key types: secp160r1
depends_on:MBEDTLS_ECP_DP_SECP160R1_ENABLED
ecc_key_types:PSA_ECC_CURVE_SECP160R1
ECC key types: secp160r2
depends_on:MBEDTLS_ECP_DP_SECP160R2_ENABLED
ecc_key_types:PSA_ECC_CURVE_SECP160R2
ECC key types: secp192k1
depends_on:MBEDTLS_ECP_DP_SECP192K1_ENABLED
ecc_key_types:PSA_ECC_CURVE_SECP192K1
ECC key types: secp192r1
depends_on:MBEDTLS_ECP_DP_SECP192R1_ENABLED
ecc_key_types:PSA_ECC_CURVE_SECP192R1
ECC key types: secp224k1
depends_on:MBEDTLS_ECP_DP_SECP224K1_ENABLED
ecc_key_types:PSA_ECC_CURVE_SECP224K1
ECC key types: secp224r1
depends_on:MBEDTLS_ECP_DP_SECP224R1_ENABLED
ecc_key_types:PSA_ECC_CURVE_SECP224R1
ECC key types: secp256k1
depends_on:MBEDTLS_ECP_DP_SECP256K1_ENABLED
ecc_key_types:PSA_ECC_CURVE_SECP256K1
ECC key types: secp256r1
depends_on:MBEDTLS_ECP_DP_SECP256R1_ENABLED
ecc_key_types:PSA_ECC_CURVE_SECP256R1
ECC key types: secp384r1
depends_on:MBEDTLS_ECP_DP_SECP384R1_ENABLED
ecc_key_types:PSA_ECC_CURVE_SECP384R1
ECC key types: secp521r1
depends_on:MBEDTLS_ECP_DP_SECP521R1_ENABLED
ecc_key_types:PSA_ECC_CURVE_SECP521R1
ECC key types: Brainpool P256R1
depends_on:MBEDTLS_ECP_DP_BP256R1_ENABLED
ecc_key_types:PSA_ECC_CURVE_BRAINPOOL_P256R1
ECC key types: Brainpool P384R1
depends_on:MBEDTLS_ECP_DP_BP384R1_ENABLED
ecc_key_types:PSA_ECC_CURVE_BRAINPOOL_P384R1
ECC key types: Brainpool P512R1
depends_on:MBEDTLS_ECP_DP_BP512R1_ENABLED
ecc_key_types:PSA_ECC_CURVE_BRAINPOOL_P512R1
ECC key types: Curve25519
depends_on:MBEDTLS_ECP_DP_CURVE25519_ENABLED
ecc_key_types:PSA_ECC_CURVE_CURVE25519
ECC key types: Curve448
depends_on:MBEDTLS_ECP_DP_CURVE448_ENABLED
ecc_key_types:PSA_ECC_CURVE_CURVE448