Crypto: Test fixes and documentation update

- Supporting key size ranges for RSA key generation
- Optional suppport for ECC key for psa_asymmetric_encrypt
- Passing actual buffer size for negative tests
- Update failure analysis doc with github issue links
diff --git a/api-tests/dev_apis/crypto/test_c016/test_c016.c b/api-tests/dev_apis/crypto/test_c016/test_c016.c
index e7483d3..58f847f 100644
--- a/api-tests/dev_apis/crypto/test_c016/test_c016.c
+++ b/api-tests/dev_apis/crypto/test_c016/test_c016.c
@@ -1,5 +1,5 @@
 /** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved.
  * SPDX-License-Identifier : Apache-2.0
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -98,7 +98,7 @@
         TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(9));
 
         /* Check the attributes of the exported key */
-        TEST_ASSERT_EQUAL(length, check1[i].expected_key_length, TEST_CHECKPOINT_NUM(10));
+        TEST_ASSERT_RANGE(length, check1[i].expected_range[0], check1[i].expected_range[1], TEST_CHECKPOINT_NUM(10));
 
         /* Reset the attributes */
         val->crypto_function(VAL_CRYPTO_RESET_KEY_ATTRIBUTES, &attributes);
diff --git a/api-tests/dev_apis/crypto/test_c016/test_data.h b/api-tests/dev_apis/crypto/test_c016/test_data.h
index c184c90..2043fff 100644
--- a/api-tests/dev_apis/crypto/test_c016/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c016/test_data.h
@@ -1,5 +1,5 @@
 /** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved.
  * SPDX-License-Identifier : Apache-2.0
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -25,7 +25,7 @@
     psa_algorithm_t         key_alg;
     size_t                  attr_bits;
     uint32_t                expected_bit_length;
-    uint32_t                expected_key_length;
+    uint32_t                expected_range[2];
     psa_status_t            expected_status;
 } test_data;
 
@@ -34,42 +34,42 @@
 #ifdef ARCH_TEST_AES_128
 {"Test psa_generate_key 16 Byte AES\n", 1, PSA_KEY_TYPE_AES,
  PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR, BYTES_TO_BITS(AES_16B_KEY_SIZE),
- BYTES_TO_BITS(AES_16B_KEY_SIZE), AES_16B_KEY_SIZE, PSA_SUCCESS
+ BYTES_TO_BITS(AES_16B_KEY_SIZE), {AES_16B_KEY_SIZE, AES_16B_KEY_SIZE}, PSA_SUCCESS
 },
 #endif
 
 #ifdef ARCH_TEST_AES_192
 {"Test psa_generate_key 24 Byte AES\n", 2, PSA_KEY_TYPE_AES,
  PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR, BYTES_TO_BITS(AES_24B_KEY_SIZE),
- BYTES_TO_BITS(AES_24B_KEY_SIZE), AES_24B_KEY_SIZE, PSA_SUCCESS
+ BYTES_TO_BITS(AES_24B_KEY_SIZE), {AES_24B_KEY_SIZE, AES_24B_KEY_SIZE}, PSA_SUCCESS
 },
 #endif
 
 #ifdef ARCH_TEST_AES_256
 {"Test psa_generate_key 32 Byte AES\n", 3, PSA_KEY_TYPE_AES,
  PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR, BYTES_TO_BITS(AES_32B_KEY_SIZE),
- BYTES_TO_BITS(AES_32B_KEY_SIZE), AES_32B_KEY_SIZE, PSA_SUCCESS
+ BYTES_TO_BITS(AES_32B_KEY_SIZE), {AES_32B_KEY_SIZE, AES_32B_KEY_SIZE}, PSA_SUCCESS
 },
 #endif
 
 #ifdef ARCH_TEST_DES_1KEY
 {"Test psa_generate_key with DES 64 bit key\n", 4, PSA_KEY_TYPE_DES,
  PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR, BYTES_TO_BITS(DES_8B_KEY_SIZE),
- BYTES_TO_BITS(DES_8B_KEY_SIZE), DES_8B_KEY_SIZE, PSA_SUCCESS
+ BYTES_TO_BITS(DES_8B_KEY_SIZE), {DES_8B_KEY_SIZE, DES_8B_KEY_SIZE}, PSA_SUCCESS
 },
 #endif
 
 #ifdef ARCH_TEST_DES_2KEY
 {"Test psa_generate_key with Triple DES 2-Key\n", 5, PSA_KEY_TYPE_DES,
  PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR, BYTES_TO_BITS(DES3_2KEY_SIZE),
- BYTES_TO_BITS(DES3_2KEY_SIZE), DES3_2KEY_SIZE, PSA_SUCCESS
+ BYTES_TO_BITS(DES3_2KEY_SIZE), {DES3_2KEY_SIZE, DES3_2KEY_SIZE}, PSA_SUCCESS
 },
 #endif
 
 #ifdef ARCH_TEST_DES_3KEY
 {"Test psa_generate_key with Triple DES 3-Key\n", 6, PSA_KEY_TYPE_DES,
  PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR, BYTES_TO_BITS(DES3_3KEY_SIZE),
- BYTES_TO_BITS(DES3_3KEY_SIZE), DES3_3KEY_SIZE, PSA_SUCCESS
+ BYTES_TO_BITS(DES3_3KEY_SIZE), {DES3_3KEY_SIZE, DES3_3KEY_SIZE}, PSA_SUCCESS
 },
 #endif
 
@@ -77,7 +77,7 @@
 
 {"Test psa_generate_key with RSA 2048 Keypair\n", 7, PSA_KEY_TYPE_RSA_KEY_PAIR,
  PSA_KEY_USAGE_EXPORT | PSA_KEY_USAGE_SIGN | PSA_KEY_USAGE_VERIFY, PSA_ALG_RSA_PKCS1V15_SIGN_RAW,
- 2048, 2048, 1192, PSA_SUCCESS
+ 2048, 2048, {1190, 1194}, PSA_SUCCESS
 },
 
 #ifdef ARCH_TEST_ECC_CURVE_SECP224R1
@@ -85,7 +85,7 @@
 {"Test psa_generate_key with ECC KeyPair\n", 8,
  PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP224R1),
  PSA_KEY_USAGE_EXPORT, PSA_ALG_CATEGORY_ASYMMETRIC_ENCRYPTION, 224,
- 224, 28, PSA_SUCCESS
+ 224, {28, 28}, PSA_SUCCESS
 },
 #endif
 #endif
@@ -94,18 +94,18 @@
 #ifdef ARCH_TEST_RSA_2048
 {"Test psa_generate_key with RSA 2048 Public key\n", 9, PSA_KEY_TYPE_RSA_PUBLIC_KEY,
  PSA_KEY_USAGE_EXPORT | PSA_KEY_USAGE_SIGN | PSA_KEY_USAGE_VERIFY, PSA_ALG_RSA_PKCS1V15_SIGN_RAW,
- 2048, 2048, 1192, PSA_ERROR_NOT_SUPPORTED
+ 2048, 2048, {1190, 1194}, PSA_ERROR_NOT_SUPPORTED
 },
 #endif
 #endif
 
 {"Test psa_generate_key with invalid key type\n", 10, 0,
  PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR, BYTES_TO_BITS(AES_16B_KEY_SIZE),
- BYTES_TO_BITS(AES_16B_KEY_SIZE), AES_16B_KEY_SIZE, PSA_ERROR_NOT_SUPPORTED
+ BYTES_TO_BITS(AES_16B_KEY_SIZE), {AES_16B_KEY_SIZE, AES_16B_KEY_SIZE}, PSA_ERROR_NOT_SUPPORTED
 },
 
 {"Test psa_generate_key with invalid usage flags\n", 11, PSA_KEY_TYPE_AES,
  PSA_KEY_USAGE_INVALID, PSA_ALG_CTR, BYTES_TO_BITS(AES_16B_KEY_SIZE),
- BYTES_TO_BITS(AES_16B_KEY_SIZE), AES_16B_KEY_SIZE, PSA_ERROR_INVALID_ARGUMENT
+ BYTES_TO_BITS(AES_16B_KEY_SIZE), {AES_16B_KEY_SIZE, AES_16B_KEY_SIZE}, PSA_ERROR_INVALID_ARGUMENT
 },
 };
diff --git a/api-tests/dev_apis/crypto/test_c039/test_data.h b/api-tests/dev_apis/crypto/test_c039/test_data.h
index b90831b..e947fd0 100644
--- a/api-tests/dev_apis/crypto/test_c039/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c039/test_data.h
@@ -216,6 +216,7 @@
 
 #ifdef ARCH_TEST_ECDSA
 #ifdef ARCH_TEST_ECC_CURVE_SECP256R1
+#ifdef ARCH_TEST_ECC_ASYMMETRIC_API_SUPPORT
 {"Test psa_asymmetric_encrypt - ECC public key\n", 9,
  PSA_KEY_TYPE_ECC_PUBLIC_KEY(PSA_ECC_CURVE_SECP256R1),
 {0}, 65, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CATEGORY_ASYMMETRIC_ENCRYPTION,
@@ -237,6 +238,7 @@
 }
 #endif
 #endif
+#endif
 };
 
 static test_data check2[] = {
diff --git a/api-tests/dev_apis/crypto/test_c043/test_data.h b/api-tests/dev_apis/crypto/test_c043/test_data.h
index b319e22..15cf38f 100644
--- a/api-tests/dev_apis/crypto/test_c043/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c043/test_data.h
@@ -1,5 +1,5 @@
 /** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved.
  * SPDX-License-Identifier : Apache-2.0
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -167,7 +167,7 @@
  0x3c, 0x6e, 0x70, 0xc4, 0x16, 0xdd, 0x5f, 0x0c, 0x68, 0x75, 0x9d, 0xd1, 0xff,
  0xf8, 0x3f, 0xa4, 0x01, 0x42, 0x20, 0x9d, 0xff, 0x5e, 0xaa, 0xd9, 0x6d, 0xb9,
  0xe6, 0x38, 0x6c}, 97,
-{0}, 0, 0, PSA_ERROR_INVALID_ARGUMENT
+{0}, 0, SIZE_50B, PSA_ERROR_INVALID_ARGUMENT
 },
 
 {"Test psa_raw_key_agreement - Public key instead of private key\n", 7,
@@ -183,7 +183,7 @@
  0x6f, 0xc7, 0x55, 0x44, 0x94, 0xbf, 0x63, 0x56, 0xfb, 0xf3, 0xca, 0x36, 0x6c,
  0xc2, 0x3e, 0x81, 0x57, 0x85, 0x4c, 0x13, 0xc5, 0x8d, 0x6a, 0xac, 0x23, 0xf0,
  0x46, 0xad, 0xa3, 0x0f, 0x83, 0x53, 0xe7, 0x4f, 0x33, 0x03, 0x98, 0x72, 0xab},
- 65, {0}, 0, 0, PSA_ERROR_INVALID_ARGUMENT
+ 65, {0}, 0, SIZE_50B, PSA_ERROR_INVALID_ARGUMENT
 },
 #endif
 #endif
diff --git a/api-tests/docs/test_failure_analysis.md b/api-tests/docs/test_failure_analysis.md
index 405de94..ab03126 100644
--- a/api-tests/docs/test_failure_analysis.md
+++ b/api-tests/docs/test_failure_analysis.md
@@ -1,38 +1,36 @@
 
 # Test failure analysis document
 
-This file contains list of failures identified when running the PSA API tests
+This file contains list of failures identified when testing the release
 on tgt_dev_apis_tfm_an521, tgt_dev_apis_tfm_musca_a and  tgt_dev_apis_tfm_musca_b1
 targets with TFM commit Hash - 6e7be077eabef00b4825e245604148d82b11f832.
 The reason for each failing test is listed here in this file.
 
 ## Known Failures
 
-| Test | Fail description                                                                |
-|------|---------------------------------------------------------------------------------|
-|test_c006 | psa_hash_compute is unimplemented in TFM	|
-|test_c007 | psa_hash_compare is unimplemented in TFM	|
-|test_c009 | psa_key_derivation_input_bytes returns incorrect error code |
-|test_c016 | psa_generate_key generates incorrect key length for RSA |
-|test_c020 | psa_key_derivation_output_bytes returns incorrect error code |
-|test_c021 | psa_key_derivation_output_key returns incorrect error code |
-|test_c039 | psa_asymmetric_encrypt does not have support for ECC keys |
-|test_c046 | psa_mac_compute is unimplemented in TFM	|
-|test_c047 | psa_mac_verify is unimplemented in TFM		|
-|test_c048 | psa_cipher_encrypt is unimplemented in TFM |
-|test_c049 | psa_cipher_decrypt is unimplemented in TFM |
-|test_c050 | psa_open_key API not enabled in TFM |
-|test_c051 | psa_close_key API not enabled in TFM |
-|test_c052 | psa_aead_encrypt_setup is unimplemented in TFM |
-|test_c053 | psa_aead_decrypt_setup is unimplemented in TFM |
-|test_c054 | psa_aead_generate_nonce is unimplemented in TFM |
-|test_c055 | psa_aead_set_nonce is unimplemented in TFM |
-|test_c056 | psa_aead_set_lengths is unimplemented in TFM |
-|test_c057 | psa_aead_update_ad is unimplemented in TFM |
-|test_c058 | psa_aead_update is unimplemented in TFM |
-|test_c059 | psa_aead_finish is unimplemented in TFM |
-|test_c060 | psa_aead_abort is unimplemented in TFM |
-|test_c061 | psa_aead_verify is unimplemented in TFM |
+| Test | Fail description                                                                | Github issue |
+|------|---------------------------------------------------------------------------------| ------------ |
+|test_c006 | psa_hash_compute is unimplemented in TFM/mbed-crypto. So the test has not been verified. 	| https://github.com/ARMmbed/mbed-crypto/issues/381 |
+|test_c007 | psa_hash_compare is unimplemented in TFM/mbed-crypto. So the test has not been verified.	| https://github.com/ARMmbed/mbed-crypto/issues/381 |
+|test_c009 | psa_key_derivation_input_bytes returns incorrect error code | https://github.com/ARMmbed/mbed-crypto/issues/175 |
+|test_c020 | psa_key_derivation_output_bytes returns incorrect error code | https://github.com/ARMmbed/mbed-crypto/issues/175 |
+|test_c021 | psa_key_derivation_output_key returns incorrect error code | https://github.com/ARMmbed/mbed-crypto/issues/175 |
+|test_c046 | psa_mac_compute is unimplemented in TFM/mbed-crypto. So the test has not been verified.	| https://github.com/ARMmbed/mbed-crypto/issues/381 |
+|test_c047 | psa_mac_verify is unimplemented in TFM/mbed-crypto. So the test has not been verified.		| https://github.com/ARMmbed/mbed-crypto/issues/381 |
+|test_c048 | psa_cipher_encrypt is unimplemented in TFM/mbed-crypto. So the test has not been verified. | https://github.com/ARMmbed/mbed-crypto/issues/381 |
+|test_c049 | psa_cipher_decrypt is unimplemented in TFM/mbed-crypto. So the test has not been verified. | https://github.com/ARMmbed/mbed-crypto/issues/381 |
+|test_c050 | Persistent key storage is unavailable in TFM/mbed-crypto. So the test has not been verified. | https://github.com/ARMmbed/mbed-crypto/issues/382 |
+|test_c051 | Persistent key storage is unavailable in TFM/mbed-crypto. So the test has not been verified. | https://github.com/ARMmbed/mbed-crypto/issues/382 |
+|test_c052 | psa_aead_encrypt_setup is unimplemented in TFM/mbed-crypto. So the test has not been verified. | https://github.com/ARMmbed/mbed-crypto/issues/381 |
+|test_c053 | psa_aead_decrypt_setup is unimplemented in TFM/mbed-crypto. So the test has not been verified. | https://github.com/ARMmbed/mbed-crypto/issues/381 |
+|test_c054 | psa_aead_generate_nonce is unimplemented in TFM/mbed-crypto. So the test has not been verified. | https://github.com/ARMmbed/mbed-crypto/issues/381 |
+|test_c055 | psa_aead_set_nonce is unimplemented in TFM/mbed-crypto. So the test has not been verified. | https://github.com/ARMmbed/mbed-crypto/issues/381 |
+|test_c056 | psa_aead_set_lengths is unimplemented in TFM/mbed-crypto. So the test has not been verified. | https://github.com/ARMmbed/mbed-crypto/issues/381 |
+|test_c057 | psa_aead_update_ad is unimplemented in TFM/mbed-crypto. So the test has not been verified. | https://github.com/ARMmbed/mbed-crypto/issues/381 |
+|test_c058 | psa_aead_update is unimplemented in TFM/mbed-crypto. So the test has not been verified. | https://github.com/ARMmbed/mbed-crypto/issues/381 |
+|test_c059 | psa_aead_finish is unimplemented in TFM/mbed-crypto. So the test has not been verified. | https://github.com/ARMmbed/mbed-crypto/issues/381 |
+|test_c060 | psa_aead_abort is unimplemented in TFM/mbed-crypto. So the test has not been verified. | https://github.com/ARMmbed/mbed-crypto/issues/381 |
+|test_c061 | psa_aead_verify is unimplemented in TFM/mbed-crypto. So the test has not been verified. | https://github.com/ARMmbed/mbed-crypto/issues/381 |
 
 ## License
 
diff --git a/api-tests/platform/targets/tgt_dev_apis_stdc/nspe/crypto/pal_crypto_config.h b/api-tests/platform/targets/tgt_dev_apis_stdc/nspe/crypto/pal_crypto_config.h
index 47bb881..2ce1d33 100644
--- a/api-tests/platform/targets/tgt_dev_apis_stdc/nspe/crypto/pal_crypto_config.h
+++ b/api-tests/platform/targets/tgt_dev_apis_stdc/nspe/crypto/pal_crypto_config.h
@@ -1,5 +1,5 @@
 /** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved.
  * SPDX-License-Identifier : Apache-2.0
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -317,6 +317,12 @@
 */
 #define ARCH_TEST_DETERMINISTIC_ECDSA
 
