Skip to content

Commit 5860bd3

Browse files
authored
Merge pull request #14126 from urutva/fix-mbedtls-sanity-test
tests: Limit PSA crypto tests to Arm-v7M targets
2 parents 96aa1bb + 61009ba commit 5860bd3

File tree

1 file changed

+23
-3
lines changed
  • connectivity/mbedtls/tests/TESTS/mbedtls/sanity

1 file changed

+23
-3
lines changed

connectivity/mbedtls/tests/TESTS/mbedtls/sanity/main.cpp

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,26 @@
1515
* limitations under the License.
1616
*/
1717

18-
#if ((!defined(FEATURE_PSA)) || (!defined(MBEDTLS_PSA_CRYPTO_C)))
18+
#if ((!defined(FEATURE_EXPERIMENTAL_API)) || (!defined(FEATURE_PSA)) || (!defined(TARGET_MBED_PSA_SRV)))
19+
/*
20+
* Currenlty in Mbed OS, PSA is marked as experimental and only few targets
21+
* enable experimental feature by default (ARM_MUSCA_B1, ARM_MUSCA_S1 and
22+
* CYTFM_064B0S2_4343W). Therefore, if this error is reported for a PSA target,
23+
* then it may be possible that experimental feature is not enabled that
24+
* target. In that case use the option
25+
* "--app-config TESTS/configs/experimental.json" while invoking "mbed test".
26+
*/
27+
28+
/*
29+
* These PSA tests are only supported for PSA targets (Arm-v7M) in emulation
30+
* mode. For Arm-v8M PSA targets, crypto regression tests provided by TF-M are
31+
* used. Refer to https://github.com/ARMmbed/mbed-os-tf-m-regression-tests
32+
* for more information.
33+
*/
34+
#error [NOT_SUPPORTED] Only PSA targets (Arm-v7M) in emulation mode are supported.
35+
#else
36+
#include "mbedtls/config.h"
37+
#if (!defined(MBEDTLS_PSA_CRYPTO_C))
1938
#error [NOT_SUPPORTED] Mbed Crypto is OFF - skipping.
2039
#else
2140

@@ -94,7 +113,7 @@ void test_crypto_asymmetric_encrypt_decrypt(void)
94113
unsigned char encrypted[64];
95114
unsigned char decrypted[sizeof(input)];
96115

97-
psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_ENCRYPT);
116+
psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT);
98117
psa_set_key_algorithm(&attributes, alg);
99118
psa_set_key_type(&attributes, key_type);
100119
psa_set_key_bits(&attributes, key_bits);
@@ -469,4 +488,5 @@ int main(void)
469488
{
470489
return !Harness::run(specification);
471490
}
472-
#endif // ((!defined(TARGET_PSA)) || (!defined(MBEDTLS_PSA_CRYPTO_C)))
491+
#endif // (!defined(MBEDTLS_PSA_CRYPTO_C))
492+
#endif // ((!defined(FEATURE_EXPERIMENTAL_API)) || (!defined(FEATURE_PSA)))

0 commit comments

Comments
 (0)