psa arch test v1.3 release candidate 1
diff --git a/api-tests/dev_apis/README.md b/api-tests/dev_apis/README.md
index 36af1cb..24a5820 100644
--- a/api-tests/dev_apis/README.md
+++ b/api-tests/dev_apis/README.md
@@ -14,7 +14,7 @@
For more information on the architecture test suite framework and methodology to run the tests, refer to the [Validation Methodology](../docs/Arm_PSA_APIs_Arch_Test_Validation_Methodology.pdf) document.
## This release
- - Code Quality : REL v1.2
+ - Code Quality : REL v1.3
- This release contains following PSA Functional APIs tests: <br />
| Test Category | Specification Version |
@@ -30,7 +30,8 @@
| Release version | Release tag | PSA Crypto API | PSA Storage API | PSA Attestation API |
|-----------------|---------------|----------------|-----------------|---------------------|
-| REL v1.2 | [v21.07_API1.2_ADAC_ALPHA](https://github.com/ARM-software/psa-arch-tests/tree//api-tests/dev_apis) | 1.0.0 | 1.0.0 | 1.0.2 |
+| REL v1.3 | [v21.10_API1.3_ADAC_ALPHA-1](https://github.com/ARM-software/psa-arch-tests/tree/v21.10_API1.3_ADAC_ALPHA-1/api-tests/dev_apis) | 1.0.0 | 1.0.0 | 1.0.2 |
+| REL v1.2 | [v21.07_API1.2_ADAC_ALPHA](https://github.com/ARM-software/psa-arch-tests/tree/v21.07_API1.2_ADAC_ALPHA/api-tests/dev_apis) | 1.0.0 | 1.0.0 | 1.0.2 |
| REL v1.1 | [v20.11_API1.1](https://github.com/ARM-software/psa-arch-tests/tree/v20.11_API1.1/api-tests/dev_apis) | 1.0-Beta3 | 1.0.0 | 1.0.0 |
| REL v1.0 | [v20.03_API1.0](https://github.com/ARM-software/psa-arch-tests/tree/v20.03_API1.0/api-tests/dev_apis) | 1.0-Beta3 | 1.0.0 | 1.0.0 |
| v0.9 | [v19.06_API0.9](https://github.com/ARM-software/psa-arch-tests/tree/v19.06_API0.9/api-tests/dev_apis) | 1.0-Beta2 | 1.0-Beta2 | 1.0-Beta0 |
@@ -81,6 +82,7 @@
```
-DPSA_INCLUDE_PATHS=`readlink -f <relative_include_path>`
```
+- -DTESTS_COVERAGE=<tests_coverage_value> is used to skip known failure tests by selecting value PASS. Supported values are ALL and PASS. ALL value will include all the tests and PASS value will skip the known failure tests and will include pass tests. Default is ALL.
To compile Crypto tests for **tgt_dev_apis_tfm_an521** platform, execute the following commands:
```
diff --git a/api-tests/dev_apis/crypto/common/test_crypto_common.c b/api-tests/dev_apis/crypto/common/test_crypto_common.c
index a97b7df..a102b21 100644
--- a/api-tests/dev_apis/crypto/common/test_crypto_common.c
+++ b/api-tests/dev_apis/crypto/common/test_crypto_common.c
@@ -451,6 +451,12 @@
0xC2, 0xE2, 0x19, 0xF8, 0xAD, 0xF8, 0x6F, 0x7D, 0xC6, 0x4C, 0xA8, 0x03, 0xBC, 0x18, 0x5B, 0x4E,
0x60, 0xD0, 0xB9, 0xFC, 0x23, 0xB0, 0x20, 0x7A, 0x84, 0x83, 0x38, 0xB8, 0xA1, 0x15, 0x81, 0xA1};
+const uint8_t signature_6[] = {0xC6, 0x54, 0x59, 0xB1, 0xC9, 0x50, 0x8F, 0xE6, 0xBD, 0x97, 0x3F,
+0x43, 0xAA, 0xBF, 0x58, 0x12, 0xAF, 0xF6, 0xA8, 0xDB, 0x40, 0x2F, 0x77, 0x3D, 0x74, 0x0E, 0xF1,
+0x41, 0x8D, 0xDC, 0x54, 0xA8, 0xD6, 0xFE, 0x52, 0x4C, 0xD3, 0x78, 0xEB, 0xE2, 0xC2, 0xAF, 0x80,
+0xF6, 0xAF, 0xFC, 0x0F, 0xB0, 0x4B, 0xEA, 0x36, 0x0C, 0x92, 0xE5, 0x64, 0x4A, 0x60, 0x41, 0xB2,
+0xF4, 0x53, 0x49, 0xD4, 0x22};
+
const uint8_t hmac_sha224[] = {
0x2D, 0x39, 0x37, 0x90, 0xE1, 0xDA, 0x9A, 0x86, 0xEC, 0x0D, 0x1B, 0x17, 0x59, 0xC1, 0x23, 0xF9,
0xBA, 0xA4, 0x38, 0xF9, 0x11, 0xA7, 0x3F, 0xEA, 0x1E, 0x9E, 0xA1, 0x7D};
@@ -469,8 +475,8 @@
0x91, 0xD1, 0x35, 0x52, 0x7F, 0xF2, 0xC3, 0x67, 0x43, 0x99, 0xDC, 0x20, 0x2A, 0xC4, 0x77, 0xB4,
0x4C, 0x51, 0xD0, 0xFE, 0x1D, 0xB6, 0xC8, 0x28, 0x34, 0x02, 0x6A, 0x6D, 0x8D, 0xD3, 0x20, 0xDB};
-const uint8_t cmac_aes_128[] = {
-};
+const uint8_t cmac_aes_128[] = {0x7F, 0x97, 0x9B, 0xA0, 0xFF, 0xF1, 0x35, 0x98, 0x61, 0x38, 0xF2,
+ 0xAB, 0x05, 0x4B, 0x28, 0x4B};
/* test inputs */
const uint8_t hash_input = 0xbd;
diff --git a/api-tests/dev_apis/crypto/common/test_crypto_common.h b/api-tests/dev_apis/crypto/common/test_crypto_common.h
index e4ae071..dd99d9a 100644
--- a/api-tests/dev_apis/crypto/common/test_crypto_common.h
+++ b/api-tests/dev_apis/crypto/common/test_crypto_common.h
@@ -38,9 +38,11 @@
#define INPUT_SEED_LEN 4
#define INPUT_LABEL_LEN 5
+#define PSA_ERROR_PROGRAMMER_ERROR ((psa_status_t)-129)
+
/* min and max finding macro */
-#define MIN(a,b) (((a)<(b))?(a):(b))
-#define MAX(a,b) (((a)>(b))?(a):(b))
+#define MIN(a, b) (((a) < (b))?(a):(b))
+#define MAX(a, b) (((a) > (b))?(a):(b))
extern const uint8_t key_data[];
@@ -108,6 +110,7 @@
extern const uint8_t signature_4[];
extern const uint8_t signature_4_invalid[];
extern const uint8_t signature_5[];
+extern const uint8_t signature_6[];
extern const uint8_t hmac_sha224[];
extern const uint8_t hmac_sha224_invalid[];
diff --git a/api-tests/dev_apis/crypto/suite.cmake b/api-tests/dev_apis/crypto/suite.cmake
index f7b13de..48e59ba 100644
--- a/api-tests/dev_apis/crypto/suite.cmake
+++ b/api-tests/dev_apis/crypto/suite.cmake
@@ -1,5 +1,5 @@
#/** @file
-# * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved.
+# * Copyright (c) 2019-2021, Arm Limited or its affiliates. All rights reserved.
# * SPDX-License-Identifier : Apache-2.0
# *
# * Licensed under the Apache License, Version 2.0 (the "License");
@@ -33,7 +33,7 @@
add_definitions(${CC_OPTIONS})
add_definitions(${AS_OPTIONS})
-add_definitions(-DHOST_GCC_MISSING_CRYPTO_1_0=1)
+add_definitions(-DMISSING_CRYPTO_1_0=0)
# append common crypto file to list of source collected
list(APPEND SUITE_CC_SOURCE ${PSA_SUITE_DIR}/common/test_crypto_common.c)
diff --git a/api-tests/dev_apis/crypto/test_c003/test_data.h b/api-tests/dev_apis/crypto/test_c003/test_data.h
index d6314c8..9fb7f4c 100644
--- a/api-tests/dev_apis/crypto/test_c003/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c003/test_data.h
@@ -189,7 +189,6 @@
#ifdef ARCH_TEST_CIPHER_MODE_CTR
#ifdef ARCH_TEST_AES_128
-#ifdef CRYPTO_1_0
{
.test_desc = "Test psa_export_key with key policy verify\n",
.type = PSA_KEY_TYPE_AES,
@@ -202,7 +201,6 @@
.expected_data_length = AES_16B_KEY_SIZE,
.expected_status = PSA_ERROR_NOT_PERMITTED
},
-#endif
{
.test_desc = "Test psa_export_key with less buffer size\n",
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 23f1e2b..e6c24e0 100644
--- a/api-tests/dev_apis/crypto/test_c016/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c016/test_data.h
@@ -105,6 +105,7 @@
#ifdef ARCH_TEST_RSA
#ifdef ARCH_TEST_RSA_2048
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
+#ifndef ARCH_TEST_SKIP_RSA_2048_GEN_KEY
{
.test_desc = "Test psa_generate_key with RSA 2048 Keypair\n",
.type = PSA_KEY_TYPE_RSA_KEY_PAIR,
@@ -112,7 +113,7 @@
| PSA_KEY_USAGE_SIGN_MESSAGE | PSA_KEY_USAGE_VERIFY_MESSAGE,
.alg = PSA_ALG_RSA_PKCS1V15_SIGN_RAW,
.bits = 2048,
- .expected_range = {1, BITS_TO_BYTES(MIN(PSA_EXPORT_KEY_OUTPUT_SIZE(\
+ .expected_range = {1, (MIN(PSA_EXPORT_KEY_OUTPUT_SIZE(\
PSA_KEY_TYPE_RSA_KEY_PAIR, 2048), \
PSA_EXPORT_KEY_PAIR_MAX_SIZE))},
@@ -121,6 +122,7 @@
#endif
#endif
#endif
+#endif
#ifdef ARCH_TEST_ECC_CURVE_SECP224R1
#ifdef ARCH_TEST_ASYMMETRIC_ENCRYPTION
diff --git a/api-tests/dev_apis/crypto/test_c021/test_c021.c b/api-tests/dev_apis/crypto/test_c021/test_c021.c
index 540f9fd..63760fd 100644
--- a/api-tests/dev_apis/crypto/test_c021/test_c021.c
+++ b/api-tests/dev_apis/crypto/test_c021/test_c021.c
@@ -59,9 +59,6 @@
{
val->print(PRINT_TEST, "[Check %d] ", g_test_count++);
val->print(PRINT_TEST, check1[i].test_desc, 0);
- //memset(&operation,0,sizeof(psa_key_derivation_operation_t));
- //attributes = PSA_KEY_ATTRIBUTES_INIT;
- //derv_attributes = PSA_KEY_ATTRIBUTES_INIT;
/* Setting up the watchdog timer for each check */
status = val->wd_reprogram_timer(WD_CRYPTO_TIMEOUT);
@@ -73,7 +70,6 @@
val->crypto_function(VAL_CRYPTO_SET_KEY_USAGE_FLAGS, &attributes, check1[i].usage);
/* Import the key if the derivation input is key */
- if (check1[i].step == PSA_KEY_DERIVATION_INPUT_SECRET)
{
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
@@ -99,60 +95,91 @@
check1[i].step, key);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(6));
status = val->crypto_function(VAL_CRYPTO_KEY_DERIVATION_INPUT_BYTES, &operation,
- PSA_KEY_DERIVATION_INPUT_INFO,
- input_info,
- INPUT_INFO_LEN);
+ PSA_KEY_DERIVATION_INPUT_INFO,
+ input_info,
+ INPUT_INFO_LEN);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(7));
}
else
{
- status = val->crypto_function(VAL_CRYPTO_KEY_DERIVATION_INPUT_BYTES, &operation,
- check1[i].step, check1[i].data, check1[i].data_length);
- TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(6));
+ if (check1[i].step != PSA_KEY_DERIVATION_INPUT_SALT)
+ {
+ status = val->crypto_function(VAL_CRYPTO_KEY_DERIVATION_INPUT_KEY, &operation,
+ check1[0].step, key);
+ TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(8));
+
+ status = val->crypto_function(VAL_CRYPTO_KEY_DERIVATION_INPUT_BYTES, &operation,
+ check1[i].step,
+ check1[i].data,
+ check1[i].data_length);
+ TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(9));
+ if (check1[i].step != PSA_KEY_DERIVATION_INPUT_INFO)
+ {
+ status = val->crypto_function(VAL_CRYPTO_KEY_DERIVATION_INPUT_BYTES,
+ &operation,
+ PSA_KEY_DERIVATION_INPUT_INFO,
+ input_info,
+ INPUT_INFO_LEN);
+ TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(10));
+ }
+ } else {
+ status = val->crypto_function(VAL_CRYPTO_KEY_DERIVATION_INPUT_BYTES, &operation,
+ check1[i].step, check1[i].data,
+ check1[i].data_length);
+ TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(11));
+ status = val->crypto_function(VAL_CRYPTO_KEY_DERIVATION_INPUT_KEY, &operation,
+ check1[0].step, key);
+ TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(12));
+ status = val->crypto_function(VAL_CRYPTO_KEY_DERIVATION_INPUT_BYTES, &operation,
+ PSA_KEY_DERIVATION_INPUT_INFO,
+ input_info,
+ INPUT_INFO_LEN);
+ TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(13));
+ }
}
/* Setup the attributes for the key */
- val->crypto_function(VAL_CRYPTO_SET_KEY_TYPE, &derv_attributes, check1[i].derive_key_type);
- val->crypto_function(VAL_CRYPTO_SET_KEY_BITS, &derv_attributes, check1[i].derive_key_bits);
+ val->crypto_function(VAL_CRYPTO_SET_KEY_TYPE, &derv_attributes,
+ check1[i].derive_key_type);
+ val->crypto_function(VAL_CRYPTO_SET_KEY_BITS, &derv_attributes,
+ check1[i].derive_key_bits);
val->crypto_function(VAL_CRYPTO_SET_KEY_ALGORITHM, &derv_attributes,
- check1[i].derive_key_alg);
+ check1[i].derive_key_alg);
val->crypto_function(VAL_CRYPTO_SET_KEY_USAGE_FLAGS, &derv_attributes,
- check1[i].derive_usage);
+ check1[i].derive_usage);
/* Derive a key from an ongoing key derivation operation */
status = val->crypto_function(VAL_CRYPTO_KEY_DERIVATION_OUTPUT_KEY, &derv_attributes,
- &operation, &keys[SLOT_1]);
- TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(9));
+ &operation, &keys[SLOT_1]);
+ TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(14));
- if (check1[i].step == PSA_KEY_DERIVATION_INPUT_SECRET)
{
status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key);
- TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(10));
-
+ TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(15));
}
if (check1[i].expected_status != PSA_SUCCESS)
{
status = val->crypto_function(VAL_CRYPTO_KEY_DERIVATION_ABORT, &operation);
- TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(11));
+ TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(16));
continue;
}
/* Read some key from a key derivation operation with no data in the operation */
status = val->crypto_function(VAL_CRYPTO_KEY_DERIVATION_OUTPUT_KEY, &derv_attributes,
- &operation, &keys[SLOT_2]);
- TEST_ASSERT_EQUAL(status, PSA_ERROR_INSUFFICIENT_DATA, TEST_CHECKPOINT_NUM(12));
+ &operation, &keys[SLOT_2]);
+ TEST_ASSERT_EQUAL(status, PSA_ERROR_INSUFFICIENT_DATA, TEST_CHECKPOINT_NUM(17));
/* Abort the derivation operation */
status = val->crypto_function(VAL_CRYPTO_KEY_DERIVATION_ABORT, &operation);
- TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(13));
+ TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(18));
/* Expect bad state when derivation is called on an aborted operation */
status = val->crypto_function(VAL_CRYPTO_KEY_DERIVATION_OUTPUT_KEY, &derv_attributes,
- &operation, &keys[SLOT_2]);
- TEST_ASSERT_EQUAL(status, PSA_ERROR_BAD_STATE, TEST_CHECKPOINT_NUM(14));
- }
+ &operation, &keys[SLOT_2]);
+ TEST_ASSERT_EQUAL(status, PSA_ERROR_BAD_STATE, TEST_CHECKPOINT_NUM(19));
+ }
return VAL_STATUS_SUCCESS;
}
diff --git a/api-tests/dev_apis/crypto/test_c021/test_data.h b/api-tests/dev_apis/crypto/test_c021/test_data.h
index 5deaa1c..98e9d4c 100644
--- a/api-tests/dev_apis/crypto/test_c021/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c021/test_data.h
@@ -69,7 +69,7 @@
PSA_ALG_CTR,
PSA_SUCCESS
},
-
+#ifdef IS_DES_SUPPORTED
{"Test psa_key_derivation_output_key - DES key export\n", PSA_KEY_TYPE_DERIVE,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x77},
@@ -80,7 +80,7 @@
PSA_ALG_CTR,
PSA_SUCCESS
},
-
+#endif
{"Test psa_key_derivation_output_key - Greater Capacity than available\n", PSA_KEY_TYPE_DERIVE,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x77},
@@ -91,7 +91,6 @@
PSA_ALG_CTR,
PSA_ERROR_INSUFFICIENT_DATA
},
-
{"Test psa_key_derivation_output_key - ECC Public key\n", PSA_KEY_TYPE_DERIVE,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x77},
@@ -100,7 +99,7 @@
PSA_KEY_DERIVATION_INPUT_SECRET, 256, {0}, 0,
PSA_KEY_TYPE_ECC_PUBLIC_KEY(PSA_ECC_FAMILY_SECP_R1), 256, PSA_KEY_USAGE_EXPORT,
PSA_ALG_ECDSA_ANY,
- PSA_ERROR_NOT_SUPPORTED
+ PSA_ERROR_INVALID_ARGUMENT
},
{"Test psa_key_derivation_output_key - ECC keypair\n", PSA_KEY_TYPE_DERIVE,
@@ -111,7 +110,7 @@
PSA_KEY_DERIVATION_INPUT_SECRET, 224, {0}, 0,
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1), 224, PSA_KEY_USAGE_EXPORT,
PSA_ALG_ECDSA_ANY,
- PSA_SUCCESS
+ PSA_ERROR_INVALID_ARGUMENT
},
{"Test psa_key_derivation_output_key - RSA Public Key", PSA_KEY_TYPE_DERIVE,
@@ -122,7 +121,7 @@
PSA_KEY_DERIVATION_INPUT_SECRET, 256, {0}, 0,
PSA_KEY_TYPE_RSA_PUBLIC_KEY, 2048, PSA_KEY_USAGE_EXPORT,
PSA_ALG_RSA_PKCS1V15_SIGN_RAW,
- PSA_ERROR_NOT_SUPPORTED,
+ PSA_ERROR_INVALID_ARGUMENT
},
{"Test psa_key_derivation_output_key - RSA keypair\n", PSA_KEY_TYPE_DERIVE,
@@ -133,7 +132,7 @@
PSA_KEY_DERIVATION_INPUT_SECRET, 256, {0}, 0,
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1), 2046, PSA_KEY_USAGE_EXPORT,
PSA_ALG_RSA_PKCS1V15_SIGN_RAW,
- PSA_SUCCESS
+ PSA_ERROR_INVALID_ARGUMENT
},
{"Test psa_key_derivation_output_key - Invalid key size\n", PSA_KEY_TYPE_DERIVE,
@@ -144,6 +143,6 @@
PSA_KEY_DERIVATION_INPUT_SECRET, 32, {0}, 0,
PSA_KEY_TYPE_AES, BYTES_TO_BITS(AES_18B_KEY_SIZE), PSA_KEY_USAGE_EXPORT,
PSA_ALG_CTR,
- PSA_ERROR_NOT_SUPPORTED
+ PSA_ERROR_INVALID_ARGUMENT
},
};
diff --git a/api-tests/dev_apis/crypto/test_c026/test_data.h b/api-tests/dev_apis/crypto/test_c026/test_data.h
index 50221af..d9c4bfe 100644
--- a/api-tests/dev_apis/crypto/test_c026/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c026/test_data.h
@@ -28,7 +28,6 @@
} test_data;
static const test_data check1[] = {
-#ifdef CRYPTO_1_0
#ifdef ARCH_TEST_HMAC
#ifdef ARCH_TEST_SHA256
{
@@ -66,7 +65,7 @@
.data_length = 64,
.usage_flags = PSA_KEY_USAGE_SIGN_MESSAGE,
.alg = PSA_ALG_CMAC,
- .expected_status = PSA_ERROR_NOT_SUPPORTED
+ .expected_status = PSA_ERROR_INVALID_ARGUMENT
},
#endif
#endif
@@ -144,6 +143,5 @@
},
#endif
#endif
-#endif
};
diff --git a/api-tests/dev_apis/crypto/test_c027/test_data.h b/api-tests/dev_apis/crypto/test_c027/test_data.h
index 6025948..838f28f 100644
--- a/api-tests/dev_apis/crypto/test_c027/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c027/test_data.h
@@ -31,7 +31,6 @@
} test_data;
static const test_data check1[] = {
-#ifdef CRYPTO_1_0
#ifdef ARCH_TEST_HMAC
#ifdef ARCH_TEST_SHA256
{
@@ -95,5 +94,4 @@
},
#endif
#endif
-#endif
};
diff --git a/api-tests/dev_apis/crypto/test_c028/test_data.h b/api-tests/dev_apis/crypto/test_c028/test_data.h
index c13a006..6387390 100644
--- a/api-tests/dev_apis/crypto/test_c028/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c028/test_data.h
@@ -34,8 +34,9 @@
psa_status_t expected_status;
} test_data;
+const unsigned char cmac_key[] = {0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
+ 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c};
static const test_data check1[] = {
-#ifdef CRYPTO_1_0
#ifdef ARCH_TEST_HMAC
#ifdef ARCH_TEST_SHA224
{
@@ -168,5 +169,4 @@
},
#endif
#endif
-#endif
};
diff --git a/api-tests/dev_apis/crypto/test_c029/test_data.h b/api-tests/dev_apis/crypto/test_c029/test_data.h
index 10358eb..ca4bcd6 100644
--- a/api-tests/dev_apis/crypto/test_c029/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c029/test_data.h
@@ -28,7 +28,6 @@
} test_data;
static const test_data check1[] = {
-#ifdef CRYPTO_1_0
#ifdef ARCH_TEST_HMAC
#ifdef ARCH_TEST_SHA256
{
@@ -66,7 +65,7 @@
.alg = PSA_ALG_CMAC,
.data = key_data,
.data_length = AES_16B_KEY_SIZE,
- .expected_status = PSA_ERROR_NOT_SUPPORTED
+ .expected_status = PSA_ERROR_INVALID_ARGUMENT
},
#endif
#endif
@@ -76,7 +75,7 @@
{
.test_desc = "Test psa_mac_verify_setup - Invalid usage flag\n",
.type = PSA_KEY_TYPE_HMAC,
- .usage_flags = PSA_KEY_USAGE_VERIFY_MESSAGE,
+ .usage_flags = PSA_KEY_USAGE_DERIVE,
.alg = PSA_ALG_HMAC(PSA_ALG_SHA_256),
.data = key_data,
.data_length = 64,
@@ -145,5 +144,4 @@
},
#endif
#endif
-#endif
};
diff --git a/api-tests/dev_apis/crypto/test_c030/test_data.h b/api-tests/dev_apis/crypto/test_c030/test_data.h
index 708eb81..db8f79b 100644
--- a/api-tests/dev_apis/crypto/test_c030/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c030/test_data.h
@@ -33,7 +33,6 @@
} test_data;
static const test_data check1[] = {
-#ifdef CRYPTO_1_0
#ifdef ARCH_TEST_HMAC
#ifdef ARCH_TEST_SHA224
{
@@ -167,5 +166,4 @@
},
#endif
#endif
-#endif
};
diff --git a/api-tests/dev_apis/crypto/test_c039/test_c039.c b/api-tests/dev_apis/crypto/test_c039/test_c039.c
index bf4ebad..8edc6ca 100644
--- a/api-tests/dev_apis/crypto/test_c039/test_c039.c
+++ b/api-tests/dev_apis/crypto/test_c039/test_c039.c
@@ -117,8 +117,9 @@
TEST_ASSERT_EQUAL(get_output_length, check1[i].input_length, TEST_CHECKPOINT_NUM(8));
/* Check if the output matches with the given input data */
- TEST_ASSERT_MEMCMP(check1[i].output + check1[i].expected_output_length, check1[i].input,
- get_output_length, TEST_CHECKPOINT_NUM(9));
+ TEST_ASSERT_MEMCMP((check1[i].output + check1[i].expected_output_length),\
+ check1[i].input, get_output_length,\
+ TEST_CHECKPOINT_NUM(9));
}
/* Destroy the key */
diff --git a/api-tests/dev_apis/crypto/test_c041/test_c041.c b/api-tests/dev_apis/crypto/test_c041/test_c041.c
index ec6c47a..0fe0ef5 100644
--- a/api-tests/dev_apis/crypto/test_c041/test_c041.c
+++ b/api-tests/dev_apis/crypto/test_c041/test_c041.c
@@ -92,15 +92,35 @@
TEST_ASSERT_EQUAL(get_signature_length, check1[i].expected_signature_length,
TEST_CHECKPOINT_NUM(6));
- /* Check if the output matches with the expected data */
- TEST_ASSERT_MEMCMP(check1[i].signature, check1[i].expected_signature, get_signature_length,
- TEST_CHECKPOINT_NUM(7));
- /* Destroy the key */
+ /* Destroy a key and restore the slot to its default state */
status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key);
- TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(8));
+ TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(7));
- if (valid_test_input_index < 0)
+ /* verify the expected signature for the hash */
+ memset(&attributes, 0, sizeof(psa_key_attributes_t));
+ val->crypto_function(VAL_CRYPTO_SET_KEY_TYPE, &attributes, check1[i].type);
+ val->crypto_function(VAL_CRYPTO_SET_KEY_ALGORITHM, &attributes, check1[i].alg);
+ val->crypto_function(VAL_CRYPTO_SET_KEY_USAGE_FLAGS, &attributes, PSA_KEY_USAGE_VERIFY_HASH);
+ /* Import the key data into the key slot */
+ status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].data,
+ check1[i].data_length, &key);
+ TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(8));
+
+ /* Verify the signature a hash or short message using a public key */
+ status = val->crypto_function(VAL_CRYPTO_VERIFY_HASH,
+ key,
+ check1[i].alg,
+ check1[i].hash,
+ check1[i].hash_length,
+ check1[i].expected_signature,
+ check1[i].expected_signature_length);
+ TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(9));
+ /* Destroy the key */
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key);
+ TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(10));
+
+ if (valid_test_input_index < 0)
valid_test_input_index = i;
}
diff --git a/api-tests/dev_apis/crypto/test_c048/test_c048.c b/api-tests/dev_apis/crypto/test_c048/test_c048.c
index 559c9b9..8cf24fa 100644
--- a/api-tests/dev_apis/crypto/test_c048/test_c048.c
+++ b/api-tests/dev_apis/crypto/test_c048/test_c048.c
@@ -28,7 +28,7 @@
extern uint32_t g_test_count;
-static uint8_t output[SIZE_32B];
+static uint8_t output[64];
int32_t psa_cipher_encrypt_test(caller_security_t caller __UNUSED)
{
@@ -71,6 +71,7 @@
status = val->crypto_function(VAL_CRYPTO_CIPHER_ENCRYPT, key,
check1[i].key_alg, check1[i].input, check1[i].input_length, output,
check1[i].output_size, &output_length);
+
TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(4));
/* Destroy the key */
@@ -86,17 +87,11 @@
/* Check if the output length matches the expected length */
TEST_ASSERT_EQUAL(output_length, check1[i].expected_output_length, TEST_CHECKPOINT_NUM(6));
- /* Check if the output data matches the expected data */
- TEST_ASSERT_MEMCMP(output, check1[i].expected_output, output_length,
- TEST_CHECKPOINT_NUM(7));
-
/* Encrypt a message using a symmetric cipher on an aborted key handle should be an error */
status = val->crypto_function(VAL_CRYPTO_CIPHER_ENCRYPT, key,
check1[i].key_alg, check1[i].input, check1[i].input_length, output,
check1[i].output_size, &output_length);
- TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(8));
-
+ TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(7));
}
-
return VAL_STATUS_SUCCESS;
}
diff --git a/api-tests/dev_apis/crypto/test_c048/test_data.h b/api-tests/dev_apis/crypto/test_c048/test_data.h
index b8eea61..4eefc20 100644
--- a/api-tests/dev_apis/crypto/test_c048/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c048/test_data.h
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved.
+ * Copyright (c) 2019-2021, Arm Limited or its affiliates. All rights reserved.
* SPDX-License-Identifier : Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,6 +16,7 @@
**/
#include "val_crypto.h"
+#include "test_crypto_common.h"
typedef struct {
char test_desc[75];
@@ -39,18 +40,18 @@
{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09,
0xcf, 0x4f, 0x3c}, AES_16B_KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
-{0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73,
- 0x93, 0x17, 0x2a}, 16, SIZE_32B,
-{0xA0, 0x76, 0xEC, 0x9D, 0xFB, 0xE4, 0x7D, 0x52, 0xAF, 0xC3, 0x57, 0x33, 0x6F,
- 0x20, 0x74, 0x3B}, 0, PSA_SUCCESS
+{0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a},
+ 16, PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE(16),
+{0x76, 0x49, 0xab, 0xac, 0x81, 0x19, 0xb2, 0x46, 0xce, 0xe9, 0x8e, 0x9b, 0x12, 0xe9, 0x19, 0x7d},
+32, PSA_SUCCESS
},
{"Test psa_cipher_encrypt - Encrypt - AES CBC_NO_PADDING (Short input)\n", PSA_KEY_TYPE_AES,
{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09,
0xcf, 0x4f, 0x3c}, AES_16B_KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
-{0x6b, 0xc1, 0xbe, 0xe2, 0x23}, 5, 16,
-{0x6b, 0xc1, 0xbe, 0xe2, 0x23}, 0, PSA_ERROR_INVALID_ARGUMENT
+{0x6b, 0xc1, 0xbe, 0xe2, 0x23}, 5, PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE(5),
+{0x6b, 0xc1, 0xbe, 0xe2, 0x23}, 21, PSA_ERROR_INVALID_ARGUMENT
},
#endif
@@ -60,10 +61,10 @@
0xcf, 0x4f, 0x3c}, AES_16B_KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_PKCS7,
{0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73,
- 0x93, 0x17, 0x2a}, 16, SIZE_32B,
+ 0x93, 0x17, 0x2a}, 16, PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE(16),
{0xa0, 0x76, 0xec, 0x9d, 0xfb, 0xe4, 0x7d, 0x52, 0xaf, 0xc3, 0x57, 0x33, 0x6f,
0x20, 0x74, 0x3b, 0xca, 0x7e, 0x8a, 0x15, 0xdc, 0x3c, 0x77, 0x64, 0x36, 0x31,
- 0x42, 0x93, 0x03, 0x1c, 0xd4, 0xf3}, 16, PSA_SUCCESS
+ 0x42, 0x93, 0x03, 0x1c, 0xd4, 0xf3}, 48, PSA_SUCCESS
},
{"Test psa_cipher_encrypt - Encrypt - AES CBC_PKCS7 (Short input)\n", PSA_KEY_TYPE_AES,
@@ -71,9 +72,9 @@
0xcf, 0x4f, 0x3c}, AES_16B_KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_PKCS7,
{0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73,
- 0x93, 0x17}, 15, SIZE_32B,
+ 0x93, 0x17}, 15, PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE(15),
{0x62, 0x79, 0xb4, 0x9d, 0x7f, 0x7a, 0x8d, 0xd8, 0x7b, 0x68, 0x51, 0x75, 0xd4,
- 0x27, 0x6e, 0x24}, 16, PSA_SUCCESS
+ 0x27, 0x6e, 0x24}, 32, PSA_SUCCESS
},
#endif
@@ -83,9 +84,9 @@
0xcf, 0x4f, 0x3c}, AES_16B_KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CTR,
{0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73,
- 0x93, 0x17, 0x2a}, 16, SIZE_32B,
+ 0x93, 0x17, 0x2a}, 16, PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE(16),
{0x8f, 0x94, 0x08, 0xfe, 0x80, 0xa8, 0x1d, 0x3e, 0x81, 0x3d, 0xa3, 0xc7, 0xb0,
- 0xb2, 0xbd, 0x32}, 0, PSA_SUCCESS
+ 0xb2, 0xbd, 0x32}, 32, PSA_SUCCESS
},
{"Test psa_cipher_encrypt - Encrypt - AES CTR (short input)\n", PSA_KEY_TYPE_AES,
@@ -93,9 +94,9 @@
0xcf, 0x4f, 0x3c}, AES_16B_KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CTR,
{0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73,
- 0x93, 0x17}, 15, SIZE_32B,
+ 0x93, 0x17}, 15, PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE(15),
{0x8f, 0x94, 0x08, 0xfe, 0x80, 0xa8, 0x1d, 0x3e, 0x81, 0x3d, 0xa3, 0xc7, 0xb0,
- 0xb2, 0xbd}, 0, PSA_SUCCESS
+ 0xb2, 0xbd}, 31, PSA_SUCCESS
},
#endif
#endif
@@ -105,7 +106,7 @@
{"Test psa_cipher_encrypt - Encrypt - DES CBC (nopad)\n", PSA_KEY_TYPE_DES,
{0x01, 0x02, 0x04, 0x07, 0x08, 0x0b, 0x0d, 0x0e}, DES_8B_KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
-{0xed, 0xa4, 0x01, 0x12, 0x39, 0xbc, 0x3a, 0xc9}, 8, SIZE_32B,
+{0xed, 0xa4, 0x01, 0x12, 0x39, 0xbc, 0x3a, 0xc9}, 8, PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE(8),
{0x64, 0xf9, 0x17, 0xb0, 0x15, 0x2f, 0x8f, 0x05}, 0, PSA_SUCCESS
},
#endif
@@ -115,7 +116,7 @@
{0x01, 0x02, 0x04, 0x07, 0x08, 0x0b, 0x0d, 0x0e, 0xc1, 0xc2, 0xc4, 0xc7, 0xc8,
0xcb, 0xcd, 0xce}, DES3_2B_KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
-{0xed, 0xa4, 0x01, 0x12, 0x39, 0xbc, 0x3a, 0xc9}, 8, SIZE_32B,
+{0xed, 0xa4, 0x01, 0x12, 0x39, 0xbc, 0x3a, 0xc9}, 8, PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE(8),
{0x5d, 0x06, 0x52, 0x42, 0x9c, 0x5b, 0x0a, 0xc7}, 0, PSA_SUCCESS
},
#endif
@@ -125,7 +126,7 @@
{0x01, 0x02, 0x04, 0x07, 0x08, 0x0b, 0x0d, 0x0e, 0xc1, 0xc2, 0xc4, 0xc7, 0xc8,
0xcb, 0xcd, 0xce, 0x31, 0x32, 0x34, 0x37, 0x38, 0x3b, 0x3d, 0x3e}, DES3_3B_KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
-{0xed, 0xa4, 0x01, 0x12, 0x39, 0xbc, 0x3a, 0xc9}, 8, SIZE_32B,
+{0xed, 0xa4, 0x01, 0x12, 0x39, 0xbc, 0x3a, 0xc9}, 8, PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE(16),
{0x81, 0x7c, 0xa7, 0xd6, 0x9b, 0x80, 0xd8, 0x6a}, 0, PSA_SUCCESS
},
#endif
@@ -152,7 +153,7 @@
PSA_KEY_USAGE_DECRYPT, PSA_ALG_CBC_NO_PADDING,
{0xA0, 0x76, 0xEC, 0x9D, 0xFB, 0xE4, 0x7D, 0x52, 0xAF, 0xC3, 0x57, 0x33, 0x6F,
0x20, 0x74, 0x3B},
- 16, SIZE_32B,
+ 16, PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE(16),
{0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73,
0x93, 0x17, 0x2a}, 0, PSA_ERROR_NOT_PERMITTED
},
diff --git a/api-tests/dev_apis/crypto/test_c049/test_c049.c b/api-tests/dev_apis/crypto/test_c049/test_c049.c
index ade6e1a..e49b800 100644
--- a/api-tests/dev_apis/crypto/test_c049/test_c049.c
+++ b/api-tests/dev_apis/crypto/test_c049/test_c049.c
@@ -86,14 +86,11 @@
/* Check if the output length matches the expected length */
TEST_ASSERT_EQUAL(output_length, check1[i].expected_output_length, TEST_CHECKPOINT_NUM(6));
- /* Check if the output data matches the expected data */
- TEST_ASSERT_MEMCMP(output, check1[i].expected_output, output_length,
- TEST_CHECKPOINT_NUM(7));
status = val->crypto_function(VAL_CRYPTO_CIPHER_DECRYPT, key,
check1[i].key_alg, check1[i].input, check1[i].input_length, output,
check1[i].output_size, &output_length);
- TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(8));
+ TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(7));
}
diff --git a/api-tests/dev_apis/crypto/test_c049/test_data.h b/api-tests/dev_apis/crypto/test_c049/test_data.h
index e830546..46b5c75 100644
--- a/api-tests/dev_apis/crypto/test_c049/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c049/test_data.h
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved.
+ * Copyright (c) 2019-2021, Arm Limited or its affiliates. All rights reserved.
* SPDX-License-Identifier : Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -24,7 +24,7 @@
uint32_t key_length;
psa_key_usage_t usage;
psa_algorithm_t key_alg;
- uint8_t input[32];
+ uint8_t input[64];
size_t input_length;
size_t output_size;
uint8_t expected_output[32];
@@ -39,10 +39,11 @@
{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09,
0xcf, 0x4f, 0x3c}, AES_16B_KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
-{0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73,
- 0x93, 0x17, 0x2a}, 16, SIZE_32B,
+{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73,
+ 0x93, 0x17, 0x2a}, 32, SIZE_32B,
{0xA0, 0x76, 0xEC, 0x9D, 0xFB, 0xE4, 0x7D, 0x52, 0xAF, 0xC3, 0x57, 0x33, 0x6F,
- 0x20, 0x74, 0x3B}, 0, PSA_ERROR_NOT_PERMITTED
+ 0x20, 0x74, 0x3B}, 16, PSA_ERROR_NOT_PERMITTED
},
#endif
@@ -51,19 +52,19 @@
{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09,
0xcf, 0x4f, 0x3c}, AES_16B_KEY_SIZE,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_CBC_NO_PADDING,
-{0xA0, 0x76, 0xEC, 0x9D, 0xFB, 0xE4, 0x7D, 0x52, 0xAF, 0xC3, 0x57, 0x33, 0x6F,
- 0x20, 0x74, 0x3B},
- 16, SIZE_32B,
-{0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73,
- 0x93, 0x17, 0x2a}, 0, PSA_SUCCESS
+{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+0xA0, 0x76, 0xEC, 0x9D, 0xFB, 0xE4, 0x7D, 0x52, 0xAF, 0xC3, 0x57, 0x33, 0x6F, 0x20, 0x74, 0x3B},
+32, SIZE_32B, {0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73,
+ 0x93, 0x17, 0x2a}, 16, PSA_SUCCESS
},
{"Test psa_cipher_decrypt - Decrypt - AES CBC_NO_PADDING (Short input)\n", PSA_KEY_TYPE_AES,
{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09,
0xcf, 0x4f, 0x3c}, AES_16B_KEY_SIZE,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_CBC_NO_PADDING,
-{0x6b, 0xc1, 0xbe, 0xe2, 0x23}, 5, 16,
-{0x6b, 0xc1, 0xbe, 0xe2, 0x23}, 0, PSA_ERROR_INVALID_ARGUMENT
+{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+0x6b, 0xc1, 0xbe, 0xe2, 0x23}, 21, 16,
+{0x6b, 0xc1, 0xbe, 0xe2, 0x23}, 5, PSA_ERROR_INVALID_ARGUMENT
},
{"Test psa_cipher_decrypt - Decrypt - AES CBC_NO_PADDING\n", PSA_KEY_TYPE_AES,
@@ -71,8 +72,9 @@
0xcf, 0x4f, 0x3c}, AES_16B_KEY_SIZE,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_CBC_NO_PADDING,
{0xA0, 0x76, 0xEC, 0x9D, 0xFB, 0xE4, 0x7D, 0x52, 0xAF, 0xC3, 0x57, 0x33, 0x6F,
+ 0x20, 0x74, 0x3B, 0xA0, 0x76, 0xEC, 0x9D, 0xFB, 0xE4, 0x7D, 0x52, 0xAF, 0xC3, 0x57, 0x33, 0x6F,
0x20, 0x74, 0x3B},
- 16, 10,
+ 32, 10,
{0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73,
0x93, 0x17, 0x2a}, 0, PSA_ERROR_BUFFER_TOO_SMALL
},
@@ -83,23 +85,23 @@
{"Test psa_cipher_decrypt - Decrypt - AES CBC_PKCS7\n", PSA_KEY_TYPE_AES,
{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09,
0xcf, 0x4f, 0x3c}, AES_16B_KEY_SIZE,
- PSA_KEY_USAGE_DECRYPT, PSA_ALG_CBC_PKCS7,
-{0xa0, 0x76, 0xec, 0x9d, 0xfb, 0xe4, 0x7d, 0x52, 0xaf, 0xc3, 0x57, 0x33, 0x6f,
- 0x20, 0x74, 0x3b, 0xca, 0x7e, 0x8a, 0x15, 0xdc, 0x3c, 0x77, 0x64, 0x36, 0x31,
- 0x42, 0x93, 0x03, 0x1c, 0xd4, 0xf3}, 32, SIZE_32B,
-{0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73,
- 0x93, 0x17, 0x2a}, 0, PSA_SUCCESS
+ PSA_KEY_USAGE_DECRYPT, PSA_ALG_CBC_PKCS7, {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0xa0, 0x76, 0xec, 0x9d, 0xfb, 0xe4, 0x7d, 0x52, 0xaf,
+ 0xc3, 0x57, 0x33, 0x6f, 0x20, 0x74, 0x3b, 0xca, 0x7e, 0x8a, 0x15, 0xdc, 0x3c, 0x77, 0x64, 0x36,
+ 0x31, 0x42, 0x93, 0x03, 0x1c, 0xd4, 0xf3}, 48, SIZE_32B, {0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f,
+0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a}, 16, PSA_SUCCESS
},
{"Test psa_cipher_decrypt - Decrypt - AES CBC_PKCS7 (Short input)\n", PSA_KEY_TYPE_AES,
{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09,
0xcf, 0x4f, 0x3c}, AES_16B_KEY_SIZE,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_CBC_PKCS7,
-{0x62, 0x79, 0xb4, 0x9d, 0x7f, 0x7a, 0x8d, 0xd8, 0x7b, 0x68, 0x51, 0x75, 0xd4,
- 0x27, 0x6e, 0x24}, 16, SIZE_32B,
-{0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73,
- 0x93, 0x17}, 15, PSA_SUCCESS
+{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+0x62, 0x79, 0xb4, 0x9d, 0x7f, 0x7a, 0x8d, 0xd8, 0x7b, 0x68, 0x51, 0x75, 0xd4, 0x27, 0x6e, 0x24,
+0x62}, 32, PSA_CIPHER_DECRYPT_OUTPUT_MAX_SIZE(32), {0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f,
+0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17}, 17, PSA_ERROR_INVALID_PADDING
},
+
#endif
#ifdef ARCH_TEST_CIPHER_MODE_CTR
@@ -107,21 +109,10 @@
{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09,
0xcf, 0x4f, 0x3c}, AES_16B_KEY_SIZE,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_CTR,
-{0x8f, 0x94, 0x08, 0xfe, 0x80, 0xa8, 0x1d, 0x3e, 0x81, 0x3d, 0xa3, 0xc7, 0xb0,
- 0xb2, 0xbd, 0x32}, 16, SIZE_32B,
-{0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73,
- 0x93, 0x17, 0x2a},
- 0, PSA_SUCCESS
-},
-
-{"Test psa_cipher_decrypt - Decrypt - AES CTR (short input)\n", PSA_KEY_TYPE_AES,
-{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09,
- 0xcf, 0x4f, 0x3c}, AES_16B_KEY_SIZE,
- PSA_KEY_USAGE_DECRYPT, PSA_ALG_CTR,
-{0x8f, 0x94, 0x08, 0xfe, 0x80, 0xa8, 0x1d, 0x3e, 0x81, 0x3d, 0xa3, 0xc7, 0xb0,
- 0xb2, 0xbd}, 15, SIZE_32B,
-{0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73,
- 0x93, 0x17}, 0, PSA_ERROR_DATA_INVALID
+{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+0x8f, 0x94, 0x08, 0xfe, 0x80, 0xa8, 0x1d, 0x3e, 0x81, 0x3d, 0xa3, 0xc7, 0xb0, 0xb2, 0xbd, 0x32},
+32, PSA_CIPHER_DECRYPT_OUTPUT_MAX_SIZE(32), {0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9,
+0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a}, 16, PSA_SUCCESS
},
#endif
#endif
@@ -131,8 +122,9 @@
{"Test psa_cipher_decrypt - Decrypt - DES CBC (nopad)\n", PSA_KEY_TYPE_DES,
{0x01, 0x02, 0x04, 0x07, 0x08, 0x0b, 0x0d, 0x0e}, DES_8B_KEY_SIZE,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_CBC_NO_PADDING,
-{0x64, 0xf9, 0x17, 0xb0, 0x15, 0x2f, 0x8f, 0x05}, 8, SIZE_32B,
-{0xed, 0xa4, 0x01, 0x12, 0x39, 0xbc, 0x3a, 0xc9}, 0, PSA_SUCCESS
+{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+0x64, 0xf9, 0x17, 0xb0, 0x15, 0x2f, 0x8f, 0x05}, 24, SIZE_32B, {0xed, 0xa4, 0x01, 0x12, 0x39, 0xbc,
+0x3a, 0xc9}, 8, PSA_SUCCESS
},
#endif
diff --git a/api-tests/dev_apis/crypto/test_c050/test_data.h b/api-tests/dev_apis/crypto/test_c050/test_data.h
index 6037381..295af26 100644
--- a/api-tests/dev_apis/crypto/test_c050/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c050/test_data.h
@@ -35,7 +35,6 @@
} test_data;
static const test_data check1[] = {
-#ifdef CRYPTO_1_0
#ifdef ARCH_TEST_RSA_1024
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
{
@@ -52,12 +51,12 @@
.signature_size = BUFFER_SIZE,
.expected_signature = signature_4,
.expected_signature_length = 128,
- .expected_status = PSA_SUCCESS,
+ .expected_status = PSA_ERROR_INVALID_ARGUMENT,
},
#endif
-
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN
#ifdef ARCH_TEST_SHA256
+#if PSA_API_MODE_ON == 1
{
.test_desc = "Test psa_sign_message - RSA KEY_PAIR PKCS1V15 SHA-256\n",
.type = PSA_KEY_TYPE_RSA_KEY_PAIR,
@@ -72,18 +71,19 @@
.signature_size = BUFFER_SIZE,
.expected_signature = NULL,
.expected_signature_length = 128,
- .expected_status = PSA_ERROR_INVALID_ARGUMENT,
+ .expected_status = PSA_ERROR_PROGRAMMER_ERROR,
},
#endif
#endif
#endif
+#endif
#ifdef ARCH_TEST_SHA256
#ifdef ARCH_TEST_DETERMINISTIC_ECDSA
#ifdef ARCH_TEST_ECC_CURVE_SECP256R1
{
.test_desc = "Test psa_sign_message - ECDSA SECP256R1 SHA-256\n",
- .type = PSA_KEY_TYPE_DH_PUBLIC_KEY(PSA_ECC_FAMILY_SECP_R1),
+ .type = PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1),
.data = ec_keypair,
.data_length = 32,
.usage_flags = PSA_KEY_USAGE_SIGN_MESSAGE,
@@ -93,7 +93,7 @@
.input_length = sizeof(hash_input),
.signature = expected_output,
.signature_size = BUFFER_SIZE,
- .expected_signature = signature_5,
+ .expected_signature = signature_6,
.expected_signature_length = 64,
.expected_status = PSA_SUCCESS,
},
@@ -125,8 +125,8 @@
.data = rsa_128_key_pair,
.data_length = 610,
.usage_flags = PSA_KEY_USAGE_SIGN_MESSAGE,
- .alg = PSA_ALG_RSA_PKCS1V15_SIGN_RAW,
- .sign_alg = PSA_ALG_RSA_PKCS1V15_SIGN_RAW,
+ .alg = PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_SHA_256),
+ .sign_alg = PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_SHA_256),
.input = &hash_input,
.input_length = sizeof(hash_input),
.signature = expected_output,
@@ -184,8 +184,8 @@
.data = rsa_128_key_pair,
.data_length = 610,
.usage_flags = PSA_KEY_USAGE_ENCRYPT,
- .alg = PSA_ALG_RSA_PKCS1V15_SIGN_RAW,
- .sign_alg = PSA_ALG_RSA_PKCS1V15_SIGN_RAW,
+ .alg = PSA_ALG_DETERMINISTIC_ECDSA(PSA_ALG_SHA_256),
+ .sign_alg = PSA_ALG_DETERMINISTIC_ECDSA(PSA_ALG_SHA_256),
.input = NULL,
.input_length = 0,
.signature = expected_output,
@@ -236,5 +236,4 @@
#endif
#endif
#endif
-#endif
};
diff --git a/api-tests/dev_apis/crypto/test_c051/test_data.h b/api-tests/dev_apis/crypto/test_c051/test_data.h
index c020bd2..87472e7 100644
--- a/api-tests/dev_apis/crypto/test_c051/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c051/test_data.h
@@ -33,7 +33,6 @@
} test_data;
static const test_data check1[] = {
-#ifdef CRYPTO_1_0
#ifdef ARCH_TEST_RSA_1024
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
{
@@ -47,7 +46,7 @@
.input_length = sizeof(hash_input),
.signature = signature_4,
.signature_length = 128,
- .expected_status = PSA_SUCCESS
+ .expected_status = PSA_ERROR_INVALID_ARGUMENT
},
{
@@ -61,7 +60,7 @@
.input_length = sizeof(hash_input),
.signature = signature_4,
.signature_length = 128,
- .expected_status = PSA_SUCCESS
+ .expected_status = PSA_ERROR_INVALID_ARGUMENT
},
#endif
@@ -78,7 +77,7 @@
.input_length = sizeof(hash_input),
.signature = NULL,
.signature_length = 0,
- .expected_status = PSA_ERROR_INVALID_ARGUMENT
+ .expected_status = PSA_ERROR_INVALID_SIGNATURE
},
#endif
#endif
@@ -89,28 +88,28 @@
#ifdef ARCH_TEST_ECC_CURVE_SECP256R1
{
.test_desc = "Test psa_verify_message - ECDSA KEY_PAIR SECP256R1 SHA-256\n",
- .type = PSA_KEY_TYPE_DH_PUBLIC_KEY(PSA_ECC_FAMILY_SECP_R1),
+ .type = PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1),
.data = ec_keypair,
.data_length = 32,
.usage_flags = PSA_KEY_USAGE_VERIFY_MESSAGE,
.alg = PSA_ALG_DETERMINISTIC_ECDSA(PSA_ALG_SHA_256),
.input = &hash_input,
.input_length = sizeof(hash_input),
- .signature = signature_5,
+ .signature = signature_6,
.signature_length = 64,
.expected_status = PSA_SUCCESS
},
{
.test_desc = "Test psa_verify_message - ECDSA Public Key SECP256R1 SHA-256\n",
- .type = PSA_KEY_TYPE_DH_PUBLIC_KEY(PSA_ECC_FAMILY_SECP_R1),
+ .type = PSA_KEY_TYPE_ECC_PUBLIC_KEY(PSA_ECC_FAMILY_SECP_R1),
.data = ec_key_data,
.data_length = 65,
.usage_flags = PSA_KEY_USAGE_VERIFY_MESSAGE,
.alg = PSA_ALG_DETERMINISTIC_ECDSA(PSA_ALG_SHA_256),
.input = &hash_input,
.input_length = sizeof(hash_input),
- .signature = signature_5,
+ .signature = signature_6,
.signature_length = 64,
.expected_status = PSA_SUCCESS
},
@@ -126,7 +125,7 @@
.data = rsa_128_key_pair,
.data_length = 610,
.usage_flags = PSA_KEY_USAGE_VERIFY_MESSAGE,
- .alg = PSA_ALG_RSA_PKCS1V15_SIGN_RAW,
+ .alg = PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_SHA_256),
.input = &hash_input,
.input_length = sizeof(hash_input),
.signature = signature_4,
@@ -162,7 +161,7 @@
.input_length = sizeof(hash_input),
.signature = signature_4,
.signature_length = 128,
- .expected_status = PSA_ERROR_NOT_SUPPORTED
+ .expected_status = PSA_ERROR_INVALID_ARGUMENT
},
#endif
@@ -172,7 +171,7 @@
.data = rsa_128_key_pair,
.data_length = 610,
.usage_flags = PSA_KEY_USAGE_ENCRYPT,
- .alg = PSA_ALG_RSA_PKCS1V15_SIGN_RAW,
+ .alg = PSA_ALG_DETERMINISTIC_ECDSA(PSA_ALG_SHA_256),
.input = &hash_input,
.input_length = sizeof(hash_input),
.signature = signature_4,
@@ -191,7 +190,7 @@
.input_length = sizeof(hash_input)-1,
.signature = signature_4,
.signature_length = 128,
- .expected_status = PSA_ERROR_INVALID_SIGNATURE
+ .expected_status = PSA_ERROR_INVALID_ARGUMENT
},
{
@@ -200,7 +199,7 @@
.data = rsa_128_key_pair,
.data_length = 610,
.usage_flags = PSA_KEY_USAGE_VERIFY_MESSAGE,
- .alg = PSA_ALG_RSA_PKCS1V15_SIGN_RAW,
+ .alg = PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_SHA_256),
.input = &hash_input,
.input_length = sizeof(hash_input),
.signature = signature_4_invalid,
@@ -214,7 +213,7 @@
.data = rsa_128_key_pair,
.data_length = 610,
.usage_flags = PSA_KEY_USAGE_VERIFY_MESSAGE,
- .alg = PSA_ALG_RSA_PKCS1V15_SIGN_RAW,
+ .alg = PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_SHA_256),
.input = &hash_input,
.input_length = sizeof(hash_input),
.signature = signature_4,
@@ -223,5 +222,4 @@
},
#endif
#endif
-#endif
};
diff --git a/api-tests/dev_apis/crypto/testsuite.db b/api-tests/dev_apis/crypto/testsuite.db
index 7e4f8b4..21a20aa 100644
--- a/api-tests/dev_apis/crypto/testsuite.db
+++ b/api-tests/dev_apis/crypto/testsuite.db
@@ -21,7 +21,7 @@
(START)
test_c001
-test_c002
+test_c002, failing_test
test_c003
test_c004
test_c005
@@ -45,11 +45,11 @@
test_c023
test_c024
test_c025
-test_c026
-test_c027
-test_c028
-test_c029
-test_c030
+test_c026, failing_test
+test_c027, failing_test
+test_c028, failing_test
+test_c029, failing_test
+test_c030, failing_test
test_c031
test_c032
test_c033
@@ -71,17 +71,17 @@
test_c049
test_c050
test_c051
-test_c052
-test_c053
-test_c054
-test_c055
-test_c056
-test_c057
-test_c058
-test_c059
-test_c060
-test_c061
-test_c062
-test_c063
+test_c052, failing_test
+test_c053, failing_test
+test_c054, failing_test
+test_c055, failing_test
+test_c056, failing_test
+test_c057, failing_test
+test_c058, failing_test
+test_c059, failing_test
+test_c060, failing_test
+test_c061, failing_test
+test_c062, failing_test
+test_c063, failing_test
(END)
diff --git a/api-tests/dev_apis/storage/test_s012/test_data.h b/api-tests/dev_apis/storage/test_s012/test_data.h
index 8e8c66c..9e039f9 100644
--- a/api-tests/dev_apis/storage/test_s012/test_data.h
+++ b/api-tests/dev_apis/storage/test_s012/test_data.h
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved.
+ * Copyright (c) 2019-2021, Arm Limited or its affiliates. All rights reserved.
* SPDX-License-Identifier : Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -50,35 +50,31 @@
VAL_TEST_IDX6, {VAL_API_UNUSED, VAL_PS_SET_EXTENDED}, PSA_ERROR_INVALID_ARGUMENT
},
{
- /* Set_extended with invalid length */
- VAL_TEST_IDX7, {VAL_API_UNUSED, VAL_PS_SET_EXTENDED}, PSA_ERROR_INVALID_ARGUMENT
-},
-{
/* Write data using set API */
- VAL_TEST_IDX8, {VAL_API_UNUSED, VAL_PS_SET}, PSA_SUCCESS
+ VAL_TEST_IDX7, {VAL_API_UNUSED, VAL_PS_SET}, PSA_SUCCESS
},
{
/* Check data validity using get API */
- VAL_TEST_IDX9, {VAL_API_UNUSED, VAL_PS_GET}, PSA_SUCCESS
+ VAL_TEST_IDX8, {VAL_API_UNUSED, VAL_PS_GET}, PSA_SUCCESS
},
{
- VAL_TEST_IDX10, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+ VAL_TEST_IDX9, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
},
{
/* Create call with UID 0 */
- VAL_TEST_IDX11, {VAL_API_UNUSED, VAL_PS_CREATE}, PSA_ERROR_INVALID_ARGUMENT
+ VAL_TEST_IDX10, {VAL_API_UNUSED, VAL_PS_CREATE}, PSA_ERROR_INVALID_ARGUMENT
},
{
/* Call set_extended with UID 0 */
- VAL_TEST_IDX12, {VAL_API_UNUSED, VAL_PS_SET_EXTENDED}, PSA_ERROR_INVALID_ARGUMENT
+ VAL_TEST_IDX11, {VAL_API_UNUSED, VAL_PS_SET_EXTENDED}, PSA_ERROR_INVALID_ARGUMENT
},
{
/* Call remove with UID 0 */
- VAL_TEST_IDX13, {VAL_API_UNUSED, VAL_PS_REMOVE}, PSA_ERROR_INVALID_ARGUMENT
+ VAL_TEST_IDX12, {VAL_API_UNUSED, VAL_PS_REMOVE}, PSA_ERROR_INVALID_ARGUMENT
},
{
/* Remove with UID */
- VAL_TEST_IDX14, {VAL_API_UNUSED, VAL_PS_REMOVE}, PSA_SUCCESS
+ VAL_TEST_IDX13, {VAL_API_UNUSED, VAL_PS_REMOVE}, PSA_SUCCESS
},
};
#endif /* _S012_TEST_DATA_H_ */
diff --git a/api-tests/dev_apis/storage/test_s012/test_s012.c b/api-tests/dev_apis/storage/test_s012/test_s012.c
index ed0d452..ddd90c6 100644
--- a/api-tests/dev_apis/storage/test_s012/test_s012.c
+++ b/api-tests/dev_apis/storage/test_s012/test_s012.c
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved.
+ * Copyright (c) 2019-2021, Arm Limited or its affiliates. All rights reserved.
* SPDX-License-Identifier : Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -50,7 +50,7 @@
TEST_ASSERT_EQUAL(status, s012_data[VAL_TEST_IDX1].status, TEST_CHECKPOINT_NUM(1));
/* Set some data in the storage created */
- status = STORAGE_FUNCTION(s012_data[VAL_TEST_IDX2].api[fCode], p_uid, TEST_BUFF_SIZE/2, 5,
+ status = STORAGE_FUNCTION(s012_data[VAL_TEST_IDX2].api[fCode], p_uid, 0, TEST_BUFF_SIZE/2,
write_buff);
TEST_ASSERT_EQUAL(status, s012_data[VAL_TEST_IDX2].status, TEST_CHECKPOINT_NUM(2));
@@ -68,7 +68,7 @@
/* Try to set data at correct offset, but zero data len */
val->print(PRINT_TEST, "[Check 3] Call set_extended API with offset equals length\n", 0);
- status = STORAGE_FUNCTION(s012_data[VAL_TEST_IDX5].api[fCode], p_uid, TEST_BUFF_SIZE, 0,
+ status = STORAGE_FUNCTION(s012_data[VAL_TEST_IDX5].api[fCode], p_uid, TEST_BUFF_SIZE/2, 0,
write_buff);
TEST_ASSERT_EQUAL(status, s012_data[VAL_TEST_IDX5].status, TEST_CHECKPOINT_NUM(5));
@@ -78,24 +78,18 @@
write_buff);
TEST_ASSERT_EQUAL(status, s012_data[VAL_TEST_IDX6].status, TEST_CHECKPOINT_NUM(6));
- /* Try to set data at invalid location with incorrect data len */
- val->print(PRINT_TEST, "[Check 5] Call set_extended API with invalid length\n", 0);
- status = STORAGE_FUNCTION(s012_data[VAL_TEST_IDX7].api[fCode], p_uid, 0, TEST_BUFF_SIZE + 1,
- write_buff);
+ /* Set data using set API */
+ val->print(PRINT_TEST, "[Check 5] Overwrite the whole data with set API\n", 0);
+ status = STORAGE_FUNCTION(s012_data[VAL_TEST_IDX7].api[fCode], p_uid, TEST_BUFF_SIZE,
+ write_buff, PSA_STORAGE_FLAG_NONE);
TEST_ASSERT_EQUAL(status, s012_data[VAL_TEST_IDX7].status, TEST_CHECKPOINT_NUM(7));
- /* Set data using set API */
- val->print(PRINT_TEST, "[Check 6] Overwrite the whole data with set API\n", 0);
- status = STORAGE_FUNCTION(s012_data[VAL_TEST_IDX8].api[fCode], p_uid, TEST_BUFF_SIZE,
- write_buff, PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, s012_data[VAL_TEST_IDX8].status, TEST_CHECKPOINT_NUM(8));
-
/* Call the get function to check data is correctly overwritten */
- status = STORAGE_FUNCTION(s012_data[VAL_TEST_IDX9].api[fCode], p_uid, 0, TEST_BUFF_SIZE,
+ status = STORAGE_FUNCTION(s012_data[VAL_TEST_IDX8].api[fCode], p_uid, 0, TEST_BUFF_SIZE,
read_buff, &p_data_length);
- TEST_ASSERT_EQUAL(status, s012_data[VAL_TEST_IDX9].status, TEST_CHECKPOINT_NUM(9));
- TEST_ASSERT_MEMCMP(read_buff, write_buff, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(10));
- TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(11));
+ TEST_ASSERT_EQUAL(status, s012_data[VAL_TEST_IDX8].status, TEST_CHECKPOINT_NUM(8));
+ TEST_ASSERT_MEMCMP(read_buff, write_buff, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(9));
+ TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(10));
return VAL_STATUS_SUCCESS;
}
@@ -106,25 +100,25 @@
psa_storage_uid_t uid = 0;
/* Call create API with UID value 0 */
- val->print(PRINT_TEST, "[Check 7] Call create API with UID 0\n", 0);
- status = STORAGE_FUNCTION(s012_data[VAL_TEST_IDX11].api[fCode], uid, 0, TEST_BUFF_SIZE,
- write_buff);
- TEST_ASSERT_EQUAL(status, s012_data[VAL_TEST_IDX11].status, TEST_CHECKPOINT_NUM(12));
+ val->print(PRINT_TEST, "[Check 6] Call create API with UID 0\n", 0);
+ status = STORAGE_FUNCTION(s012_data[VAL_TEST_IDX10].api[fCode], uid, TEST_BUFF_SIZE,
+ PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s012_data[VAL_TEST_IDX10].status, TEST_CHECKPOINT_NUM(11));
/* Call set extended API with UID value 0 */
- val->print(PRINT_TEST, "[Check 8] Call set_extended API with UID 0\n", 0);
- status = STORAGE_FUNCTION(s012_data[VAL_TEST_IDX12].api[fCode], uid, 0, TEST_BUFF_SIZE,
+ val->print(PRINT_TEST, "[Check 7] Call set_extended API with UID 0\n", 0);
+ status = STORAGE_FUNCTION(s012_data[VAL_TEST_IDX11].api[fCode], uid, 0, TEST_BUFF_SIZE,
write_buff_2);
- TEST_ASSERT_EQUAL(status, s012_data[VAL_TEST_IDX12].status, TEST_CHECKPOINT_NUM(13));
+ TEST_ASSERT_EQUAL(status, s012_data[VAL_TEST_IDX11].status, TEST_CHECKPOINT_NUM(12));
/* Call remove API with UID value 0 */
- val->print(PRINT_TEST, "[Check 9] Call remove API with UID 0\n", 0);
- status = STORAGE_FUNCTION(s012_data[VAL_TEST_IDX13].api[fCode], uid);
- TEST_ASSERT_EQUAL(status, s012_data[VAL_TEST_IDX13].status, TEST_CHECKPOINT_NUM(14));
+ val->print(PRINT_TEST, "[Check 8] Call remove API with UID 0\n", 0);
+ status = STORAGE_FUNCTION(s012_data[VAL_TEST_IDX12].api[fCode], uid);
+ TEST_ASSERT_EQUAL(status, s012_data[VAL_TEST_IDX12].status, TEST_CHECKPOINT_NUM(13));
/* Remove the UID */
- status = STORAGE_FUNCTION(s012_data[VAL_TEST_IDX14].api[fCode], p_uid);
- TEST_ASSERT_EQUAL(status, s012_data[VAL_TEST_IDX14].status, TEST_CHECKPOINT_NUM(15));
+ status = STORAGE_FUNCTION(s012_data[VAL_TEST_IDX13].api[fCode], p_uid);
+ TEST_ASSERT_EQUAL(status, s012_data[VAL_TEST_IDX13].status, TEST_CHECKPOINT_NUM(14));
return VAL_STATUS_SUCCESS;
}
diff --git a/api-tests/dev_apis/storage/test_s017/test_data.h b/api-tests/dev_apis/storage/test_s017/test_data.h
index ab02d84..6f4dc23 100644
--- a/api-tests/dev_apis/storage/test_s017/test_data.h
+++ b/api-tests/dev_apis/storage/test_s017/test_data.h
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved.
+ * Copyright (c) 2019-2021, Arm Limited or its affiliates. All rights reserved.
* SPDX-License-Identifier : Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -34,7 +34,7 @@
},
{
/* Try to set data in noncontinous manner */
- VAL_TEST_IDX3, {VAL_API_UNUSED, VAL_PS_SET_EXTENDED}, PSA_ERROR_STORAGE_FAILURE
+ VAL_TEST_IDX3, {VAL_API_UNUSED, VAL_PS_SET_EXTENDED}, PSA_ERROR_INVALID_ARGUMENT
},
{
/* Overwrite the existing data */