+/**
+ * \def ARCH_TEST_ECC_ASYMMETRIC_API_SUPPORT
+ *
+ * Enable ECC support for asymmetric API.
+*/
+//#define ARCH_TEST_ECC_ASYMMETRIC_API_SUPPORT
 #include "pal_crypto_config_check.h"
 
 #endif /* _PAL_CRYPTO_CONFIG_H_ */
diff --git a/api-tests/platform/targets/tgt_dev_apis_tfm_an521/nspe/crypto/pal_crypto_config.h b/api-tests/platform/targets/tgt_dev_apis_tfm_an521/nspe/crypto/pal_crypto_config.h
index b55309b..6f3eca7 100644
--- a/api-tests/platform/targets/tgt_dev_apis_tfm_an521/nspe/crypto/pal_crypto_config.h
+++ b/api-tests/platform/targets/tgt_dev_apis_tfm_an521/nspe/crypto/pal_crypto_config.h
@@ -318,6 +318,12 @@
 */
 #define ARCH_TEST_DETERMINISTIC_ECDSA
 
+/**
+ * \def ARCH_TEST_ECC_ASYMMETRIC_API_SUPPORT
+ *
+ * Enable ECC support for asymmetric API.
+*/
+//#define ARCH_TEST_ECC_ASYMMETRIC_API_SUPPORT
 #include "pal_crypto_config_check.h"
 
 #endif /* _PAL_CRYPTO_CONFIG_H_ */
