Merge pull request #14126 from urutva/fix-mbedtls-sanity-test

tests: Limit PSA crypto tests to Arm-v7M targets
pull/14181/head
Martin Kojtal 2021-01-20 12:35:44 +00:00 committed by GitHub
commit 5860bd3eea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 3 deletions

View File

@ -15,7 +15,26 @@
* limitations under the License.
*/
#if ((!defined(FEATURE_PSA)) || (!defined(MBEDTLS_PSA_CRYPTO_C)))
#if ((!defined(FEATURE_EXPERIMENTAL_API)) || (!defined(FEATURE_PSA)) || (!defined(TARGET_MBED_PSA_SRV)))
/*
* Currenlty in Mbed OS, PSA is marked as experimental and only few targets
* enable experimental feature by default (ARM_MUSCA_B1, ARM_MUSCA_S1 and
* CYTFM_064B0S2_4343W). Therefore, if this error is reported for a PSA target,
* then it may be possible that experimental feature is not enabled that
* target. In that case use the option
* "--app-config TESTS/configs/experimental.json" while invoking "mbed test".
*/
/*
* These PSA tests are only supported for PSA targets (Arm-v7M) in emulation
* mode. For Arm-v8M PSA targets, crypto regression tests provided by TF-M are
* used. Refer to https://github.com/ARMmbed/mbed-os-tf-m-regression-tests
* for more information.
*/
#error [NOT_SUPPORTED] Only PSA targets (Arm-v7M) in emulation mode are supported.
#else
#include "mbedtls/config.h"
#if (!defined(MBEDTLS_PSA_CRYPTO_C))
#error [NOT_SUPPORTED] Mbed Crypto is OFF - skipping.
#else
@ -94,7 +113,7 @@ void test_crypto_asymmetric_encrypt_decrypt(void)
unsigned char encrypted[64];
unsigned char decrypted[sizeof(input)];
psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_ENCRYPT);
psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT);
psa_set_key_algorithm(&attributes, alg);
psa_set_key_type(&attributes, key_type);
psa_set_key_bits(&attributes, key_bits);
@ -469,4 +488,5 @@ int main(void)
{
return !Harness::run(specification);
}
#endif // ((!defined(TARGET_PSA)) || (!defined(MBEDTLS_PSA_CRYPTO_C)))
#endif // (!defined(MBEDTLS_PSA_CRYPTO_C))
#endif // ((!defined(FEATURE_EXPERIMENTAL_API)) || (!defined(FEATURE_PSA)))