From e84d5d2f1c3cd59ba143280db6eba004ec31eeb8 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Tue, 5 Feb 2019 20:29:31 +0100 Subject: [PATCH] psa_copy_key: Add test cases to specifically check non-exportability Test that copying a non-exportable key doesn't make it exportable. This complements similar tests that exercise a different usage flag. --- tests/suites/test_suite_psa_crypto.data | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/suites/test_suite_psa_crypto.data b/tests/suites/test_suite_psa_crypto.data index 29674c9fd..a608433cb 100644 --- a/tests/suites/test_suite_psa_crypto.data +++ b/tests/suites/test_suite_psa_crypto.data @@ -503,10 +503,14 @@ Copy key: AES, fewer usage flags depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR copy_key_policy:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_EXPORT:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"404142434445464748494a4b4c4d4e4f":PSA_KEY_USAGE_ENCRYPT:PSA_ALG_CTR:-1:-1:PSA_KEY_USAGE_ENCRYPT:PSA_ALG_CTR -Copy key: AES, more usage flags +Copy key: AES, 1 more usage flag depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR copy_key_policy:PSA_KEY_USAGE_ENCRYPT:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"404142434445464748494a4b4c4d4e4f":PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT:PSA_ALG_CTR:-1:-1:PSA_KEY_USAGE_ENCRYPT:PSA_ALG_CTR +Copy key: AES, 2 more usage flags +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR +copy_key_policy:PSA_KEY_USAGE_ENCRYPT:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"404142434445464748494a4b4c4d4e4f":PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_EXPORT:PSA_ALG_CTR:-1:-1:PSA_KEY_USAGE_ENCRYPT:PSA_ALG_CTR + Copy key: AES, intersect usage flags depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR copy_key_policy:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_EXPORT:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"404142434445464748494a4b4c4d4e4f":PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT:PSA_ALG_CTR:-1:-1:PSA_KEY_USAGE_ENCRYPT:PSA_ALG_CTR @@ -519,10 +523,14 @@ Copy key: AES, source=target, constraint with fewer usage flags depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR copy_key_policy:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_EXPORT:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"404142434445464748494a4b4c4d4e4f":PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_EXPORT:PSA_ALG_CTR:PSA_KEY_USAGE_ENCRYPT:PSA_ALG_CTR:PSA_KEY_USAGE_ENCRYPT:PSA_ALG_CTR -Copy key: AES, source=target, constraint with more usage flags +Copy key: AES, source=target, constraint with 1 more usage flag depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR copy_key_policy:PSA_KEY_USAGE_ENCRYPT:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"404142434445464748494a4b4c4d4e4f":PSA_KEY_USAGE_ENCRYPT:PSA_ALG_CTR:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT:PSA_ALG_CTR:PSA_KEY_USAGE_ENCRYPT:PSA_ALG_CTR +Copy key: AES, source=target, constraint with 2 more usage flags +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR +copy_key_policy:PSA_KEY_USAGE_ENCRYPT:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"404142434445464748494a4b4c4d4e4f":PSA_KEY_USAGE_ENCRYPT:PSA_ALG_CTR:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_EXPORT:PSA_ALG_CTR:PSA_KEY_USAGE_ENCRYPT:PSA_ALG_CTR + Copy key: AES, source=target, constraint with different usage flags depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR copy_key_policy:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_EXPORT:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"404142434445464748494a4b4c4d4e4f":PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_EXPORT:PSA_ALG_CTR:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT:PSA_ALG_CTR:PSA_KEY_USAGE_ENCRYPT:PSA_ALG_CTR