diff --git a/api-tests/platform/targets/tgt_dev_apis_tfm_an524/nspe/crypto/pal_crypto_config.h b/api-tests/platform/targets/tgt_dev_apis_tfm_an524/nspe/crypto/pal_crypto_config.h
index b55309b..6f3eca7 100644
--- a/api-tests/platform/targets/tgt_dev_apis_tfm_an524/nspe/crypto/pal_crypto_config.h
+++ b/api-tests/platform/targets/tgt_dev_apis_tfm_an524/nspe/crypto/pal_crypto_config.h
@@ -318,6 +318,12 @@
 */
 #define ARCH_TEST_DETERMINISTIC_ECDSA
 
+/**
+ * \def ARCH_TEST_ECC_ASYMMETRIC_API_SUPPORT
+ *
+ * Enable ECC support for asymmetric API.
+*/
+//#define ARCH_TEST_ECC_ASYMMETRIC_API_SUPPORT
 #include "pal_crypto_config_check.h"
 
 #endif /* _PAL_CRYPTO_CONFIG_H_ */
diff --git a/api-tests/platform/targets/tgt_dev_apis_tfm_musca_a/nspe/crypto/pal_crypto_config.h b/api-tests/platform/targets/tgt_dev_apis_tfm_musca_a/nspe/crypto/pal_crypto_config.h
index b55309b..6f3eca7 100644
--- a/api-tests/platform/targets/tgt_dev_apis_tfm_musca_a/nspe/crypto/pal_crypto_config.h
+++ b/api-tests/platform/targets/tgt_dev_apis_tfm_musca_a/nspe/crypto/pal_crypto_config.h
@@ -318,6 +318,12 @@
 */
 #define ARCH_TEST_DETERMINISTIC_ECDSA
 
