|
15 | 15 | * limitations under the License.
|
16 | 16 | */
|
17 | 17 |
|
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)) |
19 | 38 | #error [NOT_SUPPORTED] Mbed Crypto is OFF - skipping.
|
20 | 39 | #else
|
21 | 40 |
|
@@ -94,7 +113,7 @@ void test_crypto_asymmetric_encrypt_decrypt(void)
|
94 | 113 | unsigned char encrypted[64];
|
95 | 114 | unsigned char decrypted[sizeof(input)];
|
96 | 115 |
|
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); |
98 | 117 | psa_set_key_algorithm(&attributes, alg);
|
99 | 118 | psa_set_key_type(&attributes, key_type);
|
100 | 119 | psa_set_key_bits(&attributes, key_bits);
|
@@ -469,4 +488,5 @@ int main(void)
|
469 | 488 | {
|
470 | 489 | return !Harness::run(specification);
|
471 | 490 | }
|
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