+/**
+ * \def ARCH_TEST_ECC_ASYMMETRIC_API_SUPPORT
+ *
+ * Enable ECC support for asymmetric API.
+*/
+//#define ARCH_TEST_ECC_ASYMMETRIC_API_SUPPORT
 #include "pal_crypto_config_check.h"
 
 #endif /* _PAL_CRYPTO_CONFIG_H_ */
diff --git a/api-tests/platform/targets/tgt_dev_apis_tfm_musca_b1/nspe/crypto/pal_crypto_config.h b/api-tests/platform/targets/tgt_dev_apis_tfm_musca_b1/nspe/crypto/pal_crypto_config.h
index b55309b..6f3eca7 100644
--- a/api-tests/platform/targets/tgt_dev_apis_tfm_musca_b1/nspe/crypto/pal_crypto_config.h
+++ b/api-tests/platform/targets/tgt_dev_apis_tfm_musca_b1/nspe/crypto/pal_crypto_config.h
@@ -318,6 +318,12 @@
 */
 #define ARCH_TEST_DETERMINISTIC_ECDSA
 
+/**
+ * \def ARCH_TEST_ECC_ASYMMETRIC_API_SUPPORT
+ *
+ * Enable ECC support for asymmetric API.
+*/
+//#define ARCH_TEST_ECC_ASYMMETRIC_API_SUPPORT
 #include "pal_crypto_config_check.h"
 
 #endif /* _PAL_CRYPTO_CONFIG_H_ */
diff --git a/api-tests/platform/targets/tgt_ff_tfm_an521/nspe/crypto/pal_crypto_config.h b/api-tests/platform/targets/tgt_ff_tfm_an521/nspe/crypto/pal_crypto_config.h
index 4c39814..0e95f72 100644
--- a/api-tests/platform/targets/tgt_ff_tfm_an521/nspe/crypto/pal_crypto_config.h
+++ b/api-tests/platform/targets/tgt_ff_tfm_an521/nspe/crypto/pal_crypto_config.h
@@ -318,6 +318,12 @@
 */
 #define ARCH_TEST_DETERMINISTIC_ECDSA
 
+/**
+ * \def ARCH_TEST_ECC_ASYMMETRIC_API_SUPPORT
+ *
+ * Enable ECC support for asymmetric API.
+*/
+//#define ARCH_TEST_ECC_ASYMMETRIC_API_SUPPORT
 #include "pal_crypto_config_check.h"
 
 #endif /* _PAL_CRYPTO_CONFIG_H_ */
diff --git a/api-tests/platform/targets/tgt_ff_tfm_musca_a/nspe/crypto/pal_crypto_config.h b/api-tests/platform/targets/tgt_ff_tfm_musca_a/nspe/crypto/pal_crypto_config.h
index b55309b..6f3eca7 100644
--- a/api-tests/platform/targets/tgt_ff_tfm_musca_a/nspe/crypto/pal_crypto_config.h
+++ b/api-tests/platform/targets/tgt_ff_tfm_musca_a/nspe/crypto/pal_crypto_config.h
@@ -318,6 +318,12 @@
 */
 #define ARCH_TEST_DETERMINISTIC_ECDSA
 
+/**
+ * \def ARCH_TEST_ECC_ASYMMETRIC_API_SUPPORT
+ *
+ * Enable ECC support for asymmetric API.
+*/
+//#define ARCH_TEST_ECC_ASYMMETRIC_API_SUPPORT
 #include "pal_crypto_config_check.h"
 
 #endif /* _PAL_CRYPTO_CONFIG_H_ */
diff --git a/api-tests/platform/targets/tgt_ff_tfm_musca_b1/nspe/crypto/pal_crypto_config.h b/api-tests/platform/targets/tgt_ff_tfm_musca_b1/nspe/crypto/pal_crypto_config.h
index c80bc66..aaa1bc5 100644
--- a/api-tests/platform/targets/tgt_ff_tfm_musca_b1/nspe/crypto/pal_crypto_config.h
+++ b/api-tests/platform/targets/tgt_ff_tfm_musca_b1/nspe/crypto/pal_crypto_config.h
@@ -318,6 +318,12 @@
 */
 #define ARCH_TEST_DETERMINISTIC_ECDSA
 
+/**
+ * \def ARCH_TEST_ECC_ASYMMETRIC_API_SUPPORT
+ *
+ * Enable ECC support for asymmetric API.
+*/
+//#define ARCH_TEST_ECC_ASYMMETRIC_API_SUPPORT
 #include "pal_crypto_config_check.h"
 
 #endif /* _PAL_CRYPTO_CONFIG_H_ */
diff --git a/api-tests/val/common/val.h b/api-tests/val/common/val.h
index c9bcc33..f7ba5f0 100644
--- a/api-tests/val/common/val.h
+++ b/api-tests/val/common/val.h
@@ -1,5 +1,5 @@
 /** @file
- * Copyright (c) 2018-2019, Arm Limited or its affiliates. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited or its affiliates. All rights reserved.
  * SPDX-License-Identifier : Apache-2.0
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -165,6 +165,18 @@
         }                                                                           \
     } while (0)
 
+#define TEST_ASSERT_RANGE(arg1, range1, range2, checkpoint)                         \
+    do {                                                                            \
+        if ((arg1) < range1 || (arg1) > range2)                                     \
+        {                                                                           \
+            val->print(PRINT_ERROR, "\tFailed at Checkpoint: %d\n", checkpoint);    \
+            val->print(PRINT_ERROR, "\tActual: %d\n", arg1);                        \
+            val->print(PRINT_ERROR, "\tExpected range: %d to ", range1);            \
+            val->print(PRINT_ERROR, "%d", range2);                                  \
+            return 1;                                                               \
+        }                                                                           \
+    } while (0)
+
 /* enums */
 typedef enum {
     CALLER_NONSECURE = 0x0,