Enhancements : Memory usage, clean up and new build option
1. const qualifier added at appropriate places.
2. Cleaned redundant code.
3. New Storage build option introduced.
-DSUITE=STORAGE to build ITS and PS as single archive
-DSUITE=INTERNAL_TRUSTED_STORAGE to build ITS only
-DSUITE=PROTECTED_STORAGE to build PS only
Signed-off-by: Vinay Kumar Kotegowder <vinaykumar.kotegowder@arm.com>
diff --git a/api-tests/dev_apis/README.md b/api-tests/dev_apis/README.md
index 9860734..d0b6f24 100644
--- a/api-tests/dev_apis/README.md
+++ b/api-tests/dev_apis/README.md
@@ -64,7 +64,7 @@
- -DTARGET=<platform_name> is the same as the name of the target-specific directory created in the **platform/targets/** directory. The current release has been tested on **tgt_dev_apis_tfm_an521**, **tgt_dev_apis_tfm_musca_b1** and **tgt_dev_apis_tfm_musca_a** platforms. Refer [Test_failure analysis](../docs/test_failure_analysis.md) document to know the reason for any known test fail.<br />
- -DTOOLCHAIN=<tool_chain> Compiler toolchain to be used for test suite compilation. Supported values are GNUARM (GNU Arm Embedded), ARMCLANG (ARM Compiler 6.x) and HOST_GCC. Default is GNUARM.<br />
- -DCPU_ARCH=<cpu_architecture_version> is the Arm Architecture version name for which the tests should be compiled. Supported CPU arch are armv8m_ml, armv8m_bl and armv7m. Default is empty. This option is unused when TOOLCHAIN type is HOST_GCC.<br />
-- -DSUITE=<suite_name> is the test suite name. Supported values are CRYPTO, INITIAL_ATTESTATION, PROTECTED_STORAGE and INTERNAL_TRUSTED_STORAGE.<br />
+- -DSUITE=<suite_name> is the test suite name. Supported values are CRYPTO, INITIAL_ATTESTATION, STORAGE(INTERNAL_TRUSTED_STORAGE and PROTECTED_STORAGE), INTERNAL_TRUSTED_STORAGE and PROTECTED_STORAGE .<br />
- -DVERBOSE=<verbose_level>. Print verbosity level. Default is 3. Supported print levels are 1(INFO & above), 2(DEBUG & above), 3(TEST & above), 4(WARN & ERROR) and 5(ERROR).
- -DBUILD=<BUILD_DIR> : To select the build directory to keep output files. Default is BUILD/ inside current directory.
- -DWATCHDOG_AVAILABLE=<0|1>: Test harness may require to access watchdog timer to recover system hang. 0 means skip watchdog programming in the test suite and 1 means program the watchdog. Default is 1. Note, watchdog must be available for the tests which check the PSA API behaviour on the system reset.
diff --git a/api-tests/dev_apis/crypto/suite.cmake b/api-tests/dev_apis/crypto/suite.cmake
index ddb3128..6f1050f 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, 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");
@@ -51,6 +51,7 @@
${CMAKE_CURRENT_BINARY_DIR}
${PSA_ROOT_DIR}/val/common
${PSA_ROOT_DIR}/val/nspe
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/common
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/crypto
+ ${PSA_ROOT_DIR}/platform/targets/common/nspe
+ ${PSA_ROOT_DIR}/platform/targets/common/nspe/crypto
+ ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe
)
diff --git a/api-tests/dev_apis/crypto/test_c001/test_c001.c b/api-tests/dev_apis/crypto/test_c001/test_c001.c
index 4f32416..fec7371 100644
--- a/api-tests/dev_apis/crypto/test_c001/test_c001.c
+++ b/api-tests/dev_apis/crypto/test_c001/test_c001.c
@@ -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");
@@ -19,7 +19,7 @@
#include "val_target.h"
#include "test_c001.h"
-client_test_t test_c001_crypto_list[] = {
+const client_test_t test_c001_crypto_list[] = {
NULL,
psa_generate_random_without_init_test,
psa_crypto_init_test,
diff --git a/api-tests/dev_apis/crypto/test_c001/test_c001.h b/api-tests/dev_apis/crypto/test_c001/test_c001.h
index 0c9c4c9..472ecbb 100644
--- a/api-tests/dev_apis/crypto/test_c001/test_c001.h
+++ b/api-tests/dev_apis/crypto/test_c001/test_c001.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");
@@ -26,7 +26,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c001_crypto_list[];
+extern const client_test_t test_c001_crypto_list[];
int32_t psa_crypto_init_test(caller_security_t caller);
int32_t multiple_psa_crypto_init_test(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c002/test_c002.c b/api-tests/dev_apis/crypto/test_c002/test_c002.c
index a23a797..bafc179 100644
--- a/api-tests/dev_apis/crypto/test_c002/test_c002.c
+++ b/api-tests/dev_apis/crypto/test_c002/test_c002.c
@@ -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");
@@ -21,7 +21,7 @@
#include "test_data.h"
#include "val_crypto.h"
-client_test_t test_c002_crypto_list[] = {
+const client_test_t test_c002_crypto_list[] = {
NULL,
psa_import_key_test,
NULL,
@@ -40,6 +40,7 @@
int num_checks = sizeof(check1)/sizeof(check1[0]);
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_key_attributes_t get_attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -99,7 +100,7 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(3));
/* If failure is expected, continue with the next data set */
@@ -107,7 +108,7 @@
continue;
/* Get the attributes of the imported key and check if it matches the given value */
- status = val->crypto_function(VAL_CRYPTO_GET_KEY_ATTRIBUTES, check1[i].key_handle,
+ status = val->crypto_function(VAL_CRYPTO_GET_KEY_ATTRIBUTES, key_handle,
&get_attributes);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(4));
@@ -118,7 +119,7 @@
TEST_ASSERT_EQUAL(get_key_bits, check1[i].expected_bit_length, TEST_CHECKPOINT_NUM(6));
/* Export a key in binary format */
- status = val->crypto_function(VAL_CRYPTO_EXPORT_KEY, check1[i].key_handle, data,
+ status = val->crypto_function(VAL_CRYPTO_EXPORT_KEY, key_handle, data,
BUFFER_SIZE, &length);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(7));
@@ -141,14 +142,14 @@
/* Reset the key attributes and check if psa_import_key fails */
val->crypto_function(VAL_CRYPTO_RESET_KEY_ATTRIBUTES, &attributes);
- val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(11));
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_NOT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(12));
- TEST_ASSERT_EQUAL(check1[i].key_handle, 0, TEST_CHECKPOINT_NUM(13));
+ TEST_ASSERT_EQUAL(key_handle, 0, TEST_CHECKPOINT_NUM(13));
}
return VAL_STATUS_SUCCESS;
diff --git a/api-tests/dev_apis/crypto/test_c002/test_c002.h b/api-tests/dev_apis/crypto/test_c002/test_c002.h
index fecfedb..f6831e7 100644
--- a/api-tests/dev_apis/crypto/test_c002/test_c002.h
+++ b/api-tests/dev_apis/crypto/test_c002/test_c002.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c002_crypto_list[];
+extern const client_test_t test_c002_crypto_list[];
int32_t psa_import_key_test(caller_security_t caller);
#endif /* _TEST_C002_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/crypto/test_c002/test_data.h b/api-tests/dev_apis/crypto/test_c002/test_data.h
index 38db0a5..116ccd3 100644
--- a/api-tests/dev_apis/crypto/test_c002/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c002/test_data.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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[34];
uint32_t key_length;
@@ -161,11 +160,11 @@
0x68, 0x49, 0xf9, 0x7d, 0x10, 0x66, 0xf6, 0x99, 0x77, 0x59, 0x63, 0x7c, 0x7e, 0x38,
0x99, 0x46, 0x4c, 0xee, 0x3e, 0xc7, 0xac, 0x97, 0x06, 0x53, 0xa0, 0xbe, 0x07, 0x42};
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_AES_128
-{"Test psa_import_key 16 Byte AES\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_import_key 16 Byte AES\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x77},
AES_16B_KEY_SIZE, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR,
@@ -174,7 +173,7 @@
#endif
#ifdef ARCH_TEST_AES_192
-{"Test psa_import_key 24 Byte AES\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_import_key 24 Byte AES\n", PSA_KEY_TYPE_AES,
{0x24, 0x13, 0x61, 0x47, 0x61, 0xB8, 0xC8, 0xF0, 0xDF, 0xAB, 0x5A, 0x0E, 0x87,
0x40, 0xAC, 0xA3, 0x90, 0x77, 0x83, 0x52, 0x31, 0x74, 0xF9, 0x05},
AES_24B_KEY_SIZE, BYTES_TO_BITS(AES_24B_KEY_SIZE), PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR,
@@ -183,7 +182,7 @@
#endif
#ifdef ARCH_TEST_AES_256
-{"Test psa_import_key 32 Byte AES\n", 3, PSA_KEY_TYPE_AES,
+{"Test psa_import_key 32 Byte AES\n", PSA_KEY_TYPE_AES,
{0xEA, 0xD5, 0xE6, 0xC8, 0x51, 0xF9, 0xEC, 0xBB, 0x9B, 0x57, 0x7C, 0xED, 0xD2,
0x4B, 0x82, 0x84, 0x9F, 0x9F, 0xE6, 0x73, 0x21, 0x3D, 0x1A, 0x05, 0xC9, 0xED,
0xDF, 0x25, 0x17, 0x68, 0x86, 0xAE},
@@ -194,13 +193,13 @@
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
#ifdef ARCH_TEST_RSA_2048
-{"Test psa_import_key 2048 RSA public key\n", 4, PSA_KEY_TYPE_RSA_PUBLIC_KEY,
+{"Test psa_import_key 2048 RSA public key\n", PSA_KEY_TYPE_RSA_PUBLIC_KEY,
{0},
270, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_RSA_PKCS1V15_SIGN_RAW,
2048, 270, PSA_SUCCESS
},
-{"Test psa_import_key with RSA 2048 keypair\n", 5, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_import_key with RSA 2048 keypair\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0},
1193, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_RSA_PKCS1V15_SIGN_RAW,
2048, 1193, PSA_SUCCESS
@@ -210,7 +209,7 @@
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_DES_1KEY
-{"Test psa_import_key with DES 64 bit key\n", 6, PSA_KEY_TYPE_DES,
+{"Test psa_import_key with DES 64 bit key\n", PSA_KEY_TYPE_DES,
{0x70, 0x24, 0x55, 0x0C, 0x14, 0x9D, 0xED, 0x29},
DES_8B_KEY_SIZE, BYTES_TO_BITS(DES_8B_KEY_SIZE), PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR,
BYTES_TO_BITS(DES_8B_KEY_SIZE), DES_8B_KEY_SIZE, PSA_SUCCESS
@@ -218,7 +217,7 @@
#endif
#ifdef ARCH_TEST_DES_2KEY
-{"Test psa_import_key with Triple DES 2-Key\n", 7, PSA_KEY_TYPE_DES,
+{"Test psa_import_key with Triple DES 2-Key\n", PSA_KEY_TYPE_DES,
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
DES3_2KEY_SIZE, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR,
@@ -227,7 +226,7 @@
#endif
#ifdef ARCH_TEST_DES_3KEY
-{"Test psa_import_key with Triple DES 3-Key\n", 8, PSA_KEY_TYPE_DES,
+{"Test psa_import_key with Triple DES 3-Key\n", PSA_KEY_TYPE_DES,
{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
0xF1, 0xE0, 0xD3, 0xC2, 0xB5, 0xA4, 0x97, 0x86,
0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10},
@@ -239,7 +238,7 @@
#ifdef ARCH_TEST_ECDSA
#ifdef ARCH_TEST_ECC_CURVE_SECP256R1
-{"Test psa_import_key with EC Public key\n", 9,
+{"Test psa_import_key with EC Public key\n",
PSA_KEY_TYPE_ECC_PUBLIC_KEY(PSA_ECC_CURVE_SECP256R1),
{0},
65, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_ECDSA_ANY,
@@ -248,7 +247,7 @@
#endif
#ifdef ARCH_TEST_ECC_CURVE_SECP224R1
-{"Test psa_import_key with EC keypair\n", 10,
+{"Test psa_import_key with EC keypair\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP224R1),
{0},
28, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_ECDSA_ANY,
@@ -259,7 +258,7 @@
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_AES
-{"Test psa_import_key with key data greater than the algorithm size\n", 11, PSA_KEY_TYPE_AES,
+{"Test psa_import_key with key data greater than the algorithm size\n", PSA_KEY_TYPE_AES,
{0x24, 0x13, 0x61, 0x47, 0x61, 0xB8, 0xC8, 0xF0, 0xDF, 0xAB, 0x5A, 0x0E, 0x87,
0x40, 0xAC, 0xA3, 0x90, 0x77, 0x83, 0x52, 0x31, 0x74, 0xF9, 0x05, 0xC9, 0xED,
0xDF, 0x25, 0x17, 0x68, 0x86, 0xAE},
@@ -267,7 +266,7 @@
BYTES_TO_BITS(AES_34B_KEY_SIZE), AES_34B_KEY_SIZE, PSA_ERROR_INVALID_ARGUMENT
},
-{"Test psa_import_key with incorrect key data size\n", 12, PSA_KEY_TYPE_AES,
+{"Test psa_import_key with incorrect key data size\n", PSA_KEY_TYPE_AES,
{0x24, 0x13, 0x61, 0x47, 0x61, 0xB8, 0xC8, 0xF0, 0xDF, 0xAB, 0x5A, 0x0E, 0x87,
0x40, 0xAC, 0xA3, 0x90, 0x77},
AES_18B_KEY_SIZE, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR,
@@ -275,7 +274,7 @@
},
#endif
-{"Test psa_import_key with incorrect key type\n", 13, PSA_KEY_TYPE_VENDOR_FLAG,
+{"Test psa_import_key with incorrect key type\n", PSA_KEY_TYPE_VENDOR_FLAG,
{0x24, 0x13, 0x61, 0x47, 0x61, 0xB8, 0xC8, 0xF0, 0xDF, 0xAB, 0x5A, 0x0E, 0x87,
0x40, 0xAC, 0xA3, 0x90, 0x77, 0x83, 0x52, 0x31, 0x74, 0xF9, 0x05},
AES_24B_KEY_SIZE, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR,
diff --git a/api-tests/dev_apis/crypto/test_c003/test_c003.c b/api-tests/dev_apis/crypto/test_c003/test_c003.c
index 47607d8..4f9fa82 100644
--- a/api-tests/dev_apis/crypto/test_c003/test_c003.c
+++ b/api-tests/dev_apis/crypto/test_c003/test_c003.c
@@ -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");
@@ -20,7 +20,7 @@
#include "test_c003.h"
#include "test_data.h"
-client_test_t test_c003_crypto_list[] = {
+const client_test_t test_c003_crypto_list[] = {
NULL,
psa_export_key_test,
NULL,
@@ -36,6 +36,7 @@
const uint8_t *key_data;
int num_checks = sizeof(check1)/sizeof(check1[0]);
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -97,11 +98,11 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Export a key in binary format */
- status = val->crypto_function(VAL_CRYPTO_EXPORT_KEY, check1[i].key_handle, data,
+ status = val->crypto_function(VAL_CRYPTO_EXPORT_KEY, key_handle, data,
check1[i].buffer_size, &length);
TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(4));
@@ -126,10 +127,10 @@
}
/* Destroy the key handle and check if export key fails */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(8));
- status = val->crypto_function(VAL_CRYPTO_EXPORT_KEY, check1[i].key_handle, data,
+ status = val->crypto_function(VAL_CRYPTO_EXPORT_KEY, key_handle, data,
check1[i].buffer_size, &length);
TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(9));
}
diff --git a/api-tests/dev_apis/crypto/test_c003/test_c003.h b/api-tests/dev_apis/crypto/test_c003/test_c003.h
index 3bd4e53..a376b4f 100644
--- a/api-tests/dev_apis/crypto/test_c003/test_c003.h
+++ b/api-tests/dev_apis/crypto/test_c003/test_c003.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c003_crypto_list[];
+extern const client_test_t test_c003_crypto_list[];
int32_t psa_export_key_test(caller_security_t caller);
int32_t psa_export_key_negative_test(caller_security_t caller);
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 625cc17..2197f37 100644
--- a/api-tests/dev_apis/crypto/test_c003/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c003/test_data.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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[34];
uint32_t key_length;
@@ -161,10 +160,10 @@
0x68, 0x49, 0xf9, 0x7d, 0x10, 0x66, 0xf6, 0x99, 0x77, 0x59, 0x63, 0x7c, 0x7e, 0x38,
0x99, 0x46, 0x4c, 0xee, 0x3e, 0xc7, 0xac, 0x97, 0x06, 0x53, 0xa0, 0xbe, 0x07, 0x42};
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_AES_128
-{"Test psa_export_key 16 Byte AES\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_export_key 16 Byte AES\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x77},
AES_16B_KEY_SIZE, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR, BUFFER_SIZE,
@@ -173,7 +172,7 @@
#endif
#ifdef ARCH_TEST_AES_192
-{"Test psa_export_key 24 Byte AES\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_export_key 24 Byte AES\n", PSA_KEY_TYPE_AES,
{0x24, 0x13, 0x61, 0x47, 0x61, 0xB8, 0xC8, 0xF0, 0xDF, 0xAB, 0x5A, 0x0E, 0x87,
0x40, 0xAC, 0xA3, 0x90, 0x77, 0x83, 0x52, 0x31, 0x74, 0xF9, 0x05},
AES_24B_KEY_SIZE, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR, BUFFER_SIZE,
@@ -182,7 +181,7 @@
#endif
#ifdef ARCH_TEST_AES_256
-{"Test psa_export_key 32 Byte AES\n", 3, PSA_KEY_TYPE_AES,
+{"Test psa_export_key 32 Byte AES\n", PSA_KEY_TYPE_AES,
{0xEA, 0xD5, 0xE6, 0xC8, 0x51, 0xF9, 0xEC, 0xBB, 0x9B, 0x57, 0x7C, 0xED, 0xD2,
0x4B, 0x82, 0x84, 0x9F, 0x9F, 0xE6, 0x73, 0x21, 0x3D, 0x1A, 0x05, 0xC9, 0xED,
0xDF, 0x25, 0x17, 0x68, 0x86, 0xAE},
@@ -194,13 +193,13 @@
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
#ifdef ARCH_TEST_RSA_2048
-{"Test psa_export_key 2048 RSA public key\n", 4, PSA_KEY_TYPE_RSA_PUBLIC_KEY,
+{"Test psa_export_key 2048 RSA public key\n", PSA_KEY_TYPE_RSA_PUBLIC_KEY,
{0},
270, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_RSA_PKCS1V15_SIGN_RAW, BUFFER_SIZE,
2048, 270, PSA_SUCCESS
},
-{"Test psa_export_key with RSA 2048 keypair\n", 5, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_export_key with RSA 2048 keypair\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0},
1193, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_RSA_PKCS1V15_SIGN_RAW, BUFFER_SIZE,
2048, 1193, PSA_SUCCESS
@@ -210,7 +209,7 @@
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_DES_1KEY
-{"Test psa_export_key with DES 64 bit key\n", 6, PSA_KEY_TYPE_DES,
+{"Test psa_export_key with DES 64 bit key\n", PSA_KEY_TYPE_DES,
{0x70, 0x24, 0x55, 0x0C, 0x14, 0x9D, 0xED, 0x29},
DES_8B_KEY_SIZE, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR, BUFFER_SIZE,
BYTES_TO_BITS(DES_8B_KEY_SIZE), DES_8B_KEY_SIZE, PSA_SUCCESS
@@ -218,7 +217,7 @@
#endif
#ifdef ARCH_TEST_DES_2KEY
-{"Test psa_export_key with Triple DES 2-Key\n", 7, PSA_KEY_TYPE_DES,
+{"Test psa_export_key with Triple DES 2-Key\n", PSA_KEY_TYPE_DES,
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
DES3_2KEY_SIZE, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR, BUFFER_SIZE,
@@ -227,7 +226,7 @@
#endif
#ifdef ARCH_TEST_DES_3KEY
-{"Test psa_export_key with Triple DES 3-Key\n", 8, PSA_KEY_TYPE_DES,
+{"Test psa_export_key with Triple DES 3-Key\n", PSA_KEY_TYPE_DES,
{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
0xF1, 0xE0, 0xD3, 0xC2, 0xB5, 0xA4, 0x97, 0x86,
0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10},
@@ -239,7 +238,7 @@
#ifdef ARCH_TEST_ASYMMETRIC_ENCRYPTION
#ifdef ARCH_TEST_ECC_CURVE_SECP256R1
-{"Test psa_export_key with EC Public key\n", 9,
+{"Test psa_export_key with EC Public key\n",
PSA_KEY_TYPE_ECC_PUBLIC_KEY(PSA_ECC_CURVE_SECP256R1),
{0},
65, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_CATEGORY_ASYMMETRIC_ENCRYPTION, BUFFER_SIZE,
@@ -248,7 +247,7 @@
#endif
#ifdef ARCH_TEST_ECC_CURVE_SECP224R1
-{"Test psa_export_key with EC keypair\n", 10,
+{"Test psa_export_key with EC keypair\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP224R1),
{0},
28, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_CATEGORY_ASYMMETRIC_ENCRYPTION, BUFFER_SIZE,
@@ -259,14 +258,14 @@
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_AES_128
-{"Test psa_export_key with key policy verify\n", 11, PSA_KEY_TYPE_AES,
+{"Test psa_export_key with key policy verify\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x05},
AES_16B_KEY_SIZE, 0, PSA_KEY_USAGE_VERIFY, PSA_ALG_CTR, BUFFER_SIZE,
BYTES_TO_BITS(AES_16B_KEY_SIZE), AES_16B_KEY_SIZE, PSA_ERROR_NOT_PERMITTED
},
-{"Test psa_export_key with less buffer size\n", 12, PSA_KEY_TYPE_AES,
+{"Test psa_export_key with less buffer size\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x05},
AES_16B_KEY_SIZE, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR, 14,
diff --git a/api-tests/dev_apis/crypto/test_c004/test_c004.c b/api-tests/dev_apis/crypto/test_c004/test_c004.c
index 00bdfd3..983ae54 100644
--- a/api-tests/dev_apis/crypto/test_c004/test_c004.c
+++ b/api-tests/dev_apis/crypto/test_c004/test_c004.c
@@ -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");
@@ -20,7 +20,7 @@
#include "test_c004.h"
#include "test_data.h"
-client_test_t test_c004_crypto_list[] = {
+const client_test_t test_c004_crypto_list[] = {
NULL,
test_psa_export_public_key,
NULL,
@@ -36,6 +36,7 @@
const uint8_t *key_data;
int num_checks = sizeof(check1)/sizeof(check1[0]);
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -97,11 +98,11 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Export a key in binary format */
- status = val->crypto_function(VAL_CRYPTO_EXPORT_PUBLIC_KEY, check1[i].key_handle, data,
+ status = val->crypto_function(VAL_CRYPTO_EXPORT_PUBLIC_KEY, key_handle, data,
check1[i].buffer_size, &length);
TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(4));
@@ -132,10 +133,10 @@
}
/* Destroy the key handle and check if export key fails */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(8));
- status = val->crypto_function(VAL_CRYPTO_EXPORT_PUBLIC_KEY, check1[i].key_handle, data,
+ status = val->crypto_function(VAL_CRYPTO_EXPORT_PUBLIC_KEY, key_handle, data,
check1[i].buffer_size, &length);
TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(9));
}
diff --git a/api-tests/dev_apis/crypto/test_c004/test_c004.h b/api-tests/dev_apis/crypto/test_c004/test_c004.h
index b8f27de..0ab1973 100644
--- a/api-tests/dev_apis/crypto/test_c004/test_c004.h
+++ b/api-tests/dev_apis/crypto/test_c004/test_c004.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c004_crypto_list[];
+extern const client_test_t test_c004_crypto_list[];
int32_t test_psa_export_public_key(caller_security_t caller);
#endif /* _TEST_C004_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/crypto/test_c004/test_data.h b/api-tests/dev_apis/crypto/test_c004/test_data.h
index f389a0f..428a112 100644
--- a/api-tests/dev_apis/crypto/test_c004/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c004/test_data.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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[34];
uint32_t key_length;
@@ -192,11 +191,11 @@
0x68, 0x49, 0xf9, 0x7d, 0x10, 0x66, 0xf6, 0x99, 0x77, 0x59, 0x63, 0x7c, 0x7e, 0x38,
0x99, 0x46, 0x4c, 0xee, 0x3e, 0xc7, 0xac, 0x97, 0x06, 0x53, 0xa0, 0xbe, 0x07, 0x42};
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_AES_128
-{"Test psa_export_public_key 16 Byte AES\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_export_public_key 16 Byte AES\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9},
AES_16B_KEY_SIZE, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR, BUFFER_SIZE,
@@ -205,7 +204,7 @@
#endif
#ifdef ARCH_TEST_AES_192
-{"Test psa_export_public_key 24 Byte AES\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_export_public_key 24 Byte AES\n", PSA_KEY_TYPE_AES,
{0x24, 0x13, 0x61, 0x47, 0x61, 0xB8, 0xC8, 0xF0, 0xDF, 0xAB, 0x5A, 0x0E, 0x87,
0x40, 0xAC, 0xA3, 0x90, 0x77, 0x83, 0x52, 0x31, 0x74, 0xF9},
AES_24B_KEY_SIZE, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR, BUFFER_SIZE,
@@ -214,7 +213,7 @@
#endif
#ifdef ARCH_TEST_AES_256
-{"Test psa_export_public_key 32 Byte AES\n", 3, PSA_KEY_TYPE_AES,
+{"Test psa_export_public_key 32 Byte AES\n", PSA_KEY_TYPE_AES,
{0xEA, 0xD5, 0xE6, 0xC8, 0x51, 0xF9, 0xEC, 0xBB, 0x9B, 0x57, 0x7C, 0xED, 0xD2,
0x4B, 0x82, 0x84, 0x9F, 0x9F, 0xE6, 0x73, 0x21, 0x3D, 0x1A, 0x05, 0xC9, 0xED,
0xDF, 0x25, 0x17, 0x68, 0x86, 0xAE},
@@ -226,13 +225,13 @@
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
#ifdef ARCH_TEST_RSA_2048
-{"Test psa_export_public_key 2048 RSA public key\n", 4, PSA_KEY_TYPE_RSA_PUBLIC_KEY,
+{"Test psa_export_public_key 2048 RSA public key\n", PSA_KEY_TYPE_RSA_PUBLIC_KEY,
{0},
270, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_RSA_PKCS1V15_SIGN_RAW, BUFFER_SIZE,
2048, 270, PSA_SUCCESS
},
-{"Test psa_export_public_key with RSA 2048 keypair\n", 5, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_export_public_key with RSA 2048 keypair\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0},
1193, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_RSA_PKCS1V15_SIGN_RAW, BUFFER_SIZE,
2048, 270, PSA_SUCCESS
@@ -242,7 +241,7 @@
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_DES_1KEY
-{"Test psa_export_public_key with DES 64 bit key\n", 6, PSA_KEY_TYPE_DES,
+{"Test psa_export_public_key with DES 64 bit key\n", PSA_KEY_TYPE_DES,
{0x70, 0x24, 0x55, 0x0C, 0x14, 0x9D, 0xED, 0x29},
DES_8B_KEY_SIZE, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR, BUFFER_SIZE,
BYTES_TO_BITS(DES_8B_KEY_SIZE), DES_8B_KEY_SIZE, PSA_ERROR_INVALID_ARGUMENT
@@ -250,7 +249,7 @@
#endif
#ifdef ARCH_TEST_DES_2KEY
-{"Test psa_export_public_key with Triple DES 2-Key\n", 7, PSA_KEY_TYPE_DES,
+{"Test psa_export_public_key with Triple DES 2-Key\n", PSA_KEY_TYPE_DES,
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
DES3_2KEY_SIZE, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR, BUFFER_SIZE,
@@ -259,7 +258,7 @@
#endif
#ifdef ARCH_TEST_DES_3KEY
-{"Test psa_export_public_key with Triple DES 3-Key\n", 8, PSA_KEY_TYPE_DES,
+{"Test psa_export_public_key with Triple DES 3-Key\n", PSA_KEY_TYPE_DES,
{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
0xF1, 0xE0, 0xD3, 0xC2, 0xB5, 0xA4, 0x97, 0x86,
0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10},
@@ -271,7 +270,7 @@
#ifdef ARCH_TEST_ASYMMETRIC_ENCRYPTION
#ifdef ARCH_TEST_ECC_CURVE_SECP256R1
-{"Test psa_export_public_key with EC Public key\n", 9,
+{"Test psa_export_public_key with EC Public key\n",
PSA_KEY_TYPE_ECC_PUBLIC_KEY(PSA_ECC_CURVE_SECP256R1),
{0},
65, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_CATEGORY_ASYMMETRIC_ENCRYPTION, BUFFER_SIZE,
@@ -280,7 +279,7 @@
#endif
#ifdef ARCH_TEST_ECC_CURVE_SECP224R1
-{"Test psa_export_public_key with EC keypair\n", 10,
+{"Test psa_export_public_key with EC keypair\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP224R1),
{0},
28, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_CATEGORY_ASYMMETRIC_ENCRYPTION, BUFFER_SIZE,
@@ -291,7 +290,7 @@
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
#ifdef ARCH_TEST_RSA
-{"Test psa_export_public_key with less buffer size\n", 12, PSA_KEY_TYPE_RSA_PUBLIC_KEY,
+{"Test psa_export_public_key with less buffer size\n", PSA_KEY_TYPE_RSA_PUBLIC_KEY,
{0},
270, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_RSA_PKCS1V15_SIGN_RAW, 200,
2048, 270, PSA_ERROR_BUFFER_TOO_SMALL
diff --git a/api-tests/dev_apis/crypto/test_c005/test_c005.c b/api-tests/dev_apis/crypto/test_c005/test_c005.c
index 0dabc9d..d66e9f7 100644
--- a/api-tests/dev_apis/crypto/test_c005/test_c005.c
+++ b/api-tests/dev_apis/crypto/test_c005/test_c005.c
@@ -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");
@@ -20,7 +20,7 @@
#include "test_c005.h"
#include "test_data.h"
-client_test_t test_c005_crypto_list[] = {
+const client_test_t test_c005_crypto_list[] = {
NULL,
psa_destroy_key_test,
NULL,
@@ -41,6 +41,7 @@
int num_checks = sizeof(check1)/sizeof(check1[0]);
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_key_attributes_t set_attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -103,15 +104,15 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &set_attributes, key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Destroy the key handle */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(4));
/* Getting the attributes of the destroyed key should return error */
- status = val->crypto_function(VAL_CRYPTO_GET_KEY_ATTRIBUTES, check1[i].key_handle,
+ status = val->crypto_function(VAL_CRYPTO_GET_KEY_ATTRIBUTES, key_handle,
&attributes);
TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(5));
@@ -135,7 +136,7 @@
TEST_ASSERT_EQUAL(get_key_bits, 0, TEST_CHECKPOINT_NUM(11));
/* Destroying an empty key handle should return error */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(12));
}
diff --git a/api-tests/dev_apis/crypto/test_c005/test_c005.h b/api-tests/dev_apis/crypto/test_c005/test_c005.h
index 95e228b..52b5a5e 100644
--- a/api-tests/dev_apis/crypto/test_c005/test_c005.h
+++ b/api-tests/dev_apis/crypto/test_c005/test_c005.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c005_crypto_list[];
+extern const client_test_t test_c005_crypto_list[];
int32_t psa_destroy_key_test(caller_security_t caller);
#endif /* _TEST_C005_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/crypto/test_c005/test_data.h b/api-tests/dev_apis/crypto/test_c005/test_data.h
index 3b70b18..e693af9 100644
--- a/api-tests/dev_apis/crypto/test_c005/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c005/test_data.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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[34];
uint32_t key_length;
@@ -161,11 +160,11 @@
0x68, 0x49, 0xf9, 0x7d, 0x10, 0x66, 0xf6, 0x99, 0x77, 0x59, 0x63, 0x7c, 0x7e, 0x38,
0x99, 0x46, 0x4c, 0xee, 0x3e, 0xc7, 0xac, 0x97, 0x06, 0x53, 0xa0, 0xbe, 0x07, 0x42};
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_AES_128
-{"Test psa_destroy_key 16 Byte AES\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_destroy_key 16 Byte AES\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9},
AES_16B_KEY_SIZE, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR,
@@ -175,7 +174,7 @@
#endif
#ifdef ARCH_TEST_AES_192
-{"Test psa_destroy_key 24 Byte AES\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_destroy_key 24 Byte AES\n", PSA_KEY_TYPE_AES,
{0x24, 0x13, 0x61, 0x47, 0x61, 0xB8, 0xC8, 0xF0, 0xDF, 0xAB, 0x5A, 0x0E, 0x87,
0x40, 0xAC, 0xA3, 0x90, 0x77, 0x83, 0x52, 0x31, 0x74, 0xF9},
AES_24B_KEY_SIZE, BYTES_TO_BITS(AES_24B_KEY_SIZE), PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR,
@@ -185,7 +184,7 @@
#endif
#ifdef ARCH_TEST_AES_256
-{"Test psa_destroy_key 32 Byte AES\n", 3, PSA_KEY_TYPE_AES,
+{"Test psa_destroy_key 32 Byte AES\n", PSA_KEY_TYPE_AES,
{0xEA, 0xD5, 0xE6, 0xC8, 0x51, 0xF9, 0xEC, 0xBB, 0x9B, 0x57, 0x7C, 0xED, 0xD2,
0x4B, 0x82, 0x84, 0x9F, 0x9F, 0xE6, 0x73, 0x21, 0x3D, 0x1A, 0x05, 0xC9, 0xED,
0xDF, 0x25, 0x17, 0x68, 0x86, 0xAE},
@@ -198,14 +197,14 @@
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
#ifdef ARCH_TEST_RSA_2048
-{"Test psa_destroy_key 2048 RSA public key\n", 4, PSA_KEY_TYPE_RSA_PUBLIC_KEY,
+{"Test psa_destroy_key 2048 RSA public key\n", PSA_KEY_TYPE_RSA_PUBLIC_KEY,
{0},
270, 2048, PSA_KEY_USAGE_EXPORT, PSA_ALG_RSA_PKCS1V15_SIGN_RAW,
0x78, PSA_KEY_LIFETIME_VOLATILE,
2048, PSA_SUCCESS
},
-{"Test psa_destroy_key with RSA 2048 keypair\n", 5, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_destroy_key with RSA 2048 keypair\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0},
1193, 2048, PSA_KEY_USAGE_EXPORT, PSA_ALG_RSA_PKCS1V15_SIGN_RAW,
0x89, PSA_KEY_LIFETIME_VOLATILE,
@@ -216,7 +215,7 @@
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_DES_1KEY
-{"Test psa_destroy_key with DES 64 bit key\n", 6, PSA_KEY_TYPE_DES,
+{"Test psa_destroy_key with DES 64 bit key\n", PSA_KEY_TYPE_DES,
{0x70, 0x24, 0x55, 0x0C, 0x14, 0x9D, 0xED, 0x29},
DES_8B_KEY_SIZE, BYTES_TO_BITS(DES_8B_KEY_SIZE), PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR,
0xAB, PSA_KEY_LIFETIME_VOLATILE,
@@ -225,7 +224,7 @@
#endif
#ifdef ARCH_TEST_DES_2KEY
-{"Test psa_destroy_key with Triple DES 2-Key\n", 7, PSA_KEY_TYPE_DES,
+{"Test psa_destroy_key with Triple DES 2-Key\n", PSA_KEY_TYPE_DES,
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
DES3_2KEY_SIZE, BYTES_TO_BITS(DES3_2KEY_SIZE), PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR,
@@ -235,7 +234,7 @@
#endif
#ifdef ARCH_TEST_DES_3KEY
-{"Test psa_destroy_key with Triple DES 3-Key\n", 8, PSA_KEY_TYPE_DES,
+{"Test psa_destroy_key with Triple DES 3-Key\n", PSA_KEY_TYPE_DES,
{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
0xF1, 0xE0, 0xD3, 0xC2, 0xB5, 0xA4, 0x97, 0x86,
0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10},
@@ -248,7 +247,7 @@
#ifdef ARCH_TEST_ECDSA
#ifdef ARCH_TEST_ECC_CURVE_SECP256R1
-{"Test psa_destroy_key with EC Public key\n", 9,
+{"Test psa_destroy_key with EC Public key\n",
PSA_KEY_TYPE_ECC_PUBLIC_KEY(PSA_ECC_CURVE_SECP256R1),
{0},
65, 256, PSA_KEY_USAGE_EXPORT, PSA_ALG_ECDSA_ANY,
@@ -260,7 +259,7 @@
#ifdef ARCH_TEST_ASYMMETRIC_ENCRYPTION
#ifdef ARCH_TEST_ECC_CURVE_SECP224R1
-{"Test psa_destroy_key with EC keypair\n", 10,
+{"Test psa_destroy_key with EC keypair\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP224R1),
{0},
28, 224, PSA_KEY_USAGE_EXPORT, PSA_ALG_CATEGORY_ASYMMETRIC_ENCRYPTION,
diff --git a/api-tests/dev_apis/crypto/test_c006/test_c006.c b/api-tests/dev_apis/crypto/test_c006/test_c006.c
index d6b603f..fc418e5 100644
--- a/api-tests/dev_apis/crypto/test_c006/test_c006.c
+++ b/api-tests/dev_apis/crypto/test_c006/test_c006.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");
@@ -21,7 +21,7 @@
#include "test_data.h"
#include "val_crypto.h"
-client_test_t test_c006_crypto_list[] = {
+const client_test_t test_c006_crypto_list[] = {
NULL,
psa_hash_compute_test,
NULL,
diff --git a/api-tests/dev_apis/crypto/test_c006/test_c006.h b/api-tests/dev_apis/crypto/test_c006/test_c006.h
index 9a1a622..12dbbcd 100644
--- a/api-tests/dev_apis/crypto/test_c006/test_c006.h
+++ b/api-tests/dev_apis/crypto/test_c006/test_c006.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c006_crypto_list[];
+extern const client_test_t test_c006_crypto_list[];
int32_t psa_hash_compute_test(caller_security_t caller);
#endif /* _TEST_C006_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/crypto/test_c006/test_data.h b/api-tests/dev_apis/crypto/test_c006/test_data.h
index 5aeee35..f238ef7 100644
--- a/api-tests/dev_apis/crypto/test_c006/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c006/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");
@@ -40,7 +40,7 @@
0xcb, 0x7b, 0x00, 0xae, 0xa8, 0x91, 0x49, 0x9c, 0xf4, 0xef, 0x6a, 0x03, 0xc8, 0xa8, 0x3f, 0xe3,
0x7c, 0x3f, 0x7b, 0xaf};
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_MD2
{"Test psa_hash_compute with MD2 algorithm\n",
PSA_ALG_MD2, 0xbd, 1,
diff --git a/api-tests/dev_apis/crypto/test_c007/test_c007.c b/api-tests/dev_apis/crypto/test_c007/test_c007.c
index 895242a..d3046c1 100644
--- a/api-tests/dev_apis/crypto/test_c007/test_c007.c
+++ b/api-tests/dev_apis/crypto/test_c007/test_c007.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");
@@ -21,7 +21,7 @@
#include "test_data.h"
#include "val_crypto.h"
-client_test_t test_c007_crypto_list[] = {
+const client_test_t test_c007_crypto_list[] = {
NULL,
psa_hash_compare_test,
NULL,
diff --git a/api-tests/dev_apis/crypto/test_c007/test_c007.h b/api-tests/dev_apis/crypto/test_c007/test_c007.h
index fb5c385..9e9c357 100644
--- a/api-tests/dev_apis/crypto/test_c007/test_c007.h
+++ b/api-tests/dev_apis/crypto/test_c007/test_c007.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c007_crypto_list[];
+extern const client_test_t test_c007_crypto_list[];
int32_t psa_hash_compare_test(caller_security_t caller);
#endif /* _TEST_C007_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/crypto/test_c007/test_data.h b/api-tests/dev_apis/crypto/test_c007/test_data.h
index 5d6dc86..c2a04bc 100644
--- a/api-tests/dev_apis/crypto/test_c007/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c007/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");
@@ -40,7 +40,7 @@
0xcb, 0x7b, 0x00, 0xae, 0xa8, 0x91, 0x49, 0x9c, 0xf4, 0xef, 0x6a, 0x03, 0xc8, 0xa8, 0x3f, 0xe3,
0x7c, 0x3f, 0x7b, 0xaf};
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_MD2
{"Test psa_hash_compare with MD2 algorithm\n",
PSA_ALG_MD2, 0xbd, 1,
diff --git a/api-tests/dev_apis/crypto/test_c008/test_c008.c b/api-tests/dev_apis/crypto/test_c008/test_c008.c
index 5063c13..a4e8387 100644
--- a/api-tests/dev_apis/crypto/test_c008/test_c008.c
+++ b/api-tests/dev_apis/crypto/test_c008/test_c008.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");
@@ -21,7 +21,7 @@
#include "test_data.h"
#include "val_crypto.h"
-client_test_t test_c008_crypto_list[] = {
+const client_test_t test_c008_crypto_list[] = {
NULL,
psa_key_derivation_setup_test,
NULL,
diff --git a/api-tests/dev_apis/crypto/test_c008/test_c008.h b/api-tests/dev_apis/crypto/test_c008/test_c008.h
index c86acf8..c8b1cfb 100644
--- a/api-tests/dev_apis/crypto/test_c008/test_c008.h
+++ b/api-tests/dev_apis/crypto/test_c008/test_c008.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c008_crypto_list[];
+extern const client_test_t test_c008_crypto_list[];
int32_t psa_key_derivation_setup_test(caller_security_t caller);
#endif /* _TEST_C008_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/crypto/test_c008/test_data.h b/api-tests/dev_apis/crypto/test_c008/test_data.h
index a350c16..f5e356f 100644
--- a/api-tests/dev_apis/crypto/test_c008/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c008/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");
@@ -23,7 +23,7 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
{"Test psa_key_derivation_setup - ECDH + HKDF-SHA-256\n",
PSA_ALG_KEY_AGREEMENT(PSA_ALG_ECDH, PSA_ALG_HKDF(PSA_ALG_SHA_256)),
PSA_SUCCESS
diff --git a/api-tests/dev_apis/crypto/test_c009/test_c009.c b/api-tests/dev_apis/crypto/test_c009/test_c009.c
index 1288bf6..0dd6dc2 100644
--- a/api-tests/dev_apis/crypto/test_c009/test_c009.c
+++ b/api-tests/dev_apis/crypto/test_c009/test_c009.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");
@@ -21,7 +21,7 @@
#include "test_data.h"
#include "val_crypto.h"
-client_test_t test_c009_crypto_list[] = {
+const client_test_t test_c009_crypto_list[] = {
NULL,
psa_key_derivation_input_bytes_test,
NULL,
diff --git a/api-tests/dev_apis/crypto/test_c009/test_c009.h b/api-tests/dev_apis/crypto/test_c009/test_c009.h
index 356ad72..4730d6d 100644
--- a/api-tests/dev_apis/crypto/test_c009/test_c009.h
+++ b/api-tests/dev_apis/crypto/test_c009/test_c009.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c009_crypto_list[];
+extern const client_test_t test_c009_crypto_list[];
int32_t psa_key_derivation_input_bytes_test(caller_security_t caller);
#endif /* _TEST_C009_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/crypto/test_c009/test_data.h b/api-tests/dev_apis/crypto/test_c009/test_data.h
index d485067..bf8e7b6 100644
--- a/api-tests/dev_apis/crypto/test_c009/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c009/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");
@@ -26,7 +26,7 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
{"Test psa_key_derivation_input_bytes - Step as Info\n",
PSA_ALG_KEY_AGREEMENT(PSA_ALG_ECDH, PSA_ALG_HKDF(PSA_ALG_SHA_256)),
"abcdefghijklmnop", 16,
diff --git a/api-tests/dev_apis/crypto/test_c010/test_c010.c b/api-tests/dev_apis/crypto/test_c010/test_c010.c
index 5455c0a..2e29adb 100644
--- a/api-tests/dev_apis/crypto/test_c010/test_c010.c
+++ b/api-tests/dev_apis/crypto/test_c010/test_c010.c
@@ -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");
@@ -21,7 +21,7 @@
#include "test_data.h"
#include "val_crypto.h"
-client_test_t test_c010_crypto_list[] = {
+const client_test_t test_c010_crypto_list[] = {
NULL,
psa_key_attributes_set_get_test,
NULL,
diff --git a/api-tests/dev_apis/crypto/test_c010/test_c010.h b/api-tests/dev_apis/crypto/test_c010/test_c010.h
index 7159b5a..94f0d37 100644
--- a/api-tests/dev_apis/crypto/test_c010/test_c010.h
+++ b/api-tests/dev_apis/crypto/test_c010/test_c010.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c010_crypto_list[];
+extern const client_test_t test_c010_crypto_list[];
int32_t psa_key_attributes_set_get_test(caller_security_t caller);
#endif /* _TEST_C010_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/crypto/test_c010/test_data.h b/api-tests/dev_apis/crypto/test_c010/test_data.h
index d6dc65d..2854892 100644
--- a/api-tests/dev_apis/crypto/test_c010/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c010/test_data.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");
@@ -28,7 +28,7 @@
psa_key_lifetime_t lifetime;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
{"Test set/get key attributes\n", PSA_KEY_TYPE_AES, BYTES_TO_BITS(AES_16B_KEY_SIZE),
PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT, PSA_ALG_CCM, 0x1234,
PSA_KEY_LIFETIME_PERSISTENT
diff --git a/api-tests/dev_apis/crypto/test_c011/test_c011.c b/api-tests/dev_apis/crypto/test_c011/test_c011.c
index 4abab81..5f15b18 100644
--- a/api-tests/dev_apis/crypto/test_c011/test_c011.c
+++ b/api-tests/dev_apis/crypto/test_c011/test_c011.c
@@ -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");
@@ -21,7 +21,7 @@
#include "test_data.h"
#include "val_crypto.h"
-client_test_t test_c011_crypto_list[] = {
+const client_test_t test_c011_crypto_list[] = {
NULL,
psa_hash_setup_test,
NULL,
diff --git a/api-tests/dev_apis/crypto/test_c011/test_c011.h b/api-tests/dev_apis/crypto/test_c011/test_c011.h
index b16284b..d89176d 100644
--- a/api-tests/dev_apis/crypto/test_c011/test_c011.h
+++ b/api-tests/dev_apis/crypto/test_c011/test_c011.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c011_crypto_list[];
+extern const client_test_t test_c011_crypto_list[];
int32_t psa_hash_setup_test(caller_security_t caller);
int32_t psa_get_key_lifetime_negative_test(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c011/test_data.h b/api-tests/dev_apis/crypto/test_c011/test_data.h
index 64b233b..b2300c9 100644
--- a/api-tests/dev_apis/crypto/test_c011/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c011/test_data.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");
@@ -23,7 +23,7 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_MD2
{"Test psa_hash_setup with MD2 algorithm\n",
PSA_ALG_MD2, PSA_SUCCESS,
diff --git a/api-tests/dev_apis/crypto/test_c012/test_c012.c b/api-tests/dev_apis/crypto/test_c012/test_c012.c
index 3e3cc21..d290702 100644
--- a/api-tests/dev_apis/crypto/test_c012/test_c012.c
+++ b/api-tests/dev_apis/crypto/test_c012/test_c012.c
@@ -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");
@@ -21,7 +21,7 @@
#include "test_data.h"
#include "val_crypto.h"
-client_test_t test_c012_crypto_list[] = {
+const client_test_t test_c012_crypto_list[] = {
NULL,
psa_hash_update_test,
psa_hash_update_invalid_handle,
diff --git a/api-tests/dev_apis/crypto/test_c012/test_c012.h b/api-tests/dev_apis/crypto/test_c012/test_c012.h
index acbf777..b541d99 100644
--- a/api-tests/dev_apis/crypto/test_c012/test_c012.h
+++ b/api-tests/dev_apis/crypto/test_c012/test_c012.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c012_crypto_list[];
+extern const client_test_t test_c012_crypto_list[];
int32_t psa_hash_update_test(caller_security_t caller);
int32_t psa_hash_update_invalid_handle(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c012/test_data.h b/api-tests/dev_apis/crypto/test_c012/test_data.h
index f5c4f52..fdbef81 100644
--- a/api-tests/dev_apis/crypto/test_c012/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c012/test_data.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");
@@ -25,7 +25,7 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_MD2
{"Test psa_hash_update with MD2 algorithm\n",
PSA_ALG_MD2, "Hello World", 11, PSA_SUCCESS,
diff --git a/api-tests/dev_apis/crypto/test_c013/test_c013.c b/api-tests/dev_apis/crypto/test_c013/test_c013.c
index 772ea61..6477465 100644
--- a/api-tests/dev_apis/crypto/test_c013/test_c013.c
+++ b/api-tests/dev_apis/crypto/test_c013/test_c013.c
@@ -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");
@@ -21,7 +21,7 @@
#include "test_data.h"
#include "val_crypto.h"
-client_test_t test_c013_crypto_list[] = {
+const client_test_t test_c013_crypto_list[] = {
NULL,
psa_hash_verify_test,
psa_hash_verify_inactive_operation_handle,
diff --git a/api-tests/dev_apis/crypto/test_c013/test_c013.h b/api-tests/dev_apis/crypto/test_c013/test_c013.h
index 2e72127..8dd0646 100644
--- a/api-tests/dev_apis/crypto/test_c013/test_c013.h
+++ b/api-tests/dev_apis/crypto/test_c013/test_c013.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c013_crypto_list[];
+extern const client_test_t test_c013_crypto_list[];
int32_t psa_hash_verify_test(caller_security_t caller);
int32_t psa_hash_verify_inactive_operation_handle(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c013/test_data.h b/api-tests/dev_apis/crypto/test_c013/test_data.h
index 520309a..463e4e3 100644
--- a/api-tests/dev_apis/crypto/test_c013/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c013/test_data.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");
@@ -40,7 +40,7 @@
0xcb, 0x7b, 0x00, 0xae, 0xa8, 0x91, 0x49, 0x9c, 0xf4, 0xef, 0x6a, 0x03, 0xc8, 0xa8, 0x3f, 0xe3,
0x7c, 0x3f, 0x7b, 0xaf};
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_MD2
{"Test psa_hash_verify with MD2 algorithm\n",
PSA_ALG_MD2, 0xbd, 1,
diff --git a/api-tests/dev_apis/crypto/test_c014/test_c014.c b/api-tests/dev_apis/crypto/test_c014/test_c014.c
index c1eda35..796072b 100644
--- a/api-tests/dev_apis/crypto/test_c014/test_c014.c
+++ b/api-tests/dev_apis/crypto/test_c014/test_c014.c
@@ -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");
@@ -21,7 +21,7 @@
#include "test_data.h"
#include "val_crypto.h"
-client_test_t test_c014_crypto_list[] = {
+const client_test_t test_c014_crypto_list[] = {
NULL,
psa_hash_finish_test,
psa_hash_finish_inactive_operation_handle,
diff --git a/api-tests/dev_apis/crypto/test_c014/test_c014.h b/api-tests/dev_apis/crypto/test_c014/test_c014.h
index 81b92ee..412c0c2 100644
--- a/api-tests/dev_apis/crypto/test_c014/test_c014.h
+++ b/api-tests/dev_apis/crypto/test_c014/test_c014.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c014_crypto_list[];
+extern const client_test_t test_c014_crypto_list[];
int32_t psa_hash_finish_test(caller_security_t caller);
int32_t psa_hash_finish_inactive_operation_handle(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c014/test_data.h b/api-tests/dev_apis/crypto/test_c014/test_data.h
index fb0fdb4..b8d77f6 100644
--- a/api-tests/dev_apis/crypto/test_c014/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c014/test_data.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");
@@ -40,7 +40,7 @@
0xcb, 0x7b, 0x00, 0xae, 0xa8, 0x91, 0x49, 0x9c, 0xf4, 0xef, 0x6a, 0x03, 0xc8, 0xa8, 0x3f, 0xe3,
0x7c, 0x3f, 0x7b, 0xaf};
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_MD2
{"Test psa_hash_finish with MD2 algorithm\n",
PSA_ALG_MD2, 0xbd, 1,
diff --git a/api-tests/dev_apis/crypto/test_c015/test_c015.c b/api-tests/dev_apis/crypto/test_c015/test_c015.c
index cd5c96d..21f736b 100644
--- a/api-tests/dev_apis/crypto/test_c015/test_c015.c
+++ b/api-tests/dev_apis/crypto/test_c015/test_c015.c
@@ -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");
@@ -21,7 +21,7 @@
#include "test_data.h"
#include "val_crypto.h"
-client_test_t test_c015_crypto_list[] = {
+const client_test_t test_c015_crypto_list[] = {
NULL,
psa_hash_abort_test,
psa_hash_abort_before_operation_finish,
diff --git a/api-tests/dev_apis/crypto/test_c015/test_c015.h b/api-tests/dev_apis/crypto/test_c015/test_c015.h
index b3edc26..28f4b62 100644
--- a/api-tests/dev_apis/crypto/test_c015/test_c015.h
+++ b/api-tests/dev_apis/crypto/test_c015/test_c015.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c015_crypto_list[];
+extern const client_test_t test_c015_crypto_list[];
int32_t psa_hash_abort_test(caller_security_t caller);
int32_t psa_hash_abort_before_operation_finish(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c015/test_data.h b/api-tests/dev_apis/crypto/test_c015/test_data.h
index 98ec64c..a9c20f8 100644
--- a/api-tests/dev_apis/crypto/test_c015/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c015/test_data.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");
@@ -23,7 +23,7 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_MD2
{"Test psa_hash_abort with MD2 algorithm\n",
PSA_ALG_MD2, PSA_SUCCESS,
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 58f847f..347990e 100644
--- a/api-tests/dev_apis/crypto/test_c016/test_c016.c
+++ b/api-tests/dev_apis/crypto/test_c016/test_c016.c
@@ -21,7 +21,7 @@
#include "test_data.h"
#include "val_crypto.h"
-client_test_t test_c016_crypto_list[] = {
+const client_test_t test_c016_crypto_list[] = {
NULL,
psa_generate_key_test,
NULL,
@@ -41,6 +41,7 @@
int num_checks = sizeof(check1)/sizeof(check1[0]);
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_key_attributes_t get_attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -69,14 +70,14 @@
val->crypto_function(VAL_CRYPTO_SET_KEY_ALGORITHM, &attributes, check1[i].key_alg);
/* Generate the key */
- status = val->crypto_function(VAL_CRYPTO_GENERATE_KEY, &attributes, &check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_GENERATE_KEY, &attributes, &key_handle);
TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(3));
if (check1[i].expected_status != PSA_SUCCESS)
continue;
/* Get the attributes of the imported key and check if it matches the given value */
- status = val->crypto_function(VAL_CRYPTO_GET_KEY_ATTRIBUTES, check1[i].key_handle,
+ status = val->crypto_function(VAL_CRYPTO_GET_KEY_ATTRIBUTES, key_handle,
&get_attributes);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(4));
@@ -93,7 +94,7 @@
TEST_ASSERT_EQUAL(get_key_alg, check1[i].key_alg, TEST_CHECKPOINT_NUM(8));
/* Export a key in binary format */
- status = val->crypto_function(VAL_CRYPTO_EXPORT_KEY, check1[i].key_handle, data,
+ status = val->crypto_function(VAL_CRYPTO_EXPORT_KEY, key_handle, data,
BUFFER_SIZE, &length);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(9));
@@ -105,7 +106,7 @@
val->crypto_function(VAL_CRYPTO_RESET_KEY_ATTRIBUTES, &get_attributes);
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(11));
}
diff --git a/api-tests/dev_apis/crypto/test_c016/test_c016.h b/api-tests/dev_apis/crypto/test_c016/test_c016.h
index 86ed985..7d894ae 100644
--- a/api-tests/dev_apis/crypto/test_c016/test_c016.h
+++ b/api-tests/dev_apis/crypto/test_c016/test_c016.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c016_crypto_list[];
+extern const client_test_t test_c016_crypto_list[];
int32_t psa_generate_key_test(caller_security_t caller);
#endif /* _TEST_C016_CLIENT_TESTS_H_ */
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 904ab4b..4f5b026 100644
--- a/api-tests/dev_apis/crypto/test_c016/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c016/test_data.h
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
psa_key_usage_t usage;
psa_algorithm_t key_alg;
@@ -29,45 +28,45 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_AES_128
-{"Test psa_generate_key 16 Byte AES\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_generate_key 16 Byte AES\n", 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, 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,
+{"Test psa_generate_key 24 Byte AES\n", 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, 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,
+{"Test psa_generate_key 32 Byte AES\n", 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, 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,
+{"Test psa_generate_key with DES 64 bit key\n", 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, 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,
+{"Test psa_generate_key with Triple DES 2-Key\n", 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, 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,
+{"Test psa_generate_key with Triple DES 3-Key\n", 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, DES3_3KEY_SIZE}, PSA_SUCCESS
},
@@ -78,7 +77,7 @@
#ifdef ARCH_TEST_RSA
#ifdef ARCH_TEST_RSA_2048
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
-{"Test psa_generate_key with RSA 2048 Keypair\n", 7, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_generate_key with RSA 2048 Keypair\n", 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, {1190, 1194}, PSA_SUCCESS
},
@@ -88,7 +87,7 @@
#ifdef ARCH_TEST_ECC_CURVE_SECP224R1
#ifdef ARCH_TEST_ASYMMETRIC_ENCRYPTION
-{"Test psa_generate_key with ECC KeyPair\n", 8,
+{"Test psa_generate_key with ECC KeyPair\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP224R1),
PSA_KEY_USAGE_EXPORT, PSA_ALG_CATEGORY_ASYMMETRIC_ENCRYPTION, 224,
224, {28, 28}, PSA_SUCCESS
@@ -98,19 +97,19 @@
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
#ifdef ARCH_TEST_RSA_2048
-{"Test psa_generate_key with RSA 2048 Public key\n", 9, PSA_KEY_TYPE_RSA_PUBLIC_KEY,
+{"Test psa_generate_key with RSA 2048 Public key\n", 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, {1190, 1194}, PSA_ERROR_NOT_SUPPORTED
},
#endif
#endif
-{"Test psa_generate_key with invalid key type\n", 10, 0,
+{"Test psa_generate_key with invalid key type\n", 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, AES_16B_KEY_SIZE}, PSA_ERROR_NOT_SUPPORTED
},
-{"Test psa_generate_key with invalid usage flags\n", 11, PSA_KEY_TYPE_AES,
+{"Test psa_generate_key with invalid usage flags\n", 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, AES_16B_KEY_SIZE}, PSA_ERROR_INVALID_ARGUMENT
},
diff --git a/api-tests/dev_apis/crypto/test_c017/test_c017.c b/api-tests/dev_apis/crypto/test_c017/test_c017.c
index 9088ddf..6fdcb48 100644
--- a/api-tests/dev_apis/crypto/test_c017/test_c017.c
+++ b/api-tests/dev_apis/crypto/test_c017/test_c017.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");
@@ -21,7 +21,7 @@
#include "test_data.h"
#include "val_crypto.h"
-client_test_t test_c017_crypto_list[] = {
+const client_test_t test_c017_crypto_list[] = {
NULL,
psa_generate_random_test,
NULL,
diff --git a/api-tests/dev_apis/crypto/test_c017/test_c017.h b/api-tests/dev_apis/crypto/test_c017/test_c017.h
index aaf24a0..56f5aa2 100644
--- a/api-tests/dev_apis/crypto/test_c017/test_c017.h
+++ b/api-tests/dev_apis/crypto/test_c017/test_c017.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c017_crypto_list[];
+extern const client_test_t test_c017_crypto_list[];
int32_t psa_generate_random_test(caller_security_t caller);
#endif /* _TEST_C017_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/crypto/test_c017/test_data.h b/api-tests/dev_apis/crypto/test_c017/test_data.h
index 53a7c24..49b7a5f 100644
--- a/api-tests/dev_apis/crypto/test_c017/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c017/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");
@@ -23,7 +23,7 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
{"Test psa_generate_random to get 0 Byte data\n", 0, PSA_SUCCESS
},
diff --git a/api-tests/dev_apis/crypto/test_c018/test_c018.c b/api-tests/dev_apis/crypto/test_c018/test_c018.c
index 154d4d6..5754495 100644
--- a/api-tests/dev_apis/crypto/test_c018/test_c018.c
+++ b/api-tests/dev_apis/crypto/test_c018/test_c018.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");
@@ -21,7 +21,7 @@
#include "test_data.h"
#include "val_crypto.h"
-client_test_t test_c018_crypto_list[] = {
+const client_test_t test_c018_crypto_list[] = {
NULL,
psa_key_derivation_input_key_test,
psa_key_derivation_input_key_negative_test,
@@ -37,6 +37,7 @@
int num_checks = sizeof(check1)/sizeof(check1[0]);
psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -97,7 +98,7 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
if (check1[i].expected_status == PSA_SUCCESS)
@@ -106,7 +107,7 @@
* failure.
*/
status = val->crypto_function(VAL_CRYPTO_KEY_DERIVATION_INPUT_KEY, &operation,
- check1[i].step, check1[i].key_handle);
+ check1[i].step, key_handle);
TEST_ASSERT_EQUAL(status, PSA_ERROR_BAD_STATE, TEST_CHECKPOINT_NUM(4));
}
@@ -117,7 +118,7 @@
/* Provide an input for key derivation or key agreement */
status = val->crypto_function(VAL_CRYPTO_KEY_DERIVATION_INPUT_KEY, &operation,
- check1[i].step, check1[i].key_handle);
+ check1[i].step, key_handle);
TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(6));
if (check1[i].expected_status != PSA_SUCCESS)
@@ -129,12 +130,12 @@
continue;
}
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(8));
/* Provide an input for key derivation or key agreement */
status = val->crypto_function(VAL_CRYPTO_KEY_DERIVATION_INPUT_KEY, &operation,
- check1[i].step, check1[i].key_handle);
+ check1[i].step, key_handle);
TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(9));
/* Abort the key derivation operation */
@@ -153,6 +154,7 @@
int32_t i, status;
int num_checks = sizeof(check2)/sizeof(check2[0]);
psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
+ psa_key_handle_t key_handle = 11;
/* Initialize the PSA crypto library*/
status = val->crypto_function(VAL_CRYPTO_INIT);
@@ -175,7 +177,7 @@
/* Provide an input for key derivation or key agreement */
status = val->crypto_function(VAL_CRYPTO_KEY_DERIVATION_INPUT_KEY, &operation,
- check2[i].step, check2[i].key_handle);
+ check2[i].step, key_handle);
TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(4));
/* Abort the key derivation operation */
diff --git a/api-tests/dev_apis/crypto/test_c018/test_c018.h b/api-tests/dev_apis/crypto/test_c018/test_c018.h
index 02555ba..429379a 100644
--- a/api-tests/dev_apis/crypto/test_c018/test_c018.h
+++ b/api-tests/dev_apis/crypto/test_c018/test_c018.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c018_crypto_list[];
+extern const client_test_t test_c018_crypto_list[];
int32_t psa_key_derivation_input_key_test(caller_security_t caller);
int32_t psa_key_derivation_input_key_negative_test(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c018/test_data.h b/api-tests/dev_apis/crypto/test_c018/test_data.h
index 56d26fc..14d777b 100644
--- a/api-tests/dev_apis/crypto/test_c018/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c018/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[34];
uint32_t key_length;
@@ -163,9 +162,9 @@
0x68, 0x49, 0xf9, 0x7d, 0x10, 0x66, 0xf6, 0x99, 0x77, 0x59, 0x63, 0x7c, 0x7e, 0x38,
0x99, 0x46, 0x4c, 0xee, 0x3e, 0xc7, 0xac, 0x97, 0x06, 0x53, 0xa0, 0xbe, 0x07, 0x42};
-static test_data check1[] = {
+static const test_data check1[] = {
-{"Test psa_key_derivation_input_key 16 Byte Key\n", 1, PSA_KEY_TYPE_DERIVE,
+{"Test psa_key_derivation_input_key 16 Byte Key\n", PSA_KEY_TYPE_DERIVE,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x77},
AES_16B_KEY_SIZE, 0, PSA_KEY_USAGE_DERIVE, PSA_ALG_HKDF(PSA_ALG_SHA_256),
@@ -173,7 +172,7 @@
BYTES_TO_BITS(AES_16B_KEY_SIZE), AES_16B_KEY_SIZE, PSA_SUCCESS
},
-{"Test psa_key_derivation_input_key with invalid usage\n", 2, PSA_KEY_TYPE_DERIVE,
+{"Test psa_key_derivation_input_key with invalid usage\n", PSA_KEY_TYPE_DERIVE,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x77},
AES_16B_KEY_SIZE, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_HKDF(PSA_ALG_SHA_256),
@@ -181,7 +180,7 @@
BYTES_TO_BITS(AES_16B_KEY_SIZE), AES_16B_KEY_SIZE, PSA_ERROR_NOT_PERMITTED
},
-{"Test psa_key_derivation_input_key with step as label\n", 3, PSA_KEY_TYPE_DERIVE,
+{"Test psa_key_derivation_input_key with step as label\n", PSA_KEY_TYPE_DERIVE,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x77},
AES_16B_KEY_SIZE, 0, PSA_KEY_USAGE_DERIVE, PSA_ALG_HKDF(PSA_ALG_SHA_256),
@@ -189,7 +188,7 @@
BYTES_TO_BITS(AES_16B_KEY_SIZE), AES_16B_KEY_SIZE, PSA_ERROR_INVALID_ARGUMENT
},
-{"Test psa_key_derivation_input_key with step as info\n", 4, PSA_KEY_TYPE_DERIVE,
+{"Test psa_key_derivation_input_key with step as info\n", PSA_KEY_TYPE_DERIVE,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x77},
AES_16B_KEY_SIZE, 0, PSA_KEY_USAGE_DERIVE, PSA_ALG_HKDF(PSA_ALG_SHA_256),
@@ -197,7 +196,7 @@
BYTES_TO_BITS(AES_16B_KEY_SIZE), AES_16B_KEY_SIZE, PSA_ERROR_INVALID_ARGUMENT
},
-{"Test psa_key_derivation_input_key with step as seed\n", 5, PSA_KEY_TYPE_DERIVE,
+{"Test psa_key_derivation_input_key with step as seed\n", PSA_KEY_TYPE_DERIVE,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x77},
AES_16B_KEY_SIZE, 0, PSA_KEY_USAGE_DERIVE, PSA_ALG_HKDF(PSA_ALG_SHA_256),
@@ -205,7 +204,7 @@
BYTES_TO_BITS(AES_16B_KEY_SIZE), AES_16B_KEY_SIZE, PSA_ERROR_INVALID_ARGUMENT
},
-{"Test psa_key_derivation_input_key with step as salt\n", 6, PSA_KEY_TYPE_DERIVE,
+{"Test psa_key_derivation_input_key with step as salt\n", PSA_KEY_TYPE_DERIVE,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x77},
AES_16B_KEY_SIZE, 0, PSA_KEY_USAGE_DERIVE, PSA_ALG_HKDF(PSA_ALG_SHA_256),
@@ -214,7 +213,7 @@
},
#ifdef ARCH_TEST_AES_192
-{"Test psa_key_derivation_input_key with key type as AES(not derive)\n", 7, PSA_KEY_TYPE_AES,
+{"Test psa_key_derivation_input_key with key type as AES(not derive)\n", PSA_KEY_TYPE_AES,
{0x24, 0x13, 0x61, 0x47, 0x61, 0xB8, 0xC8, 0xF0, 0xDF, 0xAB, 0x5A, 0x0E, 0x87,
0x40, 0xAC, 0xA3, 0x90, 0x77, 0x83, 0x52, 0x31, 0x74, 0xF9, 0x05},
AES_24B_KEY_SIZE, 0, PSA_KEY_USAGE_DERIVE, PSA_ALG_HKDF(PSA_ALG_SHA_256),
@@ -223,7 +222,7 @@
},
#endif
-{"Test psa_key_derivation_input_key incorrect key algorithm\n", 8, PSA_KEY_TYPE_DERIVE,
+{"Test psa_key_derivation_input_key incorrect key algorithm\n", PSA_KEY_TYPE_DERIVE,
{0xEA, 0xD5, 0xE6, 0xC8, 0x51, 0xF9, 0xEC, 0xBB, 0x9B, 0x57, 0x7C, 0xED, 0xD2,
0x4B, 0x82, 0x84, 0x9F, 0x9F, 0xE6, 0x73, 0x21, 0x3D, 0x1A, 0x05, 0xC9, 0xED,
0xDF, 0x25, 0x17, 0x68, 0x86, 0xAE},
@@ -234,14 +233,14 @@
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
#ifdef ARCH_TEST_RSA_2048
-{"Test psa_key_derivation_input_key 2048 RSA public key\n", 9, PSA_KEY_TYPE_RSA_PUBLIC_KEY,
+{"Test psa_key_derivation_input_key 2048 RSA public key\n", PSA_KEY_TYPE_RSA_PUBLIC_KEY,
{0},
270, 0, PSA_KEY_USAGE_DERIVE, PSA_ALG_HKDF(PSA_ALG_SHA_256), PSA_KEY_DERIVATION_INPUT_SECRET,
PSA_ALG_HKDF(PSA_ALG_SHA_256),
2048, 270, PSA_ERROR_INVALID_ARGUMENT,
},
-{"Test psa_key_derivation_input_key with RSA 2048 keypair\n", 10, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_key_derivation_input_key with RSA 2048 keypair\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0},
1193, 0, PSA_KEY_USAGE_DERIVE, PSA_ALG_HKDF(PSA_ALG_SHA_256), PSA_KEY_DERIVATION_INPUT_SECRET,
PSA_ALG_HKDF(PSA_ALG_SHA_256),
@@ -250,7 +249,7 @@
#endif
#endif
-{"Test psa_key_derivation_input_key with zero as step\n", 1, PSA_KEY_TYPE_DERIVE,
+{"Test psa_key_derivation_input_key with zero as step\n", PSA_KEY_TYPE_DERIVE,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x77},
AES_16B_KEY_SIZE, 0, PSA_KEY_USAGE_DERIVE, PSA_ALG_HKDF(PSA_ALG_SHA_256),
@@ -259,9 +258,9 @@
},
};
-static test_data check2[] = {
+static const test_data check2[] = {
-{"Test psa_key_derivation_input_key invalid handle\n", 11, PSA_KEY_TYPE_DERIVE,
+{"Test psa_key_derivation_input_key invalid handle\n", PSA_KEY_TYPE_DERIVE,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x77},
AES_16B_KEY_SIZE, 0, PSA_KEY_USAGE_DERIVE, PSA_ALG_HKDF(PSA_ALG_SHA_256),
diff --git a/api-tests/dev_apis/crypto/test_c019/test_c019.c b/api-tests/dev_apis/crypto/test_c019/test_c019.c
index 7593f8c..f2dc24b 100644
--- a/api-tests/dev_apis/crypto/test_c019/test_c019.c
+++ b/api-tests/dev_apis/crypto/test_c019/test_c019.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");
@@ -20,7 +20,7 @@
#include "test_c019.h"
#include "test_data.h"
-client_test_t test_c019_crypto_list[] = {
+const client_test_t test_c019_crypto_list[] = {
NULL,
psa_key_derivation_key_agreement_test,
psa_key_derivation_key_agreement_negative_test,
@@ -35,6 +35,7 @@
int32_t i, status;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -62,7 +63,7 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Set up a key agreement operation */
@@ -72,7 +73,7 @@
/* Perform a key agreement */
status = val->crypto_function(VAL_CRYPTO_KEY_DERIVATION_KEY_AGREEMENT, &operation,
- check1[i].step, check1[i].key_handle, check1[i].peer_key,
+ check1[i].step, key_handle, check1[i].peer_key,
check1[i].peer_key_length);
TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(5));
@@ -87,7 +88,7 @@
continue;
/* Destroy a key and restore the slot to its default state */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(7));
}
@@ -98,7 +99,8 @@
{
int32_t i, status;
int num_checks = sizeof(check2)/sizeof(check2[0]);
- psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
+ psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
+ psa_key_handle_t key_handle = 8;
/* Initialize the PSA crypto library*/
status = val->crypto_function(VAL_CRYPTO_INIT);
@@ -119,7 +121,7 @@
/* Set up a key agreement operation */
status = val->crypto_function(VAL_CRYPTO_KEY_DERIVATION_KEY_AGREEMENT, &operation,
- check2[i].step, check2[i].key_handle, check2[i].peer_key,
+ check2[i].step, key_handle, check2[i].peer_key,
check2[i].peer_key_length);
TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(4));
diff --git a/api-tests/dev_apis/crypto/test_c019/test_c019.h b/api-tests/dev_apis/crypto/test_c019/test_c019.h
index 40f2a36..33e9fdb 100644
--- a/api-tests/dev_apis/crypto/test_c019/test_c019.h
+++ b/api-tests/dev_apis/crypto/test_c019/test_c019.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c019_crypto_list[];
+extern const client_test_t test_c019_crypto_list[];
int32_t psa_key_derivation_key_agreement_test(caller_security_t caller);
int32_t psa_key_derivation_key_agreement_negative_test(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c019/test_data.h b/api-tests/dev_apis/crypto/test_c019/test_data.h
index 4ce7bd7..0e6f24b 100644
--- a/api-tests/dev_apis/crypto/test_c019/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c019/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[85];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[91];
uint32_t key_length;
@@ -32,10 +31,10 @@
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_ECDH
#ifdef ARCH_TEST_ECC_CURVE_SECP256R1
-{"Test psa_key_derivation_key_agreement - ECDH SECP256R1\n", 1,
+{"Test psa_key_derivation_key_agreement - ECDH SECP256R1\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP256R1),
{0xc8, 0x8f, 0x01, 0xf5, 0x10, 0xd9, 0xac, 0x3f, 0x70, 0xa2, 0x92, 0xda, 0xa2,
0x31, 0x6d, 0xe5, 0x44, 0xe9, 0xaa, 0xb8, 0xaf, 0xe8, 0x40, 0x49, 0xc6, 0x2a,
@@ -50,7 +49,7 @@
65, PSA_SUCCESS
},
-{"Test psa_key_derivation_key_agreement - Invalid step\n", 2,
+{"Test psa_key_derivation_key_agreement - Invalid step\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP256R1),
{0xc8, 0x8f, 0x01, 0xf5, 0x10, 0xd9, 0xac, 0x3f, 0x70, 0xa2, 0x92, 0xda, 0xa2,
0x31, 0x6d, 0xe5, 0x44, 0xe9, 0xaa, 0xb8, 0xaf, 0xe8, 0x40, 0x49, 0xc6, 0x2a,
@@ -68,7 +67,7 @@
#endif
#ifdef ARCH_TEST_ECC_CURVE_SECP384R1
-{"Test psa_key_derivation_key_agreement - ECDH SECP384R1\n", 3,
+{"Test psa_key_derivation_key_agreement - ECDH SECP384R1\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP384R1),
{0x09, 0x9f, 0x3c, 0x70, 0x34, 0xd4, 0xa2, 0xc6, 0x99, 0x88, 0x4d, 0x73, 0xa3,
0x75, 0xa6, 0x7f, 0x76, 0x24, 0xef, 0x7c, 0x6b, 0x3c, 0x0f, 0x16, 0x06, 0x47,
@@ -90,7 +89,7 @@
#endif
#ifdef ARCH_TEST_ECC_CURVE_SECP256R1
-{"Test psa_key_derivation_key_agreement - Invalid usage\n", 4,
+{"Test psa_key_derivation_key_agreement - Invalid usage\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP256R1),
{0xc8, 0x8f, 0x01, 0xf5, 0x10, 0xd9, 0xac, 0x3f, 0x70, 0xa2, 0x92, 0xda, 0xa2,
0x31, 0x6d, 0xe5, 0x44, 0xe9, 0xaa, 0xb8, 0xaf, 0xe8, 0x40, 0x49, 0xc6, 0x2a,
@@ -111,7 +110,7 @@
#ifdef ARCH_TEST_ECC_CURVE_SECP256R1
#ifdef ARCH_TEST_SHA256
#ifdef ARCH_TEST_HKDF
-{"Test psa_key_derivation_key_agreement - KDF instead of a key agreement algorithm\n", 5,
+{"Test psa_key_derivation_key_agreement - KDF instead of a key agreement algorithm\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP256R1),
{0xc8, 0x8f, 0x01, 0xf5, 0x10, 0xd9, 0xac, 0x3f, 0x70, 0xa2, 0x92, 0xda, 0xa2,
0x31, 0x6d, 0xe5, 0x44, 0xe9, 0xaa, 0xb8, 0xaf, 0xe8, 0x40, 0x49, 0xc6, 0x2a,
@@ -129,7 +128,7 @@
#endif
#ifdef ARCH_TEST_ECDH
-{"Test psa_key_derivation_key_agreement - Public key on different curve\n", 6,
+{"Test psa_key_derivation_key_agreement - Public key on different curve\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP256R1),
{0xc8, 0x8f, 0x01, 0xf5, 0x10, 0xd9, 0xac, 0x3f, 0x70, 0xa2, 0x92, 0xda, 0xa2,
0x31, 0x6d, 0xe5, 0x44, 0xe9, 0xaa, 0xb8, 0xaf, 0xe8, 0x40, 0x49, 0xc6, 0x2a,
@@ -148,7 +147,7 @@
PSA_ERROR_INVALID_ARGUMENT
},
-{"Test psa_key_derivation_key_agreement - Public key instead of private key\n", 7,
+{"Test psa_key_derivation_key_agreement - Public key instead of private key\n",
PSA_KEY_TYPE_ECC_PUBLIC_KEY(PSA_ECC_CURVE_SECP256R1),
{0x04, 0xd1, 0x2d, 0xfb, 0x52, 0x89, 0xc8, 0xd4, 0xf8, 0x12, 0x08, 0xb7, 0x02,
0x70, 0x39, 0x8c, 0x34, 0x22, 0x96, 0x97, 0x0a, 0x0b, 0xcc, 0xb7, 0x4c, 0x73,
@@ -169,10 +168,10 @@
#endif
};
-static test_data check2[] = {
+static const test_data check2[] = {
#ifdef ARCH_TEST_ECDH
#ifdef ARCH_TEST_ECC_CURVE_SECP256R1
-{"Test psa_key_derivation_key_agreement - Negative case\n", 8,
+{"Test psa_key_derivation_key_agreement - Negative case\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP256R1),
{0xc8, 0x8f, 0x01, 0xf5, 0x10, 0xd9, 0xac, 0x3f, 0x70, 0xa2, 0x92, 0xda, 0xa2,
0x31, 0x6d, 0xe5, 0x44, 0xe9, 0xaa, 0xb8, 0xaf, 0xe8, 0x40, 0x49, 0xc6, 0x2a,
diff --git a/api-tests/dev_apis/crypto/test_c020/test_c020.c b/api-tests/dev_apis/crypto/test_c020/test_c020.c
index b4f4037..b954fdb 100644
--- a/api-tests/dev_apis/crypto/test_c020/test_c020.c
+++ b/api-tests/dev_apis/crypto/test_c020/test_c020.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");
@@ -21,7 +21,7 @@
#include "test_data.h"
#include "val_crypto.h"
-client_test_t test_c020_crypto_list[] = {
+const client_test_t test_c020_crypto_list[] = {
NULL,
psa_key_derivation_output_bytes_test,
NULL,
@@ -36,6 +36,7 @@
int num_checks = sizeof(check1)/sizeof(check1[0]);
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -66,7 +67,7 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
}
@@ -85,7 +86,7 @@
{
/* Provide an input for key derivation or key agreement */
status = val->crypto_function(VAL_CRYPTO_KEY_DERIVATION_INPUT_KEY, &operation,
- check1[i].step, check1[i].key_handle);
+ check1[i].step, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(6));
}
else
@@ -102,7 +103,7 @@
if (check1[i].step == PSA_KEY_DERIVATION_INPUT_SECRET)
{
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(9));
/* Reset the key attributes and check if psa_import_key fails */
diff --git a/api-tests/dev_apis/crypto/test_c020/test_c020.h b/api-tests/dev_apis/crypto/test_c020/test_c020.h
index 3e3cdb3..ce60af6 100644
--- a/api-tests/dev_apis/crypto/test_c020/test_c020.h
+++ b/api-tests/dev_apis/crypto/test_c020/test_c020.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c020_crypto_list[];
+extern const client_test_t test_c020_crypto_list[];
int32_t psa_key_derivation_output_bytes_test(caller_security_t caller);
#endif /* _TEST_C020_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/crypto/test_c020/test_data.h b/api-tests/dev_apis/crypto/test_c020/test_data.h
index e1c6bbf..de8ec52 100644
--- a/api-tests/dev_apis/crypto/test_c020/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c020/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[34];
uint32_t key_length;
@@ -33,8 +32,8 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
-{"Test psa_key_derivation_output_bytes - Key\n", 1, PSA_KEY_TYPE_DERIVE,
+static const test_data check1[] = {
+{"Test psa_key_derivation_output_bytes - Key\n", PSA_KEY_TYPE_DERIVE,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x77},
AES_16B_KEY_SIZE, 42, PSA_KEY_USAGE_DERIVE,
@@ -43,31 +42,31 @@
PSA_SUCCESS
},
-{"Test psa_key_derivation_output_bytes - Info\n", 2, PSA_KEY_TYPE_DERIVE,
+{"Test psa_key_derivation_output_bytes - Info\n", PSA_KEY_TYPE_DERIVE,
{0}, 0, 42, 0, PSA_ALG_KEY_AGREEMENT(PSA_ALG_ECDH, PSA_ALG_HKDF(PSA_ALG_SHA_256)),
PSA_KEY_DERIVATION_INPUT_INFO, 42, "This is the info", 16,
PSA_SUCCESS
},
-{"Test psa_key_derivation_output_bytes - Salt\n", 3, PSA_KEY_TYPE_DERIVE,
+{"Test psa_key_derivation_output_bytes - Salt\n", PSA_KEY_TYPE_DERIVE,
{0}, 0, 42, 0, PSA_ALG_KEY_AGREEMENT(PSA_ALG_ECDH, PSA_ALG_HKDF(PSA_ALG_SHA_256)),
PSA_KEY_DERIVATION_INPUT_SALT, 42, "This is the info", 16,
PSA_ERROR_BAD_STATE
},
-{"Test psa_key_derivation_output_bytes - Label\n", 4, PSA_KEY_TYPE_DERIVE,
+{"Test psa_key_derivation_output_bytes - Label\n", PSA_KEY_TYPE_DERIVE,
{0}, 0, 42, 0, PSA_ALG_KEY_AGREEMENT(PSA_ALG_ECDH, PSA_ALG_HKDF(PSA_ALG_SHA_256)),
PSA_KEY_DERIVATION_INPUT_LABEL, 42, "This is the info", 16,
PSA_ERROR_BAD_STATE
},
-{"Test psa_key_derivation_output_bytes - Seed\n", 5, PSA_KEY_TYPE_DERIVE,
+{"Test psa_key_derivation_output_bytes - Seed\n", PSA_KEY_TYPE_DERIVE,
{0}, 0, 42, 0, PSA_ALG_KEY_AGREEMENT(PSA_ALG_ECDH, PSA_ALG_HKDF(PSA_ALG_SHA_256)),
PSA_KEY_DERIVATION_INPUT_SEED, 42, "This is the info", 16,
PSA_ERROR_BAD_STATE
},
-{"Test psa_key_derivation_output_bytes - Greater Capacity than available\n", 6, PSA_KEY_TYPE_DERIVE,
+{"Test psa_key_derivation_output_bytes - 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},
AES_16B_KEY_SIZE, BUFFER_SIZE, PSA_KEY_USAGE_DERIVE,
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 78a3571..6d3ff4e 100644
--- a/api-tests/dev_apis/crypto/test_c021/test_c021.c
+++ b/api-tests/dev_apis/crypto/test_c021/test_c021.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");
@@ -24,7 +24,7 @@
#define SLOT_1 1
#define SLOT_2 2
-client_test_t test_c021_crypto_list[] = {
+const client_test_t test_c021_crypto_list[] = {
NULL,
psa_key_derivation_output_key_test,
NULL,
@@ -40,6 +40,7 @@
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_key_attributes_t derv_attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
+ psa_key_handle_t tdata_key_handle;
if (num_checks == 0)
{
@@ -70,7 +71,7 @@
{
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &tdata_key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
}
@@ -89,7 +90,7 @@
{
/* Provide an input for key derivation or key agreement */
status = val->crypto_function(VAL_CRYPTO_KEY_DERIVATION_INPUT_KEY, &operation,
- check1[i].step, check1[i].key_handle);
+ check1[i].step, tdata_key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(6));
}
else
@@ -114,7 +115,7 @@
if (check1[i].step == PSA_KEY_DERIVATION_INPUT_SECRET)
{
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, tdata_key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(9));
}
diff --git a/api-tests/dev_apis/crypto/test_c021/test_c021.h b/api-tests/dev_apis/crypto/test_c021/test_c021.h
index 787fa99..90daec8 100644
--- a/api-tests/dev_apis/crypto/test_c021/test_c021.h
+++ b/api-tests/dev_apis/crypto/test_c021/test_c021.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c021_crypto_list[];
+extern const client_test_t test_c021_crypto_list[];
int32_t psa_key_derivation_output_key_test(caller_security_t caller);
#endif /* _TEST_C021_CLIENT_TESTS_H_ */
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 6a31c78..2b89b63 100644
--- a/api-tests/dev_apis/crypto/test_c021/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c021/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[34];
uint32_t key_length;
@@ -36,8 +35,8 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
-{"Test psa_key_derivation_output_key - Key\n", 1, PSA_KEY_TYPE_DERIVE,
+static const test_data check1[] = {
+{"Test psa_key_derivation_output_key - Key\n", PSA_KEY_TYPE_DERIVE,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x77},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_DERIVE,
@@ -48,7 +47,7 @@
PSA_SUCCESS
},
-{"Test psa_key_derivation_output_key - Info\n", 1, PSA_KEY_TYPE_DERIVE,
+{"Test psa_key_derivation_output_key - Info\n", PSA_KEY_TYPE_DERIVE,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x77},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_DERIVE,
@@ -59,7 +58,7 @@
PSA_SUCCESS
},
-{"Test psa_key_derivation_output_key - Label\n", 1, PSA_KEY_TYPE_DERIVE,
+{"Test psa_key_derivation_output_key - Label\n", PSA_KEY_TYPE_DERIVE,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x77},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_DERIVE,
@@ -70,7 +69,7 @@
PSA_SUCCESS
},
-{"Test psa_key_derivation_output_key - Seed\n", 1, PSA_KEY_TYPE_DERIVE,
+{"Test psa_key_derivation_output_key - Seed\n", PSA_KEY_TYPE_DERIVE,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x77},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_DERIVE,
@@ -81,7 +80,7 @@
PSA_SUCCESS
},
-{"Test psa_key_derivation_output_key - Salt\n", 1, PSA_KEY_TYPE_DERIVE,
+{"Test psa_key_derivation_output_key - Salt\n", PSA_KEY_TYPE_DERIVE,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x77},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_DERIVE,
@@ -92,7 +91,7 @@
PSA_SUCCESS
},
-{"Test psa_key_derivation_output_key - DES key export\n", 1, PSA_KEY_TYPE_DERIVE,
+{"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},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_DERIVE,
@@ -103,7 +102,7 @@
PSA_SUCCESS
},
-{"Test psa_key_derivation_output_key - Greater Capacity than available\n", 1, PSA_KEY_TYPE_DERIVE,
+{"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},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_DERIVE,
@@ -114,7 +113,7 @@
PSA_ERROR_INSUFFICIENT_DATA
},
-{"Test psa_key_derivation_output_key - ECC Public key\n", 1, PSA_KEY_TYPE_DERIVE,
+{"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},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_DERIVE,
@@ -124,7 +123,7 @@
PSA_ERROR_NOT_SUPPORTED,
},
-{"Test psa_key_derivation_output_key - ECC keypair\n", 1, PSA_KEY_TYPE_DERIVE,
+{"Test psa_key_derivation_output_key - ECC keypair\n", PSA_KEY_TYPE_DERIVE,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x77},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_DERIVE,
@@ -135,7 +134,7 @@
PSA_SUCCESS
},
-{"Test psa_key_derivation_output_key - RSA Public Key", 1, PSA_KEY_TYPE_DERIVE,
+{"Test psa_key_derivation_output_key - RSA Public Key", PSA_KEY_TYPE_DERIVE,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x77},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_DERIVE,
@@ -146,7 +145,7 @@
PSA_ERROR_NOT_SUPPORTED,
},
-{"Test psa_key_derivation_output_key - RSA keypair\n", 1, PSA_KEY_TYPE_DERIVE,
+{"Test psa_key_derivation_output_key - RSA keypair\n", PSA_KEY_TYPE_DERIVE,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x77},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_DERIVE,
@@ -157,7 +156,7 @@
PSA_SUCCESS
},
-{"Test psa_key_derivation_output_key - Invalid key size\n", 1, PSA_KEY_TYPE_DERIVE,
+{"Test psa_key_derivation_output_key - Invalid key size\n", PSA_KEY_TYPE_DERIVE,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x77},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_DERIVE,
diff --git a/api-tests/dev_apis/crypto/test_c022/test_c022.c b/api-tests/dev_apis/crypto/test_c022/test_c022.c
index 1949c73..3c96266 100644
--- a/api-tests/dev_apis/crypto/test_c022/test_c022.c
+++ b/api-tests/dev_apis/crypto/test_c022/test_c022.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");
@@ -22,7 +22,7 @@
#include "val_crypto.h"
-client_test_t test_c022_crypto_list[] = {
+const client_test_t test_c022_crypto_list[] = {
NULL,
psa_key_derivation_abort_test,
NULL,
diff --git a/api-tests/dev_apis/crypto/test_c022/test_c022.h b/api-tests/dev_apis/crypto/test_c022/test_c022.h
index 7823370..12377a2 100644
--- a/api-tests/dev_apis/crypto/test_c022/test_c022.h
+++ b/api-tests/dev_apis/crypto/test_c022/test_c022.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c022_crypto_list[];
+extern const client_test_t test_c022_crypto_list[];
int32_t psa_key_derivation_abort_test(caller_security_t caller);
#endif /* _TEST_C022_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/crypto/test_c023/test_c023.c b/api-tests/dev_apis/crypto/test_c023/test_c023.c
index 5f019a4..5fee88e 100644
--- a/api-tests/dev_apis/crypto/test_c023/test_c023.c
+++ b/api-tests/dev_apis/crypto/test_c023/test_c023.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");
@@ -21,7 +21,7 @@
#include "test_data.h"
#include "val_crypto.h"
-client_test_t test_c023_crypto_list[] = {
+const client_test_t test_c023_crypto_list[] = {
NULL,
psa_key_derivation_set_get_capacity_test,
NULL,
diff --git a/api-tests/dev_apis/crypto/test_c023/test_c023.h b/api-tests/dev_apis/crypto/test_c023/test_c023.h
index 1fc9fbf..1e422d4 100644
--- a/api-tests/dev_apis/crypto/test_c023/test_c023.h
+++ b/api-tests/dev_apis/crypto/test_c023/test_c023.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c023_crypto_list[];
+extern const client_test_t test_c023_crypto_list[];
int32_t psa_key_derivation_set_get_capacity_test(caller_security_t caller);
#endif /* _TEST_C023_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/crypto/test_c023/test_data.h b/api-tests/dev_apis/crypto/test_c023/test_data.h
index 1bc6455..86be318 100644
--- a/api-tests/dev_apis/crypto/test_c023/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c023/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");
@@ -24,7 +24,7 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
{"Test psa_key_derivation_set_get_capacity - Less than operation's capacity\n",
PSA_ALG_HKDF(PSA_ALG_SHA_256), 42, PSA_SUCCESS
},
diff --git a/api-tests/dev_apis/crypto/test_c024/test_c024.c b/api-tests/dev_apis/crypto/test_c024/test_c024.c
index ae709d6..a487b4a 100644
--- a/api-tests/dev_apis/crypto/test_c024/test_c024.c
+++ b/api-tests/dev_apis/crypto/test_c024/test_c024.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");
@@ -20,7 +20,7 @@
#include "test_c024.h"
#include "test_data.h"
-client_test_t test_c024_crypto_list[] = {
+const client_test_t test_c024_crypto_list[] = {
NULL,
psa_aead_encrypt_test,
NULL,
@@ -49,6 +49,7 @@
int num_checks = sizeof(check1)/sizeof(check1[0]);
uint8_t *nonce, *additional_data;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -76,7 +77,7 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
if (is_buffer_empty(check1[i].nonce, check1[i].nonce_length) == TRUE)
@@ -96,7 +97,7 @@
additional_data = check1[i].additional_data;
/* Process an authenticated encryption operation */
- status = val->crypto_function(VAL_CRYPTO_AEAD_ENCRYPT, check1[i].key_handle,
+ status = val->crypto_function(VAL_CRYPTO_AEAD_ENCRYPT, key_handle,
check1[i].key_alg, nonce, check1[i].nonce_length, additional_data,
check1[i].additional_data_length, check1[i].plaintext,
check1[i].plaintext_length, ciphertext, check1[i].ciphertext_size,
@@ -106,7 +107,7 @@
if (check1[i].expected_status != PSA_SUCCESS)
{
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(5));
continue;
@@ -122,14 +123,14 @@
TEST_CHECKPOINT_NUM(7));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(8));
/* Reset the key attributes and check if psa_import_key fails */
val->crypto_function(VAL_CRYPTO_RESET_KEY_ATTRIBUTES, &attributes);
/* Process an authenticated encryption operation on a destroyed key*/
- status = val->crypto_function(VAL_CRYPTO_AEAD_ENCRYPT, check1[i].key_handle,
+ status = val->crypto_function(VAL_CRYPTO_AEAD_ENCRYPT, key_handle,
check1[i].key_alg, nonce, check1[i].nonce_length, additional_data,
check1[i].additional_data_length, check1[i].plaintext,
check1[i].plaintext_length, ciphertext, check1[i].ciphertext_size,
diff --git a/api-tests/dev_apis/crypto/test_c024/test_c024.h b/api-tests/dev_apis/crypto/test_c024/test_c024.h
index 3b61390..7d39841 100644
--- a/api-tests/dev_apis/crypto/test_c024/test_c024.h
+++ b/api-tests/dev_apis/crypto/test_c024/test_c024.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c024_crypto_list[];
+extern const client_test_t test_c024_crypto_list[];
int32_t psa_aead_encrypt_test(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c024/test_data.h b/api-tests/dev_apis/crypto/test_c024/test_data.h
index dfe2f1f..6a493b2 100644
--- a/api-tests/dev_apis/crypto/test_c024/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c024/test_data.h
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[32];
uint32_t key_length;
@@ -40,7 +39,7 @@
static test_data check1[] = {
#ifdef ARCH_TEST_CCM
#ifdef ARCH_TEST_AES_128
-{"Test psa_aead_encrypt - CCM - 16B AES - 13B nounce & 8B addi data\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_aead_encrypt - CCM - 16B AES - 13B nounce & 8B addi data\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM,
@@ -55,7 +54,7 @@
BUFFER_SIZE, 39, PSA_SUCCESS
},
-{"Test psa_aead_encrypt - AES-CCM\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_aead_encrypt - AES-CCM\n", PSA_KEY_TYPE_AES,
{0x41, 0x89, 0x35, 0x1B, 0x5C, 0xAE, 0xA3, 0x75, 0xA0, 0x29, 0x9E, 0x81, 0xC6,
0x21, 0xBF, 0x43}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM,
{0x48, 0xc0, 0x90, 0x69, 0x30, 0x56, 0x1e, 0x0a, 0xb0, 0xef, 0x4c, 0xd9, 0x72},
@@ -71,7 +70,7 @@
0xe9}, BUFFER_SIZE, 40, PSA_SUCCESS
},
-{"Test psa_aead_encrypt - AES-CCM 24 bytes Tag length = 4\n", 3, PSA_KEY_TYPE_AES,
+{"Test psa_aead_encrypt - AES-CCM 24 bytes Tag length = 4\n", PSA_KEY_TYPE_AES,
{0x41, 0x89, 0x35, 0x1B, 0x5C, 0xAE, 0xA3, 0x75, 0xA0, 0x29, 0x9E, 0x81, 0xC6,
0x21, 0xBF, 0x43}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT,
PSA_ALG_AEAD_WITH_TAG_LENGTH(PSA_ALG_CCM, 4),
@@ -93,7 +92,7 @@
#ifdef ARCH_TEST_GCM
#ifdef ARCH_TEST_AES_128
{"Test psa_aead_encrypt - GCM - 16B AES - 12B Nounce & 12B addi data\n",
-4, PSA_KEY_TYPE_AES,
+PSA_KEY_TYPE_AES,
{0x3d, 0xe0, 0x98, 0x74, 0xb3, 0x88, 0xe6, 0x49, 0x19, 0x88, 0xd0, 0xc3, 0x60,
0x7e, 0xae, 0x1f}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_GCM,
{0x57, 0x69, 0x0e, 0x43, 0x4e, 0x28, 0x00, 0x00, 0xa2, 0xfc, 0xa1, 0xa3}, 12,
@@ -112,7 +111,7 @@
#ifdef ARCH_TEST_CCM
#ifdef ARCH_TEST_DES_1KEY
-{"Test psa_aead_encrypt - DES Key\n", 5, PSA_KEY_TYPE_DES,
+{"Test psa_aead_encrypt - DES Key\n", PSA_KEY_TYPE_DES,
{0x70, 0x24, 0x55, 0x0C, 0x14, 0x9D, 0xED, 0x29}, DES_8B_KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM,
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B}, 12,
@@ -126,7 +125,7 @@
#ifdef ARCH_TEST_AES_128
#ifdef ARCH_TEST_CIPER_MODE_CFB
-{"Test psa_aead_encrypt - Unsupported Algorithm\n", 6, PSA_KEY_TYPE_AES,
+{"Test psa_aead_encrypt - Unsupported Algorithm\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CFB,
{0}, 13, {0}, 0, "hello world", 11,
@@ -138,7 +137,7 @@
#endif
#ifdef ARCH_TEST_GCM
-{"Test psa_aead_encrypt - Invalid key usage\n", 7, PSA_KEY_TYPE_AES,
+{"Test psa_aead_encrypt - Invalid key usage\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_DECRYPT, PSA_ALG_GCM,
{0}, 13, {0}, 0, "hello world", 11,
@@ -148,7 +147,7 @@
BUFFER_SIZE, 27, PSA_ERROR_NOT_PERMITTED
},
-{"Test psa_aead_encrypt - Small output buffer size\n", 8, PSA_KEY_TYPE_AES,
+{"Test psa_aead_encrypt - Small output buffer size\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_DECRYPT, PSA_ALG_GCM,
{0}, 13, {0}, 0, "hello world", 11,
diff --git a/api-tests/dev_apis/crypto/test_c025/test_c025.c b/api-tests/dev_apis/crypto/test_c025/test_c025.c
index 51e6f72..8049b08 100644
--- a/api-tests/dev_apis/crypto/test_c025/test_c025.c
+++ b/api-tests/dev_apis/crypto/test_c025/test_c025.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");
@@ -20,7 +20,7 @@
#include "test_c025.h"
#include "test_data.h"
-client_test_t test_c025_crypto_list[] = {
+const client_test_t test_c025_crypto_list[] = {
NULL,
psa_aead_decrypt_test,
NULL,
@@ -49,6 +49,7 @@
int num_checks = sizeof(check1)/sizeof(check1[0]);
uint8_t *nonce, *additional_data;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -76,7 +77,7 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
if (is_buffer_empty(check1[i].nonce, check1[i].nonce_length) == TRUE)
@@ -96,7 +97,7 @@
additional_data = check1[i].additional_data;
/* Process an authenticated decryption operation */
- status = val->crypto_function(VAL_CRYPTO_AEAD_DECRYPT, check1[i].key_handle,
+ status = val->crypto_function(VAL_CRYPTO_AEAD_DECRYPT, key_handle,
check1[i].key_alg, nonce, check1[i].nonce_length, additional_data,
check1[i].additional_data_length, check1[i].ciphertext, check1[i].ciphertext_size,
plaintext, check1[i].plaintext_size, &plaintext_length);
@@ -105,7 +106,7 @@
if (check1[i].expected_status != PSA_SUCCESS)
{
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(5));
continue;
@@ -120,14 +121,14 @@
TEST_CHECKPOINT_NUM(7));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(8));
/* Reset the key attributes and check if psa_import_key fails */
val->crypto_function(VAL_CRYPTO_RESET_KEY_ATTRIBUTES, &attributes);
/* Process an authenticated decryption operation on a destroyed key handle */
- status = val->crypto_function(VAL_CRYPTO_AEAD_DECRYPT, check1[i].key_handle,
+ status = val->crypto_function(VAL_CRYPTO_AEAD_DECRYPT, key_handle,
check1[i].key_alg, nonce, check1[i].nonce_length, additional_data,
check1[i].additional_data_length, check1[i].ciphertext, check1[i].ciphertext_size,
plaintext, check1[i].plaintext_size, &plaintext_length);
diff --git a/api-tests/dev_apis/crypto/test_c025/test_c025.h b/api-tests/dev_apis/crypto/test_c025/test_c025.h
index 1955edd..0c83c93 100644
--- a/api-tests/dev_apis/crypto/test_c025/test_c025.h
+++ b/api-tests/dev_apis/crypto/test_c025/test_c025.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c025_crypto_list[];
+extern const client_test_t test_c025_crypto_list[];
int32_t psa_aead_decrypt_test(caller_security_t caller);
int32_t psa_aead_decrypt_negative_test(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c025/test_data.h b/api-tests/dev_apis/crypto/test_c025/test_data.h
index 82977ed..7aed327 100644
--- a/api-tests/dev_apis/crypto/test_c025/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c025/test_data.h
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[32];
uint32_t key_length;
@@ -40,7 +39,7 @@
static test_data check1[] = {
#ifdef ARCH_TEST_AES_128
#ifdef ARCH_TEST_CCM
-{"Test psa_aead_decrypt - CCM - 16B AES - 13B nounce & 8B addi data\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_aead_decrypt - CCM - 16B AES - 13B nounce & 8B addi data\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_DECRYPT, PSA_ALG_CCM,
@@ -55,7 +54,7 @@
39, 23, PSA_SUCCESS
},
-{"Test psa_aead_decrypt - AES-CCM\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_aead_decrypt - AES-CCM\n", PSA_KEY_TYPE_AES,
{0x41, 0x89, 0x35, 0x1B, 0x5C, 0xAE, 0xA3, 0x75, 0xA0, 0x29, 0x9E, 0x81, 0xC6,
0x21, 0xBF, 0x43}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_DECRYPT, PSA_ALG_CCM,
{0x48, 0xc0, 0x90, 0x69, 0x30, 0x56, 0x1e, 0x0a, 0xb0, 0xef, 0x4c, 0xd9, 0x72},
@@ -71,7 +70,7 @@
0xe9}, 40, 24, PSA_SUCCESS
},
-{"Test psa_aead_decrypt - AES-CCM 24 bytes Tag length = 4\n", 3, PSA_KEY_TYPE_AES,
+{"Test psa_aead_decrypt - AES-CCM 24 bytes Tag length = 4\n", PSA_KEY_TYPE_AES,
{0x41, 0x89, 0x35, 0x1B, 0x5C, 0xAE, 0xA3, 0x75, 0xA0, 0x29, 0x9E, 0x81, 0xC6,
0x21, 0xBF, 0x43}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_DECRYPT,
PSA_ALG_AEAD_WITH_TAG_LENGTH(PSA_ALG_CCM, 4),
@@ -90,7 +89,7 @@
#endif
#ifdef ARCH_TEST_GCM
-{"Test psa_aead_decrypt - GCM - 16B AES - 12B Nounce & 12B addi data\n", 4, PSA_KEY_TYPE_AES,
+{"Test psa_aead_decrypt - GCM - 16B AES - 12B Nounce & 12B addi data\n", PSA_KEY_TYPE_AES,
{0x3d, 0xe0, 0x98, 0x74, 0xb3, 0x88, 0xe6, 0x49, 0x19, 0x88, 0xd0, 0xc3, 0x60,
0x7e, 0xae, 0x1f}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_DECRYPT, PSA_ALG_GCM,
{0x57, 0x69, 0x0e, 0x43, 0x4e, 0x28, 0x00, 0x00, 0xa2, 0xfc, 0xa1, 0xa3}, 12,
@@ -109,7 +108,7 @@
#ifdef ARCH_TEST_CCM
#ifdef ARCH_TEST_DES_1KEY
-{"Test psa_aead_decrypt - DES Key\n", 5, PSA_KEY_TYPE_DES,
+{"Test psa_aead_decrypt - DES Key\n", PSA_KEY_TYPE_DES,
{0x70, 0x24, 0x55, 0x0C, 0x14, 0x9D, 0xED, 0x29}, DES_8B_KEY_SIZE,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_CCM,
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B}, 12,
@@ -123,7 +122,7 @@
#ifdef ARCH_TEST_AES_128
#ifdef ARCH_TEST_CIPER_MODE_CFB
-{"Test psa_aead_decrypt - Unsupported Algorithm\n", 6, PSA_KEY_TYPE_AES,
+{"Test psa_aead_decrypt - Unsupported Algorithm\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_DECRYPT, PSA_ALG_CFB,
{0}, 13, {0}, 0, "hello world", BUFFER_SIZE,
@@ -135,7 +134,7 @@
#endif
#ifdef ARCH_TEST_GCM
-{"Test psa_aead_decrypt - Invalid key usage\n", 7, PSA_KEY_TYPE_AES,
+{"Test psa_aead_decypt - Invalid key usage\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_GCM,
{0}, 13, {0}, 0, "hello world", BUFFER_SIZE,
@@ -145,7 +144,7 @@
27, 11, PSA_ERROR_NOT_PERMITTED
},
-{"Test psa_aead_decrypt - Small output buffer size\n", 8, PSA_KEY_TYPE_AES,
+{"Test psa_aead_decrypt - Small output buffer size\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_DECRYPT, PSA_ALG_GCM,
{0}, 13, {0}, 0, "hello world", 10,
@@ -157,7 +156,7 @@
#endif
#ifdef ARCH_TEST_CCM
-{"Test psa_aead_decrypt - Invalid cipher text\n", 9, PSA_KEY_TYPE_AES,
+{"Test psa_aead_decrypt - Invalid cipher text\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_DECRYPT, PSA_ALG_CCM,
@@ -172,7 +171,7 @@
39, 23, PSA_ERROR_INVALID_SIGNATURE
},
-{"Test psa_aead_decrypt - Invalid cipher text size\n", 10, PSA_KEY_TYPE_AES,
+{"Test psa_aead_decrypt - Invalid cipher text size\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_DECRYPT, PSA_ALG_CCM,
@@ -187,7 +186,7 @@
38, 23, PSA_ERROR_INVALID_SIGNATURE
},
-{"Test psa_aead_decrypt - Invalid tag length 0\n", 11, PSA_KEY_TYPE_AES,
+{"Test psa_aead_decrypt - Invalid tag length 0\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_DECRYPT, PSA_ALG_AEAD_WITH_TAG_LENGTH(PSA_ALG_CCM, 0),
diff --git a/api-tests/dev_apis/crypto/test_c026/test_c026.c b/api-tests/dev_apis/crypto/test_c026/test_c026.c
index 1de9cae..fd77f1b 100644
--- a/api-tests/dev_apis/crypto/test_c026/test_c026.c
+++ b/api-tests/dev_apis/crypto/test_c026/test_c026.c
@@ -1,6 +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");
@@ -21,7 +20,7 @@
#include "test_c026.h"
#include "test_data.h"
-client_test_t test_c026_crypto_list[] = {
+const client_test_t test_c026_crypto_list[] = {
NULL,
psa_mac_sign_setup_test,
psa_mac_sign_setup_negative_test,
@@ -36,6 +35,7 @@
int num_checks = sizeof(check1)/sizeof(check1[0]);
int32_t i, status;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -64,12 +64,12 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Start a multipart MAC calculation operation */
status = val->crypto_function(VAL_CRYPTO_MAC_SIGN_SETUP, &operation,
- check1[i].key_handle, check1[i].key_alg);
+ key_handle, check1[i].key_alg);
TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(4));
/* Whether setup succeeded or failed, abort must succeed.
@@ -84,12 +84,12 @@
if (check1[i].expected_status != PSA_SUCCESS)
{
status = val->crypto_function(VAL_CRYPTO_MAC_SIGN_SETUP, &operation,
- check1[i].key_handle, check1[i].key_alg);
+ key_handle, check1[i].key_alg);
TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(6));
}
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(7));
/* Reset the key attributes and check if psa_import_key fails */
@@ -103,6 +103,7 @@
{
int num_checks = sizeof(check2)/sizeof(check2[0]);
int32_t i, status;
+ psa_key_handle_t key_handle = 11;
/* Initialize the PSA crypto library*/
status = val->crypto_function(VAL_CRYPTO_INIT);
@@ -118,7 +119,7 @@
g_test_count++);
/* Start a multipart MAC verification operation */
status = val->crypto_function(VAL_CRYPTO_MAC_SIGN_SETUP, &operation,
- check2[i].key_handle, check2[i].key_alg);
+ key_handle, check2[i].key_alg);
TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(3));
val->print(PRINT_TEST, "[Check %d] Test psa_mac_sign_setup zero as key handle\n",
diff --git a/api-tests/dev_apis/crypto/test_c026/test_c026.h b/api-tests/dev_apis/crypto/test_c026/test_c026.h
index fab5a56..29e2cca 100644
--- a/api-tests/dev_apis/crypto/test_c026/test_c026.h
+++ b/api-tests/dev_apis/crypto/test_c026/test_c026.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c026_crypto_list[];
+extern const client_test_t test_c026_crypto_list[];
int32_t psa_mac_sign_setup_test(caller_security_t caller);
int32_t psa_mac_sign_setup_negative_test(caller_security_t caller);
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 02fc148..306522a 100644
--- a/api-tests/dev_apis/crypto/test_c026/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c026/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[64];
uint32_t key_length;
@@ -28,10 +27,10 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_HMAC
#ifdef ARCH_TEST_SHA256
-{"Test psa_mac_sign_setup 64 Byte HMAC\n", 1, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_sign_setup 64 Byte HMAC\n", PSA_KEY_TYPE_HMAC,
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c,
0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
@@ -45,7 +44,7 @@
#ifdef ARCH_TEST_AES_128
#ifdef ARCH_TEST_CMAC
-{"Test psa_mac_sign_setup 16 Byte AES - CMAC\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_mac_sign_setup 16 Byte AES - CMAC\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x00},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_SIGN, PSA_ALG_CMAC,
@@ -54,7 +53,7 @@
#endif
#ifdef ARCH_TEST_GMAC
-{"Test psa_mac_sign_setup 16 Byte AES - GMAC\n", 3, PSA_KEY_TYPE_AES,
+{"Test psa_mac_sign_setup 16 Byte AES - GMAC\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x00},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_SIGN, PSA_ALG_GMAC,
@@ -64,7 +63,7 @@
#ifdef ARCH_TEST_CMAC
#ifdef ARCH_TEST_HMAC
-{"Test psa_mac_sign_setup incompactible HMAC for CMAC\n", 4, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_sign_setup incompactible HMAC for CMAC\n", PSA_KEY_TYPE_HMAC,
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C,
0x0D, 0x0E, 0x0F},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_SIGN, PSA_ALG_CMAC,
@@ -72,7 +71,7 @@
},
#endif
-{"Test psa_mac_sign_setup invalid usage\n", 5, PSA_KEY_TYPE_AES,
+{"Test psa_mac_sign_setup invalid usage\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_EXPORT, PSA_ALG_CMAC,
@@ -82,7 +81,7 @@
#ifdef ARCH_TEST_HMAC
#ifdef ARCH_TEST_SHA256
-{"Test psa_mac_sign_setup invalid key type\n", 7, PSA_KEY_TYPE_RAW_DATA,
+{"Test psa_mac_sign_setup invalid key type\n", PSA_KEY_TYPE_RAW_DATA,
{0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B,
0x0B, 0x0B, 0x0B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_SIGN, PSA_ALG_HMAC(PSA_ALG_SHA_256),
@@ -95,7 +94,7 @@
#ifdef ARCH_TEST_HMAC
#ifdef ARCH_TEST_SHA256
#ifdef ARCH_TEST_TRUNCATED_MAC
-{"Test psa_mac_sign_setup truncated MAC too large\n", 8, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_sign_setup truncated MAC too large\n", PSA_KEY_TYPE_HMAC,
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c,
0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
@@ -105,7 +104,7 @@
PSA_ERROR_INVALID_ARGUMENT
},
-{"Test psa_mac_sign_setup truncated MAC too small\n", 9, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_sign_setup truncated MAC too small\n", PSA_KEY_TYPE_HMAC,
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c,
0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
@@ -118,7 +117,7 @@
#endif
#ifdef ARCH_TEST_AES_128
-{"Test psa_mac_sign_setup bad algorithm (unknown MAC algorithm)\n", 10, PSA_KEY_TYPE_AES,
+{"Test psa_mac_sign_setup bad algorithm (unknown MAC algorithm)\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x00},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_SIGN, PSA_ALG_HMAC(0),
@@ -129,7 +128,7 @@
#ifdef ARCH_TEST_AES_128
#ifdef ARCH_TEST_CBC_NO_PADDING
-{"Test psa_mac_sign_setup bad algorithm (not a MAC algorithm)\n", 11, PSA_KEY_TYPE_AES,
+{"Test psa_mac_sign_setup bad algorithm (not a MAC algorithm)\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x00},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_SIGN, PSA_ALG_CBC_NO_PADDING,
@@ -139,10 +138,10 @@
#endif
};
-static test_data check2[] = {
+static const test_data check2[] = {
#ifdef ARCH_TEST_HMAC
#ifdef ARCH_TEST_SHA256
-{"Test psa_mac_sign_setup 64 negative case\n", 11, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_sign_setup 64 negative case\n", PSA_KEY_TYPE_HMAC,
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c,
0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
diff --git a/api-tests/dev_apis/crypto/test_c027/test_c027.c b/api-tests/dev_apis/crypto/test_c027/test_c027.c
index 89bcbf2..923ef59 100644
--- a/api-tests/dev_apis/crypto/test_c027/test_c027.c
+++ b/api-tests/dev_apis/crypto/test_c027/test_c027.c
@@ -1,6 +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");
@@ -21,7 +20,7 @@
#include "test_c027.h"
#include "test_data.h"
-client_test_t test_c027_crypto_list[] = {
+const client_test_t test_c027_crypto_list[] = {
NULL,
psa_mac_update_test,
psa_mac_update_invalid_operator_test,
@@ -38,6 +37,7 @@
size_t length;
psa_mac_operation_t operation;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -51,7 +51,7 @@
for (i = 0; i < num_checks; i++)
{
- val->print(PRINT_TEST, "[Check %d] ", g_test_count++);
+ val->print(PRINT_TEST, "[Check %d] ", g_test_count++);
val->print(PRINT_TEST, check1[i].test_desc, 0);
memset(&operation, 0, sizeof(operation));
memset(data, 0, sizeof(data));
@@ -67,12 +67,12 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Start a multipart MAC calculation operation */
status = val->crypto_function(VAL_CRYPTO_MAC_SIGN_SETUP, &operation,
- check1[i].key_handle, check1[i].key_alg);
+ key_handle, check1[i].key_alg);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(4));
/* Add a message fragment to a multipart MAC operation */
@@ -87,7 +87,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(6));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(7));
continue;
@@ -108,7 +108,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(10));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(11));
}
diff --git a/api-tests/dev_apis/crypto/test_c027/test_c027.h b/api-tests/dev_apis/crypto/test_c027/test_c027.h
index 69f72f1..71d3e9c 100644
--- a/api-tests/dev_apis/crypto/test_c027/test_c027.h
+++ b/api-tests/dev_apis/crypto/test_c027/test_c027.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c027_crypto_list[];
+extern const client_test_t test_c027_crypto_list[];
int32_t psa_mac_update_test(caller_security_t caller);
int32_t psa_mac_update_invalid_operator_test(caller_security_t caller);
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 6537c7e..35eebf6 100644
--- a/api-tests/dev_apis/crypto/test_c027/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c027/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[64];
uint32_t key_length;
@@ -30,10 +29,10 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_HMAC
#ifdef ARCH_TEST_SHA256
-{"Test psa_mac_update 64 Byte HMAC SHA256\n", 1, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_update 64 Byte HMAC SHA256\n", PSA_KEY_TYPE_HMAC,
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c,
0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
@@ -47,7 +46,7 @@
#ifdef ARCH_TEST_AES_128
#ifdef ARCH_TEST_CMAC
-{"Test psa_mac_update 16 Byte AES - CMAC\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_mac_update 16 Byte AES - CMAC\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x00},
AES_16B_KEY_SIZE, "hello world", 11, PSA_KEY_USAGE_SIGN, PSA_ALG_CMAC,
@@ -58,7 +57,7 @@
#ifdef ARCH_TEST_HMAC
#ifdef ARCH_TEST_SHA512
-{"Test psa_mac_update 32 Byte HMAC SHA512\n", 3, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_update 32 Byte HMAC SHA512\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b},
diff --git a/api-tests/dev_apis/crypto/test_c028/test_c028.c b/api-tests/dev_apis/crypto/test_c028/test_c028.c
index 540af72..83963c0 100644
--- a/api-tests/dev_apis/crypto/test_c028/test_c028.c
+++ b/api-tests/dev_apis/crypto/test_c028/test_c028.c
@@ -1,6 +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");
@@ -21,7 +20,7 @@
#include "test_c028.h"
#include "test_data.h"
-client_test_t test_c028_crypto_list[] = {
+const client_test_t test_c028_crypto_list[] = {
NULL,
psa_mac_sign_finish_test,
NULL,
@@ -37,6 +36,7 @@
size_t length;
psa_mac_operation_t operation;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -66,12 +66,12 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Start a multipart MAC calculation operation */
status = val->crypto_function(VAL_CRYPTO_MAC_SIGN_SETUP, &operation,
- check1[i].key_handle, check1[i].key_alg);
+ key_handle, check1[i].key_alg);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(4));
/* Add a message fragment to a multipart MAC operation */
@@ -91,7 +91,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(7));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(8));
continue;
@@ -118,7 +118,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(12));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(14));
}
diff --git a/api-tests/dev_apis/crypto/test_c028/test_c028.h b/api-tests/dev_apis/crypto/test_c028/test_c028.h
index 792a1a9..dc400ac 100644
--- a/api-tests/dev_apis/crypto/test_c028/test_c028.h
+++ b/api-tests/dev_apis/crypto/test_c028/test_c028.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c028_crypto_list[];
+extern const client_test_t test_c028_crypto_list[];
int32_t psa_mac_sign_finish_test(caller_security_t caller);
#endif /* _TEST_C028_CLIENT_TESTS_H_ */
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 2153071..bd4e96a 100644
--- a/api-tests/dev_apis/crypto/test_c028/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c028/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[64];
uint32_t key_length;
@@ -33,10 +32,10 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_HMAC
#ifdef ARCH_TEST_SHA224
-{"Test psa_mac_sign_finish HMAC SHA 224\n", 1, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_sign_finish HMAC SHA 224\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -49,7 +48,7 @@
#endif
#ifdef ARCH_TEST_SHA256
-{"Test psa_mac_sign_finish HMAC SHA 256\n", 2, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_sign_finish HMAC SHA 256\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -62,7 +61,7 @@
#endif
#ifdef ARCH_TEST_SHA512
-{"Test psa_mac_sign_finish HMAC SHA 512\n", 3, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_sign_finish HMAC SHA 512\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -77,7 +76,7 @@
#endif
#ifdef ARCH_TEST_SHA224
-{"Test psa_mac_sign_finish HMAC SHA 224 (truncated to 8 Byte)\n", 4, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_sign_finish HMAC SHA 224 (truncated to 8 Byte)\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -90,7 +89,7 @@
#ifdef ARCH_TEST_AES_128
#ifdef ARCH_TEST_CMAC
-{"Test psa_mac_sign_finish CMAC AES 128\n", 5, PSA_KEY_TYPE_AES,
+{"Test psa_mac_sign_finish CMAC AES 128\n", PSA_KEY_TYPE_AES,
{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09,
0xcf, 0x4f, 0x3c}, 16,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -100,7 +99,7 @@
PSA_SUCCESS
},
-{"Test psa_mac_sign_finish small size buffer\n", 6, PSA_KEY_TYPE_AES,
+{"Test psa_mac_sign_finish small size buffer\n", PSA_KEY_TYPE_AES,
{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09,
0xcf, 0x4f, 0x3c}, 16,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
diff --git a/api-tests/dev_apis/crypto/test_c029/test_c029.c b/api-tests/dev_apis/crypto/test_c029/test_c029.c
index ee9b7f5..ce2e857 100644
--- a/api-tests/dev_apis/crypto/test_c029/test_c029.c
+++ b/api-tests/dev_apis/crypto/test_c029/test_c029.c
@@ -1,6 +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");
@@ -21,7 +20,7 @@
#include "test_c029.h"
#include "test_data.h"
-client_test_t test_c029_crypto_list[] = {
+const client_test_t test_c029_crypto_list[] = {
NULL,
psa_mac_verify_setup_test,
psa_mac_verify_setup_negative_test,
@@ -36,6 +35,7 @@
int num_checks = sizeof(check1)/sizeof(check1[0]);
int32_t i, status;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -64,12 +64,12 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Start a multipart MAC verification operation */
status = val->crypto_function(VAL_CRYPTO_MAC_VERIFY_SETUP, &operation,
- check1[i].key_handle, check1[i].key_alg);
+ key_handle, check1[i].key_alg);
TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(4));
/* Whether setup succeeded or failed, abort must succeed.
@@ -84,12 +84,12 @@
if (check1[i].expected_status != PSA_SUCCESS)
{
status = val->crypto_function(VAL_CRYPTO_MAC_VERIFY_SETUP, &operation,
- check1[i].key_handle, check1[i].key_alg);
+ key_handle, check1[i].key_alg);
TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(6));
}
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(7));
}
@@ -100,6 +100,7 @@
{
int num_checks = sizeof(check2)/sizeof(check2[0]);
int32_t i, status;
+ psa_key_handle_t key_handle = 11;
/* Initialize the PSA crypto library*/
status = val->crypto_function(VAL_CRYPTO_INIT);
@@ -115,7 +116,7 @@
g_test_count++);
/* Start a multipart MAC verification operation */
status = val->crypto_function(VAL_CRYPTO_MAC_VERIFY_SETUP, &operation,
- check2[i].key_handle, check2[i].key_alg);
+ key_handle, check2[i].key_alg);
TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(3));
val->print(PRINT_TEST, "[Check %d] Test psa_mac_verify_setup zero as key handle\n",
diff --git a/api-tests/dev_apis/crypto/test_c029/test_c029.h b/api-tests/dev_apis/crypto/test_c029/test_c029.h
index 81234fa..113cb04 100644
--- a/api-tests/dev_apis/crypto/test_c029/test_c029.h
+++ b/api-tests/dev_apis/crypto/test_c029/test_c029.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c029_crypto_list[];
+extern const client_test_t test_c029_crypto_list[];
int32_t psa_mac_verify_setup_test(caller_security_t caller);
int32_t psa_mac_verify_setup_negative_test(caller_security_t caller);
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 1a55b00..3b4b121 100644
--- a/api-tests/dev_apis/crypto/test_c029/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c029/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[64];
uint32_t key_length;
@@ -28,10 +27,10 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_HMAC
#ifdef ARCH_TEST_SHA256
-{"Test psa_mac_verify_setup 64 Byte HMAC\n", 1, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_verify_setup 64 Byte HMAC\n", PSA_KEY_TYPE_HMAC,
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c,
0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
@@ -45,7 +44,7 @@
#ifdef ARCH_TEST_AES_128
#ifdef ARCH_TEST_CMAC
-{"Test psa_mac_verify_setup 16 Byte AES - CMAC\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_mac_verify_setup 16 Byte AES - CMAC\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x00},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_VERIFY, PSA_ALG_CMAC,
@@ -54,7 +53,7 @@
#endif
#ifdef ARCH_TEST_GMAC
-{"Test psa_mac_verify_setup 16 Byte AES - GMAC\n", 3, PSA_KEY_TYPE_AES,
+{"Test psa_mac_verify_setup 16 Byte AES - GMAC\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x00},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_VERIFY, PSA_ALG_GMAC,
@@ -65,7 +64,7 @@
#ifdef ARCH_TEST_CMAC
#ifdef ARCH_TEST_HMAC
-{"Test psa_mac_verify_setup incompactible HMAC for CMAC\n", 4, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_verify_setup incompactible HMAC for CMAC\n", PSA_KEY_TYPE_HMAC,
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C,
0x0D, 0x0E, 0x0F},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_VERIFY, PSA_ALG_CMAC,
@@ -74,7 +73,7 @@
#endif
#ifdef ARCH_TEST_AES_128
-{"Test psa_mac_verify_setup invalid usage\n", 5, PSA_KEY_TYPE_AES,
+{"Test psa_mac_verify_setup invalid usage\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_EXPORT, PSA_ALG_CMAC,
@@ -85,7 +84,7 @@
#ifdef ARCH_TEST_HMAC
#ifdef ARCH_TEST_SHA256
-{"Test psa_mac_verify_setup invalid key type\n", 6, PSA_KEY_TYPE_RAW_DATA,
+{"Test psa_mac_verify_setup invalid key type\n", PSA_KEY_TYPE_RAW_DATA,
{0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B,
0x0B, 0x0B, 0x0B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_VERIFY, PSA_ALG_HMAC(PSA_ALG_SHA_256),
@@ -96,7 +95,7 @@
#ifdef ARCH_TEST_HMAC
#ifdef ARCH_TEST_SHA256
-{"Test psa_mac_verify_setup truncated MAC too large\n", 7, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_verify_setup truncated MAC too large\n", PSA_KEY_TYPE_HMAC,
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c,
0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
@@ -106,7 +105,7 @@
PSA_ERROR_INVALID_ARGUMENT
},
-{"Test psa_mac_verify_setup truncated MAC too small\n", 8, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_verify_setup truncated MAC too small\n", PSA_KEY_TYPE_HMAC,
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c,
0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
@@ -118,7 +117,7 @@
#endif
#ifdef ARCH_TEST_AES_128
-{"Test psa_mac_verify_setup bad algorithm (unknown MAC algorithm)\n", 9, PSA_KEY_TYPE_AES,
+{"Test psa_mac_verify_setup bad algorithm (unknown MAC algorithm)\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x00},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_VERIFY, PSA_ALG_HMAC(0),
@@ -129,7 +128,7 @@
#ifdef ARCH_TEST_AES_128
#ifdef ARCH_TEST_CBC_NO_PADDING
-{"Test psa_mac_verify_setup bad algorithm (not a MAC algorithm)\n", 10, PSA_KEY_TYPE_AES,
+{"Test psa_mac_verify_setup bad algorithm (not a MAC algorithm)\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x00},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_VERIFY, PSA_ALG_CBC_NO_PADDING,
@@ -139,10 +138,10 @@
#endif
};
-static test_data check2[] = {
+static const test_data check2[] = {
#ifdef ARCH_TEST_HMAC
#ifdef ARCH_TEST_SHA256
-{"Test psa_mac_verify_setup 64 negative case\n", 11, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_verify_setup 64 negative case\n", PSA_KEY_TYPE_HMAC,
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c,
0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
diff --git a/api-tests/dev_apis/crypto/test_c030/test_c030.c b/api-tests/dev_apis/crypto/test_c030/test_c030.c
index 6643c34..723b9bf 100644
--- a/api-tests/dev_apis/crypto/test_c030/test_c030.c
+++ b/api-tests/dev_apis/crypto/test_c030/test_c030.c
@@ -1,6 +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");
@@ -21,7 +20,7 @@
#include "test_c030.h"
#include "test_data.h"
-client_test_t test_c030_crypto_list[] = {
+const client_test_t test_c030_crypto_list[] = {
NULL,
psa_mac_verify_finish_test,
NULL,
@@ -35,6 +34,7 @@
int32_t i, status;
psa_mac_operation_t operation;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -63,12 +63,12 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Start a multipart MAC calculation operation */
status = val->crypto_function(VAL_CRYPTO_MAC_VERIFY_SETUP, &operation,
- check1[i].key_handle, check1[i].key_alg);
+ key_handle, check1[i].key_alg);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(4));
/* Add a message fragment to a multipart MAC operation */
@@ -90,7 +90,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(7));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(8));
continue;
}
@@ -108,7 +108,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(10));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(11));
}
diff --git a/api-tests/dev_apis/crypto/test_c030/test_c030.h b/api-tests/dev_apis/crypto/test_c030/test_c030.h
index defd603..2ffcf12 100644
--- a/api-tests/dev_apis/crypto/test_c030/test_c030.h
+++ b/api-tests/dev_apis/crypto/test_c030/test_c030.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c030_crypto_list[];
+extern const client_test_t test_c030_crypto_list[];
int32_t psa_mac_verify_finish_test(caller_security_t caller);
#endif /* _TEST_C030_CLIENT_TESTS_H_ */
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 eb9f250..e4c8cc3 100644
--- a/api-tests/dev_apis/crypto/test_c030/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c030/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[64];
uint32_t key_length;
@@ -32,10 +31,10 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_HMAC
#ifdef ARCH_TEST_SHA224
-{"Test psa_mac_verify_finish HMAC SHA 224\n", 1, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_verify_finish HMAC SHA 224\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -48,7 +47,7 @@
#endif
#ifdef ARCH_TEST_SHA256
-{"Test psa_mac_verify_finish HMAC SHA 256\n", 2, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_verify_finish HMAC SHA 256\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -61,7 +60,7 @@
#endif
#ifdef ARCH_TEST_SHA512
-{"Test psa_mac_verify_finish HMAC SHA 512\n", 3, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_verify_finish HMAC SHA 512\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -76,7 +75,7 @@
#endif
#ifdef ARCH_TEST_SHA224
-{"Test psa_mac_verify_finish HMAC SHA 224 (truncated to 8 Byte)\n", 4, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_verify_finish HMAC SHA 224 (truncated to 8 Byte)\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -89,7 +88,7 @@
#ifdef ARCH_TEST_AES_128
#ifdef ARCH_TEST_CMAC
-{"Test psa_mac_verify_finish CMAC AES 128\n", 5, PSA_KEY_TYPE_AES,
+{"Test psa_mac_verify_finish CMAC AES 128\n", PSA_KEY_TYPE_AES,
{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09,
0xcf, 0x4f, 0x3c}, 16,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -103,7 +102,7 @@
#ifdef ARCH_TEST_HMAC
#ifdef ARCH_TEST_SHA256
-{"Test psa_mac_verify_finish small size buffer\n", 6, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_verify_finish small size buffer\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -116,7 +115,7 @@
#endif
#ifdef ARCH_TEST_SHA224
-{"Test psa_mac_verify_finish incorrect expected MAC\n", 7, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_verify_finish incorrect expected MAC\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
diff --git a/api-tests/dev_apis/crypto/test_c031/test_c031.c b/api-tests/dev_apis/crypto/test_c031/test_c031.c
index 3e8c94e..8cd6a1d 100644
--- a/api-tests/dev_apis/crypto/test_c031/test_c031.c
+++ b/api-tests/dev_apis/crypto/test_c031/test_c031.c
@@ -1,6 +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");
@@ -21,7 +20,7 @@
#include "test_c031.h"
#include "test_data.h"
-client_test_t test_c031_crypto_list[] = {
+const client_test_t test_c031_crypto_list[] = {
NULL,
psa_mac_abort_test,
psa_mac_abort_before_finish_test,
@@ -37,6 +36,7 @@
int32_t i, status;
psa_mac_operation_t operation;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -65,12 +65,12 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Start a multipart MAC calculation operation */
status = val->crypto_function(VAL_CRYPTO_MAC_SIGN_SETUP, &operation,
- check1[i].key_handle, check1[i].key_alg);
+ key_handle, check1[i].key_alg);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(4));
/* Abort a MAC operation */
@@ -82,7 +82,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(6));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(7));
}
diff --git a/api-tests/dev_apis/crypto/test_c031/test_c031.h b/api-tests/dev_apis/crypto/test_c031/test_c031.h
index ba716fa..0ea5c9b 100644
--- a/api-tests/dev_apis/crypto/test_c031/test_c031.h
+++ b/api-tests/dev_apis/crypto/test_c031/test_c031.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c031_crypto_list[];
+extern const client_test_t test_c031_crypto_list[];
int32_t psa_mac_abort_test(caller_security_t caller);
int32_t psa_mac_abort_before_finish_test(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c031/test_data.h b/api-tests/dev_apis/crypto/test_c031/test_data.h
index e816f81..50590eb 100644
--- a/api-tests/dev_apis/crypto/test_c031/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c031/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[64];
uint32_t key_length;
@@ -28,10 +27,10 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_HMAC
#ifdef ARCH_TEST_SHA224
-{"Test psa_mac_abort HMAC SHA 224\n", 1, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_abort HMAC SHA 224\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
PSA_KEY_USAGE_SIGN, PSA_ALG_HMAC(PSA_ALG_SHA_224),
@@ -40,7 +39,7 @@
#endif
#ifdef ARCH_TEST_SHA256
-{"Test psa_mac_abort HMAC SHA 256\n", 2, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_abort HMAC SHA 256\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
PSA_KEY_USAGE_SIGN, PSA_ALG_HMAC(PSA_ALG_SHA_256),
@@ -49,7 +48,7 @@
#endif
#ifdef ARCH_TEST_SHA512
-{"Test psa_mac_abort HMAC SHA 512\n", 3, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_abort HMAC SHA 512\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
PSA_KEY_USAGE_SIGN, PSA_ALG_HMAC(PSA_ALG_SHA_512),
@@ -58,7 +57,7 @@
#endif
#ifdef ARCH_TEST_SHA224
-{"Test psa_mac_abort HMAC SHA 224 (truncated to 8 Byte)\n", 4, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_abort HMAC SHA 224 (truncated to 8 Byte)\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
PSA_KEY_USAGE_SIGN, PSA_ALG_TRUNCATED_MAC(PSA_ALG_HMAC(PSA_ALG_SHA_224), 8),
@@ -69,7 +68,7 @@
#ifdef ARCH_TEST_AES_128
#ifdef ARCH_TEST_CMAC
-{"Test psa_mac_abort CMAC AES 128\n", 5, PSA_KEY_TYPE_AES,
+{"Test psa_mac_abort CMAC AES 128\n", PSA_KEY_TYPE_AES,
{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09,
0xcf, 0x4f, 0x3c}, 16,
PSA_KEY_USAGE_SIGN, PSA_ALG_CMAC,
diff --git a/api-tests/dev_apis/crypto/test_c032/test_c032.c b/api-tests/dev_apis/crypto/test_c032/test_c032.c
index aa35e30..d1093fc 100644
--- a/api-tests/dev_apis/crypto/test_c032/test_c032.c
+++ b/api-tests/dev_apis/crypto/test_c032/test_c032.c
@@ -1,6 +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");
@@ -21,7 +20,7 @@
#include "test_c032.h"
#include "test_data.h"
-client_test_t test_c032_crypto_list[] = {
+const client_test_t test_c032_crypto_list[] = {
NULL,
psa_cipher_encrypt_setup_test,
psa_cipher_encrypt_setup_negative_test,
@@ -37,6 +36,7 @@
int32_t i, status;
const uint8_t *key_data;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -97,12 +97,12 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Set the key for a multipart symmetric encryption operation */
status = val->crypto_function(VAL_CRYPTO_CIPHER_ENCRYPT_SETUP, &operation,
- check1[i].key_handle, check1[i].key_alg);
+ key_handle, check1[i].key_alg);
TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(4));
/* Whether setup succeeded or failed, abort must succeed.
@@ -114,7 +114,7 @@
if (check1[i].expected_status != PSA_SUCCESS)
{
status = val->crypto_function(VAL_CRYPTO_CIPHER_ENCRYPT_SETUP, &operation,
- check1[i].key_handle, check1[i].key_alg);
+ key_handle, check1[i].key_alg);
TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(6));
status = val->crypto_function(VAL_CRYPTO_CIPHER_ABORT, &operation);
@@ -122,7 +122,7 @@
}
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(8));
/* Reset the key attributes and check if psa_import_key fails */
@@ -136,6 +136,7 @@
{
int num_checks = sizeof(check2)/sizeof(check2[0]);
int32_t i, status;
+ psa_key_handle_t key_handle = 16;
/* Initialize the PSA crypto library*/
status = val->crypto_function(VAL_CRYPTO_INIT);
@@ -151,7 +152,7 @@
g_test_count++);
/* Set the key for a multipart symmetric encryption operation */
status = val->crypto_function(VAL_CRYPTO_CIPHER_ENCRYPT_SETUP, &operation,
- check2[i].key_handle, check2[i].key_alg);
+ key_handle, check2[i].key_alg);
TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(3));
val->print(PRINT_TEST, "[Check %d] Test psa_cipher_encrypt_setup - Zero as key handle\n",
diff --git a/api-tests/dev_apis/crypto/test_c032/test_c032.h b/api-tests/dev_apis/crypto/test_c032/test_c032.h
index f9887a2..362f3a3 100644
--- a/api-tests/dev_apis/crypto/test_c032/test_c032.h
+++ b/api-tests/dev_apis/crypto/test_c032/test_c032.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c032_crypto_list[];
+extern const client_test_t test_c032_crypto_list[];
int32_t psa_cipher_encrypt_setup_test(caller_security_t caller);
int32_t psa_cipher_encrypt_setup_negative_test(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c032/test_data.h b/api-tests/dev_apis/crypto/test_c032/test_data.h
index 763afde..c512c01 100644
--- a/api-tests/dev_apis/crypto/test_c032/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c032/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[64];
uint32_t key_length;
@@ -160,10 +159,10 @@
0x68, 0x49, 0xf9, 0x7d, 0x10, 0x66, 0xf6, 0x99, 0x77, 0x59, 0x63, 0x7c, 0x7e, 0x38,
0x99, 0x46, 0x4c, 0xee, 0x3e, 0xc7, 0xac, 0x97, 0x06, 0x53, 0xa0, 0xbe, 0x07, 0x42};
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_AES_128
-{"Test psa_cipher_encrypt_setup 16 Byte AES\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_encrypt_setup 16 Byte AES\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0xD0}, AES_16B_KEY_SIZE, BYTES_TO_BITS(AES_16B_KEY_SIZE),
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CTR, BYTES_TO_BITS(AES_16B_KEY_SIZE),
@@ -172,7 +171,7 @@
#endif
#ifdef ARCH_TEST_AES_192
-{"Test psa_cipher_encrypt_setup 24 Byte AES\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_encrypt_setup 24 Byte AES\n", PSA_KEY_TYPE_AES,
{0x24, 0x13, 0x61, 0x47, 0x61, 0xB8, 0xC8, 0xF0, 0xDF, 0xAB, 0x5A, 0x0E, 0x87,
0x40, 0xAC, 0xA3, 0x90, 0x77, 0x83, 0x52, 0x31, 0x74, 0xF9}, AES_24B_KEY_SIZE, 0,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CTR, BYTES_TO_BITS(AES_24B_KEY_SIZE),
@@ -181,7 +180,7 @@
#endif
#ifdef ARCH_TEST_AES_256
-{"Test psa_cipher_encrypt_setup 32 Byte AES\n", 3, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_encrypt_setup 32 Byte AES\n", PSA_KEY_TYPE_AES,
{0xEA, 0xD5, 0xE6, 0xC8, 0x51, 0xF9, 0xEC, 0xBB, 0x9B, 0x57, 0x7C, 0xED, 0xD2,
0x4B, 0x82, 0x84, 0x9F, 0x9F, 0xE6, 0x73, 0x21, 0x3D, 0x1A, 0x05, 0xC9, 0xED,
0xDF, 0x25, 0x17, 0x68, 0x86, 0xAE}, AES_32B_KEY_SIZE, 0,
@@ -193,7 +192,7 @@
#ifdef ARCH_TEST_CBC_NO_PADDING
#ifdef ARCH_TEST_DES_1KEY
-{"Test psa_cipher_encrypt_setup DES 64 bit key\n", 4, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_encrypt_setup DES 64 bit key\n", PSA_KEY_TYPE_DES,
{0x70, 0x24, 0x55, 0x0C, 0x14, 0x9D, 0xED, 0x29},
DES_8B_KEY_SIZE, 0, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING, BYTES_TO_BITS(DES_8B_KEY_SIZE),
PSA_SUCCESS
@@ -201,7 +200,7 @@
#endif
#ifdef ARCH_TEST_DES_2KEY
-{"Test psa_cipher_encrypt_setup Triple DES 2-Key\n", 5, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_encrypt_setup Triple DES 2-Key\n", PSA_KEY_TYPE_DES,
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
DES3_2KEY_SIZE, 0, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING, BYTES_TO_BITS(DES3_2KEY_SIZE),
@@ -210,7 +209,7 @@
#endif
#ifdef ARCH_TEST_DES_3KEY
-{"Test psa_cipher_encrypt_setup Triple DES 3-Key\n", 6, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_encrypt_setup Triple DES 3-Key\n", PSA_KEY_TYPE_DES,
{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
0xF1, 0xE0, 0xD3, 0xC2, 0xB5, 0xA4, 0x97, 0x86,
0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10},
@@ -221,7 +220,7 @@
#endif
#ifdef ARCH_TEST_CIPER_MODE_CTR
-{"Test psa_cipher_encrypt_setup 16 Byte raw data\n", 7, PSA_KEY_TYPE_RAW_DATA,
+{"Test psa_cipher_encrypt_setup 16 Byte raw data\n", PSA_KEY_TYPE_RAW_DATA,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0xD0}, AES_16B_KEY_SIZE, 0,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CTR, BYTES_TO_BITS(AES_16B_KEY_SIZE),
@@ -231,7 +230,7 @@
#ifdef ARCH_TEST_AES_128
#ifdef ARCH_TEST_CMAC
-{"Test psa_cipher_encrypt_setup - not a cipher algorithm\n", 8, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_encrypt_setup - not a cipher algorithm\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0xD0}, AES_16B_KEY_SIZE, 0,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CMAC, BYTES_TO_BITS(AES_16B_KEY_SIZE),
@@ -240,7 +239,7 @@
#endif
#ifdef ARCH_TEST_CIPER
-{"Test psa_cipher_encrypt_setup - unknown cipher algorithm\n", 9, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_encrypt_setup - unknown cipher algorithm\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0xD0}, AES_16B_KEY_SIZE, 0,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CATEGORY_CIPHER, BYTES_TO_BITS(AES_16B_KEY_SIZE),
@@ -250,7 +249,7 @@
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_ARC4
-{"Test psa_cipher_encrypt_setup - incompatible key ARC4\n", 10, PSA_KEY_TYPE_ARC4,
+{"Test psa_cipher_encrypt_setup - incompatible key ARC4\n", PSA_KEY_TYPE_ARC4,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0xD0}, AES_16B_KEY_SIZE, 0,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CTR, BYTES_TO_BITS(AES_16B_KEY_SIZE),
@@ -258,7 +257,7 @@
},
#endif
-{"Test psa_cipher_encrypt_setup - incorrect usage\n", 11, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_encrypt_setup - incorrect usage\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0xD0}, AES_16B_KEY_SIZE, 0,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_CTR, BYTES_TO_BITS(AES_16B_KEY_SIZE),
@@ -269,13 +268,13 @@
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
#ifdef ARCH_TEST_RSA_2048
-{"Test psa_cipher_encrypt_setup - RSA public key\n", 12, PSA_KEY_TYPE_RSA_PUBLIC_KEY,
+{"Test psa_cipher_encrypt_setup - RSA public key\n", PSA_KEY_TYPE_RSA_PUBLIC_KEY,
{0}, 270, 0,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_RSA_PKCS1V15_SIGN_RAW, 2048,
PSA_ERROR_INVALID_ARGUMENT
},
-{"Test psa_cipher_encrypt_setup - RSA keypair\n", 13, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_cipher_encrypt_setup - RSA keypair\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0}, 1193, 0,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_RSA_PKCS1V15_SIGN_RAW, 2048,
PSA_ERROR_INVALID_ARGUMENT
@@ -285,7 +284,7 @@
#ifdef ARCH_TEST_ASYMMETRIC_ENCRYPTION
#ifdef ARCH_TEST_ECC_CURVE_SECP256R1
-{"Test psa_cipher_encrypt_setup - EC Public key\n", 14,
+{"Test psa_cipher_encrypt_setup - EC Public key\n",
PSA_KEY_TYPE_ECC_PUBLIC_KEY(PSA_ECC_CURVE_SECP256R1), {0}, 65, 0,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CATEGORY_ASYMMETRIC_ENCRYPTION, 256,
PSA_ERROR_INVALID_ARGUMENT
@@ -293,7 +292,7 @@
#endif
#ifdef ARCH_TEST_ECC_CURVE_SECP224R1
-{"Test psa_cipher_encrypt_setup - EC keypair\n", 15,
+{"Test psa_cipher_encrypt_setup - EC keypair\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP224R1), {0}, 28, 0,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CATEGORY_ASYMMETRIC_ENCRYPTION, 224,
PSA_ERROR_INVALID_ARGUMENT
@@ -302,10 +301,10 @@
#endif
};
-static test_data check2[] = {
+static const test_data check2[] = {
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_AES_128
-{"Test psa_cipher_encrypt_setup negative cases\n", 16, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_encrypt_setup negative cases\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0xD0}, AES_16B_KEY_SIZE, 0,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CTR, BYTES_TO_BITS(AES_16B_KEY_SIZE),
diff --git a/api-tests/dev_apis/crypto/test_c033/test_c033.c b/api-tests/dev_apis/crypto/test_c033/test_c033.c
index 4899f10..2ec5d43 100644
--- a/api-tests/dev_apis/crypto/test_c033/test_c033.c
+++ b/api-tests/dev_apis/crypto/test_c033/test_c033.c
@@ -1,6 +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");
@@ -21,7 +20,7 @@
#include "test_c033.h"
#include "test_data.h"
-client_test_t test_c033_crypto_list[] = {
+const client_test_t test_c033_crypto_list[] = {
NULL,
psa_cipher_decrypt_setup_test,
psa_cipher_decrypt_setup_negative_test,
@@ -37,6 +36,7 @@
int32_t i, status;
const uint8_t *key_data;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -96,12 +96,12 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Set the key for a multipart symmetric decryption operation */
status = val->crypto_function(VAL_CRYPTO_CIPHER_DECRYPT_SETUP, &operation,
- check1[i].key_handle, check1[i].key_alg);
+ key_handle, check1[i].key_alg);
TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(4));
/* Whether setup succeeded or failed, abort must succeed.
@@ -113,7 +113,7 @@
if (check1[i].expected_status != PSA_SUCCESS)
{
status = val->crypto_function(VAL_CRYPTO_CIPHER_DECRYPT_SETUP, &operation,
- check1[i].key_handle, check1[i].key_alg);
+ key_handle, check1[i].key_alg);
TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(6));
/* Abort a cipher operation */
@@ -122,7 +122,7 @@
}
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(8));
/* Reset the key attributes and check if psa_import_key fails */
@@ -136,6 +136,7 @@
{
int num_checks = sizeof(check2)/sizeof(check2[0]);
int32_t i, status;
+ psa_key_handle_t key_handle = 16;
/* Initialize the PSA crypto library*/
status = val->crypto_function(VAL_CRYPTO_INIT);
@@ -151,7 +152,7 @@
g_test_count++);
/* Set the key for a multipart symmetric decryption operation */
status = val->crypto_function(VAL_CRYPTO_CIPHER_DECRYPT_SETUP, &operation,
- check2[i].key_handle, check2[i].key_alg);
+ key_handle, check2[i].key_alg);
TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(3));
val->print(PRINT_TEST, "[Check %d] Test psa_cipher_decrypt_setup - Zero as key handle\n",
diff --git a/api-tests/dev_apis/crypto/test_c033/test_c033.h b/api-tests/dev_apis/crypto/test_c033/test_c033.h
index ea045b4..c30d05c 100644
--- a/api-tests/dev_apis/crypto/test_c033/test_c033.h
+++ b/api-tests/dev_apis/crypto/test_c033/test_c033.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c033_crypto_list[];
+extern const client_test_t test_c033_crypto_list[];
int32_t psa_cipher_decrypt_setup_test(caller_security_t caller);
int32_t psa_cipher_decrypt_setup_negative_test(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c033/test_data.h b/api-tests/dev_apis/crypto/test_c033/test_data.h
index c44e8ed..c847a08 100644
--- a/api-tests/dev_apis/crypto/test_c033/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c033/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[64];
uint32_t key_length;
@@ -159,10 +158,10 @@
0x68, 0x49, 0xf9, 0x7d, 0x10, 0x66, 0xf6, 0x99, 0x77, 0x59, 0x63, 0x7c, 0x7e, 0x38,
0x99, 0x46, 0x4c, 0xee, 0x3e, 0xc7, 0xac, 0x97, 0x06, 0x53, 0xa0, 0xbe, 0x07, 0x42};
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_AES_128
-{"Test psa_cipher_decrypt_setup 16 Byte AES\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_decrypt_setup 16 Byte AES\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0xD0}, AES_16B_KEY_SIZE,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_CTR, BYTES_TO_BITS(AES_16B_KEY_SIZE),
@@ -171,7 +170,7 @@
#endif
#ifdef ARCH_TEST_AES_192
-{"Test psa_cipher_decrypt_setup 24 Byte AES\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_decrypt_setup 24 Byte AES\n", PSA_KEY_TYPE_AES,
{0x24, 0x13, 0x61, 0x47, 0x61, 0xB8, 0xC8, 0xF0, 0xDF, 0xAB, 0x5A, 0x0E, 0x87,
0x40, 0xAC, 0xA3, 0x90, 0x77, 0x83, 0x52, 0x31, 0x74, 0xF9}, AES_24B_KEY_SIZE,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_CTR, BYTES_TO_BITS(AES_24B_KEY_SIZE),
@@ -180,7 +179,7 @@
#endif
#ifdef ARCH_TEST_AES_256
-{"Test psa_cipher_decrypt_setup 32 Byte AES\n", 3, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_decrypt_setup 32 Byte AES\n", PSA_KEY_TYPE_AES,
{0xEA, 0xD5, 0xE6, 0xC8, 0x51, 0xF9, 0xEC, 0xBB, 0x9B, 0x57, 0x7C, 0xED, 0xD2,
0x4B, 0x82, 0x84, 0x9F, 0x9F, 0xE6, 0x73, 0x21, 0x3D, 0x1A, 0x05, 0xC9, 0xED,
0xDF, 0x25, 0x17, 0x68, 0x86, 0xAE}, AES_32B_KEY_SIZE,
@@ -192,7 +191,7 @@
#ifdef ARCH_TEST_CBC_NO_PADDING
#ifdef ARCH_TEST_DES_1KEY
-{"Test psa_cipher_decrypt_setup DES 64 bit key\n", 4, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_decrypt_setup DES 64 bit key\n", PSA_KEY_TYPE_DES,
{0x70, 0x24, 0x55, 0x0C, 0x14, 0x9D, 0xED, 0x29},
DES_8B_KEY_SIZE, PSA_KEY_USAGE_DECRYPT, PSA_ALG_CBC_NO_PADDING, BYTES_TO_BITS(DES_8B_KEY_SIZE),
PSA_SUCCESS
@@ -200,7 +199,7 @@
#endif
#ifdef ARCH_TEST_DES_2KEY
-{"Test psa_cipher_decrypt_setup Triple DES 2-Key\n", 5, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_decrypt_setup Triple DES 2-Key\n", PSA_KEY_TYPE_DES,
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
DES3_2KEY_SIZE, PSA_KEY_USAGE_DECRYPT, PSA_ALG_CBC_NO_PADDING, BYTES_TO_BITS(DES3_2KEY_SIZE),
@@ -209,7 +208,7 @@
#endif
#ifdef ARCH_TEST_DES_3KEY
-{"Test psa_cipher_decrypt_setup Triple DES 3-Key\n", 6, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_decrypt_setup Triple DES 3-Key\n", PSA_KEY_TYPE_DES,
{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
0xF1, 0xE0, 0xD3, 0xC2, 0xB5, 0xA4, 0x97, 0x86,
0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10},
@@ -221,7 +220,7 @@
#ifdef ARCH_TEST_AES_128
#ifdef ARCH_TEST_CIPER_MODE_CTR
-{"Test psa_cipher_decrypt_setup 16 Byte raw data\n", 7, PSA_KEY_TYPE_RAW_DATA,
+{"Test psa_cipher_decrypt_setup 16 Byte raw data\n", PSA_KEY_TYPE_RAW_DATA,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0xD0}, AES_16B_KEY_SIZE,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_CTR, BYTES_TO_BITS(AES_16B_KEY_SIZE),
@@ -230,7 +229,7 @@
#endif
#ifdef ARCH_TEST_CMAC
-{"Test psa_cipher_decrypt_setup - not a cipher algorithm\n", 8, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_decrypt_setup - not a cipher algorithm\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0xD0}, AES_16B_KEY_SIZE,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_CMAC, BYTES_TO_BITS(AES_16B_KEY_SIZE),
@@ -239,7 +238,7 @@
#endif
#ifdef ARCH_TEST_CIPER
-{"Test psa_cipher_decrypt_setup - unknown cipher algorithm\n", 9, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_decrypt_setup - unknown cipher algorithm\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0xD0}, AES_16B_KEY_SIZE,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_CATEGORY_CIPHER, BYTES_TO_BITS(AES_16B_KEY_SIZE),
@@ -249,7 +248,7 @@
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_ARC4
-{"Test psa_cipher_decrypt_setup - incompatible key ARC4\n", 10, PSA_KEY_TYPE_ARC4,
+{"Test psa_cipher_decrypt_setup - incompatible key ARC4\n", PSA_KEY_TYPE_ARC4,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0xD0}, AES_16B_KEY_SIZE,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_CTR, BYTES_TO_BITS(AES_16B_KEY_SIZE),
@@ -257,7 +256,7 @@
},
#endif
-{"Test psa_cipher_decrypt_setup - incorrect usage\n", 11, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_decrypt_setup - incorrect usage\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0xD0}, AES_16B_KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CTR, BYTES_TO_BITS(AES_16B_KEY_SIZE),
@@ -268,13 +267,13 @@
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
#ifdef ARCH_TEST_RSA_2048
-{"Test psa_cipher_decrypt_setup - RSA public key\n", 12, PSA_KEY_TYPE_RSA_PUBLIC_KEY,
+{"Test psa_cipher_decrypt_setup - RSA public key\n", PSA_KEY_TYPE_RSA_PUBLIC_KEY,
{0}, 270,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_RSA_PKCS1V15_SIGN_RAW, 2048,
PSA_ERROR_INVALID_ARGUMENT
},
-{"Test psa_cipher_decrypt_setup - RSA keypair\n", 13, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_cipher_decrypt_setup - RSA keypair\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0}, 1193,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_RSA_PKCS1V15_SIGN_RAW, 2048,
PSA_ERROR_INVALID_ARGUMENT
@@ -284,7 +283,7 @@
#ifdef ARCH_TEST_RSA_PKCS1V15_CRYPT
#ifdef ARCH_TEST_ECC_CURVE_SECP256R1
-{"Test psa_cipher_decrypt_setup - EC Public key\n", 14,
+{"Test psa_cipher_decrypt_setup - EC Public key\n",
PSA_KEY_TYPE_ECC_PUBLIC_KEY(PSA_ECC_CURVE_SECP256R1), {0}, 65,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_RSA_PKCS1V15_CRYPT, 192,
PSA_ERROR_INVALID_ARGUMENT
@@ -292,7 +291,7 @@
#endif
#ifdef ARCH_TEST_ECC_CURVE_SECP224R1
-{"Test psa_cipher_decrypt_setup - EC keypair\n", 15,
+{"Test psa_cipher_decrypt_setup - EC keypair\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP224R1), {0}, 28,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_RSA_PKCS1V15_CRYPT, 224,
PSA_ERROR_INVALID_ARGUMENT
@@ -301,10 +300,10 @@
#endif
};
-static test_data check2[] = {
+static const test_data check2[] = {
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_AES_128
-{"Test psa_cipher_decrypt_setup - negative test\n", 16, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_decrypt_setup - negative test\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0xD0}, AES_16B_KEY_SIZE,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_CTR, BYTES_TO_BITS(AES_16B_KEY_SIZE),
diff --git a/api-tests/dev_apis/crypto/test_c034/test_c034.c b/api-tests/dev_apis/crypto/test_c034/test_c034.c
index 0017ce0..6a77a21 100644
--- a/api-tests/dev_apis/crypto/test_c034/test_c034.c
+++ b/api-tests/dev_apis/crypto/test_c034/test_c034.c
@@ -1,6 +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");
@@ -22,7 +21,7 @@
#include "test_data.h"
-client_test_t test_c034_crypto_list[] = {
+const client_test_t test_c034_crypto_list[] = {
NULL,
psa_cipher_generate_iv_test,
NULL,
@@ -39,6 +38,7 @@
psa_cipher_operation_t operation;
int32_t status;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -67,12 +67,12 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Set the key for a multipart symmetric encryption operation */
status = val->crypto_function(VAL_CRYPTO_CIPHER_ENCRYPT_SETUP, &operation,
- check1[i].key_handle, check1[i].key_alg);
+ key_handle, check1[i].key_alg);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(4));
/* Generate an IV for a symmetric encryption operation */
@@ -87,7 +87,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(6));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(7));
continue;
@@ -117,7 +117,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(11));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(12));
/* Reset the key attributes and check if psa_import_key fails */
diff --git a/api-tests/dev_apis/crypto/test_c034/test_c034.h b/api-tests/dev_apis/crypto/test_c034/test_c034.h
index 67273ab..399ec13 100644
--- a/api-tests/dev_apis/crypto/test_c034/test_c034.h
+++ b/api-tests/dev_apis/crypto/test_c034/test_c034.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c034_crypto_list[];
+extern const client_test_t test_c034_crypto_list[];
int32_t psa_cipher_generate_iv_test(caller_security_t caller);
#endif /* _TEST_C034_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/crypto/test_c034/test_data.h b/api-tests/dev_apis/crypto/test_c034/test_data.h
index 7bc7eab..d03dae9 100644
--- a/api-tests/dev_apis/crypto/test_c034/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c034/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[32];
uint32_t key_length;
@@ -30,10 +29,10 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_AES_128
-{"Test psa_cipher_generate_iv 16 Byte AES\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_generate_iv 16 Byte AES\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0xD0}, AES_16B_KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CTR, 16, 16,
@@ -42,7 +41,7 @@
#endif
#ifdef ARCH_TEST_AES_192
-{"Test psa_cipher_generate_iv 24 Byte AES\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_generate_iv 24 Byte AES\n", PSA_KEY_TYPE_AES,
{0x24, 0x13, 0x61, 0x47, 0x61, 0xB8, 0xC8, 0xF0, 0xDF, 0xAB, 0x5A, 0x0E, 0x87,
0x40, 0xAC, 0xA3, 0x90, 0x77, 0x83, 0x52, 0x31, 0x74, 0xF9}, AES_24B_KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CTR, 16, 16,
@@ -51,7 +50,7 @@
#endif
#ifdef ARCH_TEST_AES_256
-{"Test psa_cipher_generate_iv 32 Byte AES\n", 3, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_generate_iv 32 Byte AES\n", PSA_KEY_TYPE_AES,
{0xEA, 0xD5, 0xE6, 0xC8, 0x51, 0xF9, 0xEC, 0xBB, 0x9B, 0x57, 0x7C, 0xED, 0xD2,
0x4B, 0x82, 0x84, 0x9F, 0x9F, 0xE6, 0x73, 0x21, 0x3D, 0x1A, 0x05, 0xC9, 0xED,
0xDF, 0x25, 0x17, 0x68, 0x86, 0xAE}, AES_32B_KEY_SIZE,
@@ -63,7 +62,7 @@
#ifdef ARCH_TEST_CBC_NO_PADDING
#ifdef ARCH_TEST_DES_1KEY
-{"Test psa_cipher_generate_iv DES 64 bit key\n", 4, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_generate_iv DES 64 bit key\n", PSA_KEY_TYPE_DES,
{0x70, 0x24, 0x55, 0x0C, 0x14, 0x9D, 0xED, 0x29},
DES_8B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
8, 8,
@@ -72,7 +71,7 @@
#endif
#ifdef ARCH_TEST_DES_2KEY
-{"Test psa_cipher_generate_iv Triple DES 2-Key\n", 5, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_generate_iv Triple DES 2-Key\n", PSA_KEY_TYPE_DES,
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
DES3_2KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
@@ -82,7 +81,7 @@
#endif
#ifdef ARCH_TEST_DES_3KEY
-{"Test psa_cipher_generate_iv Triple DES 3-Key\n", 6, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_generate_iv Triple DES 3-Key\n", PSA_KEY_TYPE_DES,
{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
0xF1, 0xE0, 0xD3, 0xC2, 0xB5, 0xA4, 0x97, 0x86,
0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10},
@@ -95,7 +94,7 @@
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_AES_128
-{"Test psa_cipher_generate_iv AES - small iv buffer\n", 7, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_generate_iv AES - small iv buffer\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0xD0}, AES_16B_KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CTR, 8, 16,
@@ -106,7 +105,7 @@
#ifdef ARCH_TEST_CBC_NO_PADDING
#ifdef ARCH_TEST_DES_1KEY
-{"Test psa_cipher_generate_iv DES - small iv buffer\n", 8, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_generate_iv DES - small iv buffer\n", PSA_KEY_TYPE_DES,
{0x70, 0x24, 0x55, 0x0C, 0x14, 0x9D, 0xED, 0x29},
DES_8B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
4, 8,
@@ -117,7 +116,7 @@
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_AES_128
-{"Test psa_cipher_generate_iv AES - large iv buffer\n", 9, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_generate_iv AES - large iv buffer\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0xD0}, AES_16B_KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CTR, 32, 16,
@@ -128,7 +127,7 @@
#ifdef ARCH_TEST_CBC_NO_PADDING
#ifdef ARCH_TEST_DES_1KEY
-{"Test psa_cipher_generate_iv DES - large iv buffer\n", 10, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_generate_iv DES - large iv buffer\n", PSA_KEY_TYPE_DES,
{0x70, 0x24, 0x55, 0x0C, 0x14, 0x9D, 0xED, 0x29},
DES_8B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
16, 8,
diff --git a/api-tests/dev_apis/crypto/test_c035/test_c035.c b/api-tests/dev_apis/crypto/test_c035/test_c035.c
index 8d19a10..887ca14 100644
--- a/api-tests/dev_apis/crypto/test_c035/test_c035.c
+++ b/api-tests/dev_apis/crypto/test_c035/test_c035.c
@@ -1,6 +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");
@@ -22,7 +21,7 @@
#include "test_data.h"
-client_test_t test_c035_crypto_list[] = {
+const client_test_t test_c035_crypto_list[] = {
NULL,
psa_cipher_set_iv_test,
NULL,
@@ -36,6 +35,7 @@
int32_t i, status;
psa_cipher_operation_t operation;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -64,12 +64,12 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Set the key for a multipart symmetric encryption operation */
status = val->crypto_function(VAL_CRYPTO_CIPHER_ENCRYPT_SETUP, &operation,
- check1[i].key_handle, check1[i].key_alg);
+ key_handle, check1[i].key_alg);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(4));
/* Set an IV for a symmetric encryption operation */
@@ -89,7 +89,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(7));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(8));
/* Reset the key attributes and check if psa_import_key fails */
diff --git a/api-tests/dev_apis/crypto/test_c035/test_c035.h b/api-tests/dev_apis/crypto/test_c035/test_c035.h
index b5a6a49..d66774b 100644
--- a/api-tests/dev_apis/crypto/test_c035/test_c035.h
+++ b/api-tests/dev_apis/crypto/test_c035/test_c035.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c035_crypto_list[];
+extern const client_test_t test_c035_crypto_list[];
int32_t psa_cipher_set_iv_test(caller_security_t caller);
#endif /* _TEST_C035_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/crypto/test_c035/test_data.h b/api-tests/dev_apis/crypto/test_c035/test_data.h
index af43a3b..9f4d653 100644
--- a/api-tests/dev_apis/crypto/test_c035/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c035/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[32];
uint32_t key_length;
@@ -30,10 +29,10 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_AES_128
-{"Test psa_cipher_set_iv 16 Byte AES\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_set_iv 16 Byte AES\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0xD0}, AES_16B_KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CTR,
@@ -44,7 +43,7 @@
#endif
#ifdef ARCH_TEST_AES_192
-{"Test psa_cipher_set_iv 24 Byte AES\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_set_iv 24 Byte AES\n", PSA_KEY_TYPE_AES,
{0x24, 0x13, 0x61, 0x47, 0x61, 0xB8, 0xC8, 0xF0, 0xDF, 0xAB, 0x5A, 0x0E, 0x87,
0x40, 0xAC, 0xA3, 0x90, 0x77, 0x83, 0x52, 0x31, 0x74, 0xF9}, AES_24B_KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CTR,
@@ -55,7 +54,7 @@
#endif
#ifdef ARCH_TEST_AES_256
-{"Test psa_cipher_set_iv 32 Byte AES\n", 3, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_set_iv 32 Byte AES\n", PSA_KEY_TYPE_AES,
{0xEA, 0xD5, 0xE6, 0xC8, 0x51, 0xF9, 0xEC, 0xBB, 0x9B, 0x57, 0x7C, 0xED, 0xD2,
0x4B, 0x82, 0x84, 0x9F, 0x9F, 0xE6, 0x73, 0x21, 0x3D, 0x1A, 0x05, 0xC9, 0xED,
0xDF, 0x25, 0x17, 0x68, 0x86, 0xAE}, AES_32B_KEY_SIZE,
@@ -69,7 +68,7 @@
#ifdef ARCH_TEST_CBC_AES_NO_PADDING
#ifdef ARCH_TEST_DES_1KEY
-{"Test psa_cipher_set_iv DES 64 bit key\n", 4, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_set_iv DES 64 bit key\n", PSA_KEY_TYPE_DES,
{0x70, 0x24, 0x55, 0x0C, 0x14, 0x9D, 0xED, 0x29},
DES_8B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 8,
@@ -79,7 +78,7 @@
#endif
#ifdef ARCH_TEST_DES_2KEY
-{"Test psa_cipher_set_iv Triple DES 2-Key\n", 5, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_set_iv Triple DES 2-Key\n", PSA_KEY_TYPE_DES,
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
DES3_2KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
@@ -89,7 +88,7 @@
#endif
#ifdef ARCH_TEST_DES_3KEY
-{"Test psa_cipher_set_iv Triple DES 3-Key\n", 6, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_set_iv Triple DES 3-Key\n", PSA_KEY_TYPE_DES,
{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
0xF1, 0xE0, 0xD3, 0xC2, 0xB5, 0xA4, 0x97, 0x86,
0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10},
@@ -102,7 +101,7 @@
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_AES_128
-{"Test psa_cipher_set_iv AES - small iv buffer\n", 7, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_set_iv AES - small iv buffer\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0xD0}, AES_16B_KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CTR,
@@ -114,7 +113,7 @@
#ifdef ARCH_TEST_CBC_AES_NO_PADDING
#ifdef ARCH_TEST_DES_1KEY
-{"Test psa_cipher_set_iv DES - small iv buffer\n", 8, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_set_iv DES - small iv buffer\n", PSA_KEY_TYPE_DES,
{0x70, 0x24, 0x55, 0x0C, 0x14, 0x9D, 0xED, 0x29},
DES_8B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
{0x00, 0x01, 0x02, 0x03,}, 4,
@@ -125,7 +124,7 @@
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_AES_128
-{"Test psa_cipher_set_iv AES - large iv buffer\n", 9, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_set_iv AES - large iv buffer\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0xD0}, AES_16B_KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CTR,
@@ -139,7 +138,7 @@
#ifdef ARCH_TEST_CBC_AES_NO_PADDING
#ifdef ARCH_TEST_DES_1KEY
-{"Test psa_cipher_set_iv DES - large iv buffer\n", 10, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_set_iv DES - large iv buffer\n", PSA_KEY_TYPE_DES,
{0x70, 0x24, 0x55, 0x0C, 0x14, 0x9D, 0xED, 0x29},
DES_8B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C,
diff --git a/api-tests/dev_apis/crypto/test_c036/test_c036.c b/api-tests/dev_apis/crypto/test_c036/test_c036.c
index 64fea25..0744ed1 100644
--- a/api-tests/dev_apis/crypto/test_c036/test_c036.c
+++ b/api-tests/dev_apis/crypto/test_c036/test_c036.c
@@ -1,6 +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");
@@ -22,7 +21,7 @@
#include "test_data.h"
-client_test_t test_c036_crypto_list[] = {
+const client_test_t test_c036_crypto_list[] = {
NULL,
psa_cipher_update_test,
psa_cipher_update_negative_test,
@@ -40,6 +39,7 @@
size_t length;
psa_cipher_operation_t operation;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -68,20 +68,20 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
if (check1[i].usage == PSA_KEY_USAGE_ENCRYPT)
{
/* Set the key for a multipart symmetric encryption operation */
status = val->crypto_function(VAL_CRYPTO_CIPHER_ENCRYPT_SETUP, &operation,
- check1[i].key_handle, check1[i].key_alg);
+ key_handle, check1[i].key_alg);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(4));
}
else if (check1[i].usage == PSA_KEY_USAGE_DECRYPT)
{
status = val->crypto_function(VAL_CRYPTO_CIPHER_DECRYPT_SETUP, &operation,
- check1[i].key_handle, check1[i].key_alg);
+ key_handle, check1[i].key_alg);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(5));
}
@@ -102,7 +102,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(8));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(9));
continue;
}
@@ -118,7 +118,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(12));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(13));
/* Reset the key attributes and check if psa_import_key fails */
diff --git a/api-tests/dev_apis/crypto/test_c036/test_c036.h b/api-tests/dev_apis/crypto/test_c036/test_c036.h
index 2056762..6547630 100644
--- a/api-tests/dev_apis/crypto/test_c036/test_c036.h
+++ b/api-tests/dev_apis/crypto/test_c036/test_c036.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c036_crypto_list[];
+extern const client_test_t test_c036_crypto_list[];
int32_t psa_cipher_update_test(caller_security_t caller);
int32_t psa_cipher_update_negative_test(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c036/test_data.h b/api-tests/dev_apis/crypto/test_c036/test_data.h
index c5e4fbe..9d1db05 100644
--- a/api-tests/dev_apis/crypto/test_c036/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c036/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[32];
uint32_t key_length;
@@ -35,10 +34,10 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_AES_128
#ifdef ARCH_TEST_CBC_NO_PADDING
-{"Test psa_cipher_update - Encrypt - AES CBC_NO_PADDING\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_update - Encrypt - AES CBC_NO_PADDING\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,
@@ -50,7 +49,7 @@
0x20, 0x74, 0x3B}, 16, PSA_SUCCESS
},
-{"Test psa_cipher_update - Encrypt - AES CBC_NO_PADDING (Short input)\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_update - 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,
@@ -62,7 +61,7 @@
#endif
#ifdef ARCH_TEST_CBC_PKCS7
-{"Test psa_cipher_update - Encrypt - AES CBC_PKCS7\n", 3, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_update - Encrypt - 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_ENCRYPT, PSA_ALG_CBC_PKCS7,
@@ -74,7 +73,7 @@
0x20, 0x74, 0x3b}, 16, PSA_SUCCESS
},
-{"Test psa_cipher_update - Encrypt - AES CBC_PKCS7 (Short input)\n", 4, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_update - Encrypt - 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_ENCRYPT, PSA_ALG_CBC_PKCS7,
@@ -87,7 +86,7 @@
#endif
#ifdef ARCH_TEST_CIPER_MODE_CTR
-{"Test psa_cipher_update - Encrypt - AES CTR\n", 5, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_update - Encrypt - AES CTR\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_CTR,
@@ -102,7 +101,7 @@
#ifdef ARCH_TEST_CBC_NO_PADDING
#ifdef ARCH_TEST_DES_1KEY
-{"Test psa_cipher_update - Encrypt - DES CBC (nopad)\n", 6, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_update - 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,
{0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a}, 8,
@@ -115,7 +114,7 @@
#ifdef ARCH_TEST_CBC_NO_PADDING
#ifdef ARCH_TEST_DES_2KEY
-{"Test psa_cipher_update - Encrypt - 2-key 3DE -CBC (nopad)\n", 7, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_update - Encrypt - 2-key 3DE -CBC (nopad)\n", PSA_KEY_TYPE_DES,
{0x01, 0x02, 0x04, 0x07, 0x08, 0x0b, 0x0d, 0x0e, 0xc1, 0xc2, 0xc4, 0xc7, 0xc8,
0xcb, 0xcd, 0xce}, DES3_2KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
@@ -126,7 +125,7 @@
#endif
#ifdef ARCH_TEST_DES_3KEY
-{"Test psa_cipher_update - Encrypt - 3-key 3DE -CBC (nopad)\n", 8, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_update - Encrypt - 3-key 3DE -CBC (nopad)\n", PSA_KEY_TYPE_DES,
{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_3KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
@@ -137,7 +136,7 @@
#endif
#ifdef ARCH_TEST_AES_128
-{"Test psa_cipher_update - small output buffer size\n", 9, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_update - small output buffer size\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,
@@ -149,7 +148,7 @@
0x20, 0x74, 0x3B}, 16, PSA_ERROR_BUFFER_TOO_SMALL
},
-{"Test psa_cipher_update - Decrypt - AES CBC_NO_PADDING\n", 10, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_update - Decrypt - AES CBC_NO_PADDING\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,
@@ -161,7 +160,7 @@
0x93, 0x17, 0x2a}, 16, PSA_SUCCESS
},
-{"Test psa_cipher_update - Decrypt - AES CBC_NO_PADDING (Short input)\n", 11, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_update - 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,
@@ -175,7 +174,7 @@
#ifdef ARCH_TEST_AES_128
#ifdef ARCH_TEST_CBC_PKCS7
-{"Test psa_cipher_update - Decrypt - AES CBC_PKCS7\n", 12, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_update - 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,
@@ -187,7 +186,7 @@
0x93, 0x17, 0x2a}, 0, PSA_SUCCESS
},
-{"Test psa_cipher_update - Decrypt - AES CBC_PKCS7 (Short input)\n", 13, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_update - 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,
@@ -202,7 +201,7 @@
#endif
#ifdef ARCH_TEST_CIPER_MODE_CTR
-{"Test psa_cipher_update - Decrypt - AES CTR\n", 14, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_update - Decrypt - AES CTR\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,
@@ -218,7 +217,7 @@
#ifdef ARCH_TEST_CBC_NO_PADDING
#ifdef ARCH_TEST_DES_1KEY
-{"Test psa_cipher_update - Decrypt - DES CBC (nopad)\n", 15, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_update - 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,
{0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a}, 8,
@@ -228,7 +227,7 @@
#endif
#ifdef ARCH_TEST_DES_2KEY
-{"Test psa_cipher_update - Decrypt - 2-key 3DE -CBC (nopad)\n", 16, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_update - Decrypt - 2-key 3DE -CBC (nopad)\n", PSA_KEY_TYPE_DES,
{0x01, 0x02, 0x04, 0x07, 0x08, 0x0b, 0x0d, 0x0e, 0xc1, 0xc2, 0xc4, 0xc7, 0xc8,
0xcb, 0xcd, 0xce}, DES3_2KEY_SIZE,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_CBC_NO_PADDING,
@@ -239,7 +238,7 @@
#endif
#ifdef ARCH_TEST_DES_3KEY
-{"Test psa_cipher_update - Decrypt - 3-key 3DE -CBC (nopad)\n", 17, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_update - Decrypt - 3-key 3DE -CBC (nopad)\n", PSA_KEY_TYPE_DES,
{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_3KEY_SIZE,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_CBC_NO_PADDING,
diff --git a/api-tests/dev_apis/crypto/test_c037/test_c037.c b/api-tests/dev_apis/crypto/test_c037/test_c037.c
index 86c2931..665047f 100644
--- a/api-tests/dev_apis/crypto/test_c037/test_c037.c
+++ b/api-tests/dev_apis/crypto/test_c037/test_c037.c
@@ -1,6 +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");
@@ -24,7 +23,7 @@
#define SLOT_1 0
#define SLOT_2 1
-client_test_t test_c037_crypto_list[] = {
+const client_test_t test_c037_crypto_list[] = {
NULL,
psa_cipher_finish_test,
NULL,
@@ -40,6 +39,7 @@
size_t update_length, finish_length;
psa_cipher_operation_t operation, invalid_operation;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -69,21 +69,21 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
if (check1[i].usage == PSA_KEY_USAGE_ENCRYPT)
{
/* Set the key for a multipart symmetric encryption operation */
status = val->crypto_function(VAL_CRYPTO_CIPHER_ENCRYPT_SETUP, &operation,
- check1[i].key_handle, check1[i].key_alg);
+ key_handle, check1[i].key_alg);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(4));
}
else if (check1[i].usage == PSA_KEY_USAGE_DECRYPT)
{
/* Set the key for a multipart symmetric decryption operation */
status = val->crypto_function(VAL_CRYPTO_CIPHER_DECRYPT_SETUP, &operation,
- check1[i].key_handle, check1[i].key_alg);
+ key_handle, check1[i].key_alg);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(5));
}
@@ -109,7 +109,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(9));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(10));
continue;
}
@@ -136,7 +136,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(15));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(16));
/* Reset the key attributes and check if psa_import_key fails */
diff --git a/api-tests/dev_apis/crypto/test_c037/test_c037.h b/api-tests/dev_apis/crypto/test_c037/test_c037.h
index cf57c40..14b6ac7 100644
--- a/api-tests/dev_apis/crypto/test_c037/test_c037.h
+++ b/api-tests/dev_apis/crypto/test_c037/test_c037.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c037_crypto_list[];
+extern const client_test_t test_c037_crypto_list[];
int32_t psa_cipher_finish_test(caller_security_t caller);
#endif /* _TEST_C037_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/crypto/test_c037/test_data.h b/api-tests/dev_apis/crypto/test_c037/test_data.h
index 013eec1..8e3c901 100644
--- a/api-tests/dev_apis/crypto/test_c037/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c037/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[32];
uint32_t key_length;
@@ -35,10 +34,10 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_AES_128
#ifdef ARCH_TEST_CBC_NO_PADDING
-{"Test psa_cipher_finish - Encrypt - AES CBC_NO_PADDING\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_finish - Encrypt - AES CBC_NO_PADDING\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,
@@ -50,7 +49,7 @@
0x20, 0x74, 0x3B}, 0, PSA_SUCCESS
},
-{"Test psa_cipher_finish - Encrypt - AES CBC_NO_PADDING (Short input)\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_finish - 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,
@@ -62,7 +61,7 @@
#endif
#ifdef ARCH_TEST_CBC_PKCS7
-{"Test psa_cipher_finish - Encrypt - AES CBC_PKCS7\n", 3, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_finish - Encrypt - 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_ENCRYPT, PSA_ALG_CBC_PKCS7,
@@ -75,7 +74,7 @@
0x42, 0x93, 0x03, 0x1c, 0xd4, 0xf3}, 16, PSA_SUCCESS
},
-{"Test psa_cipher_finish - Encrypt - AES CBC_PKCS7 (Short input)\n", 4, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_finish - Encrypt - 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_ENCRYPT, PSA_ALG_CBC_PKCS7,
@@ -89,7 +88,7 @@
#endif
#ifdef ARCH_TEST_CIPER_MODE_CTR
-{"Test psa_cipher_finish - Encrypt - AES CTR\n", 5, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_finish - Encrypt - AES CTR\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_CTR,
@@ -101,7 +100,7 @@
0xb2, 0xbd, 0x32}, 0, PSA_SUCCESS
},
-{"Test psa_cipher_finish - Encrypt - AES CTR (short input)\n", 6, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_finish - Encrypt - 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_ENCRYPT, PSA_ALG_CTR,
@@ -117,7 +116,7 @@
#ifdef ARCH_TEST_CBC_NO_PADDING
#ifdef ARCH_TEST_DES_1KEY
-{"Test psa_cipher_finish - Encrypt - DES CBC (nopad)\n", 7, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_finish - 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,
{0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a}, 8,
@@ -127,7 +126,7 @@
#endif
#ifdef ARCH_TEST_DES_2KEY
-{"Test psa_cipher_finish - Encrypt - 2-key 3DE -CBC (nopad)\n", 8, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_finish - Encrypt - 2-key 3DE -CBC (nopad)\n", PSA_KEY_TYPE_DES,
{0x01, 0x02, 0x04, 0x07, 0x08, 0x0b, 0x0d, 0x0e, 0xc1, 0xc2, 0xc4, 0xc7, 0xc8,
0xcb, 0xcd, 0xce}, DES3_2KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
@@ -138,7 +137,7 @@
#endif
#ifdef ARCH_TEST_DES_3KEY
-{"Test psa_cipher_finish - Encrypt - 3-key 3DE -CBC (nopad)\n", 9, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_finish - Encrypt - 3-key 3DE -CBC (nopad)\n", PSA_KEY_TYPE_DES,
{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_3KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
@@ -151,7 +150,7 @@
#ifdef ARCH_TEST_AES_128
#ifdef ARCH_TEST_CBC_PKCS7
-{"Test psa_cipher_finish - small output buffer size\n", 10, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_finish - small output buffer size\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_PKCS7,
@@ -166,7 +165,7 @@
#endif
#ifdef ARCH_TEST_CBC_NO_PADDING
-{"Test psa_cipher_finish - Decrypt - AES CBC_NO_PADDING\n", 11, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_finish - Decrypt - AES CBC_NO_PADDING\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,
@@ -179,7 +178,7 @@
0x93, 0x17, 0x2a}, 0, PSA_SUCCESS
},
-{"Test psa_cipher_finish - Decrypt - AES CBC_NO_PADDING (Short input)\n", 12, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_finish - 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_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
@@ -191,7 +190,7 @@
#endif
#ifdef ARCH_TEST_CBC_PKCS7
-{"Test psa_cipher_finish - Decrypt - AES CBC_PKCS7\n", 13, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_finish - 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,
@@ -204,7 +203,7 @@
0x93, 0x17, 0x2a}, 0, PSA_SUCCESS
},
-{"Test psa_cipher_finish - Decrypt - AES CBC_PKCS7 (Short input)\n", 14, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_finish - 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,
@@ -218,7 +217,7 @@
#endif
#ifdef ARCH_TEST_CIPER_MODE_CTR
-{"Test psa_cipher_finish - Decrypt - AES CTR\n", 15, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_finish - Decrypt - AES CTR\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,
@@ -231,7 +230,7 @@
0, PSA_SUCCESS
},
-{"Test psa_cipher_finish - Decrypt - AES CTR (short input)\n", 16, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_finish - 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,
@@ -247,7 +246,7 @@
#ifdef ARCH_TEST_CBC_NO_PADDING
#ifdef ARCH_TEST_DES_1KEY
-{"Test psa_cipher_finish - Decrypt - DES CBC (nopad)\n", 17, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_finish - 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,
{0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a}, 8,
@@ -257,7 +256,7 @@
#endif
#ifdef ARCH_TEST_DES_2KEY
-{"Test psa_cipher_finish - Decrypt - 2-key 3DE -CBC (nopad)\n", 18, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_finish - Decrypt - 2-key 3DE -CBC (nopad)\n", PSA_KEY_TYPE_DES,
{0x01, 0x02, 0x04, 0x07, 0x08, 0x0b, 0x0d, 0x0e, 0xc1, 0xc2, 0xc4, 0xc7, 0xc8,
0xcb, 0xcd, 0xce}, DES3_2KEY_SIZE,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_CBC_NO_PADDING,
@@ -268,7 +267,7 @@
#endif
#ifdef ARCH_TEST_DES_3KEY
-{"Test psa_cipher_finish - 3-key 3DE -CBC (nopad)\n", 19, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_finish - 3-key 3DE -CBC (nopad)\n", PSA_KEY_TYPE_DES,
{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_3KEY_SIZE,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_CBC_NO_PADDING,
diff --git a/api-tests/dev_apis/crypto/test_c038/test_c038.c b/api-tests/dev_apis/crypto/test_c038/test_c038.c
index 8cf69cd..7f80eda 100644
--- a/api-tests/dev_apis/crypto/test_c038/test_c038.c
+++ b/api-tests/dev_apis/crypto/test_c038/test_c038.c
@@ -1,6 +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");
@@ -21,7 +20,7 @@
#include "test_c038.h"
#include "test_data.h"
-client_test_t test_c038_crypto_list[] = {
+const client_test_t test_c038_crypto_list[] = {
NULL,
psa_cipher_abort_test,
psa_cipher_abort_before_update_test,
@@ -37,6 +36,7 @@
int32_t i, status;
psa_cipher_operation_t operation;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -65,21 +65,21 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
if (check1[i].usage == PSA_KEY_USAGE_ENCRYPT)
{
/* Set the key for a multipart symmetric encryption operation */
status = val->crypto_function(VAL_CRYPTO_CIPHER_ENCRYPT_SETUP, &operation,
- check1[i].key_handle, check1[i].key_alg);
+ key_handle, check1[i].key_alg);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(4));
}
else if (check1[i].usage == PSA_KEY_USAGE_DECRYPT)
{
/* Set the key for a multipart symmetric decryption operation */
status = val->crypto_function(VAL_CRYPTO_CIPHER_DECRYPT_SETUP, &operation,
- check1[i].key_handle, check1[i].key_alg);
+ key_handle, check1[i].key_alg);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(5));
}
@@ -92,7 +92,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(7));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(8));
/* Reset the key attributes and check if psa_import_key fails */
diff --git a/api-tests/dev_apis/crypto/test_c038/test_c038.h b/api-tests/dev_apis/crypto/test_c038/test_c038.h
index 3568e65..f304d98 100644
--- a/api-tests/dev_apis/crypto/test_c038/test_c038.h
+++ b/api-tests/dev_apis/crypto/test_c038/test_c038.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c038_crypto_list[];
+extern const client_test_t test_c038_crypto_list[];
int32_t psa_cipher_abort_test(caller_security_t caller);
int32_t psa_cipher_abort_before_update_test(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c038/test_data.h b/api-tests/dev_apis/crypto/test_c038/test_data.h
index 1dedbec..f3b6788 100644
--- a/api-tests/dev_apis/crypto/test_c038/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c038/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[32];
uint32_t key_length;
@@ -28,10 +27,10 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_AES_128
#ifdef ARCH_TEST_CBC_NO_PADDING
-{"Test psa_cipher_abort - Encrypt - AES CBC_NO_PADDING\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_abort - Encrypt - AES CBC_NO_PADDING\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,
@@ -40,7 +39,7 @@
#endif
#ifdef ARCH_TEST_CBC_PKCS7
-{"Test psa_cipher_abort - Encrypt - AES CBC_PKCS7\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_abort - Encrypt - 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_ENCRYPT, PSA_ALG_CBC_PKCS7,
@@ -49,7 +48,7 @@
#endif
#ifdef ARCH_TEST_CIPER_MODE_CTR
-{"Test psa_cipher_abort - Encrypt - AES CTR\n", 3, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_abort - Encrypt - AES CTR\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_CTR,
@@ -60,7 +59,7 @@
#ifdef ARCH_TEST_CBC_NO_PADDING
#ifdef ARCH_TEST_DES_1KEY
-{"Test psa_cipher_abort - Encrypt - DES CBC (nopad)\n", 4, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_abort - 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,
PSA_SUCCESS
@@ -68,7 +67,7 @@
#endif
#ifdef ARCH_TEST_DES_2KEY
-{"Test psa_cipher_abort - Encrypt - 2-key 3DE -CBC (nopad)\n", 5, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_abort - Encrypt - 2-key 3DE -CBC (nopad)\n", PSA_KEY_TYPE_DES,
{0x01, 0x02, 0x04, 0x07, 0x08, 0x0b, 0x0d, 0x0e, 0xc1, 0xc2, 0xc4, 0xc7, 0xc8,
0xcb, 0xcd, 0xce}, DES3_2KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
@@ -77,7 +76,7 @@
#endif
#ifdef ARCH_TEST_DES_3KEY
-{"Test psa_cipher_abort - Encrypt - 3-key 3DE -CBC (nopad)\n", 6, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_abort - Encrypt - 3-key 3DE -CBC (nopad)\n", PSA_KEY_TYPE_DES,
{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_3KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
@@ -88,7 +87,7 @@
#ifdef ARCH_TEST_AES_128
#ifdef ARCH_TEST_CBC_NO_PADDING
-{"Test psa_cipher_abort - Decrypt - AES CBC_NO_PADDING\n", 7, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_abort - Decrypt - AES CBC_NO_PADDING\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,
@@ -97,7 +96,7 @@
#endif
#ifdef ARCH_TEST_CBC_PKCS7
-{"Test psa_cipher_abort - Decrypt - AES CBC_PKCS7\n", 8, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_abort - 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,
@@ -106,7 +105,7 @@
#endif
#ifdef ARCH_TEST_CIPER_MODE_CTR
-{"Test psa_cipher_abort - Decrypt - AES CTR\n", 9, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_abort - Decrypt - AES CTR\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,
@@ -117,7 +116,7 @@
#ifdef ARCH_TEST_CBC_NO_PADDING
#ifdef ARCH_TEST_DES_1KEY
-{"Test psa_cipher_abort - Decrypt - DES CBC (nopad)\n", 10, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_abort - 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,
PSA_SUCCESS
@@ -125,7 +124,7 @@
#endif
#ifdef ARCH_TEST_DES_2KEY
-{"Test psa_cipher_abort - Decrypt - 2-key 3DE -CBC (nopad)\n", 11, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_abort - Decrypt - 2-key 3DE -CBC (nopad)\n", PSA_KEY_TYPE_DES,
{0x01, 0x02, 0x04, 0x07, 0x08, 0x0b, 0x0d, 0x0e, 0xc1, 0xc2, 0xc4, 0xc7, 0xc8,
0xcb, 0xcd, 0xce}, DES3_2KEY_SIZE,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_CBC_NO_PADDING,
@@ -134,7 +133,7 @@
#endif
#ifdef ARCH_TEST_DES_3KEY
-{"Test psa_cipher_abort - Decrypt - 3-key 3DE -CBC (nopad)\n", 12, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_abort - Decrypt - 3-key 3DE -CBC (nopad)\n", PSA_KEY_TYPE_DES,
{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_3KEY_SIZE,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_CBC_NO_PADDING,
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 72648bc..1df1f76 100644
--- a/api-tests/dev_apis/crypto/test_c039/test_c039.c
+++ b/api-tests/dev_apis/crypto/test_c039/test_c039.c
@@ -1,6 +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");
@@ -21,7 +20,7 @@
#include "test_c039.h"
#include "test_data.h"
-client_test_t test_c039_crypto_list[] = {
+const client_test_t test_c039_crypto_list[] = {
NULL,
psa_asymmetric_encrypt_test,
psa_asymmetric_encrypt_negative_test,
@@ -52,6 +51,7 @@
uint8_t *salt;
size_t length;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -117,7 +117,7 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
if (is_buffer_empty(check1[i].salt, check1[i].salt_length) == TRUE)
@@ -129,7 +129,7 @@
salt = check1[i].salt;
/* Encrypt a short message with a public key */
- status = val->crypto_function(VAL_CRYPTO_ASYMMTERIC_ENCRYPT, check1[i].key_handle,
+ status = val->crypto_function(VAL_CRYPTO_ASYMMTERIC_ENCRYPT, key_handle,
check1[i].key_alg, check1[i].input, check1[i].input_length, salt,
check1[i].salt_length, output, check1[i].output_size, &length);
TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(4));
@@ -137,7 +137,7 @@
if (check1[i].expected_status != PSA_SUCCESS)
{
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(5));
continue;
@@ -152,7 +152,7 @@
if ((check1[i].usage & PSA_KEY_USAGE_DECRYPT) == PSA_KEY_USAGE_DECRYPT)
{
status = val->crypto_function(VAL_CRYPTO_ASYMMTERIC_DECRYPT,
- check1[i].key_handle, check1[i].key_alg, output, length, salt,
+ key_handle, check1[i].key_alg, output, length, salt,
check1[i].salt_length, output, check1[i].output_size, &length);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(7));
@@ -164,7 +164,7 @@
}
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(10));
/* Reset the key attributes and check if psa_import_key fails */
@@ -180,6 +180,7 @@
int32_t i, status;
uint8_t *salt = NULL;
size_t length;
+ psa_key_handle_t key_handle = 11;
/* Initialize the PSA crypto library*/
status = val->crypto_function(VAL_CRYPTO_INIT);
@@ -202,7 +203,7 @@
val->print(PRINT_TEST, "[Check %d] Test psa_asymmetric_encrypt - Invalid key handle\n",
g_test_count++);
/* Encrypt a short message with a public key */
- status = val->crypto_function(VAL_CRYPTO_ASYMMTERIC_ENCRYPT, check2[i].key_handle,
+ status = val->crypto_function(VAL_CRYPTO_ASYMMTERIC_ENCRYPT, key_handle,
check2[i].key_alg, check2[i].input, check2[i].input_length, salt,
check2[i].salt_length, output, check2[i].output_size, &length);
TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(3));
diff --git a/api-tests/dev_apis/crypto/test_c039/test_c039.h b/api-tests/dev_apis/crypto/test_c039/test_c039.h
index dd431d3..b31e141 100644
--- a/api-tests/dev_apis/crypto/test_c039/test_c039.h
+++ b/api-tests/dev_apis/crypto/test_c039/test_c039.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c039_crypto_list[];
+extern const client_test_t test_c039_crypto_list[];
int32_t psa_asymmetric_encrypt_test(caller_security_t caller);
int32_t psa_asymmetric_encrypt_negative_test(caller_security_t caller);
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 e947fd0..93e59a6 100644
--- a/api-tests/dev_apis/crypto/test_c039/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c039/test_data.h
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[16];
uint32_t key_length;
@@ -123,7 +122,7 @@
static test_data check1[] = {
#ifdef ARCH_TEST_RSA_1024
#ifdef ARCH_TEST_RSA_PKCS1V15_CRYPT
-{"Test psa_asymmetric_encrypt - RSA PKCS1V15\n", 1, PSA_KEY_TYPE_RSA_PUBLIC_KEY,
+{"Test psa_asymmetric_encrypt - RSA PKCS1V15\n", PSA_KEY_TYPE_RSA_PUBLIC_KEY,
{0}, 162, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_RSA_PKCS1V15_CRYPT,
{0}, 0,
{0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d,
@@ -135,7 +134,7 @@
#ifdef ARCH_TEST_SHA256
#ifdef ARCH_TEST_RSA_OAEP
-{"Test psa_asymmetric_encrypt - RSA OAEP SHA256\n", 2, PSA_KEY_TYPE_RSA_PUBLIC_KEY,
+{"Test psa_asymmetric_encrypt - RSA OAEP SHA256\n", PSA_KEY_TYPE_RSA_PUBLIC_KEY,
{0}, 162, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_RSA_OAEP(PSA_ALG_SHA_256),
{0}, 0,
{0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d,
@@ -144,7 +143,7 @@
128, 1024, PSA_SUCCESS
},
-{"Test psa_asymmetric_encrypt - RSA OAEP SHA256 with label\n", 3, PSA_KEY_TYPE_RSA_PUBLIC_KEY,
+{"Test psa_asymmetric_encrypt - RSA OAEP SHA256 with label\n", PSA_KEY_TYPE_RSA_PUBLIC_KEY,
{0}, 162, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_RSA_OAEP(PSA_ALG_SHA_256),
{0x74, 0x68, 0x69, 0x73, 0x00, 0x69, 0x73, 0x00, 0x61, 0x00, 0x6c, 0x61, 0x62,
0x65, 0x6c, 0x00}, 16,
@@ -157,7 +156,7 @@
#endif
#ifdef ARCH_TEST_RSA_PKCS1V15_CRYPT
-{"Test psa_asymmetric_encrypt - RSA KEY_PAIR PKCS1V15\n", 4, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_asymmetric_encrypt - RSA KEY_PAIR PKCS1V15\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0}, 610, PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT, PSA_ALG_RSA_PKCS1V15_CRYPT,
{0}, 0,
{0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d,
@@ -166,7 +165,7 @@
128, 1024, PSA_SUCCESS
},
-{"Test psa_asymmetric_encrypt - Small output buffer\n", 5, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_asymmetric_encrypt - Small output buffer\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0}, 610, PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT, PSA_ALG_RSA_PKCS1V15_CRYPT,
{0}, 0,
{0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d,
@@ -177,7 +176,7 @@
#endif
#ifdef ARCH_TEST_SHA256
-{"Test psa_asymmetric_encrypt - Invalid algorithm\n", 6, PSA_KEY_TYPE_RSA_PUBLIC_KEY,
+{"Test psa_asymmetric_encrypt - Invalid algorithm\n", PSA_KEY_TYPE_RSA_PUBLIC_KEY,
{0}, 162, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_SHA_256,
{0}, 0,
{0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d,
@@ -190,7 +189,7 @@
#ifdef ARCH_TEST_RSA_PKCS1V15_CRYPT
#ifdef ARCH_TEST_AES_128
-{"Test psa_asymmetric_encrypt - Invalid key type\n", 7, PSA_KEY_TYPE_AES,
+{"Test psa_asymmetric_encrypt - Invalid key type\n", PSA_KEY_TYPE_AES,
{0x30, 0x82, 0x02, 0x5e, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0xaf, 0x05,
0x7d, 0x39, 0x6e}, 16,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_RSA_PKCS1V15_CRYPT,
@@ -203,7 +202,7 @@
#endif
#ifdef ARCH_TEST_RSA_1024
-{"Test psa_asymmetric_encrypt - Invalid usage\n", 8, PSA_KEY_TYPE_RSA_PUBLIC_KEY,
+{"Test psa_asymmetric_encrypt - Invalid usage\n", PSA_KEY_TYPE_RSA_PUBLIC_KEY,
{0}, 162, PSA_KEY_USAGE_DECRYPT, PSA_ALG_RSA_PKCS1V15_CRYPT,
{0}, 0,
{0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d,
@@ -217,7 +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,
+{"Test psa_asymmetric_encrypt - ECC public key\n",
PSA_KEY_TYPE_ECC_PUBLIC_KEY(PSA_ECC_CURVE_SECP256R1),
{0}, 65, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CATEGORY_ASYMMETRIC_ENCRYPTION,
{0}, 0,
@@ -227,7 +226,7 @@
128, 256, PSA_SUCCESS
},
-{"Test psa_asymmetric_encrypt - ECC keypair\n", 10,
+{"Test psa_asymmetric_encrypt - ECC keypair\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP256R1),
{0}, 97, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_DETERMINISTIC_ECDSA(PSA_ALG_SHA_256),
{0}, 0,
@@ -244,7 +243,7 @@
static test_data check2[] = {
#ifdef ARCH_TEST_RSA_PKCS1V15_CRYPT
#ifdef ARCH_TEST_RSA_1024
-{"Test psa_asymmetric_encrypt - Negative case\n", 11, PSA_KEY_TYPE_RSA_PUBLIC_KEY,
+{"Test psa_asymmetric_encrypt - Negative case\n", PSA_KEY_TYPE_RSA_PUBLIC_KEY,
{0}, 162, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_RSA_PKCS1V15_CRYPT,
{0}, 0,
{0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d,
diff --git a/api-tests/dev_apis/crypto/test_c040/test_c040.c b/api-tests/dev_apis/crypto/test_c040/test_c040.c
index e769c1a..93d242e 100644
--- a/api-tests/dev_apis/crypto/test_c040/test_c040.c
+++ b/api-tests/dev_apis/crypto/test_c040/test_c040.c
@@ -1,6 +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");
@@ -21,7 +20,7 @@
#include "test_c040.h"
#include "test_data.h"
-client_test_t test_c040_crypto_list[] = {
+const client_test_t test_c040_crypto_list[] = {
NULL,
psa_asymmetric_decrypt_test,
psa_asymmetric_decrypt_negative_test,
@@ -52,6 +51,7 @@
uint8_t *salt;
size_t length;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -117,7 +117,7 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
if (is_buffer_empty(check1[i].salt, check1[i].salt_length) == TRUE)
@@ -129,7 +129,7 @@
salt = check1[i].salt;
/* Decrypt a short message with a private key */
- status = val->crypto_function(VAL_CRYPTO_ASYMMTERIC_DECRYPT, check1[i].key_handle,
+ status = val->crypto_function(VAL_CRYPTO_ASYMMTERIC_DECRYPT, key_handle,
check1[i].key_alg, check1[i].input, check1[i].input_length, salt,
check1[i].salt_length, output, check1[i].output_size, &length);
TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(4));
@@ -137,7 +137,7 @@
if (check1[i].expected_status != PSA_SUCCESS)
{
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(5));
continue;
@@ -150,7 +150,7 @@
TEST_ASSERT_MEMCMP(output, check1[i].expected_output, length, TEST_CHECKPOINT_NUM(7));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(8));
/* Reset the key attributes and check if psa_import_key fails */
@@ -166,6 +166,7 @@
int32_t i, status;
uint8_t *salt;
size_t length;
+ psa_key_handle_t key_handle = 1;
/* Initialize the PSA crypto library*/
status = val->crypto_function(VAL_CRYPTO_INIT);
@@ -189,7 +190,7 @@
val->print(PRINT_TEST, "[Check %d] Test psa_asymmetric_decrypt - Invalid key handle\n",
g_test_count++);
/* Encrypt a short message with a public key */
- status = val->crypto_function(VAL_CRYPTO_ASYMMTERIC_DECRYPT, check2[i].key_handle,
+ status = val->crypto_function(VAL_CRYPTO_ASYMMTERIC_DECRYPT, key_handle,
check2[i].key_alg, check2[i].input, check2[i].input_length, salt,
check2[i].salt_length, output, check2[i].output_size, &length);
TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(3));
diff --git a/api-tests/dev_apis/crypto/test_c040/test_c040.h b/api-tests/dev_apis/crypto/test_c040/test_c040.h
index 80e95f9..8758446 100644
--- a/api-tests/dev_apis/crypto/test_c040/test_c040.h
+++ b/api-tests/dev_apis/crypto/test_c040/test_c040.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c040_crypto_list[];
+extern const client_test_t test_c040_crypto_list[];
int32_t psa_asymmetric_decrypt_test(caller_security_t caller);
int32_t psa_asymmetric_decrypt_negative_test(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c040/test_data.h b/api-tests/dev_apis/crypto/test_c040/test_data.h
index 371d230..348065c 100644
--- a/api-tests/dev_apis/crypto/test_c040/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c040/test_data.h
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[16];
uint32_t key_length;
@@ -125,7 +124,7 @@
static test_data check1[] = {
#ifdef ARCH_TEST_RSA_1024
#ifdef ARCH_TEST_RSA_PKCS1V15_CRYPT
-{"Test psa_asymmetric_decrypt - RSA KEY_PAIR PKCS1V15\n", 1, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_asymmetric_decrypt - RSA KEY_PAIR PKCS1V15\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0}, 610, PSA_KEY_USAGE_DECRYPT, PSA_ALG_RSA_PKCS1V15_CRYPT,
{0}, 0,
{0x99, 0xff, 0xde, 0x2f, 0xcc, 0x00, 0xc9, 0xcc, 0x01, 0x97, 0x2e, 0xbf, 0xa7,
@@ -148,7 +147,7 @@
#ifdef ARCH_TEST_SHA256
#ifdef ARCH_TEST_RSA_OAEP
-{"Test psa_asymmetric_decrypt - RSA KEY_PAIR OAEP SHA256\n", 2, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_asymmetric_decrypt - RSA KEY_PAIR OAEP SHA256\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0}, 610, PSA_KEY_USAGE_DECRYPT, PSA_ALG_RSA_OAEP(PSA_ALG_SHA_256),
{0}, 0,
{0x3d, 0x31, 0x46, 0xb1, 0xc9, 0x82, 0x00, 0x42, 0x73, 0xa9, 0xeb, 0xb9, 0xb0,
@@ -166,7 +165,7 @@
0, 1024, PSA_SUCCESS
},
-{"Test psa_asymmetric_decrypt - RSA KEY_PAIR OAEP SHA256 with label\n", 3,
+{"Test psa_asymmetric_decrypt - RSA KEY_PAIR OAEP SHA256 with label\n",
PSA_KEY_TYPE_RSA_KEY_PAIR,
{0}, 610, PSA_KEY_USAGE_DECRYPT, PSA_ALG_RSA_OAEP(PSA_ALG_SHA_256),
{0x74, 0x68, 0x69, 0x73, 0x00, 0x69, 0x73, 0x00, 0x61, 0x00, 0x6c, 0x61, 0x62,
@@ -191,7 +190,7 @@
#endif
#ifdef ARCH_TEST_RSA_PKCS1V15_CRYPT
-{"Test psa_asymmetric_decrypt - Invalid key type (RSA public key)\n", 4,
+{"Test psa_asymmetric_decrypt - Invalid key type (RSA public key)\n",
PSA_KEY_TYPE_RSA_PUBLIC_KEY,
{0}, 162, PSA_KEY_USAGE_DECRYPT, PSA_ALG_RSA_PKCS1V15_CRYPT,
{0}, 0,
@@ -210,7 +209,7 @@
0, 1024, PSA_ERROR_INVALID_ARGUMENT
},
-{"Test psa_asymmetric_decrypt - Small output buffer\n", 5, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_asymmetric_decrypt - Small output buffer\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0}, 610, PSA_KEY_USAGE_DECRYPT, PSA_ALG_RSA_PKCS1V15_CRYPT,
{0}, 0,
{0x99, 0xff, 0xde, 0x2f, 0xcc, 0x00, 0xc9, 0xcc, 0x01, 0x97, 0x2e, 0xbf, 0xa7,
@@ -232,7 +231,7 @@
#endif
#ifdef ARCH_TEST_SHA256
-{"Test psa_asymmetric_decrypt - Invalid algorithm\n", 6, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_asymmetric_decrypt - Invalid algorithm\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0}, 610, PSA_KEY_USAGE_DECRYPT, PSA_ALG_SHA_256,
{0}, 0,
{0x99, 0xff, 0xde, 0x2f, 0xcc, 0x00, 0xc9, 0xcc, 0x01, 0x97, 0x2e, 0xbf, 0xa7,
@@ -256,7 +255,7 @@
#ifdef ARCH_TEST_RSA_PKCS1V15_CRYPT
#ifdef ARCH_TEST_AES_128
-{"Test psa_asymmetric_decrypt - Invalid key type (AES Key)\n", 7, PSA_KEY_TYPE_AES,
+{"Test psa_asymmetric_decrypt - Invalid key type (AES Key)\n", PSA_KEY_TYPE_AES,
{0x30, 0x82, 0x02, 0x5e, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0xaf, 0x05,
0x7d, 0x39, 0x6e}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_DECRYPT, PSA_ALG_RSA_PKCS1V15_CRYPT,
{0}, 0,
@@ -279,7 +278,7 @@
#endif
#ifdef ARCH_TEST_RSA_1024
-{"Test psa_asymmetric_decrypt - Invalid usage\n", 8, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_asymmetric_decrypt - Invalid usage\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0}, 610, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_RSA_PKCS1V15_CRYPT,
{0}, 0,
{0x99, 0xff, 0xde, 0x2f, 0xcc, 0x00, 0xc9, 0xcc, 0x01, 0x97, 0x2e, 0xbf, 0xa7,
@@ -305,7 +304,7 @@
static test_data check2[] = {
#ifdef ARCH_TEST_RSA_PKCS1V15_CRYPT
#ifdef ARCH_TEST_RSA_1024
-{"Test psa_asymmetric_decrypt - Negative case\n", 1, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_asymmetric_decrypt - Negative case\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0}, 610, PSA_KEY_USAGE_DECRYPT, PSA_ALG_RSA_PKCS1V15_CRYPT,
{0}, 0,
{0x99, 0xff, 0xde, 0x2f, 0xcc, 0x00, 0xc9, 0xcc, 0x01, 0x97, 0x2e, 0xbf, 0xa7,
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 8221728..c7cf836 100644
--- a/api-tests/dev_apis/crypto/test_c041/test_c041.c
+++ b/api-tests/dev_apis/crypto/test_c041/test_c041.c
@@ -1,6 +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");
@@ -21,7 +20,7 @@
#include "test_c041.h"
#include "test_data.h"
-client_test_t test_c041_crypto_list[] = {
+const client_test_t test_c041_crypto_list[] = {
NULL,
psa_asymmetric_sign_test,
psa_asymmetric_sign_negative_test,
@@ -38,6 +37,7 @@
const uint8_t *key_data;
size_t length;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -102,11 +102,11 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Sign a hash or short message with a private key */
- status = val->crypto_function(VAL_CRYPTO_ASYMMTERIC_SIGN, check1[i].key_handle,
+ status = val->crypto_function(VAL_CRYPTO_ASYMMTERIC_SIGN, key_handle,
check1[i].key_alg, check1[i].input, check1[i].input_length,
signature, check1[i].signature_size, &length);
TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(4));
@@ -114,7 +114,7 @@
if (check1[i].expected_status != PSA_SUCCESS)
{
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(5));
continue;
@@ -127,7 +127,7 @@
TEST_ASSERT_MEMCMP(signature, check1[i].expected_signature, length, TEST_CHECKPOINT_NUM(7));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(8));
}
@@ -139,6 +139,7 @@
int num_checks = sizeof(check2)/sizeof(check2[0]);
int32_t i, status;
size_t length;
+ psa_key_handle_t key_handle = 10;
/* Initialize the PSA crypto library*/
status = val->crypto_function(VAL_CRYPTO_INIT);
@@ -153,7 +154,7 @@
val->print(PRINT_TEST, "[Check %d] Test psa_asymmetric_sign - Invalid key handle\n",
g_test_count++);
/* Sign a hash or short message with a private key */
- status = val->crypto_function(VAL_CRYPTO_ASYMMTERIC_SIGN, check2[i].key_handle,
+ status = val->crypto_function(VAL_CRYPTO_ASYMMTERIC_SIGN, key_handle,
check2[i].key_alg, check2[i].input, check2[i].input_length,
signature, check2[i].signature_size, &length);
TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(3));
diff --git a/api-tests/dev_apis/crypto/test_c041/test_c041.h b/api-tests/dev_apis/crypto/test_c041/test_c041.h
index f761ec6..7bb26cb 100644
--- a/api-tests/dev_apis/crypto/test_c041/test_c041.h
+++ b/api-tests/dev_apis/crypto/test_c041/test_c041.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c041_crypto_list[];
+extern const client_test_t test_c041_crypto_list[];
int32_t psa_asymmetric_sign_test(caller_security_t caller);
int32_t psa_asymmetric_sign_negative_test(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c041/test_data.h b/api-tests/dev_apis/crypto/test_c041/test_data.h
index 8c596e1..cbd1dd1 100644
--- a/api-tests/dev_apis/crypto/test_c041/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c041/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[16];
uint32_t key_length;
@@ -109,10 +108,10 @@
0x5e, 0x71, 0x78, 0x4e, 0x25, 0xac, 0xa4, 0xba, 0xf2, 0x5b, 0xe5, 0x73, 0x8a,
0xae, 0x59, 0xbb, 0xfe, 0x1c, 0x99, 0x77, 0x81, 0x44, 0x7a, 0x2b, 0x24};
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_RSA_1024
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
-{"Test psa_asymmetric_sign - RSA KEY_PAIR PKCS1V15 RAW\n", 1, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_asymmetric_sign - RSA KEY_PAIR PKCS1V15 RAW\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0}, 610, PSA_KEY_USAGE_SIGN, PSA_ALG_RSA_PKCS1V15_SIGN_RAW,
{0x61, 0x62, 0x63}, 3, 128,
{0x2c, 0x77, 0x44, 0x98, 0x3f, 0x02, 0x3a, 0xc7, 0xbb, 0x1c, 0x55, 0x52, 0x9d,
@@ -131,7 +130,7 @@
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN
#ifdef ARCH_TEST_SHA256
-{"Test psa_asymmetric_sign - RSA KEY_PAIR PKCS1V15 SHA-256\n", 2, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_asymmetric_sign - RSA KEY_PAIR PKCS1V15 SHA-256\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0}, 610, PSA_KEY_USAGE_SIGN, PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_SHA_256),
{0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d,
0xae, 0x22, 0x23, 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, 0xb4, 0x10,
@@ -155,7 +154,7 @@
#ifdef ARCH_TEST_SHA256
#ifdef ARCH_TEST_DETERMINISTIC_ECDSA
#ifdef ARCH_TEST_ECC_CURVE_SECP256R1
-{"Test psa_asymmetric_sign - ECDSA SECP256R1 SHA-256\n", 3,
+{"Test psa_asymmetric_sign - ECDSA SECP256R1 SHA-256\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP256R1), {0}, 32,
PSA_KEY_USAGE_SIGN, PSA_ALG_DETERMINISTIC_ECDSA(PSA_ALG_SHA_256),
{0x9a, 0xc4, 0x33, 0x5b, 0x46, 0x9b, 0xbd, 0x79, 0x14, 0x39, 0x24, 0x85, 0x04,
@@ -173,7 +172,7 @@
#ifdef ARCH_TEST_RSA_1024
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN
-{"Test psa_asymmetric_sign - Invalid key type (RSA public key)\n", 4,
+{"Test psa_asymmetric_sign - Invalid key type (RSA public key)\n",
PSA_KEY_TYPE_RSA_PUBLIC_KEY,
{0}, 162, PSA_KEY_USAGE_SIGN, PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_SHA_256),
{0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d,
@@ -192,7 +191,7 @@
128, 1024, PSA_ERROR_INVALID_ARGUMENT
},
-{"Test psa_asymmetric_sign - Small output buffer\n", 5, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_asymmetric_sign - Small output buffer\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0}, 610, PSA_KEY_USAGE_SIGN, PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_SHA_256),
{0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d,
0xae, 0x22, 0x23, 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, 0xb4, 0x10,
@@ -211,7 +210,7 @@
},
#endif
-{"Test psa_asymmetric_sign - Invalid algorithm\n", 6, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_asymmetric_sign - Invalid algorithm\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0}, 610, PSA_KEY_USAGE_SIGN, PSA_ALG_SHA_256,
{0x61, 0x62, 0x63}, 3, 128,
{0x2c, 0x77, 0x44, 0x98, 0x3f, 0x02, 0x3a, 0xc7, 0xbb, 0x1c, 0x55, 0x52, 0x9d,
@@ -230,7 +229,7 @@
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN
#ifdef ARCH_TEST_AES_128
-{"Test psa_asymmetric_sign - Invalid key type (AES Key)\n", 7, PSA_KEY_TYPE_AES,
+{"Test psa_asymmetric_sign - Invalid key type (AES Key)\n", PSA_KEY_TYPE_AES,
{0x30, 0x82, 0x02, 0x5e, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0xaf, 0x05,
0x7d, 0x39, 0x6e}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_SIGN,
PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_SHA_256),
@@ -253,7 +252,7 @@
#ifdef ARCH_TEST_RSA_1024
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
-{"Test psa_asymmetric_sign - Invalid usage\n", 8, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_asymmetric_sign - Invalid usage\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0}, 610, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_RSA_PKCS1V15_SIGN_RAW,
{0x61, 0x62, 0x63}, 3, 128,
{0x2c, 0x77, 0x44, 0x98, 0x3f, 0x02, 0x3a, 0xc7, 0xbb, 0x1c, 0x55, 0x52, 0x9d,
@@ -272,7 +271,7 @@
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN
#ifdef ARCH_TEST_SHA256
-{"Test psa_asymmetric_sign - Wrong hash size\n", 9, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_asymmetric_sign - Wrong hash size\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0}, 610, PSA_KEY_USAGE_SIGN, PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_SHA_256),
{0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d,
0xae, 0x22, 0x23, 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, 0xb4, 0x10,
@@ -294,10 +293,10 @@
#endif
};
-static test_data check2[] = {
+static const test_data check2[] = {
#ifdef ARCH_TEST_RSA_1024
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
-{"Test psa_asymmetric_sign - Negative case\n", 10, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_asymmetric_sign - Negative case\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0}, 610, PSA_KEY_USAGE_SIGN, PSA_ALG_RSA_PKCS1V15_SIGN_RAW,
{0x61, 0x62, 0x63}, 3, 128,
{0x2c, 0x77, 0x44, 0x98, 0x3f, 0x02, 0x3a, 0xc7, 0xbb, 0x1c, 0x55, 0x52, 0x9d,
diff --git a/api-tests/dev_apis/crypto/test_c042/test_c042.c b/api-tests/dev_apis/crypto/test_c042/test_c042.c
index 996577d..f257c82 100644
--- a/api-tests/dev_apis/crypto/test_c042/test_c042.c
+++ b/api-tests/dev_apis/crypto/test_c042/test_c042.c
@@ -1,6 +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");
@@ -21,7 +20,7 @@
#include "test_c042.h"
#include "test_data.h"
-client_test_t test_c042_crypto_list[] = {
+const client_test_t test_c042_crypto_list[] = {
NULL,
psa_asymmetric_verify_test,
psa_asymmetric_verify_negative_test,
@@ -36,6 +35,7 @@
int32_t i, status;
const uint8_t *key_data;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -99,17 +99,17 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Verify the signature a hash or short message using a public key */
- status = val->crypto_function(VAL_CRYPTO_ASYMMTERIC_VERIFY, check1[i].key_handle,
+ status = val->crypto_function(VAL_CRYPTO_ASYMMTERIC_VERIFY, key_handle,
check1[i].key_alg, check1[i].input, check1[i].input_length,
check1[i].signature, check1[i].signature_size);
TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(4));
/* Destroy a key and restore the slot to its default state */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(5));
}
@@ -120,6 +120,7 @@
{
int num_checks = sizeof(check2)/sizeof(check2[0]);
int32_t i, status;
+ psa_key_handle_t key_handle = 13;
/* Initialize the PSA crypto library*/
status = val->crypto_function(VAL_CRYPTO_INIT);
@@ -135,7 +136,7 @@
TEST_ASSERT_EQUAL(status, VAL_STATUS_SUCCESS, TEST_CHECKPOINT_NUM(2));
/* Verify the signature a hash or short message using a public key */
- status = val->crypto_function(VAL_CRYPTO_ASYMMTERIC_VERIFY, check2[i].key_handle,
+ status = val->crypto_function(VAL_CRYPTO_ASYMMTERIC_VERIFY, key_handle,
check2[i].key_alg, check2[i].input, check2[i].input_length,
check2[i].signature, check2[i].signature_size);
TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(3));
diff --git a/api-tests/dev_apis/crypto/test_c042/test_c042.h b/api-tests/dev_apis/crypto/test_c042/test_c042.h
index ffa2eaf..9fcdee8 100644
--- a/api-tests/dev_apis/crypto/test_c042/test_c042.h
+++ b/api-tests/dev_apis/crypto/test_c042/test_c042.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c042_crypto_list[];
+extern const client_test_t test_c042_crypto_list[];
int32_t psa_asymmetric_verify_test(caller_security_t caller);
int32_t psa_asymmetric_verify_negative_test(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c042/test_data.h b/api-tests/dev_apis/crypto/test_c042/test_data.h
index 95a1c72..7ac5096 100644
--- a/api-tests/dev_apis/crypto/test_c042/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c042/test_data.h
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[16];
uint32_t key_length;
@@ -114,10 +113,10 @@
0x5e, 0x71, 0x78, 0x4e, 0x25, 0xac, 0xa4, 0xba, 0xf2, 0x5b, 0xe5, 0x73, 0x8a,
0xae, 0x59, 0xbb, 0xfe, 0x1c, 0x99, 0x77, 0x81, 0x44, 0x7a, 0x2b, 0x24};
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_RSA_1024
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
-{"Test psa_asymmetric_verify - RSA KEY_PAIR PKCS1V15 RAW\n", 1, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_asymmetric_verify - RSA KEY_PAIR PKCS1V15 RAW\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0}, 610, PSA_KEY_USAGE_VERIFY, PSA_ALG_RSA_PKCS1V15_SIGN_RAW,
{0x61, 0x62, 0x63}, 3,
{0x2c, 0x77, 0x44, 0x98, 0x3f, 0x02, 0x3a, 0xc7, 0xbb, 0x1c, 0x55, 0x52, 0x9d,
@@ -136,7 +135,7 @@
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN
#ifdef ARCH_TEST_SHA256
-{"Test psa_asymmetric_verify - RSA KEY_PAIR PKCS1V15 SHA-256\n", 2, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_asymmetric_verify - RSA KEY_PAIR PKCS1V15 SHA-256\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0}, 610, PSA_KEY_USAGE_VERIFY, PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_SHA_256),
{0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d,
0xae, 0x22, 0x23, 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, 0xb4, 0x10,
@@ -160,7 +159,7 @@
#ifdef ARCH_TEST_SHA256
#ifdef ARCH_TEST_DETERMINISTIC_ECDSA
#ifdef ARCH_TEST_ECC_CURVE_SECP256R1
-{"Test psa_asymmetric_verify - ECDSA KEY_PAIR SECP256R1 SHA-256\n", 3,
+{"Test psa_asymmetric_verify - ECDSA KEY_PAIR SECP256R1 SHA-256\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP256R1), {0}, 32,
PSA_KEY_USAGE_VERIFY, PSA_ALG_DETERMINISTIC_ECDSA(PSA_ALG_SHA_256),
{0x9a, 0xc4, 0x33, 0x5b, 0x46, 0x9b, 0xbd, 0x79, 0x14, 0x39, 0x24, 0x85, 0x04,
@@ -178,7 +177,7 @@
#ifdef ARCH_TEST_RSA_1024
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN
-{"Test psa_asymmetric_verify - RSA public key\n", 4,
+{"Test psa_asymmetric_verify - RSA public key\n",
PSA_KEY_TYPE_RSA_PUBLIC_KEY,
{0}, 162, PSA_KEY_USAGE_VERIFY, PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_SHA_256),
{0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d,
@@ -197,7 +196,7 @@
128, 1024, PSA_SUCCESS
},
-{"Test psa_asymmetric_verify - Small output buffer\n", 5, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_asymmetric_verify - Small output buffer\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0}, 610, PSA_KEY_USAGE_VERIFY, PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_SHA_256),
{0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d,
0xae, 0x22, 0x23, 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, 0xb4, 0x10,
@@ -216,7 +215,7 @@
},
#endif
-{"Test psa_asymmetric_verify - Invalid algorithm\n", 6, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_asymmetric_verify - Invalid algorithm\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0}, 610, PSA_KEY_USAGE_VERIFY, PSA_ALG_SHA_256,
{0x61, 0x62, 0x63}, 3,
{0x2c, 0x77, 0x44, 0x98, 0x3f, 0x02, 0x3a, 0xc7, 0xbb, 0x1c, 0x55, 0x52, 0x9d,
@@ -235,7 +234,7 @@
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN
#ifdef ARCH_TEST_AES_128
-{"Test psa_asymmetric_verify - Invalid key type (AES Key)\n", 7, PSA_KEY_TYPE_AES,
+{"Test psa_asymmetric_verify - Invalid key type (AES Key)\n", PSA_KEY_TYPE_AES,
{0x30, 0x82, 0x02, 0x5e, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0xaf, 0x05,
0x7d, 0x39, 0x6e}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_VERIFY,
PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_SHA_256),
@@ -258,7 +257,7 @@
#ifdef ARCH_TEST_RSA_1024
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
-{"Test psa_asymmetric_verify - Invalid usage\n", 8, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_asymmetric_verify - Invalid usage\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0}, 610, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_RSA_PKCS1V15_SIGN_RAW,
{0x61, 0x62, 0x63}, 3,
{0x2c, 0x77, 0x44, 0x98, 0x3f, 0x02, 0x3a, 0xc7, 0xbb, 0x1c, 0x55, 0x52, 0x9d,
@@ -277,7 +276,7 @@
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN
#ifdef ARCH_TEST_SHA256
-{"Test psa_asymmetric_verify - Wrong hash size\n", 9, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_asymmetric_verify - Wrong hash size\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0}, 610, PSA_KEY_USAGE_VERIFY, PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_SHA_256),
{0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d,
0xae, 0x22, 0x23, 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, 0xb4, 0x10,
@@ -295,7 +294,7 @@
128, 1024, PSA_ERROR_INVALID_ARGUMENT
},
-{"Test psa_asymmetric_verify - Wrong signature\n", 10,
+{"Test psa_asymmetric_verify - Wrong signature\n",
PSA_KEY_TYPE_RSA_PUBLIC_KEY,
{0}, 162, PSA_KEY_USAGE_VERIFY, PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_SHA_256),
{0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d,
@@ -319,7 +318,7 @@
#ifdef ARCH_TEST_ECC_CURVE_SECP256R1
#ifdef ARCH_TEST_ECDSA
-{"Test psa_asymmetric_verify - EC public key\n", 11,
+{"Test psa_asymmetric_verify - EC public key\n",
PSA_KEY_TYPE_ECC_PUBLIC_KEY(PSA_ECC_CURVE_SECP256R1),
{0}, 65, PSA_KEY_USAGE_VERIFY, PSA_ALG_ECDSA_ANY,
{0x9a, 0xc4, 0x33, 0x5b, 0x46, 0x9b, 0xbd, 0x79, 0x14, 0x39, 0x24, 0x85, 0x04,
@@ -333,7 +332,7 @@
64, 512, PSA_SUCCESS
},
-{"Test psa_asymmetric_verify - Wrong signature size\n", 12,
+{"Test psa_asymmetric_verify - Wrong signature size\n",
PSA_KEY_TYPE_ECC_PUBLIC_KEY(PSA_ECC_CURVE_SECP256R1),
{0}, 65, PSA_KEY_USAGE_VERIFY, PSA_ALG_ECDSA_ANY,
{0x9a, 0xc4, 0x33, 0x5b, 0x46, 0x9b, 0xbd, 0x79, 0x14, 0x39, 0x24, 0x85, 0x04,
@@ -350,10 +349,10 @@
#endif
};
-static test_data check2[] = {
+static const test_data check2[] = {
#ifdef ARCH_TEST_RSA_1024
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
-{"Test psa_asymmetric_verify - Negative case\n", 13, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_asymmetric_verify - Negative case\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0}, 610, PSA_KEY_USAGE_VERIFY, PSA_ALG_RSA_PKCS1V15_SIGN_RAW,
{0x61, 0x62, 0x63}, 3,
{0x2c, 0x77, 0x44, 0x98, 0x3f, 0x02, 0x3a, 0xc7, 0xbb, 0x1c, 0x55, 0x52, 0x9d,
diff --git a/api-tests/dev_apis/crypto/test_c043/test_c043.c b/api-tests/dev_apis/crypto/test_c043/test_c043.c
index 5817fa2..d048364 100644
--- a/api-tests/dev_apis/crypto/test_c043/test_c043.c
+++ b/api-tests/dev_apis/crypto/test_c043/test_c043.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");
@@ -20,7 +20,7 @@
#include "test_c043.h"
#include "test_data.h"
-client_test_t test_c043_crypto_list[] = {
+const client_test_t test_c043_crypto_list[] = {
NULL,
psa_raw_key_agreement_test,
psa_raw_key_agreement_negative_test,
@@ -36,6 +36,7 @@
int32_t i, status;
size_t output_length;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -63,19 +64,19 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Set up a key agreement operation */
status = val->crypto_function(VAL_CRYPTO_RAW_KEY_AGREEMENT, check1[i].key_alg,
- check1[i].key_handle, check1[i].peer_key, check1[i].peer_key_length,
+ key_handle, check1[i].peer_key, check1[i].peer_key_length,
output, check1[i].output_size, &output_length);
TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(4));
if (check1[i].expected_status != PSA_SUCCESS)
{
/* Destroy a key and restore the slot to its default state */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(5));
continue;
}
@@ -85,7 +86,7 @@
TEST_CHECKPOINT_NUM(7));
/* Destroy a key and restore the slot to its default state */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(8));
}
@@ -97,6 +98,7 @@
int num_checks = sizeof(check2)/sizeof(check2[0]);
int32_t i, status;
size_t output_length;
+ psa_key_handle_t key_handle = 8;
/* Initialize the PSA crypto library*/
status = val->crypto_function(VAL_CRYPTO_INIT);
@@ -113,7 +115,7 @@
g_test_count++);
/* Set up a key agreement operation */
status = val->crypto_function(VAL_CRYPTO_RAW_KEY_AGREEMENT, check2[i].key_alg,
- check2[i].key_handle, check2[i].peer_key, check2[i].peer_key_length,
+ key_handle, check2[i].peer_key, check2[i].peer_key_length,
output, check2[i].output_size, &output_length);
TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(3));
diff --git a/api-tests/dev_apis/crypto/test_c043/test_c043.h b/api-tests/dev_apis/crypto/test_c043/test_c043.h
index 136a47b..265be6f 100644
--- a/api-tests/dev_apis/crypto/test_c043/test_c043.h
+++ b/api-tests/dev_apis/crypto/test_c043/test_c043.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c043_crypto_list[];
+extern const client_test_t test_c043_crypto_list[];
int32_t psa_raw_key_agreement_test(caller_security_t caller);
int32_t psa_raw_key_agreement_negative_test(caller_security_t caller);
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 15cf38f..c66c2b2 100644
--- a/api-tests/dev_apis/crypto/test_c043/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c043/test_data.h
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[91];
uint32_t key_length;
@@ -34,10 +33,10 @@
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_ECDH
#ifdef ARCH_TEST_ECC_CURVE_SECP256R1
-{"Test psa_raw_key_agreement - ECDH SECP256R1\n", 1,
+{"Test psa_raw_key_agreement - ECDH SECP256R1\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP256R1),
{0xc8, 0x8f, 0x01, 0xf5, 0x10, 0xd9, 0xac, 0x3f, 0x70, 0xa2, 0x92, 0xda, 0xa2,
0x31, 0x6d, 0xe5, 0x44, 0xe9, 0xaa, 0xb8, 0xaf, 0xe8, 0x40, 0x49, 0xc6, 0x2a,
@@ -53,7 +52,7 @@
0x64, 0xd0, 0x4b, 0x94, 0x42, 0xde}, 32, 32, PSA_SUCCESS
},
-{"Test psa_raw_key_agreement - Small buffer size\n", 1,
+{"Test psa_raw_key_agreement - Small buffer size\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP256R1),
{0xc8, 0x8f, 0x01, 0xf5, 0x10, 0xd9, 0xac, 0x3f, 0x70, 0xa2, 0x92, 0xda, 0xa2,
0x31, 0x6d, 0xe5, 0x44, 0xe9, 0xaa, 0xb8, 0xaf, 0xe8, 0x40, 0x49, 0xc6, 0x2a,
@@ -72,7 +71,7 @@
#endif
#ifdef ARCH_TEST_ECC_CURVE_SECP384R1
-{"Test psa_raw_key_agreement - ECDH SECP384R1\n", 2,
+{"Test psa_raw_key_agreement - ECDH SECP384R1\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP384R1),
{0x09, 0x9f, 0x3c, 0x70, 0x34, 0xd4, 0xa2, 0xc6, 0x99, 0x88, 0x4d, 0x73, 0xa3,
0x75, 0xa6, 0x7f, 0x76, 0x24, 0xef, 0x7c, 0x6b, 0x3c, 0x0f, 0x16, 0x06, 0x47,
@@ -96,7 +95,7 @@
#endif
#ifdef ARCH_TEST_ECC_CURVE_SECP256R1
-{"Test psa_raw_key_agreement - Invalid usage\n", 3,
+{"Test psa_raw_key_agreement - Invalid usage\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP256R1),
{0xc8, 0x8f, 0x01, 0xf5, 0x10, 0xd9, 0xac, 0x3f, 0x70, 0xa2, 0x92, 0xda, 0xa2,
0x31, 0x6d, 0xe5, 0x44, 0xe9, 0xaa, 0xb8, 0xaf, 0xe8, 0x40, 0x49, 0xc6, 0x2a,
@@ -112,7 +111,7 @@
0x64, 0xd0, 0x4b, 0x94, 0x42, 0xde}, 32, 32, PSA_ERROR_NOT_PERMITTED
},
-{"Test psa_raw_key_agreement - Unknown KDF\n", 4,
+{"Test psa_raw_key_agreement - Unknown KDF\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP256R1),
{0xc8, 0x8f, 0x01, 0xf5, 0x10, 0xd9, 0xac, 0x3f, 0x70, 0xa2, 0x92, 0xda, 0xa2,
0x31, 0x6d, 0xe5, 0x44, 0xe9, 0xaa, 0xb8, 0xaf, 0xe8, 0x40, 0x49, 0xc6, 0x2a,
@@ -134,7 +133,7 @@
#ifdef ARCH_TEST_ECC_CURVE_SECP256R1
#ifdef ARCH_TEST_SHA256
#ifdef ARCH_TEST_HKDF
-{"Test psa_raw_key_agreement - Not a key agreement alg\n", 5,
+{"Test psa_raw_key_agreement - Not a key agreement alg\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP256R1),
{0xc8, 0x8f, 0x01, 0xf5, 0x10, 0xd9, 0xac, 0x3f, 0x70, 0xa2, 0x92, 0xda, 0xa2,
0x31, 0x6d, 0xe5, 0x44, 0xe9, 0xaa, 0xb8, 0xaf, 0xe8, 0x40, 0x49, 0xc6, 0x2a,
@@ -153,7 +152,7 @@
#endif
#ifdef ARCH_TEST_ECDH
-{"Test psa_raw_key_agreement - Public key on different curve\n", 6,
+{"Test psa_raw_key_agreement - Public key on different curve\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP256R1),
{0xc8, 0x8f, 0x01, 0xf5, 0x10, 0xd9, 0xac, 0x3f, 0x70, 0xa2, 0x92, 0xda, 0xa2,
0x31, 0x6d, 0xe5, 0x44, 0xe9, 0xaa, 0xb8, 0xaf, 0xe8, 0x40, 0x49, 0xc6, 0x2a,
@@ -170,7 +169,7 @@
{0}, 0, SIZE_50B, PSA_ERROR_INVALID_ARGUMENT
},
-{"Test psa_raw_key_agreement - Public key instead of private key\n", 7,
+{"Test psa_raw_key_agreement - Public key instead of private key\n",
PSA_KEY_TYPE_ECC_PUBLIC_KEY(PSA_ECC_CURVE_SECP256R1),
{0x04, 0xd1, 0x2d, 0xfb, 0x52, 0x89, 0xc8, 0xd4, 0xf8, 0x12, 0x08, 0xb7, 0x02,
0x70, 0x39, 0x8c, 0x34, 0x22, 0x96, 0x97, 0x0a, 0x0b, 0xcc, 0xb7, 0x4c, 0x73,
@@ -189,10 +188,10 @@
#endif
};
-static test_data check2[] = {
+static const test_data check2[] = {
#ifdef ARCH_TEST_ECDH
#ifdef ARCH_TEST_ECC_CURVE_SECP256R1
-{"Test psa_raw_key_agreement - Negative case\n", 8,
+{"Test psa_raw_key_agreement - Negative case\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP256R1),
{0xc8, 0x8f, 0x01, 0xf5, 0x10, 0xd9, 0xac, 0x3f, 0x70, 0xa2, 0x92, 0xda, 0xa2,
0x31, 0x6d, 0xe5, 0x44, 0xe9, 0xaa, 0xb8, 0xaf, 0xe8, 0x40, 0x49, 0xc6, 0x2a,
diff --git a/api-tests/dev_apis/crypto/test_c044/test_c044.c b/api-tests/dev_apis/crypto/test_c044/test_c044.c
index 60cf422..f2a085b 100644
--- a/api-tests/dev_apis/crypto/test_c044/test_c044.c
+++ b/api-tests/dev_apis/crypto/test_c044/test_c044.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");
@@ -21,7 +21,7 @@
#include "test_data.h"
#include "val_crypto.h"
-client_test_t test_c044_crypto_list[] = {
+const client_test_t test_c044_crypto_list[] = {
NULL,
psa_copy_key_test,
NULL,
@@ -43,6 +43,7 @@
int32_t status, export_status;
psa_key_attributes_t source_attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_key_attributes_t target_attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -103,7 +104,7 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &source_attributes, key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Setup the attributes for the target key */
@@ -115,12 +116,12 @@
check1[i].target_usage);
/* Make a copy of a key */
- status = val->crypto_function(VAL_CRYPTO_COPY_KEY, check1[i].key_handle,
+ status = val->crypto_function(VAL_CRYPTO_COPY_KEY, key_handle,
&target_attributes, &target_handle);
TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(4));
/* Destroy the source key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(5));
if (check1[i].expected_status != PSA_SUCCESS)
@@ -185,7 +186,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(15));
/* Copy on a destroyed source should be an error */
- status = val->crypto_function(VAL_CRYPTO_COPY_KEY, check1[i].key_handle,
+ status = val->crypto_function(VAL_CRYPTO_COPY_KEY, key_handle,
&target_attributes, &target_handle);
TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(16));
diff --git a/api-tests/dev_apis/crypto/test_c044/test_c044.h b/api-tests/dev_apis/crypto/test_c044/test_c044.h
index caea58b..1a5e9c7 100644
--- a/api-tests/dev_apis/crypto/test_c044/test_c044.h
+++ b/api-tests/dev_apis/crypto/test_c044/test_c044.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c044_crypto_list[];
+extern const client_test_t test_c044_crypto_list[];
int32_t psa_copy_key_test(caller_security_t caller);
#endif /* _TEST_C044_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/crypto/test_c044/test_data.h b/api-tests/dev_apis/crypto/test_c044/test_data.h
index e5dd430..0903eb6 100644
--- a/api-tests/dev_apis/crypto/test_c044/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c044/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[34];
uint32_t key_length;
@@ -164,10 +163,10 @@
0x68, 0x49, 0xf9, 0x7d, 0x10, 0x66, 0xf6, 0x99, 0x77, 0x59, 0x63, 0x7c, 0x7e, 0x38,
0x99, 0x46, 0x4c, 0xee, 0x3e, 0xc7, 0xac, 0x97, 0x06, 0x53, 0xa0, 0xbe, 0x07, 0x42};
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_AES_128
-{"Test psa_copy_key 16 Byte AES\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_copy_key 16 Byte AES\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x77},
AES_16B_KEY_SIZE,
@@ -177,7 +176,7 @@
BYTES_TO_BITS(AES_16B_KEY_SIZE), AES_16B_KEY_SIZE, PSA_SUCCESS
},
-{"Test psa_copy_key without copy usage\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_copy_key without copy usage\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x77},
AES_16B_KEY_SIZE,
@@ -189,7 +188,7 @@
#endif
#ifdef ARCH_TEST_AES_192
-{"Test psa_copy_key 24 Byte AES\n", 3, PSA_KEY_TYPE_AES,
+{"Test psa_copy_key 24 Byte AES\n", PSA_KEY_TYPE_AES,
{0x24, 0x13, 0x61, 0x47, 0x61, 0xB8, 0xC8, 0xF0, 0xDF, 0xAB, 0x5A, 0x0E, 0x87,
0x40, 0xAC, 0xA3, 0x90, 0x77, 0x83, 0x52, 0x31, 0x74, 0xF9, 0x05},
AES_24B_KEY_SIZE,
@@ -202,7 +201,7 @@
#endif
#ifdef ARCH_TEST_AES_256
-{"Test psa_copy_key 32 Byte AES\n", 4, PSA_KEY_TYPE_AES,
+{"Test psa_copy_key 32 Byte AES\n", PSA_KEY_TYPE_AES,
{0xEA, 0xD5, 0xE6, 0xC8, 0x51, 0xF9, 0xEC, 0xBB, 0x9B, 0x57, 0x7C, 0xED, 0xD2,
0x4B, 0x82, 0x84, 0x9F, 0x9F, 0xE6, 0x73, 0x21, 0x3D, 0x1A, 0x05, 0xC9, 0xED,
0xDF, 0x25, 0x17, 0x68, 0x86, 0xAE},
@@ -218,7 +217,7 @@
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
#ifdef ARCH_TEST_RSA_2048
-{"Test psa_copy_key 2048 RSA public key\n", 5, PSA_KEY_TYPE_RSA_PUBLIC_KEY,
+{"Test psa_copy_key 2048 RSA public key\n", PSA_KEY_TYPE_RSA_PUBLIC_KEY,
{0},
270,
PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT | PSA_KEY_USAGE_SIGN,
@@ -229,7 +228,7 @@
2048, 270, PSA_SUCCESS
},
-{"Test psa_copy_key with RSA 2048 keypair\n", 6, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_copy_key with RSA 2048 keypair\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0},
1193,
PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT,
@@ -241,7 +240,7 @@
},
{"Test psa_copy_key with Incompatible target policy(source and target)\n",
- 7, PSA_KEY_TYPE_RSA_KEY_PAIR,
+ PSA_KEY_TYPE_RSA_KEY_PAIR,
{0},
1193,
PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT, PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT,
@@ -251,7 +250,7 @@
2048, 1193, PSA_ERROR_INVALID_ARGUMENT
},
-{"Test psa_copy_key with Incompatible constraint\n", 8, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_copy_key with Incompatible constraint\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0},
1193,
PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT, PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT,
@@ -261,7 +260,7 @@
2048, 1193, PSA_ERROR_INVALID_ARGUMENT
},
-{"Test psa_copy_key with unexport source key usage\n", 9, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_copy_key with unexport source key usage\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0},
1193,
PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_SIGN, PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT,
@@ -276,7 +275,7 @@
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_DES_1KEY
-{"Test psa_copy_key with DES 64 bit key\n", 10, PSA_KEY_TYPE_DES,
+{"Test psa_copy_key with DES 64 bit key\n", PSA_KEY_TYPE_DES,
{0x70, 0x24, 0x55, 0x0C, 0x14, 0x9D, 0xED, 0x29},
DES_8B_KEY_SIZE,
PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT, PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT,
@@ -287,7 +286,7 @@
#endif
#ifdef ARCH_TEST_DES_2KEY
-{"Test psa_copy_key with Triple DES 2-Key\n", 11, PSA_KEY_TYPE_DES,
+{"Test psa_copy_key with Triple DES 2-Key\n", PSA_KEY_TYPE_DES,
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
DES3_2KEY_SIZE,
@@ -299,7 +298,7 @@
#endif
#ifdef ARCH_TEST_DES_3KEY
-{"Test psa_copy_key with Triple DES 3-Key\n", 12, PSA_KEY_TYPE_DES,
+{"Test psa_copy_key with Triple DES 3-Key\n", PSA_KEY_TYPE_DES,
{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
0xF1, 0xE0, 0xD3, 0xC2, 0xB5, 0xA4, 0x97, 0x86,
0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10},
@@ -314,7 +313,7 @@
#ifdef ARCH_TEST_ECDSA
#ifdef ARCH_TEST_ECC_CURVE_SECP256R1
-{"Test psa_copy_key with EC Public key\n", 13,
+{"Test psa_copy_key with EC Public key\n",
PSA_KEY_TYPE_ECC_PUBLIC_KEY(PSA_ECC_CURVE_SECP256R1),
{0},
65,
@@ -326,7 +325,7 @@
#endif
#ifdef ARCH_TEST_ECC_CURVE_SECP224R1
-{"Test psa_copy_key with EC keypair\n", 14,
+{"Test psa_copy_key with EC keypair\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP224R1),
{0},
28,
@@ -340,7 +339,7 @@
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_AES
-{"Test psa_copy_key with Incompatible target policy\n", 15, PSA_KEY_TYPE_AES,
+{"Test psa_copy_key with Incompatible target policy\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x77},
AES_16B_KEY_SIZE,
diff --git a/api-tests/dev_apis/crypto/test_c045/test_c045.c b/api-tests/dev_apis/crypto/test_c045/test_c045.c
index 03e06f8..c03ab4e 100644
--- a/api-tests/dev_apis/crypto/test_c045/test_c045.c
+++ b/api-tests/dev_apis/crypto/test_c045/test_c045.c
@@ -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");
@@ -21,7 +21,7 @@
#include "test_data.h"
#include "val_crypto.h"
-client_test_t test_c045_crypto_list[] = {
+const client_test_t test_c045_crypto_list[] = {
NULL,
psa_hash_clone_test,
NULL,
diff --git a/api-tests/dev_apis/crypto/test_c045/test_c045.h b/api-tests/dev_apis/crypto/test_c045/test_c045.h
index df92d96..aba247e 100644
--- a/api-tests/dev_apis/crypto/test_c045/test_c045.h
+++ b/api-tests/dev_apis/crypto/test_c045/test_c045.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c045_crypto_list[];
+extern const client_test_t test_c045_crypto_list[];
int32_t psa_hash_clone_test(caller_security_t caller);
#endif /* _TEST_C045_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/crypto/test_c045/test_data.h b/api-tests/dev_apis/crypto/test_c045/test_data.h
index 55eff9f..a284be0 100644
--- a/api-tests/dev_apis/crypto/test_c045/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c045/test_data.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");
@@ -40,7 +40,7 @@
0xcb, 0x7b, 0x00, 0xae, 0xa8, 0x91, 0x49, 0x9c, 0xf4, 0xef, 0x6a, 0x03, 0xc8, 0xa8, 0x3f, 0xe3,
0x7c, 0x3f, 0x7b, 0xaf};
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_MD2
{"Test psa_hash_clone with MD2 algorithm\n",
PSA_ALG_MD2, 0xbd, 1,
diff --git a/api-tests/dev_apis/crypto/test_c046/test_c046.c b/api-tests/dev_apis/crypto/test_c046/test_c046.c
index 0ed33fa..6f08f80 100644
--- a/api-tests/dev_apis/crypto/test_c046/test_c046.c
+++ b/api-tests/dev_apis/crypto/test_c046/test_c046.c
@@ -1,6 +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");
@@ -21,7 +20,7 @@
#include "test_c046.h"
#include "test_data.h"
-client_test_t test_c046_crypto_list[] = {
+const client_test_t test_c046_crypto_list[] = {
NULL,
psa_mac_compute_test,
NULL,
@@ -36,6 +35,7 @@
int32_t i, status;
size_t length;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -64,11 +64,11 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Calculate the MAC (message authentication code) of a message */
- status = val->crypto_function(VAL_CRYPTO_MAC_COMPUTE, check1[i].key_handle,
+ status = val->crypto_function(VAL_CRYPTO_MAC_COMPUTE, key_handle,
check1[i].key_alg, check1[i].data, check1[i].data_size, data,
check1[i].mac_size, &length);
TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(4));
@@ -76,7 +76,7 @@
if (check1[i].expected_status != PSA_SUCCESS)
{
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(5));
continue;
@@ -91,13 +91,13 @@
memset(data, 0, sizeof(data));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(8));
/* Reset the key attributes and check if psa_import_key fails */
val->crypto_function(VAL_CRYPTO_RESET_KEY_ATTRIBUTES, &attributes);
- status = val->crypto_function(VAL_CRYPTO_MAC_COMPUTE, check1[i].key_handle,
+ status = val->crypto_function(VAL_CRYPTO_MAC_COMPUTE, key_handle,
check1[i].key_alg, check1[i].data, check1[i].data_size, data,
check1[i].mac_size, &length);
TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(9));
diff --git a/api-tests/dev_apis/crypto/test_c046/test_c046.h b/api-tests/dev_apis/crypto/test_c046/test_c046.h
index b0d994e..ddd8c1b 100644
--- a/api-tests/dev_apis/crypto/test_c046/test_c046.h
+++ b/api-tests/dev_apis/crypto/test_c046/test_c046.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c046_crypto_list[];
+extern const client_test_t test_c046_crypto_list[];
int32_t psa_mac_compute_test(caller_security_t caller);
#endif /* _TEST_C046_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/crypto/test_c046/test_data.h b/api-tests/dev_apis/crypto/test_c046/test_data.h
index 5ab7070..6830ac4 100644
--- a/api-tests/dev_apis/crypto/test_c046/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c046/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[64];
uint32_t key_length;
@@ -33,10 +32,10 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_HMAC
#ifdef ARCH_TEST_SHA224
-{"Test psa_mac_compute HMAC SHA 224\n", 1, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_compute HMAC SHA 224\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -47,7 +46,7 @@
PSA_SUCCESS
},
-{"Test psa_mac_compute - Incompactible HMAC for CMAC\n", 2, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_compute - Incompactible HMAC for CMAC\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -58,7 +57,7 @@
PSA_ERROR_NOT_SUPPORTED
},
-{"Test psa_mac_compute - Invalid usage\n", 3, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_compute - Invalid usage\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -69,7 +68,7 @@
PSA_ERROR_NOT_SUPPORTED
},
-{"Test psa_mac_compute - truncated MAC too small\n", 4, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_compute - truncated MAC too small\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -80,7 +79,7 @@
PSA_ERROR_NOT_SUPPORTED
},
-{"Test psa_mac_compute - truncated MAC too large\n", 5, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_compute - truncated MAC too large\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -91,7 +90,7 @@
PSA_ERROR_INVALID_ARGUMENT
},
-{"Test psa_mac_compute - bad algorithm (unknown MAC algorithm)\n", 6, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_compute - bad algorithm (unknown MAC algorithm)\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -104,7 +103,7 @@
#endif
#ifdef ARCH_TEST_SHA256
-{"Test psa_mac_compute HMAC SHA 256\n", 7, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_compute HMAC SHA 256\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -117,7 +116,7 @@
#endif
#ifdef ARCH_TEST_SHA512
-{"Test psa_mac_compute HMAC SHA 512\n", 8, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_compute HMAC SHA 512\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -132,7 +131,7 @@
#endif
#ifdef ARCH_TEST_SHA224
-{"Test psa_mac_compute HMAC SHA 224 (truncated to 8 Byte)\n", 9, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_compute HMAC SHA 224 (truncated to 8 Byte)\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -145,7 +144,7 @@
#ifdef ARCH_TEST_CMAC
#ifdef ARCH_TEST_AES_128
-{"Test psa_mac_compute CMAC AES 128\n", 10, PSA_KEY_TYPE_AES,
+{"Test psa_mac_compute CMAC AES 128\n", PSA_KEY_TYPE_AES,
{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09,
0xcf, 0x4f, 0x3c}, 16,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -155,7 +154,7 @@
PSA_SUCCESS
},
-{"Test psa_mac_compute small size buffer\n", 11, PSA_KEY_TYPE_AES,
+{"Test psa_mac_compute small size buffer\n", PSA_KEY_TYPE_AES,
{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09,
0xcf, 0x4f, 0x3c}, 16,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -166,7 +165,7 @@
},
#endif
-{"Test psa_mac_compute - Invalid key type\n", 12, PSA_KEY_TYPE_RAW_DATA,
+{"Test psa_mac_compute - Invalid key type\n", PSA_KEY_TYPE_RAW_DATA,
{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09,
0xcf, 0x4f, 0x3c}, 16,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
diff --git a/api-tests/dev_apis/crypto/test_c047/test_c047.c b/api-tests/dev_apis/crypto/test_c047/test_c047.c
index da4d267..55f8d6b 100644
--- a/api-tests/dev_apis/crypto/test_c047/test_c047.c
+++ b/api-tests/dev_apis/crypto/test_c047/test_c047.c
@@ -1,6 +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");
@@ -21,7 +20,7 @@
#include "test_c047.h"
#include "test_data.h"
-client_test_t test_c047_crypto_list[] = {
+const client_test_t test_c047_crypto_list[] = {
NULL,
psa_mac_verify_test,
NULL,
@@ -34,6 +33,7 @@
int num_checks = sizeof(check1)/sizeof(check1[0]);
int32_t i, status;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -61,24 +61,24 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Calculate the MAC of a message and compare it with a reference value */
- status = val->crypto_function(VAL_CRYPTO_MAC_VERIFY, check1[i].key_handle,
+ status = val->crypto_function(VAL_CRYPTO_MAC_VERIFY, key_handle,
check1[i].key_alg, check1[i].data, check1[i].data_size,
check1[i].expected_mac, check1[i].mac_size);
TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(4));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(5));
/* Reset the key attributes and check if psa_import_key fails */
val->crypto_function(VAL_CRYPTO_RESET_KEY_ATTRIBUTES, &attributes);
/* Calculate the MAC of a message on a destroyed key handle should be an error */
- status = val->crypto_function(VAL_CRYPTO_MAC_VERIFY, check1[i].key_handle,
+ status = val->crypto_function(VAL_CRYPTO_MAC_VERIFY, key_handle,
check1[i].key_alg, check1[i].data, check1[i].data_size,
check1[i].expected_mac, check1[i].mac_size);
TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(6));
diff --git a/api-tests/dev_apis/crypto/test_c047/test_c047.h b/api-tests/dev_apis/crypto/test_c047/test_c047.h
index 7e36fd3..e33762c 100644
--- a/api-tests/dev_apis/crypto/test_c047/test_c047.h
+++ b/api-tests/dev_apis/crypto/test_c047/test_c047.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c047_crypto_list[];
+extern const client_test_t test_c047_crypto_list[];
int32_t psa_mac_verify_test(caller_security_t caller);
#endif /* _TEST_C047_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/crypto/test_c047/test_data.h b/api-tests/dev_apis/crypto/test_c047/test_data.h
index e94b27f..5a21729 100644
--- a/api-tests/dev_apis/crypto/test_c047/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c047/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[64];
uint32_t key_length;
@@ -32,10 +31,10 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_HMAC
#ifdef ARCH_TEST_SHA224
-{"Test psa_mac_verify HMAC SHA 224\n", 1, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_verify HMAC SHA 224\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -48,7 +47,7 @@
#endif
#ifdef ARCH_TEST_SHA256
-{"Test psa_mac_verify HMAC SHA 256\n", 2, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_verify HMAC SHA 256\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -59,7 +58,7 @@
PSA_SUCCESS
},
-{"Test psa_mac_verify - Incompactible HMAC for CMAC\n", 3, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_verify - Incompactible HMAC for CMAC\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -70,7 +69,7 @@
PSA_ERROR_NOT_SUPPORTED
},
-{"Test psa_mac_verify - Invalid usage\n", 4, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_verify - Invalid usage\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -81,7 +80,7 @@
PSA_ERROR_NOT_SUPPORTED
},
-{"Test psa_mac_verify - Truncated MAC too large\n", 5, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_verify - Truncated MAC too large\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -92,7 +91,7 @@
PSA_ERROR_INVALID_ARGUMENT
},
-{"Test psa_mac_verify - Truncated MAC too small\n", 6, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_verify - Truncated MAC too small\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -103,7 +102,7 @@
PSA_ERROR_NOT_SUPPORTED
},
-{"Test psa_mac_verify - bad algorithm (unknown MAC algorithm)\n", 7, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_verify - bad algorithm (unknown MAC algorithm)\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -117,7 +116,7 @@
#endif
#ifdef ARCH_TEST_SHA512
-{"Test psa_mac_verify HMAC SHA 512\n", 8, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_verify HMAC SHA 512\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -132,7 +131,7 @@
#endif
#ifdef ARCH_TEST_SHA224
-{"Test psa_mac_verify HMAC SHA 224 (truncated to 8 Byte)\n", 9, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_verify HMAC SHA 224 (truncated to 8 Byte)\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -145,7 +144,7 @@
#ifdef ARCH_TEST_AES_128
#ifdef ARCH_TEST_CMAC
-{"Test psa_mac_verify CMAC AES 128\n", 10, PSA_KEY_TYPE_AES,
+{"Test psa_mac_verify CMAC AES 128\n", PSA_KEY_TYPE_AES,
{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09,
0xcf, 0x4f, 0x3c}, 16,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -157,7 +156,7 @@
#endif
#endif
-{"Test psa_mac_verify - Invalid key type\n", 11, PSA_KEY_TYPE_RAW_DATA,
+{"Test psa_mac_verify - Invalid key type\n", PSA_KEY_TYPE_RAW_DATA,
{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09,
0xcf, 0x4f, 0x3c}, 16,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -169,7 +168,7 @@
#ifdef ARCH_TEST_HMAC
#ifdef ARCH_TEST_SHA256
-{"Test psa_mac_verify small size buffer\n", 12, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_verify small size buffer\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
@@ -182,7 +181,7 @@
#endif
#ifdef ARCH_TEST_SHA224
-{"Test psa_mac_verify incorrect expected MAC\n", 13, PSA_KEY_TYPE_HMAC,
+{"Test psa_mac_verify incorrect expected MAC\n", PSA_KEY_TYPE_HMAC,
{0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
{0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
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 8ad6cd0..d791fd0 100644
--- a/api-tests/dev_apis/crypto/test_c048/test_c048.c
+++ b/api-tests/dev_apis/crypto/test_c048/test_c048.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");
@@ -20,7 +20,7 @@
#include "test_c048.h"
#include "test_data.h"
-client_test_t test_c048_crypto_list[] = {
+const client_test_t test_c048_crypto_list[] = {
NULL,
psa_cipher_encrypt_test,
NULL,
@@ -35,6 +35,7 @@
int32_t i, status;
size_t output_length;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -62,17 +63,17 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Encrypt a message using a symmetric cipher */
- status = val->crypto_function(VAL_CRYPTO_CIPHER_ENCRYPT, check1[i].key_handle,
+ status = val->crypto_function(VAL_CRYPTO_CIPHER_ENCRYPT, key_handle,
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 */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(5));
/* Reset the key attributes and check if psa_import_key fails */
@@ -89,7 +90,7 @@
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, check1[i].key_handle,
+ status = val->crypto_function(VAL_CRYPTO_CIPHER_ENCRYPT, key_handle,
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));
diff --git a/api-tests/dev_apis/crypto/test_c048/test_c048.h b/api-tests/dev_apis/crypto/test_c048/test_c048.h
index d0ede7b..16db18e 100644
--- a/api-tests/dev_apis/crypto/test_c048/test_c048.h
+++ b/api-tests/dev_apis/crypto/test_c048/test_c048.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c048_crypto_list[];
+extern const client_test_t test_c048_crypto_list[];
int32_t psa_cipher_encrypt_test(caller_security_t caller);
#endif /* _TEST_C048_CLIENT_TESTS_H_ */
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 0f9abe3..bf67c1a 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, 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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[32];
uint32_t key_length;
@@ -33,10 +32,10 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_AES_128
#ifdef ARCH_TEST_CBC_NO_PADDING
-{"Test psa_cipher_encrypt - Encrypt - AES CBC_NO_PADDING\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_encrypt - Encrypt - AES CBC_NO_PADDING\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,
@@ -46,7 +45,7 @@
0x20, 0x74, 0x3B}, 0, PSA_SUCCESS
},
-{"Test psa_cipher_encrypt - Encrypt - AES CBC_NO_PADDING (Short input)\n", 2, PSA_KEY_TYPE_AES,
+{"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,
@@ -56,7 +55,7 @@
#endif
#ifdef ARCH_TEST_CBC_PKCS7
-{"Test psa_cipher_encrypt - Encrypt - AES CBC_PKCS7\n", 3, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_encrypt - Encrypt - 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_ENCRYPT, PSA_ALG_CBC_PKCS7,
@@ -67,7 +66,7 @@
0x42, 0x93, 0x03, 0x1c, 0xd4, 0xf3}, 16, PSA_SUCCESS
},
-{"Test psa_cipher_encrypt - Encrypt - AES CBC_PKCS7 (Short input)\n", 4, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_encrypt - Encrypt - 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_ENCRYPT, PSA_ALG_CBC_PKCS7,
@@ -79,7 +78,7 @@
#endif
#ifdef ARCH_TEST_CIPER_MODE_CTR
-{"Test psa_cipher_encrypt - Encrypt - AES CTR\n", 5, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_encrypt - Encrypt - AES CTR\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_CTR,
@@ -89,7 +88,7 @@
0xb2, 0xbd, 0x32}, 0, PSA_SUCCESS
},
-{"Test psa_cipher_encrypt - Encrypt - AES CTR (short input)\n", 6, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_encrypt - Encrypt - 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_ENCRYPT, PSA_ALG_CTR,
@@ -103,7 +102,7 @@
#ifdef ARCH_TEST_CBC_NO_PADDING
#ifdef ARCH_TEST_DES_1KEY
-{"Test psa_cipher_encrypt - Encrypt - DES CBC (nopad)\n", 7, PSA_KEY_TYPE_DES,
+{"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,
@@ -112,7 +111,7 @@
#endif
#ifdef ARCH_TEST_DES_2KEY
-{"Test psa_cipher_encrypt - Encrypt - 2-key 3DE -CBC (nopad)\n", 8, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_encrypt - Encrypt - 2-key 3DE -CBC (nopad)\n", PSA_KEY_TYPE_DES,
{0x01, 0x02, 0x04, 0x07, 0x08, 0x0b, 0x0d, 0x0e, 0xc1, 0xc2, 0xc4, 0xc7, 0xc8,
0xcb, 0xcd, 0xce}, DES3_2KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
@@ -122,7 +121,7 @@
#endif
#ifdef ARCH_TEST_DES_3KEY
-{"Test psa_cipher_encrypt - Encrypt - 3-key 3DE -CBC (nopad)\n", 9, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_encrypt - Encrypt - 3-key 3DE -CBC (nopad)\n", PSA_KEY_TYPE_DES,
{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_3KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
@@ -134,7 +133,7 @@
#ifdef ARCH_TEST_AES_128
#ifdef ARCH_TEST_CBC_PKCS7
-{"Test psa_cipher_encrypt - small output buffer size\n", 10, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_encrypt - small output buffer size\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_PKCS7,
@@ -147,7 +146,7 @@
#endif
#ifdef ARCH_TEST_CBC_NO_PADDING
-{"Test psa_cipher_encrypt - Decrypt - AES CBC_NO_PADDING\n", 11, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_encrypt - Decrypt - AES CBC_NO_PADDING\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,
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 e923582..de53362 100644
--- a/api-tests/dev_apis/crypto/test_c049/test_c049.c
+++ b/api-tests/dev_apis/crypto/test_c049/test_c049.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");
@@ -20,7 +20,7 @@
#include "test_c049.h"
#include "test_data.h"
-client_test_t test_c049_crypto_list[] = {
+const client_test_t test_c049_crypto_list[] = {
NULL,
psa_cipher_decrypt_test,
NULL,
@@ -35,6 +35,7 @@
int32_t i, status;
size_t output_length;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -62,17 +63,17 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Decrypt a message using a symmetric cipher */
- status = val->crypto_function(VAL_CRYPTO_CIPHER_DECRYPT, check1[i].key_handle,
+ status = val->crypto_function(VAL_CRYPTO_CIPHER_DECRYPT, key_handle,
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 */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(5));
/* Reset the key attributes and check if psa_import_key fails */
@@ -88,7 +89,7 @@
TEST_ASSERT_MEMCMP(output, check1[i].expected_output, output_length,
TEST_CHECKPOINT_NUM(7));
- status = val->crypto_function(VAL_CRYPTO_CIPHER_DECRYPT, check1[i].key_handle,
+ status = val->crypto_function(VAL_CRYPTO_CIPHER_DECRYPT, key_handle,
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));
diff --git a/api-tests/dev_apis/crypto/test_c049/test_c049.h b/api-tests/dev_apis/crypto/test_c049/test_c049.h
index 412a8ae..2b2ab06 100644
--- a/api-tests/dev_apis/crypto/test_c049/test_c049.h
+++ b/api-tests/dev_apis/crypto/test_c049/test_c049.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c049_crypto_list[];
+extern const client_test_t test_c049_crypto_list[];
int32_t psa_cipher_decrypt_test(caller_security_t caller);
#endif /* _TEST_C049_CLIENT_TESTS_H_ */
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 2598395..8a74e81 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, 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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[32];
uint32_t key_length;
@@ -33,10 +32,10 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_AES_128
#ifdef ARCH_TEST_CBC_NO_PADDING
-{"Test psa_cipher_decrypt - Encrypt - AES CBC_NO_PADDING\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_decrypt - Encrypt - AES CBC_NO_PADDING\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,
@@ -48,7 +47,7 @@
#endif
#ifdef ARCH_TEST_CBC_NO_PADDING
-{"Test psa_cipher_decrypt - Decrypt - AES CBC_NO_PADDING\n", 11, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_decrypt - Decrypt - AES CBC_NO_PADDING\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,
@@ -59,7 +58,7 @@
0x93, 0x17, 0x2a}, 0, PSA_SUCCESS
},
-{"Test psa_cipher_decrypt - Decrypt - AES CBC_NO_PADDING (Short input)\n", 12, PSA_KEY_TYPE_AES,
+{"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_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
@@ -67,7 +66,7 @@
{0x6b, 0xc1, 0xbe, 0xe2, 0x23}, 0, PSA_ERROR_INVALID_ARGUMENT
},
-{"Test psa_cipher_decrypt - Decrypt - AES CBC_NO_PADDING\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_decrypt - Decrypt - AES CBC_NO_PADDING\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,
@@ -81,7 +80,7 @@
#endif
#ifdef ARCH_TEST_CBC_PKCS7
-{"Test psa_cipher_decrypt - Decrypt - AES CBC_PKCS7\n", 13, PSA_KEY_TYPE_AES,
+{"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,
@@ -92,7 +91,7 @@
0x93, 0x17, 0x2a}, 0, PSA_SUCCESS
},
-{"Test psa_cipher_decrypt - Decrypt - AES CBC_PKCS7 (Short input)\n", 14, PSA_KEY_TYPE_AES,
+{"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,
@@ -104,7 +103,7 @@
#endif
#ifdef ARCH_TEST_CIPER_MODE_CTR
-{"Test psa_cipher_decrypt - Decrypt - AES CTR\n", 15, PSA_KEY_TYPE_AES,
+{"Test psa_cipher_decrypt - Decrypt - AES CTR\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,
@@ -115,7 +114,7 @@
0, PSA_SUCCESS
},
-{"Test psa_cipher_decrypt - Decrypt - AES CTR (short input)\n", 16, PSA_KEY_TYPE_AES,
+{"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,
@@ -129,7 +128,7 @@
#ifdef ARCH_TEST_CBC_NO_PADDING
#ifdef ARCH_TEST_DES_1KEY
-{"Test psa_cipher_decrypt - Decrypt - DES CBC (nopad)\n", 17, PSA_KEY_TYPE_DES,
+{"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,
@@ -138,7 +137,7 @@
#endif
#ifdef ARCH_TEST_DES_2KEY
-{"Test psa_cipher_decrypt - Decrypt - 2-key 3DE -CBC (nopad)\n", 18, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_decrypt - Decrypt - 2-key 3DE -CBC (nopad)\n", PSA_KEY_TYPE_DES,
{0x01, 0x02, 0x04, 0x07, 0x08, 0x0b, 0x0d, 0x0e, 0xc1, 0xc2, 0xc4, 0xc7, 0xc8,
0xcb, 0xcd, 0xce}, DES3_2KEY_SIZE,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_CBC_NO_PADDING,
@@ -148,7 +147,7 @@
#endif
#ifdef ARCH_TEST_DES_3KEY
-{"Test psa_cipher_decrypt - 3-key 3DE -CBC (nopad)\n", 19, PSA_KEY_TYPE_DES,
+{"Test psa_cipher_decrypt - 3-key 3DE -CBC (nopad)\n", PSA_KEY_TYPE_DES,
{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_3KEY_SIZE,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_CBC_NO_PADDING,
diff --git a/api-tests/dev_apis/crypto/test_c050/test_c050.c b/api-tests/dev_apis/crypto/test_c050/test_c050.c
index ee48216..a7cf51e 100644
--- a/api-tests/dev_apis/crypto/test_c050/test_c050.c
+++ b/api-tests/dev_apis/crypto/test_c050/test_c050.c
@@ -21,7 +21,7 @@
#include "test_data.h"
#include "val_crypto.h"
-client_test_t test_c050_crypto_list[] = {
+const client_test_t test_c050_crypto_list[] = {
NULL,
psa_open_key_test,
NULL,
@@ -44,6 +44,7 @@
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_key_attributes_t get_attributes = PSA_KEY_ATTRIBUTES_INIT;
boot_t boot;
+ psa_key_handle_t tdata_key_handle;
if (num_checks == 0)
{
@@ -127,7 +128,7 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &tdata_key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(6));
/* Save the details of current check, key id and key handle value in NV memory */
@@ -138,7 +139,7 @@
sizeof(psa_key_id_t));
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(8));
- status = val->nvmem_write(VAL_NVMEM_OFFSET(NV_TEST_DATA3), &check1[i].key_handle,
+ status = val->nvmem_write(VAL_NVMEM_OFFSET(NV_TEST_DATA3), &tdata_key_handle,
sizeof(psa_key_handle_t));
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(9));
@@ -147,7 +148,11 @@
TEST_ASSERT_EQUAL(status, VAL_STATUS_SUCCESS, TEST_CHECKPOINT_NUM(10));
/* Wait for system to reset */
- val->crypto_function(VAL_CRYPTO_RESET);
+ status = val->crypto_function(VAL_CRYPTO_RESET);
+ if (status != PSA_SUCCESS)
+ {
+ return RESULT_SKIP(status);
+ }
while (1);
}
else if (boot.state == BOOT_EXPECTED_CONT_TEST_EXEC)
diff --git a/api-tests/dev_apis/crypto/test_c050/test_c050.h b/api-tests/dev_apis/crypto/test_c050/test_c050.h
index 76fc8c5..d3179e3 100644
--- a/api-tests/dev_apis/crypto/test_c050/test_c050.h
+++ b/api-tests/dev_apis/crypto/test_c050/test_c050.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c050_crypto_list[];
+extern const client_test_t test_c050_crypto_list[];
int32_t psa_open_key_test(caller_security_t caller);
#endif /* _TEST_C050_CLIENT_TESTS_H_ */
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 3a61714..24fa169 100644
--- a/api-tests/dev_apis/crypto/test_c050/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c050/test_data.h
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
psa_key_id_t key_id;
uint8_t key_data[34];
@@ -166,7 +165,7 @@
static test_data check1[] = {
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_AES_128
-{"Test psa_open_key 16 Byte AES\n", 1, PSA_KEY_TYPE_AES, 0x12,
+{"Test psa_open_key 16 Byte AES\n", PSA_KEY_TYPE_AES, 0x12,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9, 0x77},
AES_16B_KEY_SIZE, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR, PSA_KEY_LIFETIME_PERSISTENT,
@@ -175,7 +174,7 @@
#endif
#ifdef ARCH_TEST_AES_192
-{"Test psa_open_key 24 Byte AES\n", 2, PSA_KEY_TYPE_AES, 0x34,
+{"Test psa_open_key 24 Byte AES\n", PSA_KEY_TYPE_AES, 0x34,
{0x24, 0x13, 0x61, 0x47, 0x61, 0xB8, 0xC8, 0xF0, 0xDF, 0xAB, 0x5A, 0x0E, 0x87,
0x40, 0xAC, 0xA3, 0x90, 0x77, 0x83, 0x52, 0x31, 0x74, 0xF9, 0x05},
AES_24B_KEY_SIZE, BYTES_TO_BITS(AES_24B_KEY_SIZE), PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR,
@@ -185,7 +184,7 @@
#endif
#ifdef ARCH_TEST_AES_256
-{"Test psa_open_key 32 Byte AES\n", 3, PSA_KEY_TYPE_AES, 0x56,
+{"Test psa_open_key 32 Byte AES\n", PSA_KEY_TYPE_AES, 0x56,
{0xEA, 0xD5, 0xE6, 0xC8, 0x51, 0xF9, 0xEC, 0xBB, 0x9B, 0x57, 0x7C, 0xED, 0xD2,
0x4B, 0x82, 0x84, 0x9F, 0x9F, 0xE6, 0x73, 0x21, 0x3D, 0x1A, 0x05, 0xC9, 0xED,
0xDF, 0x25, 0x17, 0x68, 0x86, 0xAE},
@@ -197,13 +196,13 @@
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
#ifdef ARCH_TEST_RSA_2048
-{"Test psa_open_key 2048 RSA public key\n", 4, PSA_KEY_TYPE_RSA_PUBLIC_KEY, 0x78,
+{"Test psa_open_key 2048 RSA public key\n", PSA_KEY_TYPE_RSA_PUBLIC_KEY, 0x78,
{0},
270, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_RSA_PKCS1V15_SIGN_RAW, PSA_KEY_LIFETIME_PERSISTENT,
2048, 270, PSA_SUCCESS
},
-{"Test psa_open_key with RSA 2048 keypair\n", 5, PSA_KEY_TYPE_RSA_KEY_PAIR, 0x89,
+{"Test psa_open_key with RSA 2048 keypair\n", PSA_KEY_TYPE_RSA_KEY_PAIR, 0x89,
{0},
1193, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_RSA_PKCS1V15_SIGN_RAW, PSA_KEY_LIFETIME_PERSISTENT,
2048, 1193, PSA_SUCCESS
@@ -213,7 +212,7 @@
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_DES_1KEY
-{"Test psa_open_key with DES 64 bit key\n", 6, PSA_KEY_TYPE_DES, 0x90,
+{"Test psa_open_key with DES 64 bit key\n", PSA_KEY_TYPE_DES, 0x90,
{0x70, 0x24, 0x55, 0x0C, 0x14, 0x9D, 0xED, 0x29},
DES_8B_KEY_SIZE, BYTES_TO_BITS(DES_8B_KEY_SIZE), PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR,
PSA_KEY_LIFETIME_PERSISTENT,
@@ -222,7 +221,7 @@
#endif
#ifdef ARCH_TEST_DES_2KEY
-{"Test psa_open_key with Triple DES 2-Key\n", 7, PSA_KEY_TYPE_DES, 0x123,
+{"Test psa_open_key with Triple DES 2-Key\n", PSA_KEY_TYPE_DES, 0x123,
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
DES3_2KEY_SIZE, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR, PSA_KEY_LIFETIME_PERSISTENT,
@@ -231,7 +230,7 @@
#endif
#ifdef ARCH_TEST_DES_3KEY
-{"Test psa_open_key with Triple DES 3-Key\n", 8, PSA_KEY_TYPE_DES, 0x456,
+{"Test psa_open_key with Triple DES 3-Key\n", PSA_KEY_TYPE_DES, 0x456,
{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
0xF1, 0xE0, 0xD3, 0xC2, 0xB5, 0xA4, 0x97, 0x86,
0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10},
@@ -243,7 +242,7 @@
#ifdef ARCH_TEST_ECDSA
#ifdef ARCH_TEST_ECC_CURVE_SECP256R1
-{"Test psa_open_key with EC Public key\n", 9,
+{"Test psa_open_key with EC Public key\n",
PSA_KEY_TYPE_ECC_PUBLIC_KEY(PSA_ECC_CURVE_SECP256R1), 0x789,
{0},
65, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_ECDSA_ANY, PSA_KEY_LIFETIME_PERSISTENT,
@@ -252,7 +251,7 @@
#endif
#ifdef ARCH_TEST_ECC_CURVE_SECP224R1
-{"Test psa_open_key with EC keypair\n", 10,
+{"Test psa_open_key with EC keypair\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP224R1), 0x1234,
{0},
28, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_ECDSA_ANY, PSA_KEY_LIFETIME_PERSISTENT,
@@ -263,7 +262,7 @@
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_AES
-{"Test psa_open_key with volatile key\n", 11, PSA_KEY_TYPE_AES,
+{"Test psa_open_key with volatile key\n", PSA_KEY_TYPE_AES,
0x5678,
{0x24, 0x13, 0x61, 0x47, 0x61, 0xB8, 0xC8, 0xF0, 0xDF, 0xAB, 0x5A, 0x0E, 0x87,
0x40, 0xAC, 0xA3, 0x90, 0x77, 0x83, 0x52, 0x31, 0x74, 0xF9, 0x05, 0xC9, 0xED,
diff --git a/api-tests/dev_apis/crypto/test_c051/test_c051.c b/api-tests/dev_apis/crypto/test_c051/test_c051.c
index d3e2215..f2403e4 100644
--- a/api-tests/dev_apis/crypto/test_c051/test_c051.c
+++ b/api-tests/dev_apis/crypto/test_c051/test_c051.c
@@ -20,7 +20,7 @@
#include "test_c051.h"
#include "test_data.h"
-client_test_t test_c051_crypto_list[] = {
+const client_test_t test_c051_crypto_list[] = {
NULL,
psa_close_key_test,
NULL,
@@ -41,6 +41,7 @@
int num_checks = sizeof(check1)/sizeof(check1[0]);
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_key_attributes_t set_attributes = PSA_KEY_ATTRIBUTES_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -103,15 +104,15 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &set_attributes, key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Close the key handle */
- status = val->crypto_function(VAL_CRYPTO_CLOSE_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_CLOSE_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(4));
/* Getting the attributes of the closed key should return error */
- status = val->crypto_function(VAL_CRYPTO_GET_KEY_ATTRIBUTES, check1[i].key_handle,
+ status = val->crypto_function(VAL_CRYPTO_GET_KEY_ATTRIBUTES, key_handle,
&attributes);
TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(5));
@@ -135,18 +136,18 @@
TEST_ASSERT_EQUAL(get_key_bits, 0, TEST_CHECKPOINT_NUM(11));
/* Closing an empty key handle should return error */
- status = val->crypto_function(VAL_CRYPTO_CLOSE_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_CLOSE_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(12));
if (check1[i].key_lifetime == PSA_KEY_LIFETIME_PERSISTENT)
{
/* Open the key handle and retrieve the data */
status = val->crypto_function(VAL_CRYPTO_OPEN_KEY, check1[i].key_id,
- &check1[i].key_handle);
+ &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(13));
/* Get the attributes of the persistent key and check if it matches the given value */
- status = val->crypto_function(VAL_CRYPTO_GET_KEY_ATTRIBUTES, check1[i].key_handle,
+ status = val->crypto_function(VAL_CRYPTO_GET_KEY_ATTRIBUTES, key_handle,
&attributes);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(14));
@@ -172,10 +173,10 @@
/* Reset the key attributes */
val->crypto_function(VAL_CRYPTO_RESET_KEY_ATTRIBUTES, &attributes);
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(21));
- status = val->crypto_function(VAL_CRYPTO_CLOSE_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_CLOSE_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(22));
}
diff --git a/api-tests/dev_apis/crypto/test_c051/test_c051.h b/api-tests/dev_apis/crypto/test_c051/test_c051.h
index a539ecc..94f0edc 100644
--- a/api-tests/dev_apis/crypto/test_c051/test_c051.h
+++ b/api-tests/dev_apis/crypto/test_c051/test_c051.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c051_crypto_list[];
+extern const client_test_t test_c051_crypto_list[];
int32_t psa_close_key_test(caller_security_t caller);
#endif /* _TEST_C051_CLIENT_TESTS_H_ */
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 6792a2a..5e77062 100644
--- a/api-tests/dev_apis/crypto/test_c051/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c051/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[34];
uint32_t key_length;
@@ -161,11 +160,11 @@
0x68, 0x49, 0xf9, 0x7d, 0x10, 0x66, 0xf6, 0x99, 0x77, 0x59, 0x63, 0x7c, 0x7e, 0x38,
0x99, 0x46, 0x4c, 0xee, 0x3e, 0xc7, 0xac, 0x97, 0x06, 0x53, 0xa0, 0xbe, 0x07, 0x42};
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_AES_128
-{"Test psa_close_key 16 Byte AES\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_close_key 16 Byte AES\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9},
AES_16B_KEY_SIZE, 0, PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR,
@@ -175,7 +174,7 @@
#endif
#ifdef ARCH_TEST_AES_192
-{"Test psa_close_key 24 Byte AES\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_close_key 24 Byte AES\n", PSA_KEY_TYPE_AES,
{0x24, 0x13, 0x61, 0x47, 0x61, 0xB8, 0xC8, 0xF0, 0xDF, 0xAB, 0x5A, 0x0E, 0x87,
0x40, 0xAC, 0xA3, 0x90, 0x77, 0x83, 0x52, 0x31, 0x74, 0xF9},
AES_24B_KEY_SIZE, BYTES_TO_BITS(AES_24B_KEY_SIZE), PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR,
@@ -185,7 +184,7 @@
#endif
#ifdef ARCH_TEST_AES_256
-{"Test psa_close_key 32 Byte AES\n", 3, PSA_KEY_TYPE_AES,
+{"Test psa_close_key 32 Byte AES\n", PSA_KEY_TYPE_AES,
{0xEA, 0xD5, 0xE6, 0xC8, 0x51, 0xF9, 0xEC, 0xBB, 0x9B, 0x57, 0x7C, 0xED, 0xD2,
0x4B, 0x82, 0x84, 0x9F, 0x9F, 0xE6, 0x73, 0x21, 0x3D, 0x1A, 0x05, 0xC9, 0xED,
0xDF, 0x25, 0x17, 0x68, 0x86, 0xAE},
@@ -198,14 +197,14 @@
#ifdef ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
#ifdef ARCH_TEST_RSA_2048
-{"Test psa_close_key 2048 RSA public key\n", 4, PSA_KEY_TYPE_RSA_PUBLIC_KEY,
+{"Test psa_close_key 2048 RSA public key\n", PSA_KEY_TYPE_RSA_PUBLIC_KEY,
{0},
270, 2048, PSA_KEY_USAGE_EXPORT, PSA_ALG_RSA_PKCS1V15_SIGN_RAW,
0x78, PSA_KEY_LIFETIME_PERSISTENT,
2048, PSA_SUCCESS
},
-{"Test psa_close_key with RSA 2048 keypair\n", 5, PSA_KEY_TYPE_RSA_KEY_PAIR,
+{"Test psa_close_key with RSA 2048 keypair\n", PSA_KEY_TYPE_RSA_KEY_PAIR,
{0},
1193, 2048, PSA_KEY_USAGE_EXPORT, PSA_ALG_RSA_PKCS1V15_SIGN_RAW,
0x89, PSA_KEY_LIFETIME_PERSISTENT,
@@ -216,7 +215,7 @@
#ifdef ARCH_TEST_CIPER_MODE_CTR
#ifdef ARCH_TEST_DES_1KEY
-{"Test psa_close_key with DES 64 bit key\n", 6, PSA_KEY_TYPE_DES,
+{"Test psa_close_key with DES 64 bit key\n", PSA_KEY_TYPE_DES,
{0x70, 0x24, 0x55, 0x0C, 0x14, 0x9D, 0xED, 0x29},
DES_8B_KEY_SIZE, BYTES_TO_BITS(DES_8B_KEY_SIZE), PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR,
0xAB, PSA_KEY_LIFETIME_PERSISTENT,
@@ -225,7 +224,7 @@
#endif
#ifdef ARCH_TEST_DES_2KEY
-{"Test psa_close_key with Triple DES 2-Key\n", 7, PSA_KEY_TYPE_DES,
+{"Test psa_close_key with Triple DES 2-Key\n", PSA_KEY_TYPE_DES,
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
DES3_2KEY_SIZE, BYTES_TO_BITS(DES3_2KEY_SIZE), PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR,
@@ -235,7 +234,7 @@
#endif
#ifdef ARCH_TEST_DES_3KEY
-{"Test psa_close_key with Triple DES 3-Key\n", 8, PSA_KEY_TYPE_DES,
+{"Test psa_close_key with Triple DES 3-Key\n", PSA_KEY_TYPE_DES,
{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
0xF1, 0xE0, 0xD3, 0xC2, 0xB5, 0xA4, 0x97, 0x86,
0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10},
@@ -248,7 +247,7 @@
#ifdef ARCH_TEST_ECDSA
#ifdef ARCH_TEST_ECC_CURVE_SECP256R1
-{"Test psa_close_key with EC Public key\n", 9,
+{"Test psa_close_key with EC Public key\n",
PSA_KEY_TYPE_ECC_PUBLIC_KEY(PSA_ECC_CURVE_SECP256R1),
{0},
65, 256, PSA_KEY_USAGE_EXPORT, PSA_ALG_ECDSA_ANY,
@@ -260,7 +259,7 @@
#ifdef ARCH_TEST_ASYMMETRIC_ENCRYPTION
#ifdef ARCH_TEST_ECC_CURVE_SECP224R1
-{"Test psa_close_key with EC keypair\n", 10,
+{"Test psa_close_key with EC keypair\n",
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP224R1),
{0},
28, 224, PSA_KEY_USAGE_EXPORT, PSA_ALG_CATEGORY_ASYMMETRIC_ENCRYPTION,
diff --git a/api-tests/dev_apis/crypto/test_c052/test_c052.c b/api-tests/dev_apis/crypto/test_c052/test_c052.c
index 61cd7bb..8e4dffc 100644
--- a/api-tests/dev_apis/crypto/test_c052/test_c052.c
+++ b/api-tests/dev_apis/crypto/test_c052/test_c052.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");
@@ -20,7 +20,7 @@
#include "test_c052.h"
#include "test_data.h"
-client_test_t test_c052_crypto_list[] = {
+const client_test_t test_c052_crypto_list[] = {
NULL,
psa_aead_encrypt_setup_test,
NULL,
@@ -34,6 +34,7 @@
int num_checks = sizeof(check1)/sizeof(check1[0]);
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_aead_operation_t operation = PSA_AEAD_OPERATION_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -61,21 +62,21 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Set the key for a multipart authenticated encryption operation */
status = val->crypto_function(VAL_CRYPTO_AEAD_ENCRYPT_SETUP, &operation,
- check1[i].key_handle, check1[i].alg);
+ key_handle, check1[i].alg);
TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(4));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(5));
/* Setting up aead on destroyed key handle should return an error */
status = val->crypto_function(VAL_CRYPTO_AEAD_ENCRYPT_SETUP, &operation,
- check1[i].key_handle, check1[i].alg);
+ key_handle, check1[i].alg);
TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(6));
/* Reset the key attributes and check if psa_import_key fails */
diff --git a/api-tests/dev_apis/crypto/test_c052/test_c052.h b/api-tests/dev_apis/crypto/test_c052/test_c052.h
index 65e5c5f..a9fc662 100644
--- a/api-tests/dev_apis/crypto/test_c052/test_c052.h
+++ b/api-tests/dev_apis/crypto/test_c052/test_c052.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c052_crypto_list[];
+extern const client_test_t test_c052_crypto_list[];
int32_t psa_aead_encrypt_setup_test(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c052/test_data.h b/api-tests/dev_apis/crypto/test_c052/test_data.h
index efe55f5..74812c9 100644
--- a/api-tests/dev_apis/crypto/test_c052/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c052/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[32];
uint32_t key_length;
@@ -29,17 +28,17 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_CCM
#ifdef ARCH_TEST_AES_128
-{"Test psa_aead_encrypt_setup - AES-CCM\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_aead_encrypt_setup - AES-CCM\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM, PSA_ALG_CCM,
PSA_SUCCESS
},
-{"Test psa_aead_encrypt_setup - AES-CCM 24 bytes Tag length = 4\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_aead_encrypt_setup - AES-CCM 24 bytes Tag length = 4\n", PSA_KEY_TYPE_AES,
{0x41, 0x89, 0x35, 0x1B, 0x5C, 0xAE, 0xA3, 0x75, 0xA0, 0x29, 0x9E, 0x81, 0xC6,
0x21, 0xBF, 0x43}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM,
PSA_ALG_AEAD_WITH_TAG_LENGTH(PSA_ALG_CCM, 4),
@@ -50,7 +49,7 @@
#ifdef ARCH_TEST_GCM
#ifdef ARCH_TEST_AES_128
-{"Test psa_aead_encrypt_setup - GCM - 16B AES - 12B Nounce & 12B addi data\n", 3, PSA_KEY_TYPE_AES,
+{"Test psa_aead_encrypt_setup - GCM - 16B AES - 12B Nounce & 12B addi data\n", PSA_KEY_TYPE_AES,
{0x3d, 0xe0, 0x98, 0x74, 0xb3, 0x88, 0xe6, 0x49, 0x19, 0x88, 0xd0, 0xc3, 0x60,
0x7e, 0xae, 0x1f}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_GCM, PSA_ALG_GCM,
PSA_SUCCESS
@@ -60,7 +59,7 @@
#ifdef ARCH_TEST_CCM
#ifdef ARCH_TEST_DES_1KEY
-{"Test psa_aead_encrypt_setup - DES Key\n", 4, PSA_KEY_TYPE_DES,
+{"Test psa_aead_encrypt_setup - DES Key\n", PSA_KEY_TYPE_DES,
{0x70, 0x24, 0x55, 0x0C, 0x14, 0x9D, 0xED, 0x29}, DES_8B_KEY_SIZE,
PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM, PSA_ALG_CCM,
PSA_ERROR_NOT_SUPPORTED
@@ -70,7 +69,7 @@
#ifdef ARCH_TEST_AES_128
#ifdef ARCH_TEST_CIPER_MODE_CFB
-{"Test psa_aead_encrypt_setup - Unsupported Algorithm\n", 5, PSA_KEY_TYPE_AES,
+{"Test psa_aead_encrypt_setup - Unsupported Algorithm\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CFB, PSA_ALG_CFB,
PSA_ERROR_NOT_SUPPORTED
@@ -78,7 +77,7 @@
#endif
#ifdef ARCH_TEST_GCM
-{"Test psa_aead_encrypt_setup - Invalid key usage\n", 6, PSA_KEY_TYPE_AES,
+{"Test psa_aead_encrypt_setup - Invalid key usage\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_DECRYPT, PSA_ALG_GCM, PSA_ALG_GCM,
PSA_ERROR_NOT_PERMITTED
diff --git a/api-tests/dev_apis/crypto/test_c053/test_c053.c b/api-tests/dev_apis/crypto/test_c053/test_c053.c
index 8b21504..b70afb5 100644
--- a/api-tests/dev_apis/crypto/test_c053/test_c053.c
+++ b/api-tests/dev_apis/crypto/test_c053/test_c053.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");
@@ -20,7 +20,7 @@
#include "test_c053.h"
#include "test_data.h"
-client_test_t test_c053_crypto_list[] = {
+const client_test_t test_c053_crypto_list[] = {
NULL,
psa_aead_decrypt_setup_test,
NULL,
@@ -34,6 +34,7 @@
int num_checks = sizeof(check1)/sizeof(check1[0]);
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_aead_operation_t operation = PSA_AEAD_OPERATION_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -61,21 +62,21 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Set the key for a multipart authenticated decryption operation */
status = val->crypto_function(VAL_CRYPTO_AEAD_DECRYPT_SETUP, &operation,
- check1[i].key_handle, check1[i].alg);
+ key_handle, check1[i].alg);
TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(4));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(5));
/* Setting up aead on destroyed key handle should return an error */
status = val->crypto_function(VAL_CRYPTO_AEAD_DECRYPT_SETUP, &operation,
- check1[i].key_handle, check1[i].alg);
+ key_handle, check1[i].alg);
TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(6));
/* Reset the key attributes and check if psa_import_key fails */
diff --git a/api-tests/dev_apis/crypto/test_c053/test_c053.h b/api-tests/dev_apis/crypto/test_c053/test_c053.h
index 0f3dde7..272ae24 100644
--- a/api-tests/dev_apis/crypto/test_c053/test_c053.h
+++ b/api-tests/dev_apis/crypto/test_c053/test_c053.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c053_crypto_list[];
+extern const client_test_t test_c053_crypto_list[];
int32_t psa_aead_decrypt_setup_test(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c053/test_data.h b/api-tests/dev_apis/crypto/test_c053/test_data.h
index 1dd20fa..995a146 100644
--- a/api-tests/dev_apis/crypto/test_c053/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c053/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[32];
uint32_t key_length;
@@ -29,17 +28,17 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_CCM
#ifdef ARCH_TEST_AES_128
-{"Test psa_aead_decrypt_setup - AES-CCM\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_aead_decrypt_setup - AES-CCM\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_DECRYPT, PSA_ALG_CCM, PSA_ALG_CCM,
PSA_SUCCESS
},
-{"Test psa_aead_decrypt_setup - AES-CCM 24 bytes Tag length = 4\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_aead_decrypt_setup - AES-CCM 24 bytes Tag length = 4\n", PSA_KEY_TYPE_AES,
{0x41, 0x89, 0x35, 0x1B, 0x5C, 0xAE, 0xA3, 0x75, 0xA0, 0x29, 0x9E, 0x81, 0xC6,
0x21, 0xBF, 0x43}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_DECRYPT, PSA_ALG_CCM,
PSA_ALG_AEAD_WITH_TAG_LENGTH(PSA_ALG_CCM, 4),
@@ -50,7 +49,7 @@
#ifdef ARCH_TEST_GCM
#ifdef ARCH_TEST_AES_128
-{"Test psa_aead_decrypt_setup - GCM - 16B AES - 12B Nounce & 12B addi data\n", 3, PSA_KEY_TYPE_AES,
+{"Test psa_aead_decrypt_setup - GCM - 16B AES - 12B Nounce & 12B addi data\n", PSA_KEY_TYPE_AES,
{0x3d, 0xe0, 0x98, 0x74, 0xb3, 0x88, 0xe6, 0x49, 0x19, 0x88, 0xd0, 0xc3, 0x60,
0x7e, 0xae, 0x1f}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_DECRYPT, PSA_ALG_GCM, PSA_ALG_GCM,
PSA_SUCCESS
@@ -60,7 +59,7 @@
#ifdef ARCH_TEST_CCM
#ifdef ARCH_TEST_DES_1KEY
-{"Test psa_aead_decrypt_setup - DES Key\n", 4, PSA_KEY_TYPE_DES,
+{"Test psa_aead_decrypt_setup - DES Key\n", PSA_KEY_TYPE_DES,
{0x70, 0x24, 0x55, 0x0C, 0x14, 0x9D, 0xED, 0x29}, DES_8B_KEY_SIZE,
PSA_KEY_USAGE_DECRYPT, PSA_ALG_CCM, PSA_ALG_CCM,
PSA_ERROR_NOT_SUPPORTED
@@ -70,7 +69,7 @@
#ifdef ARCH_TEST_AES_128
#ifdef ARCH_TEST_CIPER_MODE_CFB
-{"Test psa_aead_decrypt_setup - Unsupported Algorithm\n", 5, PSA_KEY_TYPE_AES,
+{"Test psa_aead_decrypt_setup - Unsupported Algorithm\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_DECRYPT, PSA_ALG_CFB, PSA_ALG_CFB,
PSA_ERROR_NOT_SUPPORTED
@@ -78,7 +77,7 @@
#endif
#ifdef ARCH_TEST_GCM
-{"Test psa_aead_decrypt_setup - Invalid key usage\n", 6, PSA_KEY_TYPE_AES,
+{"Test psa_aead_decrypt_setup - Invalid key usage\n", PSA_KEY_TYPE_AES,
{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
0x5F, 0xC9}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_GCM, PSA_ALG_GCM,
PSA_ERROR_NOT_PERMITTED
diff --git a/api-tests/dev_apis/crypto/test_c054/test_c054.c b/api-tests/dev_apis/crypto/test_c054/test_c054.c
index 553e073..6271299 100644
--- a/api-tests/dev_apis/crypto/test_c054/test_c054.c
+++ b/api-tests/dev_apis/crypto/test_c054/test_c054.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");
@@ -20,7 +20,7 @@
#include "test_c054.h"
#include "test_data.h"
-client_test_t test_c054_crypto_list[] = {
+const client_test_t test_c054_crypto_list[] = {
NULL,
psa_aead_generate_nonce_test,
NULL,
@@ -36,6 +36,7 @@
int num_checks = sizeof(check1)/sizeof(check1[0]);
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_aead_operation_t operation = PSA_AEAD_OPERATION_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -63,12 +64,12 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Set the key for a multipart authenticated encryption operation */
status = val->crypto_function(VAL_CRYPTO_AEAD_ENCRYPT_SETUP, &operation,
- check1[i].key_handle, check1[i].alg);
+ key_handle, check1[i].alg);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(4));
/* Generate a random nonce for an authenticated encryption operation */
@@ -83,7 +84,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(6));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(7));
/* Reset the key attributes */
@@ -110,7 +111,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(10));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(11));
/* Reset the key attributes */
diff --git a/api-tests/dev_apis/crypto/test_c054/test_c054.h b/api-tests/dev_apis/crypto/test_c054/test_c054.h
index 6560716..ad33076 100644
--- a/api-tests/dev_apis/crypto/test_c054/test_c054.h
+++ b/api-tests/dev_apis/crypto/test_c054/test_c054.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c054_crypto_list[];
+extern const client_test_t test_c054_crypto_list[];
int32_t psa_aead_generate_nonce_test(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c054/test_data.h b/api-tests/dev_apis/crypto/test_c054/test_data.h
index 7fbeb40..e1402c7 100644
--- a/api-tests/dev_apis/crypto/test_c054/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c054/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[32];
uint32_t key_length;
@@ -30,24 +29,24 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_CCM
#ifdef ARCH_TEST_AES_128
-{"Test psa_aead_generate_nonce - AES-CCM\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_aead_generate_nonce - AES-CCM\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM, PSA_ALG_CCM, SIZE_32B,
PSA_SUCCESS
},
-{"Test psa_aead_generate_nonce - AES-CCM 24 bytes Tag length = 4\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_aead_generate_nonce - AES-CCM 24 bytes Tag length = 4\n", PSA_KEY_TYPE_AES,
{0x41, 0x89, 0x35, 0x1B, 0x5C, 0xAE, 0xA3, 0x75, 0xA0, 0x29, 0x9E, 0x81, 0xC6,
0x21, 0xBF, 0x43}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM, SIZE_32B,
PSA_ALG_AEAD_WITH_TAG_LENGTH(PSA_ALG_CCM, 4),
PSA_SUCCESS
},
-{"Test psa_aead_generate_nonce - Small buffer size\n", 3, PSA_KEY_TYPE_AES,
+{"Test psa_aead_generate_nonce - Small buffer size\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM, PSA_ALG_CCM, 8,
@@ -58,7 +57,7 @@
#ifdef ARCH_TEST_GCM
#ifdef ARCH_TEST_AES_128
-{"Test psa_aead_generate_nonce - GCM - 16B AES - 12B Nounce & 12B addi data\n", 4, PSA_KEY_TYPE_AES,
+{"Test psa_aead_generate_nonce - GCM - 16B AES - 12B Nounce & 12B addi data\n", PSA_KEY_TYPE_AES,
{0x3d, 0xe0, 0x98, 0x74, 0xb3, 0x88, 0xe6, 0x49, 0x19, 0x88, 0xd0, 0xc3, 0x60,
0x7e, 0xae, 0x1f}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_GCM, PSA_ALG_GCM, SIZE_32B,
PSA_SUCCESS
diff --git a/api-tests/dev_apis/crypto/test_c055/test_c055.c b/api-tests/dev_apis/crypto/test_c055/test_c055.c
index 741fad1..0433e16 100644
--- a/api-tests/dev_apis/crypto/test_c055/test_c055.c
+++ b/api-tests/dev_apis/crypto/test_c055/test_c055.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");
@@ -20,7 +20,7 @@
#include "test_c055.h"
#include "test_data.h"
-client_test_t test_c055_crypto_list[] = {
+const client_test_t test_c055_crypto_list[] = {
NULL,
psa_aead_set_nonce_test,
NULL,
@@ -34,6 +34,7 @@
int num_checks = sizeof(check1)/sizeof(check1[0]);
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_aead_operation_t operation = PSA_AEAD_OPERATION_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -61,12 +62,12 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Set the key for a multipart authenticated encryption operation */
status = val->crypto_function(VAL_CRYPTO_AEAD_ENCRYPT_SETUP, &operation,
- check1[i].key_handle, check1[i].alg);
+ key_handle, check1[i].alg);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(4));
/* Set the nonce for an authenticated encryption operation */
@@ -81,7 +82,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(6));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(7));
/* Reset the key attributes */
@@ -99,7 +100,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(9));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(10));
/* Reset the key attributes */
diff --git a/api-tests/dev_apis/crypto/test_c055/test_c055.h b/api-tests/dev_apis/crypto/test_c055/test_c055.h
index 6e4ae3f..80bd725 100644
--- a/api-tests/dev_apis/crypto/test_c055/test_c055.h
+++ b/api-tests/dev_apis/crypto/test_c055/test_c055.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c055_crypto_list[];
+extern const client_test_t test_c055_crypto_list[];
int32_t psa_aead_set_nonce_test(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c055/test_data.h b/api-tests/dev_apis/crypto/test_c055/test_data.h
index 458e70b..12e2185 100644
--- a/api-tests/dev_apis/crypto/test_c055/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c055/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[32];
uint32_t key_length;
@@ -31,10 +30,10 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_CCM
#ifdef ARCH_TEST_AES_128
-{"Test psa_aead_set_nonce - AES-CCM\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_aead_set_nonce - AES-CCM\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM, PSA_ALG_CCM,
@@ -43,7 +42,7 @@
PSA_SUCCESS
},
-{"Test psa_aead_set_nonce - AES-CCM 24 bytes Tag length = 4\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_aead_set_nonce - AES-CCM 24 bytes Tag length = 4\n", PSA_KEY_TYPE_AES,
{0x41, 0x89, 0x35, 0x1B, 0x5C, 0xAE, 0xA3, 0x75, 0xA0, 0x29, 0x9E, 0x81, 0xC6,
0x21, 0xBF, 0x43}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM,
PSA_ALG_AEAD_WITH_TAG_LENGTH(PSA_ALG_CCM, 4),
@@ -52,7 +51,7 @@
PSA_SUCCESS
},
-{"Test psa_aead_set_nonce - Small nounce size\n", 3, PSA_KEY_TYPE_AES,
+{"Test psa_aead_set_nonce - Small nounce size\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM, PSA_ALG_CCM,
@@ -60,7 +59,7 @@
PSA_ERROR_INVALID_ARGUMENT
},
-{"Test psa_aead_set_nonce - Large nonce size\n", 4, PSA_KEY_TYPE_AES,
+{"Test psa_aead_set_nonce - Large nonce size\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM, PSA_ALG_CCM,
@@ -74,7 +73,7 @@
#ifdef ARCH_TEST_GCM
#ifdef ARCH_TEST_AES_128
-{"Test psa_aead_set_nonce - GCM - 16B AES - 12B Nounce & 12B addi data\n", 6, PSA_KEY_TYPE_AES,
+{"Test psa_aead_set_nonce - GCM - 16B AES - 12B Nounce & 12B addi data\n", PSA_KEY_TYPE_AES,
{0x3d, 0xe0, 0x98, 0x74, 0xb3, 0x88, 0xe6, 0x49, 0x19, 0x88, 0xd0, 0xc3, 0x60,
0x7e, 0xae, 0x1f}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_GCM, PSA_ALG_GCM,
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C,
diff --git a/api-tests/dev_apis/crypto/test_c056/test_c056.c b/api-tests/dev_apis/crypto/test_c056/test_c056.c
index 5b9f0c7..6585851 100644
--- a/api-tests/dev_apis/crypto/test_c056/test_c056.c
+++ b/api-tests/dev_apis/crypto/test_c056/test_c056.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");
@@ -20,7 +20,7 @@
#include "test_c056.h"
#include "test_data.h"
-client_test_t test_c056_crypto_list[] = {
+const client_test_t test_c056_crypto_list[] = {
NULL,
psa_aead_set_lengths_test,
NULL,
@@ -34,6 +34,7 @@
int num_checks = sizeof(check1)/sizeof(check1[0]);
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_aead_operation_t operation = PSA_AEAD_OPERATION_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -61,12 +62,12 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Set the key for a multipart authenticated encryption operation */
status = val->crypto_function(VAL_CRYPTO_AEAD_ENCRYPT_SETUP, &operation,
- check1[i].key_handle, check1[i].alg);
+ key_handle, check1[i].alg);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(4));
/* Set the nonce for an authenticated encryption operation */
@@ -91,7 +92,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(8));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(9));
/* Reset the key attributes */
@@ -104,7 +105,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(10));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(11));
/* Reset the key attributes */
diff --git a/api-tests/dev_apis/crypto/test_c056/test_c056.h b/api-tests/dev_apis/crypto/test_c056/test_c056.h
index ba639f1..59bb799 100644
--- a/api-tests/dev_apis/crypto/test_c056/test_c056.h
+++ b/api-tests/dev_apis/crypto/test_c056/test_c056.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c056_crypto_list[];
+extern const client_test_t test_c056_crypto_list[];
int32_t psa_aead_set_lengths_test(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c056/test_data.h b/api-tests/dev_apis/crypto/test_c056/test_data.h
index 8022ea9..f891b7e 100644
--- a/api-tests/dev_apis/crypto/test_c056/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c056/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[32];
uint32_t key_length;
@@ -33,10 +32,10 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_CCM
#ifdef ARCH_TEST_AES_128
-{"Test psa_aead_set_lengths - AES-CCM\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_aead_set_lengths - AES-CCM\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM, PSA_ALG_CCM,
@@ -45,7 +44,7 @@
PSA_SUCCESS
},
-{"Test psa_aead_set_lengths - AES-CCM 24 bytes Tag length = 4\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_aead_set_lengths - AES-CCM 24 bytes Tag length = 4\n", PSA_KEY_TYPE_AES,
{0x41, 0x89, 0x35, 0x1B, 0x5C, 0xAE, 0xA3, 0x75, 0xA0, 0x29, 0x9E, 0x81, 0xC6,
0x21, 0xBF, 0x43}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM,
PSA_ALG_AEAD_WITH_TAG_LENGTH(PSA_ALG_CCM, 4),
@@ -54,7 +53,7 @@
PSA_SUCCESS
},
-{"Test psa_aead_set_lengths - Zero ad size\n", 3, PSA_KEY_TYPE_AES,
+{"Test psa_aead_set_lengths - Zero ad size\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM, PSA_ALG_CCM,
@@ -63,7 +62,7 @@
PSA_ERROR_INVALID_ARGUMENT
},
-{"Test psa_aead_set_lengths - Zero plaintext size\n", 4, PSA_KEY_TYPE_AES,
+{"Test psa_aead_set_lengths - Zero plaintext size\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM, PSA_ALG_CCM,
@@ -72,7 +71,7 @@
PSA_ERROR_INVALID_ARGUMENT
},
-{"Test psa_aead_set_lengths - Invalid lengths\n", 5, PSA_KEY_TYPE_AES,
+{"Test psa_aead_set_lengths - Invalid lengths\n", PSA_KEY_TYPE_AES,
{0x41, 0x89, 0x35, 0x1B, 0x5C, 0xAE, 0xA3, 0x75, 0xA0, 0x29, 0x9E, 0x81, 0xC6,
0x21, 0xBF, 0x43}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM,
PSA_ALG_AEAD_WITH_TAG_LENGTH(PSA_ALG_CCM, 4),
@@ -85,7 +84,7 @@
#ifdef ARCH_TEST_GCM
#ifdef ARCH_TEST_AES_128
-{"Test psa_aead_set_lengths - Vey large lengths\n", 6, PSA_KEY_TYPE_AES,
+{"Test psa_aead_set_lengths - Vey large lengths\n", PSA_KEY_TYPE_AES,
{0x3d, 0xe0, 0x98, 0x74, 0xb3, 0x88, 0xe6, 0x49, 0x19, 0x88, 0xd0, 0xc3, 0x60,
0x7e, 0xae, 0x1f}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_GCM, PSA_ALG_GCM,
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C,
diff --git a/api-tests/dev_apis/crypto/test_c057/test_c057.c b/api-tests/dev_apis/crypto/test_c057/test_c057.c
index 95dd0f4..ce0745c 100644
--- a/api-tests/dev_apis/crypto/test_c057/test_c057.c
+++ b/api-tests/dev_apis/crypto/test_c057/test_c057.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");
@@ -20,7 +20,7 @@
#include "test_c057.h"
#include "test_data.h"
-client_test_t test_c057_crypto_list[] = {
+const client_test_t test_c057_crypto_list[] = {
NULL,
psa_aead_update_ad_test,
NULL,
@@ -34,6 +34,7 @@
int num_checks = sizeof(check1)/sizeof(check1[0]);
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_aead_operation_t operation = PSA_AEAD_OPERATION_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -61,12 +62,12 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Set the key for a multipart authenticated encryption operation */
status = val->crypto_function(VAL_CRYPTO_AEAD_ENCRYPT_SETUP, &operation,
- check1[i].key_handle, check1[i].alg);
+ key_handle, check1[i].alg);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(4));
/* Set the nonce for an authenticated encryption operation */
@@ -96,7 +97,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(9));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(10));
/* Reset the key attributes */
@@ -109,7 +110,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(11));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(12));
/* Reset the key attributes */
diff --git a/api-tests/dev_apis/crypto/test_c057/test_c057.h b/api-tests/dev_apis/crypto/test_c057/test_c057.h
index fcbfd89..900328d 100644
--- a/api-tests/dev_apis/crypto/test_c057/test_c057.h
+++ b/api-tests/dev_apis/crypto/test_c057/test_c057.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c057_crypto_list[];
+extern const client_test_t test_c057_crypto_list[];
int32_t psa_aead_update_ad_test(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c057/test_data.h b/api-tests/dev_apis/crypto/test_c057/test_data.h
index 68bb98c..9ead790 100644
--- a/api-tests/dev_apis/crypto/test_c057/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c057/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[32];
uint32_t key_length;
@@ -34,10 +33,10 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_CCM
#ifdef ARCH_TEST_AES_128
-{"Test psa_aead_update_ad - AES-CCM\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_aead_update_ad - AES-CCM\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM, PSA_ALG_CCM,
@@ -47,7 +46,7 @@
PSA_SUCCESS
},
-{"Test psa_aead_update_ad - AES-CCM 24 bytes Tag length = 4\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_aead_update_ad - AES-CCM 24 bytes Tag length = 4\n", PSA_KEY_TYPE_AES,
{0x41, 0x89, 0x35, 0x1B, 0x5C, 0xAE, 0xA3, 0x75, 0xA0, 0x29, 0x9E, 0x81, 0xC6,
0x21, 0xBF, 0x43}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM,
PSA_ALG_AEAD_WITH_TAG_LENGTH(PSA_ALG_CCM, 4),
@@ -57,7 +56,7 @@
PSA_SUCCESS
},
-{"Test psa_aead_update_ad - Zero ad size\n", 3, PSA_KEY_TYPE_AES,
+{"Test psa_aead_update_ad - Zero ad size\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM, PSA_ALG_CCM,
@@ -67,7 +66,7 @@
PSA_ERROR_INVALID_ARGUMENT
},
-{"Test psa_aead_update_ad - Zero plaintext size\n", 4, PSA_KEY_TYPE_AES,
+{"Test psa_aead_update_ad - Zero plaintext size\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM, PSA_ALG_CCM,
@@ -77,7 +76,7 @@
PSA_ERROR_INVALID_ARGUMENT
},
-{"Test psa_aead_update_ad - Invalid lengths\n", 5, PSA_KEY_TYPE_AES,
+{"Test psa_aead_update_ad - Invalid lengths\n", PSA_KEY_TYPE_AES,
{0x41, 0x89, 0x35, 0x1B, 0x5C, 0xAE, 0xA3, 0x75, 0xA0, 0x29, 0x9E, 0x81, 0xC6,
0x21, 0xBF, 0x43}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM,
PSA_ALG_AEAD_WITH_TAG_LENGTH(PSA_ALG_CCM, 4),
@@ -91,7 +90,7 @@
#ifdef ARCH_TEST_GCM
#ifdef ARCH_TEST_AES_128
-{"Test psa_aead_update_ad - Vey large lengths\n", 6, PSA_KEY_TYPE_AES,
+{"Test psa_aead_update_ad - Vey large lengths\n", PSA_KEY_TYPE_AES,
{0x3d, 0xe0, 0x98, 0x74, 0xb3, 0x88, 0xe6, 0x49, 0x19, 0x88, 0xd0, 0xc3, 0x60,
0x7e, 0xae, 0x1f}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_GCM, PSA_ALG_GCM,
{0x10},
diff --git a/api-tests/dev_apis/crypto/test_c058/test_c058.c b/api-tests/dev_apis/crypto/test_c058/test_c058.c
index 5b6db96..2992e62 100644
--- a/api-tests/dev_apis/crypto/test_c058/test_c058.c
+++ b/api-tests/dev_apis/crypto/test_c058/test_c058.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");
@@ -20,7 +20,7 @@
#include "test_c058.h"
#include "test_data.h"
-client_test_t test_c058_crypto_list[] = {
+const client_test_t test_c058_crypto_list[] = {
NULL,
psa_aead_update_test,
NULL,
@@ -36,6 +36,7 @@
int num_checks = sizeof(check1)/sizeof(check1[0]);
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_aead_operation_t operation = PSA_AEAD_OPERATION_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -63,12 +64,12 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Set the key for a multipart authenticated encryption operation */
status = val->crypto_function(VAL_CRYPTO_AEAD_ENCRYPT_SETUP, &operation,
- check1[i].key_handle, check1[i].alg);
+ key_handle, check1[i].alg);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(4));
/* Set the nonce for an authenticated encryption operation */
@@ -105,7 +106,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(10));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(11));
/* Reset the key attributes */
@@ -122,7 +123,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(14));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(15));
/* Reset the key attributes */
diff --git a/api-tests/dev_apis/crypto/test_c058/test_c058.h b/api-tests/dev_apis/crypto/test_c058/test_c058.h
index 7212975..b2273cd 100644
--- a/api-tests/dev_apis/crypto/test_c058/test_c058.h
+++ b/api-tests/dev_apis/crypto/test_c058/test_c058.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c058_crypto_list[];
+extern const client_test_t test_c058_crypto_list[];
int32_t psa_aead_update_test(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c058/test_data.h b/api-tests/dev_apis/crypto/test_c058/test_data.h
index bdae86a..20a4944 100644
--- a/api-tests/dev_apis/crypto/test_c058/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c058/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[32];
uint32_t key_length;
@@ -39,10 +38,10 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_CCM
#ifdef ARCH_TEST_AES_128
-{"Test psa_aead_update - AES-CCM\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_aead_update - AES-CCM\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM, PSA_ALG_CCM,
@@ -58,7 +57,7 @@
PSA_SUCCESS
},
-{"Test psa_aead_update - AES-CCM 24 bytes Tag length = 4\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_aead_update - AES-CCM 24 bytes Tag length = 4\n", PSA_KEY_TYPE_AES,
{0x41, 0x89, 0x35, 0x1B, 0x5C, 0xAE, 0xA3, 0x75, 0xA0, 0x29, 0x9E, 0x81, 0xC6,
0x21, 0xBF, 0x43}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM,
PSA_ALG_AEAD_WITH_TAG_LENGTH(PSA_ALG_CCM, 4),
@@ -73,7 +72,7 @@
PSA_SUCCESS
},
-{"Test psa_aead_update - Zero plaintext size\n", 3, PSA_KEY_TYPE_AES,
+{"Test psa_aead_update - Zero plaintext size\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM, PSA_ALG_CCM,
@@ -84,7 +83,7 @@
PSA_ERROR_INVALID_ARGUMENT
},
-{"Test psa_aead_update - Small buffer size\n", 4, PSA_KEY_TYPE_AES,
+{"Test psa_aead_update - Small buffer size\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM, PSA_ALG_CCM,
@@ -96,7 +95,7 @@
PSA_ERROR_BUFFER_TOO_SMALL
},
-{"Test psa_aead_update - Input length overflows plaintext length\n", 5, PSA_KEY_TYPE_AES,
+{"Test psa_aead_update - Input length overflows plaintext length\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM, PSA_ALG_CCM,
@@ -112,7 +111,7 @@
#ifdef ARCH_TEST_GCM
#ifdef ARCH_TEST_AES_128
-{"Test psa_aead_update - GCM - 16B AES - 12B Nounce & 12B addi data\n", 6, PSA_KEY_TYPE_AES,
+{"Test psa_aead_update - GCM - 16B AES - 12B Nounce & 12B addi data\n", PSA_KEY_TYPE_AES,
{0x3d, 0xe0, 0x98, 0x74, 0xb3, 0x88, 0xe6, 0x49, 0x19, 0x88, 0xd0, 0xc3, 0x60,
0x7e, 0xae, 0x1f}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_GCM, PSA_ALG_GCM,
{0x45, 0x00, 0x00, 0x1c, 0x42, 0xa2, 0x00, 0x00, 0x80, 0x01, 0x44, 0x1f, 0x40,
diff --git a/api-tests/dev_apis/crypto/test_c059/test_c059.c b/api-tests/dev_apis/crypto/test_c059/test_c059.c
index 86f3fb7..ee1cd08 100644
--- a/api-tests/dev_apis/crypto/test_c059/test_c059.c
+++ b/api-tests/dev_apis/crypto/test_c059/test_c059.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");
@@ -20,7 +20,7 @@
#include "test_c059.h"
#include "test_data.h"
-client_test_t test_c059_crypto_list[] = {
+const client_test_t test_c059_crypto_list[] = {
NULL,
psa_aead_finish_test,
NULL,
@@ -36,6 +36,7 @@
int num_checks = sizeof(check1)/sizeof(check1[0]);
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_aead_operation_t operation = PSA_AEAD_OPERATION_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -63,12 +64,12 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Set the key for a multipart authenticated encryption operation */
status = val->crypto_function(VAL_CRYPTO_AEAD_ENCRYPT_SETUP, &operation,
- check1[i].key_handle, check1[i].alg);
+ key_handle, check1[i].alg);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(4));
/* Set the nonce for an authenticated encryption operation */
@@ -109,7 +110,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(11));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(12));
/* Reset the key attributes */
@@ -128,7 +129,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(17));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(18));
/* Reset the key attributes */
diff --git a/api-tests/dev_apis/crypto/test_c059/test_c059.h b/api-tests/dev_apis/crypto/test_c059/test_c059.h
index ed18925..6c8dd91 100644
--- a/api-tests/dev_apis/crypto/test_c059/test_c059.h
+++ b/api-tests/dev_apis/crypto/test_c059/test_c059.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c059_crypto_list[];
+extern const client_test_t test_c059_crypto_list[];
int32_t psa_aead_finish_test(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c059/test_data.h b/api-tests/dev_apis/crypto/test_c059/test_data.h
index 9ea4b0e..a7b698f 100644
--- a/api-tests/dev_apis/crypto/test_c059/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c059/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[32];
uint32_t key_length;
@@ -42,10 +41,10 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_CCM
#ifdef ARCH_TEST_AES_128
-{"Test psa_aead_finish - AES-CCM\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_aead_finish - AES-CCM\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM, PSA_ALG_CCM,
@@ -61,7 +60,7 @@
PSA_SUCCESS
},
-{"Test psa_aead_finish - AES-CCM 24 bytes Tag length = 4\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_aead_finish - AES-CCM 24 bytes Tag length = 4\n", PSA_KEY_TYPE_AES,
{0x41, 0x89, 0x35, 0x1B, 0x5C, 0xAE, 0xA3, 0x75, 0xA0, 0x29, 0x9E, 0x81, 0xC6,
0x21, 0xBF, 0x43}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM,
PSA_ALG_AEAD_WITH_TAG_LENGTH(PSA_ALG_CCM, 4),
@@ -76,7 +75,7 @@
PSA_SUCCESS
},
-{"Test psa_aead_finish - Small buffer size\n", 4, PSA_KEY_TYPE_AES,
+{"Test psa_aead_finish - Small buffer size\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM, PSA_ALG_CCM,
@@ -88,7 +87,7 @@
PSA_ERROR_BUFFER_TOO_SMALL
},
-{"Test psa_aead_finish - Input length is less than plaintext length\n", 5, PSA_KEY_TYPE_AES,
+{"Test psa_aead_finish - Input length is less than plaintext length\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM, PSA_ALG_CCM,
@@ -104,7 +103,7 @@
#ifdef ARCH_TEST_GCM
#ifdef ARCH_TEST_AES_128
-{"Test psa_aead_finish - GCM - 16B AES - 12B Nounce & 12B addi data\n", 6, PSA_KEY_TYPE_AES,
+{"Test psa_aead_finish - GCM - 16B AES - 12B Nounce & 12B addi data\n", PSA_KEY_TYPE_AES,
{0x3d, 0xe0, 0x98, 0x74, 0xb3, 0x88, 0xe6, 0x49, 0x19, 0x88, 0xd0, 0xc3, 0x60,
0x7e, 0xae, 0x1f}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_GCM, PSA_ALG_GCM,
{0x45, 0x00, 0x00, 0x1c, 0x42, 0xa2, 0x00, 0x00, 0x80, 0x01, 0x44, 0x1f, 0x40,
diff --git a/api-tests/dev_apis/crypto/test_c060/test_c060.c b/api-tests/dev_apis/crypto/test_c060/test_c060.c
index e924a9e..44739ec 100644
--- a/api-tests/dev_apis/crypto/test_c060/test_c060.c
+++ b/api-tests/dev_apis/crypto/test_c060/test_c060.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");
@@ -20,7 +20,7 @@
#include "test_c060.h"
#include "test_data.h"
-client_test_t test_c060_crypto_list[] = {
+const client_test_t test_c060_crypto_list[] = {
NULL,
psa_aead_abort_test,
psa_aead_abort_init_test,
@@ -35,6 +35,7 @@
int num_checks = sizeof(check1)/sizeof(check1[0]);
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_aead_operation_t operation = PSA_AEAD_OPERATION_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -62,16 +63,16 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Set the key for a multipart authenticated encryption operation */
status = val->crypto_function(VAL_CRYPTO_AEAD_ENCRYPT_SETUP, &operation,
- check1[i].key_handle, check1[i].alg);
+ key_handle, check1[i].alg);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(4));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(5));
/* Reset the key attributes and check if psa_import_key fails */
diff --git a/api-tests/dev_apis/crypto/test_c060/test_c060.h b/api-tests/dev_apis/crypto/test_c060/test_c060.h
index 334d180..5d724b6 100644
--- a/api-tests/dev_apis/crypto/test_c060/test_c060.h
+++ b/api-tests/dev_apis/crypto/test_c060/test_c060.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c060_crypto_list[];
+extern const client_test_t test_c060_crypto_list[];
int32_t psa_aead_abort_test(caller_security_t caller);
int32_t psa_aead_abort_init_test(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c060/test_data.h b/api-tests/dev_apis/crypto/test_c060/test_data.h
index fcdef1f..2618c53 100644
--- a/api-tests/dev_apis/crypto/test_c060/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c060/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[32];
uint32_t key_length;
@@ -29,17 +28,17 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_CCM
#ifdef ARCH_TEST_AES_128
-{"Test psa_aead_abort - AES-CCM\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_aead_abort - AES-CCM\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM, PSA_ALG_CCM,
PSA_SUCCESS
},
-{"Test psa_aead_abort - AES-CCM 24 bytes Tag length = 4\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_aead_abort - AES-CCM 24 bytes Tag length = 4\n", PSA_KEY_TYPE_AES,
{0x41, 0x89, 0x35, 0x1B, 0x5C, 0xAE, 0xA3, 0x75, 0xA0, 0x29, 0x9E, 0x81, 0xC6,
0x21, 0xBF, 0x43}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM,
PSA_ALG_AEAD_WITH_TAG_LENGTH(PSA_ALG_CCM, 4),
@@ -50,7 +49,7 @@
#ifdef ARCH_TEST_GCM
#ifdef ARCH_TEST_AES_128
-{"Test psa_aead_abort - GCM - 16B AES - 12B Nounce & 12B addi data\n", 3, PSA_KEY_TYPE_AES,
+{"Test psa_aead_abort - GCM - 16B AES - 12B Nounce & 12B addi data\n", PSA_KEY_TYPE_AES,
{0x3d, 0xe0, 0x98, 0x74, 0xb3, 0x88, 0xe6, 0x49, 0x19, 0x88, 0xd0, 0xc3, 0x60,
0x7e, 0xae, 0x1f}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_GCM, PSA_ALG_GCM,
PSA_SUCCESS
diff --git a/api-tests/dev_apis/crypto/test_c061/test_c061.c b/api-tests/dev_apis/crypto/test_c061/test_c061.c
index 4b6bec9..5adfea0 100644
--- a/api-tests/dev_apis/crypto/test_c061/test_c061.c
+++ b/api-tests/dev_apis/crypto/test_c061/test_c061.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");
@@ -20,7 +20,7 @@
#include "test_c061.h"
#include "test_data.h"
-client_test_t test_c061_crypto_list[] = {
+const client_test_t test_c061_crypto_list[] = {
NULL,
psa_aead_verify_test,
NULL,
@@ -36,6 +36,7 @@
int num_checks = sizeof(check1)/sizeof(check1[0]);
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_aead_operation_t operation = PSA_AEAD_OPERATION_INIT;
+ psa_key_handle_t key_handle;
if (num_checks == 0)
{
@@ -63,12 +64,12 @@
/* Import the key data into the key slot */
status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, check1[i].key_data,
- check1[i].key_length, &check1[i].key_handle);
+ check1[i].key_length, &key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(3));
/* Set the key for a multipart authenticated encryption operation */
status = val->crypto_function(VAL_CRYPTO_AEAD_DECRYPT_SETUP, &operation,
- check1[i].key_handle, check1[i].alg);
+ key_handle, check1[i].alg);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(4));
/* Set the nonce for an authenticated encryption operation */
@@ -109,7 +110,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(11));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(12));
/* Reset the key attributes */
@@ -128,7 +129,7 @@
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(16));
/* Destroy the key */
- status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, check1[i].key_handle);
+ status = val->crypto_function(VAL_CRYPTO_DESTROY_KEY, key_handle);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(17));
/* Reset the key attributes */
diff --git a/api-tests/dev_apis/crypto/test_c061/test_c061.h b/api-tests/dev_apis/crypto/test_c061/test_c061.h
index 9ce0ed2..b9d67e9 100644
--- a/api-tests/dev_apis/crypto/test_c061/test_c061.h
+++ b/api-tests/dev_apis/crypto/test_c061/test_c061.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");
@@ -24,7 +24,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_c061_crypto_list[];
+extern const client_test_t test_c061_crypto_list[];
int32_t psa_aead_verify_test(caller_security_t caller);
diff --git a/api-tests/dev_apis/crypto/test_c061/test_data.h b/api-tests/dev_apis/crypto/test_c061/test_data.h
index af8e261..a6d0f5c 100644
--- a/api-tests/dev_apis/crypto/test_c061/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c061/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");
@@ -19,7 +19,6 @@
typedef struct {
char test_desc[75];
- psa_key_handle_t key_handle;
psa_key_type_t key_type;
uint8_t key_data[32];
uint32_t key_length;
@@ -42,10 +41,10 @@
psa_status_t expected_status;
} test_data;
-static test_data check1[] = {
+static const test_data check1[] = {
#ifdef ARCH_TEST_CCM
#ifdef ARCH_TEST_AES_128
-{"Test psa_aead_verify - AES-CCM\n", 1, PSA_KEY_TYPE_AES,
+{"Test psa_aead_verify - AES-CCM\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_DECRYPT, PSA_ALG_CCM, PSA_ALG_CCM,
@@ -61,7 +60,7 @@
PSA_SUCCESS
},
-{"Test psa_aead_verify - AES-CCM 24 bytes Tag length = 4\n", 2, PSA_KEY_TYPE_AES,
+{"Test psa_aead_verify - AES-CCM 24 bytes Tag length = 4\n", PSA_KEY_TYPE_AES,
{0x41, 0x89, 0x35, 0x1B, 0x5C, 0xAE, 0xA3, 0x75, 0xA0, 0x29, 0x9E, 0x81, 0xC6,
0x21, 0xBF, 0x43}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_DECRYPT, PSA_ALG_CCM,
PSA_ALG_AEAD_WITH_TAG_LENGTH(PSA_ALG_CCM, 4),
@@ -76,7 +75,7 @@
PSA_SUCCESS
},
-{"Test psa_aead_verify - Small buffer size\n", 4, PSA_KEY_TYPE_AES,
+{"Test psa_aead_verify - Small buffer size\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_DECRYPT, PSA_ALG_CCM, PSA_ALG_CCM,
@@ -88,7 +87,7 @@
PSA_ERROR_BUFFER_TOO_SMALL
},
-{"Test psa_aead_verify - Input length is less than plaintext length\n", 5, PSA_KEY_TYPE_AES,
+{"Test psa_aead_verify - Input length is less than plaintext length\n", PSA_KEY_TYPE_AES,
{0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3, 0x25, 0xA7, 0x62, 0x36, 0xDF,
0x93, 0xCC, 0x6B},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_DECRYPT, PSA_ALG_CCM, PSA_ALG_CCM,
@@ -104,7 +103,7 @@
#ifdef ARCH_TEST_GCM
#ifdef ARCH_TEST_AES_128
-{"Test psa_aead_verify - GCM - 16B AES - 12B Nounce & 12B addi data\n", 6, PSA_KEY_TYPE_AES,
+{"Test psa_aead_verify - GCM - 16B AES - 12B Nounce & 12B addi data\n", PSA_KEY_TYPE_AES,
{0x3d, 0xe0, 0x98, 0x74, 0xb3, 0x88, 0xe6, 0x49, 0x19, 0x88, 0xd0, 0xc3, 0x60,
0x7e, 0xae, 0x1f}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_DECRYPT, PSA_ALG_GCM, PSA_ALG_GCM,
{0x45, 0x00, 0x00, 0x1c, 0x42, 0xa2, 0x00, 0x00, 0x80, 0x01, 0x44, 0x1f, 0x40,
diff --git a/api-tests/dev_apis/initial_attestation/suite.cmake b/api-tests/dev_apis/initial_attestation/suite.cmake
index 913f7a4..ed94f07 100644
--- a/api-tests/dev_apis/initial_attestation/suite.cmake
+++ b/api-tests/dev_apis/initial_attestation/suite.cmake
@@ -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");
@@ -35,12 +35,6 @@
add_definitions(${AS_OPTIONS})
add_library(${PSA_TARGET_TEST_COMBINE_LIB} STATIC ${SUITE_CC_SOURCE} ${SUITE_AS_SOURCE})
-if(${SUITE} STREQUAL "INITIAL_ATTESTATION")
-target_include_directories(${PSA_TARGET_TEST_COMBINE_LIB} PRIVATE
- ${PSA_QCBOR_INCLUDE_PATH}
-)
-endif()
-
# Test related Include directories
foreach(test ${PSA_TEST_LIST})
target_include_directories(${PSA_TARGET_TEST_COMBINE_LIB} PRIVATE ${PSA_SUITE_DIR}/${test})
@@ -57,6 +51,8 @@
${CMAKE_CURRENT_BINARY_DIR}
${PSA_ROOT_DIR}/val/common
${PSA_ROOT_DIR}/val/nspe
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/common
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/crypto
+ ${PSA_ROOT_DIR}/platform/targets/common/nspe
+ ${PSA_ROOT_DIR}/platform/targets/common/nspe/crypto
+ ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe
+ ${PSA_QCBOR_INCLUDE_PATH}
)
diff --git a/api-tests/dev_apis/initial_attestation/test_a001/test_a001.c b/api-tests/dev_apis/initial_attestation/test_a001/test_a001.c
index f46012d..3a2251a 100644
--- a/api-tests/dev_apis/initial_attestation/test_a001/test_a001.c
+++ b/api-tests/dev_apis/initial_attestation/test_a001/test_a001.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");
@@ -20,7 +20,7 @@
#include "test_a001.h"
#include "test_data.h"
-client_test_t test_a001_attestation_list[] = {
+const client_test_t test_a001_attestation_list[] = {
NULL,
psa_initial_attestation_get_token_test,
psa_initial_attestation_get_token_size_test,
diff --git a/api-tests/dev_apis/initial_attestation/test_a001/test_a001.h b/api-tests/dev_apis/initial_attestation/test_a001/test_a001.h
index 432b431..3a118eb 100644
--- a/api-tests/dev_apis/initial_attestation/test_a001/test_a001.h
+++ b/api-tests/dev_apis/initial_attestation/test_a001/test_a001.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");
@@ -26,7 +26,7 @@
extern val_api_t *val;
extern psa_api_t *psa;
-extern client_test_t test_a001_attestation_list[];
+extern const client_test_t test_a001_attestation_list[];
int32_t psa_initial_attestation_get_token_test(caller_security_t caller);
int32_t psa_initial_attestation_get_token_size_test(caller_security_t caller);
diff --git a/api-tests/dev_apis/initial_attestation/test_a001/test_data.h b/api-tests/dev_apis/initial_attestation/test_a001/test_data.h
index 036aab1..55d8a3c 100644
--- a/api-tests/dev_apis/initial_attestation/test_a001/test_data.h
+++ b/api-tests/dev_apis/initial_attestation/test_a001/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");
@@ -68,7 +68,7 @@
},
};
-static test_data check2[] = {
+static const test_data check2[] = {
{"Test psa_initial_attestation_get_token_size with Challenge 32\n",
PSA_INITIAL_ATTEST_CHALLENGE_SIZE_32, PSA_INITIAL_ATTEST_CHALLENGE_SIZE_32, TOKEN_SIZE, PSA_SUCCESS
},
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s001/test.cmake b/api-tests/dev_apis/internal_trusted_storage/test_s001/test.cmake
deleted file mode 100644
index fb61ac1..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s001/test.cmake
+++ /dev/null
@@ -1,24 +0,0 @@
-#/** @file
-# * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
-# * SPDX-License-Identifier : Apache-2.0
-# *
-# * Licensed under the Apache License, Version 2.0 (the "License");
-# * you may not use this file except in compliance with the License.
-# * You may obtain a copy of the License at
-# *
-# * http://www.apache.org/licenses/LICENSE-2.0
-# *
-# * Unless required by applicable law or agreed to in writing, software
-# * distributed under the License is distributed on an "AS IS" BASIS,
-# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# * See the License for the specific language governing permissions and
-# * limitations under the License.
-#**/
-
-list(APPEND CC_SOURCE
- test_entry_s001.c
- test_s001.c
-)
-list(APPEND CC_OPTIONS -DITS_TEST)
-list(APPEND AS_SOURCE )
-list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s001/test_its_data.h b/api-tests/dev_apis/internal_trusted_storage/test_s001/test_its_data.h
deleted file mode 100644
index b31767e..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s001/test_its_data.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_S001_ITS_DATA_TESTS_H_
-#define _TEST_S001_ITS_DATA_TESTS_H_
-
-#include "val_internal_trusted_storage.h"
-
-#define SST_FUNCTION val->its_function
-
-typedef struct {
- enum its_function_code api;
- psa_status_t status;
-} test_data;
-
-static struct psa_storage_info_t info;
-static const test_data s001_data[] = {
-{
- 0, 0 /* This is dummy for Index0 */
-},
-{
- VAL_ITS_GET, PSA_ERROR_DOES_NOT_EXIST /* Index1 - Call the get API when no UID is set */
-},
-{
- VAL_ITS_GET_INFO, PSA_ERROR_DOES_NOT_EXIST /* Index2 - Call the get_info API when no UID is set */
-},
-{
- VAL_ITS_REMOVE, PSA_ERROR_DOES_NOT_EXIST /* Index3 - Call the remove API when no UID is set */
-},
-{
- VAL_ITS_SET, PSA_SUCCESS /* Index4 - Create a valid storage entity with UID1 */
-},
-{
- VAL_ITS_SET, PSA_SUCCESS /* Index5 - Create a valid storage entity with UID2 */
-},
-{
- VAL_ITS_REMOVE, PSA_SUCCESS /* Index6 - Remove UID1 */
-},
-{
- VAL_ITS_GET, PSA_ERROR_DOES_NOT_EXIST /* Index7 - Call get API for UID1 */
-},
-{
- VAL_ITS_GET_INFO, PSA_ERROR_DOES_NOT_EXIST /* Index8 - Call get_info API for UID1 */
-},
-{
- VAL_ITS_REMOVE, PSA_ERROR_DOES_NOT_EXIST /* Index9 - Call remove API for UID1 */
-},
-{
- VAL_ITS_SET, PSA_SUCCESS /* Index10 - Create a valid storage entity again with UID1 */
-},
-{
- VAL_ITS_GET, PSA_ERROR_DOES_NOT_EXIST /* Index11 - Call get API for UID not same as UID1 or UID2 */
-},
-{
- VAL_ITS_GET_INFO, PSA_ERROR_DOES_NOT_EXIST /* Index12 - Call get_info for UID not same as UID1
- or UID2 */
-},
-{
- VAL_ITS_REMOVE, PSA_ERROR_DOES_NOT_EXIST /* Index13 - Call remove API for UID not same as UID1
- or UID2 */
-},
-{
- VAL_ITS_REMOVE, PSA_SUCCESS /* Index14 - Remove UID1 */
-},
-{
- VAL_ITS_REMOVE, PSA_SUCCESS /* Index15 - Remove UID2 */
-},
-};
-#endif /* _TEST_S001_ITS_DATA_TESTS_H_ */
-
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s001/test_ps_data.h b/api-tests/dev_apis/internal_trusted_storage/test_s001/test_ps_data.h
deleted file mode 100644
index b9b775e..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s001/test_ps_data.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_S001_PS_DATA_TESTS_H_
-#define _TEST_S001_PS_DATA_TESTS_H_
-
-#include "val_protected_storage.h"
-
-#define SST_FUNCTION val->ps_function
-
-typedef struct {
- enum ps_function_code api;
- psa_status_t status;
-} test_data;
-
-static struct psa_storage_info_t info;
-static const test_data s001_data[] = {
-{
- 0, 0 /* This is dummy for Index0 */
-},
-{
- VAL_PS_GET, PSA_ERROR_DOES_NOT_EXIST /* Index1 - Call the get API when no UID is set */
-},
-{
- VAL_PS_GET_INFO, PSA_ERROR_DOES_NOT_EXIST /* Index2 - Call the get_info API when no UID is set */
-},
-{
- VAL_PS_REMOVE, PSA_ERROR_DOES_NOT_EXIST /* Index3 - Call the remove API when no UID is set */
-},
-{
- VAL_PS_SET, PSA_SUCCESS /* Index4 - Create a valid storage entity with UID1 */
-},
-{
- VAL_PS_SET, PSA_SUCCESS /* Index5 - Create a valid storage entity with UID2 */
-},
-{
- VAL_PS_REMOVE, PSA_SUCCESS /* Index6 - Remove UID1 */
-},
-{
- VAL_PS_GET, PSA_ERROR_DOES_NOT_EXIST /* Index7 - Call get API for UID1 */
-},
-{
- VAL_PS_GET_INFO, PSA_ERROR_DOES_NOT_EXIST /* Index8 - Call get_info API for UID1 */
-},
-{
- VAL_PS_REMOVE, PSA_ERROR_DOES_NOT_EXIST /* Index9 - Call remove API for UID1 */
-},
-{
- VAL_PS_SET, PSA_SUCCESS /* Index10 - Create a valid storage entity again with UID1 */
-},
-{
- VAL_PS_GET, PSA_ERROR_DOES_NOT_EXIST /* Index11 - Call get API for UID not same as UID1 or UID2 */
-},
-{
- VAL_PS_GET_INFO, PSA_ERROR_DOES_NOT_EXIST /* Index12 - Call get_info for UID not same as UID1
- or UID2 */
-},
-{
- VAL_PS_REMOVE, PSA_ERROR_DOES_NOT_EXIST /* Index13 - Call remove API for UID not same as UID1
- or UID2 */
-},
-{
- VAL_PS_REMOVE, PSA_SUCCESS /* Index14 - Remove UID1 */
-},
-{
- VAL_PS_REMOVE, PSA_SUCCESS /* Index15 - Remove UID2 */
-},
-};
-#endif /* _TEST_S001_PS_DATA_TESTS_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s001/test_s001.c b/api-tests/dev_apis/internal_trusted_storage/test_s001/test_s001.c
deleted file mode 100644
index 76bd753..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s001/test_s001.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-
-#include "val_interfaces.h"
-#include "val_target.h"
-#include "test_s001.h"
-#ifdef ITS_TEST
-#include "test_its_data.h"
-#elif PS_TEST
-#include "test_ps_data.h"
-#endif
-
-#define TEST_BUFF_SIZE 16
-
-client_test_t test_s001_sst_list[] = {
- NULL,
- psa_sst_uid_not_found,
- NULL,
-};
-
-static uint8_t write_buff[TEST_BUFF_SIZE] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F};
-static uint8_t read_buff[TEST_BUFF_SIZE] = {0};
-
-static int32_t sst_calls_without_set_call(psa_storage_uid_t p_uid)
-{
- uint32_t status, p_data_length = 0;
-
- /* get() without using set() before */
- val->print(PRINT_TEST, "[Check 1] Call get API for UID %d which is not set\n", p_uid);
- status = SST_FUNCTION(s001_data[1].api, p_uid, 0, TEST_BUFF_SIZE, read_buff, &p_data_length);
- TEST_ASSERT_EQUAL(status,s001_data[1].status,TEST_CHECKPOINT_NUM(1));
-
- /* get_info() without using set() before */
- val->print(PRINT_TEST, "[Check 2] Call get_info API for UID %d which is not set\n", p_uid);
- status = SST_FUNCTION(s001_data[2].api, p_uid, &info);
- TEST_ASSERT_EQUAL(status, s001_data[2].status, TEST_CHECKPOINT_NUM(2));
-
- /* remove() without using set() before */
- val->print(PRINT_TEST, "[Check 3] Call remove API for UID %d which is not set\n", p_uid);
- status = SST_FUNCTION(s001_data[3].api, p_uid);
- TEST_ASSERT_EQUAL(status, s001_data[3].status, TEST_CHECKPOINT_NUM(3));
-
- return VAL_STATUS_SUCCESS;
-}
-
-static int32_t sst_set_and_remove(psa_storage_uid_t p_uid)
-{
- uint32_t status;
-
- /* set() a UID1 */
- status = SST_FUNCTION(s001_data[4].api, p_uid, TEST_BUFF_SIZE, write_buff,
- PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, s001_data[4].status, TEST_CHECKPOINT_NUM(4));
-
- /* Also set() with a different UID */
- status = SST_FUNCTION(s001_data[5].api, p_uid + 1, TEST_BUFF_SIZE, write_buff,
- PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, s001_data[5].status, TEST_CHECKPOINT_NUM(5));
-
- /* remove() UID1 */
- status = SST_FUNCTION(s001_data[6].api, p_uid);
- TEST_ASSERT_EQUAL(status, s001_data[6].status, TEST_CHECKPOINT_NUM(6));
-
- return VAL_STATUS_SUCCESS;
-}
-
-static int32_t sst_calls_after_uid_remove(psa_storage_uid_t p_uid)
-{
- uint32_t status, p_data_length = 0;
-
- /* get() for UID which is removed */
- val->print(PRINT_TEST, "[Check 4] Call get API for UID %d which is removed\n", p_uid);
- status = SST_FUNCTION(s001_data[7].api, p_uid, 0, TEST_BUFF_SIZE, read_buff, &p_data_length);
- TEST_ASSERT_EQUAL(status, s001_data[7].status, TEST_CHECKPOINT_NUM(7));
-
- /* get_info() for UID which is removed */
- val->print(PRINT_TEST, "[Check 5] Call get_info API for UID %d which is removed\n", p_uid);
- status = SST_FUNCTION(s001_data[8].api, p_uid, &info);
- TEST_ASSERT_EQUAL(status, s001_data[8].status, TEST_CHECKPOINT_NUM(8));
-
- /* remove() for UID which is removed */
- val->print(PRINT_TEST, "[Check 6] Call remove API for UID %d which is removed\n", p_uid);
- status = SST_FUNCTION(s001_data[9].api, p_uid);
- TEST_ASSERT_EQUAL(status, s001_data[9].status, TEST_CHECKPOINT_NUM(9));
-
- return VAL_STATUS_SUCCESS;
-}
-
-static int32_t sst_calls_with_different_uid(psa_storage_uid_t p_uid)
-{
- uint32_t status, p_data_length = 0;
-
- /* set() a UID */
- val->print(PRINT_TEST, "Set storage for UID %d\n", p_uid);
- status = SST_FUNCTION(s001_data[10].api, p_uid, TEST_BUFF_SIZE, write_buff,
- PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, s001_data[10].status, TEST_CHECKPOINT_NUM(10));
-
- /* get() for different UID then set UID */
- val->print(PRINT_TEST, "[Check 7] Call get API for different UID %d\n", p_uid-1);
- status = SST_FUNCTION(s001_data[11].api, p_uid-1, 0, TEST_BUFF_SIZE - 1, read_buff,
- &p_data_length);
- TEST_ASSERT_EQUAL(status, s001_data[11].status, TEST_CHECKPOINT_NUM(11));
-
- /* get_info() for different UID then set UID */
- val->print(PRINT_TEST, "[Check 8] Call get_info API for different UID %d\n", p_uid-1);
- status = SST_FUNCTION(s001_data[12].api, p_uid-1, &info);
- TEST_ASSERT_EQUAL(status, s001_data[12].status, TEST_CHECKPOINT_NUM(12));
-
- /* remove() for different UID then set UID */
- val->print(PRINT_TEST, "[Check 9] Call remove API for different UID %d\n", p_uid-1);
- status = SST_FUNCTION(s001_data[13].api, p_uid-1);
- TEST_ASSERT_EQUAL(status, s001_data[13].status, TEST_CHECKPOINT_NUM(13));
-
- /* remove() the set UID */
- status = SST_FUNCTION(s001_data[14].api, p_uid);
- TEST_ASSERT_EQUAL(status, s001_data[14].status, TEST_CHECKPOINT_NUM(14));
-
- return VAL_STATUS_SUCCESS;
-}
-
-static int32_t sst_remove_stray_uid(psa_storage_uid_t p_uid)
-{
- uint32_t status;
-
- /* Remove UID + 1 */
- status = SST_FUNCTION(s001_data[15].api, p_uid);
- TEST_ASSERT_EQUAL(status, s001_data[15].status, TEST_CHECKPOINT_NUM(15));
-
- return VAL_STATUS_SUCCESS;
-}
-
-int32_t psa_sst_uid_not_found(caller_security_t caller)
-{
- int32_t test_status;
- psa_storage_uid_t uid = UID_BASE_VALUE + 6;
-
- test_status = sst_calls_without_set_call(uid);
- if (test_status != VAL_STATUS_SUCCESS)
- return test_status;
-
- test_status = sst_set_and_remove(uid);
- if (test_status != VAL_STATUS_SUCCESS)
- return test_status;
-
- test_status = sst_calls_after_uid_remove(uid);
- if (test_status != VAL_STATUS_SUCCESS)
- return test_status;
-
- test_status = sst_calls_with_different_uid(uid);
- if (test_status != VAL_STATUS_SUCCESS)
- return test_status;
-
- test_status = sst_remove_stray_uid(uid + 1);
- if (test_status != VAL_STATUS_SUCCESS)
- return test_status;
-
- return VAL_STATUS_SUCCESS;
-}
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s002/test.cmake b/api-tests/dev_apis/internal_trusted_storage/test_s002/test.cmake
deleted file mode 100644
index e8cfe6a..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s002/test.cmake
+++ /dev/null
@@ -1,24 +0,0 @@
-#/** @file
-# * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
-# * SPDX-License-Identifier : Apache-2.0
-# *
-# * Licensed under the Apache License, Version 2.0 (the "License");
-# * you may not use this file except in compliance with the License.
-# * You may obtain a copy of the License at
-# *
-# * http://www.apache.org/licenses/LICENSE-2.0
-# *
-# * Unless required by applicable law or agreed to in writing, software
-# * distributed under the License is distributed on an "AS IS" BASIS,
-# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# * See the License for the specific language governing permissions and
-# * limitations under the License.
-#**/
-
-list(APPEND CC_SOURCE
- test_entry_s002.c
- test_s002.c
-)
-list(APPEND CC_OPTIONS -DITS_TEST)
-list(APPEND AS_SOURCE )
-list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s002/test_its_data.h b/api-tests/dev_apis/internal_trusted_storage/test_s002/test_its_data.h
deleted file mode 100755
index b0c2541..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s002/test_its_data.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_S002_ITS_DATA_TESTS_H_
-#define _TEST_S002_ITS_DATA_TESTS_H_
-
-#include "val_internal_trusted_storage.h"
-
-#define SST_FUNCTION val->its_function
-
-typedef struct {
- enum its_function_code api;
- psa_status_t status;
-} test_data;
-
-static struct psa_storage_info_t orig_info;
-static struct psa_storage_info_t new_info;
-static const test_data s002_data[] = {
-{
- 0, 0 /* This is dummy for Index0 */
-},
-{
- VAL_ITS_SET, PSA_SUCCESS /* Index1 - Create a valid storage with create flag value 0 */
-},
-{
- VAL_ITS_GET_INFO, PSA_SUCCESS /* Index2 - Call the get_info API to validate the attributes */
-},
-{
- 0, 0 /* This is dummy for Index3 */
-},
-{
- 0, 0 /* This is dummy for Index4 */
-},
-{
- VAL_ITS_GET, PSA_SUCCESS /* Index5 - Validate the data using get API */
-},
-{
- 0, 0 /* This is dummy for Index6 */
-},
-{
- VAL_ITS_SET, PSA_SUCCESS /* Index7 - Change the flag to WRITE_ONCE using set API */
-},
-{
- VAL_ITS_GET_INFO, PSA_SUCCESS /* Index8 - Call the get_info API to validate the flag change */
-},
-{
- 0, 0 /* This is dummy for Index9 */
-},
-{
- 0, 0 /* This is dummy for Index10 */
-},
-{
- VAL_ITS_GET, PSA_SUCCESS /* Index11 - Validate the data using get API after flag change */
-},
-{
- 0, 0 /* This is dummy for Index12 */
-},
-{
- VAL_ITS_REMOVE, PSA_ERROR_NOT_PERMITTED /* Index13 - Storage should not be removed after
- WRITE_ONCE flag */
-},
-{
- VAL_ITS_SET, PSA_SUCCESS /* Index14 - Create a storage with different UID and flag value
- WRITE_ONCE */
-},
-{
- VAL_ITS_REMOVE, PSA_ERROR_NOT_PERMITTED /* Index15 - Storage should not be removed */
-},
-{
- VAL_ITS_GET, PSA_SUCCESS /* Index16 - Validate the data using get API after flag change */
-},
-{
- 0, 0 /* This is dummy for Index17 */
-},
-{
- VAL_ITS_GET_INFO, PSA_SUCCESS /* Index18 - Call the get_info API to validate the flag change */
-},
-{
- 0, 0 /* This is dummy for Index19 */
-},
-{
- 0, 0 /* This is dummy for Index20 */
-},
-{
- VAL_ITS_SET, PSA_ERROR_NOT_PERMITTED /* Index21 - Try to set different size for same UID and
- flag value */
-},
-{
- VAL_ITS_REMOVE, PSA_ERROR_NOT_PERMITTED /* Index22 - Storage should not be removed */
-},
-{
- VAL_ITS_GET_INFO, PSA_SUCCESS /* Index23 - Call the get_info API to validate the flag change */
-},
-{
- 0, 0 /* This is dummy for Index24 */
-},
-{
- 0, 0 /* This is dummy for Index25 */
-},
-{
- VAL_ITS_GET, PSA_SUCCESS /* Index26 - Validate the data using get API after flag change */
-},
-{
- 0, 0 /* This is dummy for Index27 */
-},
-{
- VAL_ITS_SET, PSA_ERROR_NOT_PERMITTED /* Index28 - Setting flag to zero for UID should fail */
-},
-{
- VAL_ITS_REMOVE, PSA_ERROR_NOT_PERMITTED /* Index29 - Storage should not be removed */
-},
-{
- VAL_ITS_GET_INFO, PSA_SUCCESS /* Index30 - Check that the WRITE_ONCE flag is preserved */
-},
-{
- 0, 0 /* This is dummy for Index31 */
-},
-{
- 0, 0 /* This is dummy for Index32 */
-},
-};
-#endif /* _TEST_S002_ITS_DATA_TESTS_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s002/test_ps_data.h b/api-tests/dev_apis/internal_trusted_storage/test_s002/test_ps_data.h
deleted file mode 100755
index 162984e..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s002/test_ps_data.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_S002_PS_DATA_TESTS_H_
-#define _TEST_S002_PS_DATA_TESTS_H_
-
-#include "val_protected_storage.h"
-
-#define SST_FUNCTION val->ps_function
-
-typedef struct {
- enum ps_function_code api;
- psa_status_t status;
-} test_data;
-
-static struct psa_storage_info_t orig_info;
-static struct psa_storage_info_t new_info;
-static const test_data s002_data[] = {
-{
- 0, 0 /* This is dummy for Index0 */
-},
-{
- VAL_PS_SET, PSA_SUCCESS /* Index1 - Create a valid storage with create flag value 0 */
-},
-{
- VAL_PS_GET_INFO, PSA_SUCCESS /* Index2 - Call the get_info API to validate the attributes */
-},
-{
- 0, 0 /* This is dummy for Index3 */
-},
-{
- 0, 0 /* This is dummy for Index4 */
-},
-{
- VAL_PS_GET, PSA_SUCCESS /* Index5 - Validate the data using get API */
-},
-{
- 0, 0 /* This is dummy for Index6 */
-},
-{
- VAL_PS_SET, PSA_SUCCESS /* Index7 - Change the flag to WRITE_ONCE using set API */
-},
-{
- VAL_PS_GET_INFO, PSA_SUCCESS /* Index8 - Call the get_info API to validate the flag change */
-},
-{
- 0, 0 /* This is dummy for Index9 */
-},
-{
- 0, 0 /* This is dummy for Index10 */
-},
-{
- VAL_PS_GET, PSA_SUCCESS /* Index11 - Validate the data using get API after flag change */
-},
-{
- 0, 0 /* This is dummy for Index12 */
-},
-{
- VAL_PS_REMOVE, PSA_ERROR_NOT_PERMITTED /* Index13 - Storage should not be removed after
- WRITE_ONCE flag */
-},
-{
- VAL_PS_SET, PSA_SUCCESS /* Index14 - Create a storage with different UID and flag value
- WRITE_ONCE */
-},
-{
- VAL_PS_REMOVE, PSA_ERROR_NOT_PERMITTED /* Index15 - Storage should not be removed */
-},
-{
- VAL_PS_GET, PSA_SUCCESS /* Index16 - Validate the data using get API after flag change */
-},
-{
- 0, 0 /* This is dummy for Index17 */
-},
-{
- VAL_PS_GET_INFO, PSA_SUCCESS /* Index18 - Call the get_info API to validate the flag change */
-},
-{
- 0, 0 /* This is dummy for Index19 */
-},
-{
- 0, 0 /* This is dummy for Index20 */
-},
-{
- VAL_PS_SET, PSA_ERROR_NOT_PERMITTED /* Index21 - Try to set different size for same UID and
- flag value */
-},
-{
- VAL_PS_REMOVE, PSA_ERROR_NOT_PERMITTED /* Index22 - Storage should not be removed */
-},
-{
- VAL_PS_GET_INFO, PSA_SUCCESS /* Index23 - Call the get_info API to validate the flag change */
-},
-{
- 0, 0 /* This is dummy for Index24 */
-},
-{
- 0, 0 /* This is dummy for Index25 */
-},
-{
- VAL_PS_GET, PSA_SUCCESS /* Index26 - Validate the data using get API after flag change */
-},
-{
- 0, 0 /* This is dummy for Index27 */
-},
-{
- VAL_PS_SET, PSA_ERROR_NOT_PERMITTED /* Index28 - Setting flag to zero for UID should fail */
-},
-{
- VAL_PS_REMOVE, PSA_ERROR_NOT_PERMITTED /* Index29 - Storage should not be removed */
-},
-{
- VAL_PS_GET_INFO, PSA_SUCCESS /* Index30 - Check that the WRITE_ONCE flag is preserved */
-},
-{
- 0, 0 /* This is dummy for Index31 */
-},
-{
- 0, 0 /* This is dummy for Index32 */
-},
-};
-#endif /* _TEST_S002_PS_DATA_TESTS_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s002/test_s002.c b/api-tests/dev_apis/internal_trusted_storage/test_s002/test_s002.c
deleted file mode 100755
index 5bb0ccd..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s002/test_s002.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-
-#include "val_interfaces.h"
-#include "val_target.h"
-#include "test_s002.h"
-#ifdef ITS_TEST
-#include "test_its_data.h"
-#elif PS_TEST
-#include "test_ps_data.h"
-#endif
-
-#define UID_WRITE_ONCE_1 UID_BASE_VALUE + 1
-#define UID_WRITE_ONCE_2 UID_BASE_VALUE + 2
-#define TEST_BUFF_SIZE 16
-
-client_test_t test_s002_sst_list[] = {
- NULL,
- psa_sst_update_write_once_flag_after_create,
- psa_sst_create_with_write_once_flag,
- NULL,
-};
-
-int32_t psa_sst_update_write_once_flag_after_create(caller_security_t caller)
-{
- uint32_t status, p_data_length = 0;
- psa_storage_uid_t uid = UID_WRITE_ONCE_1;
- uint8_t write_buff[TEST_BUFF_SIZE/2] = {0xDE, 0xAD, 0xBE, 0xEF, 0xCA, 0xFE, 0xBA, 0xBE};
- uint8_t read_buff[TEST_BUFF_SIZE/2] = {0};
- uint8_t write_buff_new[TEST_BUFF_SIZE/4] = {0xFF, 0xFF, 0xFF, 0xFF};
-
- /* set() data without a WRITE_ONCE flag */
- status = SST_FUNCTION(s002_data[1].api, uid, TEST_BUFF_SIZE/2, write_buff,
- PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, s002_data[1].status, TEST_CHECKPOINT_NUM(1));
-
- /* Check that get_info() returns correct attributes; also store for reference for later */
- status = SST_FUNCTION(s002_data[2].api, uid, &orig_info);
- TEST_ASSERT_EQUAL(status, s002_data[2].status, TEST_CHECKPOINT_NUM(2));
- TEST_ASSERT_EQUAL(orig_info.size, TEST_BUFF_SIZE/2, TEST_CHECKPOINT_NUM(3));
- TEST_ASSERT_EQUAL(orig_info.flags, PSA_STORAGE_FLAG_NONE, TEST_CHECKPOINT_NUM(4));
-
- /* Check for data consistency using get() */
- status = SST_FUNCTION(s002_data[5].api, uid, 0, TEST_BUFF_SIZE/2, read_buff, &p_data_length);
- TEST_ASSERT_EQUAL(status, s002_data[5].status, TEST_CHECKPOINT_NUM(5));
- TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE/2, TEST_CHECKPOINT_NUM(6));
- TEST_ASSERT_MEMCMP(write_buff, read_buff, TEST_BUFF_SIZE/2, TEST_CHECKPOINT_NUM(7));
-
- /* set() with WRITE_ONCE_FLAG */
- val->print(PRINT_TEST, "[Check 1] Update the flag of UID %d with WRITE_ONCE flag\n", uid);
- status = SST_FUNCTION(s002_data[7].api, uid, TEST_BUFF_SIZE/4, write_buff_new,
- PSA_STORAGE_FLAG_WRITE_ONCE);
- TEST_ASSERT_EQUAL(status, s002_data[7].status, TEST_CHECKPOINT_NUM(8));
-
- /* Check that info is updated, after new set */
- status = SST_FUNCTION(s002_data[8].api, uid, &new_info);
- TEST_ASSERT_EQUAL(status, s002_data[8].status, TEST_CHECKPOINT_NUM(9));
- TEST_ASSERT_EQUAL(new_info.size, TEST_BUFF_SIZE/4, TEST_CHECKPOINT_NUM(10));
- TEST_ASSERT_EQUAL(new_info.flags, PSA_STORAGE_FLAG_WRITE_ONCE, TEST_CHECKPOINT_NUM(11));
-
- /* Check that data contents are preserved which were written with WRITE_ONCE_FLAG originally */
- status = SST_FUNCTION(s002_data[11].api, uid, 0, TEST_BUFF_SIZE/4, read_buff, &p_data_length);
- TEST_ASSERT_EQUAL(status, s002_data[11].status, TEST_CHECKPOINT_NUM(12));
- TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE/4, TEST_CHECKPOINT_NUM(13));
- TEST_ASSERT_MEMCMP(write_buff_new, read_buff, TEST_BUFF_SIZE/4, TEST_CHECKPOINT_NUM(14));
-
- /* remove() the UID */
- val->print(PRINT_TEST, "[Check 2] Try to remove the UID %d having WRITE_ONCE flag\n", uid);
- status = SST_FUNCTION(s002_data[13].api, uid);
- TEST_ASSERT_EQUAL(status, s002_data[13].status, TEST_CHECKPOINT_NUM(15));
-
- return VAL_STATUS_SUCCESS;
-}
-
-
-int32_t psa_sst_create_with_write_once_flag(caller_security_t caller)
-{
- uint32_t status, p_data_length = 0;
- psa_storage_uid_t uid = UID_WRITE_ONCE_2;
- uint8_t write_buff[TEST_BUFF_SIZE] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F};
- uint8_t read_buff[TEST_BUFF_SIZE] = {0};
- uint8_t write_buff_new[TEST_BUFF_SIZE + 1] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF};
-
- /* Set data for a UID using WRITE_ONCE flag */
- val->print(PRINT_TEST, "[Check 3] Create a new UID %d with WRITE_ONCE flag\n", uid);
- status = SST_FUNCTION(s002_data[14].api, uid, TEST_BUFF_SIZE, write_buff,
- PSA_STORAGE_FLAG_WRITE_ONCE);
- TEST_ASSERT_EQUAL(status, s002_data[14].status, TEST_CHECKPOINT_NUM(16));
-
- /* Check that remove() fails with PSA_SST_ERROR_WRITE_ONCE */
- val->print(PRINT_TEST, "[Check 4] Try to remove the UID %d having WRITE_ONCE flag\n", uid);
- status = SST_FUNCTION(s002_data[15].api, uid);
- TEST_ASSERT_EQUAL(status, s002_data[15].status, TEST_CHECKPOINT_NUM(17));
-
- /* Check data consistency using get()*/
- status = SST_FUNCTION(s002_data[16].api, uid, 0, TEST_BUFF_SIZE, read_buff, &p_data_length);
- TEST_ASSERT_EQUAL(status, s002_data[16].status, TEST_CHECKPOINT_NUM(18));
- TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(19));
- TEST_ASSERT_MEMCMP(write_buff, read_buff, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(20));
-
- /* Check that info values is as expected */
- status = SST_FUNCTION(s002_data[18].api, uid, &orig_info);
- TEST_ASSERT_EQUAL(status, s002_data[18].status, TEST_CHECKPOINT_NUM(21));
- TEST_ASSERT_EQUAL(orig_info.size, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(22));
- TEST_ASSERT_EQUAL(orig_info.flags, PSA_STORAGE_FLAG_WRITE_ONCE, TEST_CHECKPOINT_NUM(23));
-
- /* Try to overwrite using set() with same UID as used before with WRITE_ONCE_FLAG */
- val->print(PRINT_TEST, "[Check 5] Try to change the length of write_once UID %d\n", uid);
- status = SST_FUNCTION(s002_data[21].api, uid, (TEST_BUFF_SIZE + 1), write_buff_new,
- PSA_STORAGE_FLAG_WRITE_ONCE);
- TEST_ASSERT_EQUAL(status, s002_data[21].status, TEST_CHECKPOINT_NUM(24));
-
- /* Check that remove() still fails with PSA_SST_ERROR_WRITE_ONCE */
- val->print(PRINT_TEST, "[Check 6] Check UID removal still fails\n", 0);
- status = SST_FUNCTION(s002_data[22].api, uid);
- TEST_ASSERT_EQUAL(status, s002_data[22].status, TEST_CHECKPOINT_NUM(25));
-
- /* Check that info is preserved */
- status = SST_FUNCTION(s002_data[23].api, uid, &new_info);
- TEST_ASSERT_EQUAL(status, s002_data[23].status, TEST_CHECKPOINT_NUM(26));
- TEST_ASSERT_EQUAL(new_info.size, orig_info.size, TEST_CHECKPOINT_NUM(27));
- TEST_ASSERT_EQUAL(new_info.flags, orig_info.flags, TEST_CHECKPOINT_NUM(28));
-
- /* Check that data contents are preserved which were written with WRITE_ONCE_FLAG originally */
- status = SST_FUNCTION(s002_data[26].api, uid, 0, TEST_BUFF_SIZE, read_buff, &p_data_length);
- TEST_ASSERT_EQUAL(status, s002_data[26].status, TEST_CHECKPOINT_NUM(29));
- TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(30));
- TEST_ASSERT_MEMCMP(write_buff, read_buff, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(31));
-
- /* Try to overwrite using set() with same UID as used before without WRITE_ONCE_FLAG */
- val->print(PRINT_TEST, "[Check 7] Try to change the WRITE_ONCE flag to None for UID %d\n", uid);
- new_info.size = 0;
- new_info.flags = 0;
- status = SST_FUNCTION(s002_data[28].api, uid, (TEST_BUFF_SIZE - 1), write_buff_new,
- PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, s002_data[28].status, TEST_CHECKPOINT_NUM(32));
-
- /* Check that remove() still fails with PSA_SST_ERROR_WRITE_ONCE */
- val->print(PRINT_TEST, "[Check 8] Check UID removal still fails\n", 0);
- status = SST_FUNCTION(s002_data[29].api, uid);
- TEST_ASSERT_EQUAL(status, s002_data[29].status, TEST_CHECKPOINT_NUM(33));
-
- /* Check that info is preserved */
- status = SST_FUNCTION(s002_data[30].api, uid, &new_info);
- TEST_ASSERT_EQUAL(status, s002_data[30].status, TEST_CHECKPOINT_NUM(34));
- TEST_ASSERT_EQUAL(new_info.size, orig_info.size, TEST_CHECKPOINT_NUM(35));
- TEST_ASSERT_EQUAL(new_info.flags, orig_info.flags, TEST_CHECKPOINT_NUM(36));
-
- return VAL_STATUS_SUCCESS;
-}
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s002/test_s002.h b/api-tests/dev_apis/internal_trusted_storage/test_s002/test_s002.h
deleted file mode 100755
index e4b339e..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s002/test_s002.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * SPDX-License-Identifier : Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_S002_CLIENT_TESTS_H_
-#define _TEST_S002_CLIENT_TESTS_H_
-
-#ifdef ITS_TEST
-#define VAL_STORAGE_BASE VAL_INTERNAL_TRUSTED_STORAGE_BASE
-#define test_entry CONCAT(test_entry_, s002)
-#elif PS_TEST
-#define VAL_STORAGE_BASE VAL_PROTECTED_STORAGE_BASE
-#define test_entry CONCAT(test_entry_, p002)
-#endif
-#define val CONCAT(val, test_entry)
-#define psa CONCAT(psa, test_entry)
-
-extern val_api_t *val;
-extern psa_api_t *psa;
-extern client_test_t test_s002_sst_list[];
-
-int32_t psa_sst_update_write_once_flag_after_create(caller_security_t caller);
-int32_t psa_sst_create_with_write_once_flag(caller_security_t caller);
-#endif /* _TEST_S002_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s003/test.cmake b/api-tests/dev_apis/internal_trusted_storage/test_s003/test.cmake
deleted file mode 100644
index da2f1ad..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s003/test.cmake
+++ /dev/null
@@ -1,24 +0,0 @@
-#/** @file
-# * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
-# * SPDX-License-Identifier : Apache-2.0
-# *
-# * Licensed under the Apache License, Version 2.0 (the "License");
-# * you may not use this file except in compliance with the License.
-# * You may obtain a copy of the License at
-# *
-# * http://www.apache.org/licenses/LICENSE-2.0
-# *
-# * Unless required by applicable law or agreed to in writing, software
-# * distributed under the License is distributed on an "AS IS" BASIS,
-# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# * See the License for the specific language governing permissions and
-# * limitations under the License.
-#**/
-
-list(APPEND CC_SOURCE
- test_entry_s003.c
- test_s003.c
-)
-list(APPEND CC_OPTIONS -DITS_TEST)
-list(APPEND AS_SOURCE )
-list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s003/test_its_data.h b/api-tests/dev_apis/internal_trusted_storage/test_s003/test_its_data.h
deleted file mode 100755
index 095dcfe..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s003/test_its_data.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_S003_ITS_DATA_TESTS_H_
-#define _TEST_S003_ITS_DATA_TESTS_H_
-
-#include "val_internal_trusted_storage.h"
-
-#define SST_FUNCTION val->its_function
-#define PSA_SST_SUCCESS PSA_SUCCESS
-
-typedef struct {
- enum its_function_code api;
- psa_status_t status;
-} test_data;
-
-static const test_data s003_data[] = {
-{
- 0, 0 /* This is dummy for Index0 */
-},
-{
- VAL_ITS_SET, PSA_ERROR_INSUFFICIENT_STORAGE /* Index1 - Call set API till insufficent space */
-},
-{
- VAL_ITS_REMOVE, PSA_SUCCESS /* Index2 - Remove the UID created */
-},
-};
-#endif /* _TEST_S003_ITS_DATA_TESTS_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s003/test_ps_data.h b/api-tests/dev_apis/internal_trusted_storage/test_s003/test_ps_data.h
deleted file mode 100755
index 60e750d..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s003/test_ps_data.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_S003_PS_DATA_TESTS_H_
-#define _TEST_S003_PS_DATA_TESTS_H_
-
-#include "val_protected_storage.h"
-
-#define SST_FUNCTION val->ps_function
-
-typedef struct {
- enum ps_function_code api;
- psa_status_t status;
-} test_data;
-
-static const test_data s003_data[] = {
-{
- 0, 0 /* This is dummy for Index0 */
-},
-{
- VAL_PS_SET, PSA_ERROR_INSUFFICIENT_STORAGE /* Index1 - Call set API till insufficent space */
-},
-{
- VAL_PS_REMOVE, PSA_SUCCESS /* Index2 - Remove the UID created */
-},
-};
-#endif /* _TEST_S003_PS_DATA_TESTS_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s004/test.cmake b/api-tests/dev_apis/internal_trusted_storage/test_s004/test.cmake
deleted file mode 100644
index 88caf83..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s004/test.cmake
+++ /dev/null
@@ -1,24 +0,0 @@
-#/** @file
-# * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
-# * SPDX-License-Identifier : Apache-2.0
-# *
-# * Licensed under the Apache License, Version 2.0 (the "License");
-# * you may not use this file except in compliance with the License.
-# * You may obtain a copy of the License at
-# *
-# * http://www.apache.org/licenses/LICENSE-2.0
-# *
-# * Unless required by applicable law or agreed to in writing, software
-# * distributed under the License is distributed on an "AS IS" BASIS,
-# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# * See the License for the specific language governing permissions and
-# * limitations under the License.
-#**/
-
-list(APPEND CC_SOURCE
- test_entry_s004.c
- test_s004.c
-)
-list(APPEND CC_OPTIONS -DITS_TEST)
-list(APPEND AS_SOURCE )
-list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s004/test_its_data.h b/api-tests/dev_apis/internal_trusted_storage/test_s004/test_its_data.h
deleted file mode 100755
index f92ab6d..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s004/test_its_data.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_S004_ITS_DATA_TESTS_H_
-#define _TEST_S004_ITS_DATA_TESTS_H_
-
-#include "val_internal_trusted_storage.h"
-
-#define SST_FUNCTION val->its_function
-
-typedef struct {
- enum its_function_code api;
- psa_status_t status;
-} test_data;
-
-static const test_data s004_data[] = {
-{
- 0, 0 /* This is dummy for Index0 */
-},
-{
- VAL_ITS_SET, PSA_SUCCESS /* Index1 - Create a valid storage entity */
-},
-{
- VAL_ITS_GET, PSA_SUCCESS /* Index2 - Validate the data using get API after set API failure */
-},
-{
- 0, 0 /* This is dummy for Index3 */
-},
-{
- VAL_ITS_SET, PSA_SUCCESS /* Index4 - For same UID set the length as half of previous */
-},
-{
- VAL_ITS_GET, PSA_SUCCESS /* Index5 - Call get with incorrect length */
-},
-{
- 0, 0 /* This is dummy for Index6 */
-},
-{
- VAL_ITS_REMOVE, PSA_SUCCESS /* Index7 - Remove the valid storage entity */
-},
-};
-#endif /* _TEST_S004_ITS_DATA_TESTS_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s004/test_ps_data.h b/api-tests/dev_apis/internal_trusted_storage/test_s004/test_ps_data.h
deleted file mode 100755
index e17dfde..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s004/test_ps_data.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_S004_PS_DATA_TESTS_H_
-#define _TEST_S004_PS_DATA_TESTS_H_
-
-#include "val_protected_storage.h"
-
-#define SST_FUNCTION val->ps_function
-
-typedef struct {
- enum ps_function_code api;
- psa_status_t status;
-} test_data;
-
-static const test_data s004_data[] = {
-{
- 0, 0 /* This is dummy for Index0 */
-},
-{
- VAL_PS_SET, PSA_SUCCESS /* Index1 - Create a valid storage entity */
-},
-{
- VAL_PS_GET, PSA_SUCCESS /* Index2 - Validate the data using get API after set API failure */
-},
-{
- 0, 0 /* This is dummy for Index3 */
-},
-{
- VAL_PS_SET, PSA_SUCCESS /* Index4 - For same UID set the length as half of previous */
-},
-{
- VAL_PS_GET, PSA_SUCCESS /* Index5 - Call get with incorrect length */
-},
-{
- 0, 0 /* This is dummy for Index6 */
-},
-{
- VAL_PS_REMOVE, PSA_SUCCESS /* Index7 - Remove the valid storage entity */
-},
-};
-#endif /* _TEST_S004_PS_DATA_TESTS_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s004/test_s004.c b/api-tests/dev_apis/internal_trusted_storage/test_s004/test_s004.c
deleted file mode 100755
index 94240c0..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s004/test_s004.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-
-#include "val_interfaces.h"
-#include "val_target.h"
-#include "test_s004.h"
-#ifdef ITS_TEST
-#include "test_its_data.h"
-#elif PS_TEST
-#include "test_ps_data.h"
-#endif
-
-#define TEST_BUFF_SIZE 20
-
-client_test_t test_s004_sst_list[] = {
- NULL,
- psa_sst_get_data_check,
- NULL,
-};
-
-static psa_storage_uid_t uid = UID_BASE_VALUE + 5;
-static uint8_t read_buff[TEST_BUFF_SIZE] = {0};
-static uint8_t write_buff[TEST_BUFF_SIZE] = {0x99, 0x01, 0x30, 0x50, 0x04, 0x23, 0xF6, 0x07, 0x08, \
- 0x0D, 0x70, 0xA1, 0xFF, 0xFF, 0x14, 0x73, 0x46, 0x97, 0xE8, 0xDD};
-
-int32_t psa_sst_get_data_check(caller_security_t caller)
-{
- uint32_t status, p_data_length = 0;
-
- /* Set data for UID */
- status = SST_FUNCTION(s004_data[1].api, uid, TEST_BUFF_SIZE, write_buff, PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, s004_data[1].status, TEST_CHECKPOINT_NUM(1));
-
- /* Call get function and check the data consistency */
- status = SST_FUNCTION(s004_data[2].api, uid, 0, TEST_BUFF_SIZE, read_buff, &p_data_length);
- TEST_ASSERT_EQUAL(status, s004_data[2].status, TEST_CHECKPOINT_NUM(2));
- TEST_ASSERT_MEMCMP(read_buff, write_buff, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(3));
- TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(4));
-
- /* Call the set again for same uid and set the length as half */
- val->print(PRINT_TEST, "[Check 1] Call set API with reduced length - TEST_BUFF_SIZE/2\n", 0);
- status = SST_FUNCTION(s004_data[4].api, uid, TEST_BUFF_SIZE/2, write_buff,
- PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, s004_data[4].status, TEST_CHECKPOINT_NUM(5));
-
- /* Call get function with incorrect buffer length */
- val->print(PRINT_TEST, "[Check 2] Call get API with default length - TEST_BUFF_SIZE\n", 0);
- status = SST_FUNCTION(s004_data[5].api, uid, 0, TEST_BUFF_SIZE, read_buff, &p_data_length);
- TEST_ASSERT_EQUAL(status, s004_data[5].status, TEST_CHECKPOINT_NUM(6));
- TEST_ASSERT_MEMCMP(read_buff, write_buff, TEST_BUFF_SIZE/2, TEST_CHECKPOINT_NUM(7));
- /* Expect p_data_length = TEST_BUFF_SIZE/2 */
- TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE/2, TEST_CHECKPOINT_NUM(8));
-
- /* Remove the UID */
- status = SST_FUNCTION(s004_data[7].api, uid);
- TEST_ASSERT_EQUAL(status, s004_data[7].status, TEST_CHECKPOINT_NUM(9));
-
- return VAL_STATUS_SUCCESS;
-}
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s005/test.cmake b/api-tests/dev_apis/internal_trusted_storage/test_s005/test.cmake
deleted file mode 100644
index 33559cb..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s005/test.cmake
+++ /dev/null
@@ -1,24 +0,0 @@
-#/** @file
-# * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
-# * SPDX-License-Identifier : Apache-2.0
-# *
-# * Licensed under the Apache License, Version 2.0 (the "License");
-# * you may not use this file except in compliance with the License.
-# * You may obtain a copy of the License at
-# *
-# * http://www.apache.org/licenses/LICENSE-2.0
-# *
-# * Unless required by applicable law or agreed to in writing, software
-# * distributed under the License is distributed on an "AS IS" BASIS,
-# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# * See the License for the specific language governing permissions and
-# * limitations under the License.
-#**/
-
-list(APPEND CC_SOURCE
- test_entry_s005.c
- test_s005.c
-)
-list(APPEND CC_OPTIONS -DITS_TEST)
-list(APPEND AS_SOURCE )
-list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s005/test_its_data.h b/api-tests/dev_apis/internal_trusted_storage/test_s005/test_its_data.h
deleted file mode 100755
index 5f985e8..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s005/test_its_data.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_S005_ITS_DATA_TESTS_H_
-#define _TEST_S005_ITS_DATA_TESTS_H_
-
-#include "val_internal_trusted_storage.h"
-
-#define SST_FUNCTION val->its_function
-
-typedef struct {
- enum its_function_code api;
- psa_status_t status;
-} test_data;
-
-static struct psa_storage_info_t info;
-static const test_data s005_data[] = {
-{
- 0, 0 /* This is dummy for Index0 */
-},
-{
- VAL_ITS_SET, PSA_SUCCESS /* Index1 - Create a valid storage entity */
-},
-{
- VAL_ITS_GET, PSA_SUCCESS /* Index2 - Validate the data using get API */
-},
-{
- 0, 0 /* This is dummy for Index3 */
-},
-{
- VAL_ITS_GET_INFO, PSA_SUCCESS /* Index4 - Validate the data attributes get_info API */
-},
-{
- 0, 0 /* This is dummy for Index5 */
-},
-{
- 0, 0 /* This is dummy for Index6 */
-},
-{
- VAL_ITS_REMOVE, PSA_SUCCESS /* Index7 - Remove the valid storage entity */
-},
-};
-#endif /* _TEST_S005_ITS_DATA_TESTS_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s005/test_ps_data.h b/api-tests/dev_apis/internal_trusted_storage/test_s005/test_ps_data.h
deleted file mode 100755
index ad248bd..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s005/test_ps_data.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_S005_PS_DATA_TESTS_H_
-#define _TEST_S005_PS_DATA_TESTS_H_
-
-#include "val_protected_storage.h"
-
-#define SST_FUNCTION val->ps_function
-
-typedef struct {
- enum ps_function_code api;
- psa_status_t status;
-} test_data;
-
-static struct psa_storage_info_t info;
-static const test_data s005_data[] = {
-{
- 0, 0 /* This is dummy for Index0 */
-},
-{
- VAL_PS_SET, PSA_SUCCESS /* Index1 - Create a valid storage entity */
-},
-{
- VAL_PS_GET, PSA_SUCCESS /* Index2 - Validate the data using get API */
-},
-{
- 0, 0 /* This is dummy for Index3 */
-},
-{
- VAL_PS_GET_INFO, PSA_SUCCESS /* Index4 - Validate the data attributes get_info API */
-},
-{
- 0, 0 /* This is dummy for Index5 */
-},
-{
- 0, 0 /* This is dummy for Index6 */
-},
-{
- VAL_PS_REMOVE, PSA_SUCCESS /* Index7 - Remove the valid storage entity */
-},
-};
-#endif /* _TEST_S005_PS_DATA_TESTS_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s005/test_s005.c b/api-tests/dev_apis/internal_trusted_storage/test_s005/test_s005.c
deleted file mode 100755
index 51bf8a4..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s005/test_s005.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * SPDX-License-Identifier : Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-
-#include "val_interfaces.h"
-#include "val_target.h"
-#include "test_s005.h"
-#ifdef ITS_TEST
-#include "test_its_data.h"
-#elif PS_TEST
-#include "test_ps_data.h"
-#endif
-
-#define TEST_BUFF_SIZE 30
-
-client_test_t test_s005_sst_list[] = {
- NULL,
- psa_sst_apis_check_success_case,
- NULL,
-};
-
-static uint8_t read_buff[TEST_BUFF_SIZE];
-static uint8_t write_buff[TEST_BUFF_SIZE] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x23, 0xF6, 0x07, 0x08, 0x0D, 0x0A, 0x1B, 0x0C, 0x5D, 0x0E,\
- 0x70, 0xA1, 0xFF, 0xFF, 0x14, 0x73, 0x46, 0x97, 0xE8, 0xDD, 0xCA, 0x0B, 0x3C, 0x0D, 0x2E};
-
-static int32_t psa_sst_apis_check(psa_storage_uid_t uid, uint32_t data_len,
- uint8_t *data_buff, psa_storage_create_flags_t create_flag)
-{
- uint32_t status, p_data_length = 0;
-
- /* Set the UID with the data_len and data_buff */
- status = SST_FUNCTION(s005_data[1].api, uid, data_len, data_buff, create_flag);
- TEST_ASSERT_EQUAL(status, s005_data[1].status, TEST_CHECKPOINT_NUM(1));
-
- /* Call the get function to get the data buffer and match the buffer */
- status = SST_FUNCTION(s005_data[2].api, uid, 0, data_len, read_buff, &p_data_length);
- TEST_ASSERT_EQUAL(status, s005_data[2].status, TEST_CHECKPOINT_NUM(2));
- TEST_ASSERT_MEMCMP(read_buff, data_buff, data_len, TEST_CHECKPOINT_NUM(3));
- TEST_ASSERT_EQUAL(p_data_length, data_len, TEST_CHECKPOINT_NUM(4));
-
- /* Call the get_info function and match the attributes */
- status = SST_FUNCTION(s005_data[4].api, uid, &info);
- TEST_ASSERT_EQUAL(status, s005_data[4].status, TEST_CHECKPOINT_NUM(5));
- TEST_ASSERT_EQUAL(info.size, data_len, TEST_CHECKPOINT_NUM(6));
- TEST_ASSERT_EQUAL(info.flags, create_flag, TEST_CHECKPOINT_NUM(7));
-
- /* Remove the UID */
- status = SST_FUNCTION(s005_data[7].api, uid);
- TEST_ASSERT_EQUAL(status, s005_data[7].status, TEST_CHECKPOINT_NUM(8));
-
- return VAL_STATUS_SUCCESS;
-}
-
-int32_t psa_sst_apis_check_success_case(caller_security_t caller)
-{
- psa_storage_uid_t uid = UID_BASE_VALUE + 4;
- uint32_t data_len = 0, status = VAL_STATUS_SUCCESS;
-
- /* Calling set function with data_len 1 and valid data pointer */
- val->print(PRINT_TEST, "[Check 1] Set UID with data length zero and call storage APIs\n", 0);
- if (psa_sst_apis_check(uid, data_len, write_buff, PSA_STORAGE_FLAG_NONE))
- {
- val->print(PRINT_ERROR, "Data Len = %d\n", data_len);
- return VAL_STATUS_ERROR;
- }
-
- data_len = TEST_BUFF_SIZE/2;
- val->print(PRINT_TEST, "[Check 2] Resetting the length check\n", 0);
- if (psa_sst_apis_check(uid, data_len, write_buff, PSA_STORAGE_FLAG_NONE))
- {
- val->print(PRINT_ERROR, "Data Len = %d\n", data_len);
- return VAL_STATUS_ERROR;
- }
-
- return status;
-}
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s006/test.cmake b/api-tests/dev_apis/internal_trusted_storage/test_s006/test.cmake
deleted file mode 100644
index 7810ff6..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s006/test.cmake
+++ /dev/null
@@ -1,24 +0,0 @@
-#/** @file
-# * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
-# * SPDX-License-Identifier : Apache-2.0
-# *
-# * Licensed under the Apache License, Version 2.0 (the "License");
-# * you may not use this file except in compliance with the License.
-# * You may obtain a copy of the License at
-# *
-# * http://www.apache.org/licenses/LICENSE-2.0
-# *
-# * Unless required by applicable law or agreed to in writing, software
-# * distributed under the License is distributed on an "AS IS" BASIS,
-# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# * See the License for the specific language governing permissions and
-# * limitations under the License.
-#**/
-
-list(APPEND CC_SOURCE
- test_entry_s006.c
- test_s006.c
-)
-list(APPEND CC_OPTIONS -DITS_TEST)
-list(APPEND AS_SOURCE )
-list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s006/test_its_data.h b/api-tests/dev_apis/internal_trusted_storage/test_s006/test_its_data.h
deleted file mode 100755
index b6a3cf9..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s006/test_its_data.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_S006_ITS_DATA_TESTS_H_
-#define _TEST_S006_ITS_DATA_TESTS_H_
-
-#include "val_internal_trusted_storage.h"
-
-#define SST_FUNCTION val->its_function
-
-typedef struct {
- enum its_function_code api;
- psa_status_t status;
-} test_data;
-
-static struct psa_storage_info_t info;
-static const test_data s006_data[] = {
-{
- 0, 0 /* This is dummy for Index0 */
-},
-{
- VAL_ITS_SET, PSA_SUCCESS /* Index1 - Create a valid storage entity with different flag values */
-},
-{
- VAL_ITS_GET_INFO, PSA_SUCCESS /* Index2 - Validate the flag value get_info API */
-},
-{
- 0, 0 /* This is dummy for Index3 */
-},
-{
- VAL_ITS_REMOVE, PSA_SUCCESS /* Index4 - Remove the storage entity */
-},
-{
- VAL_ITS_REMOVE, PSA_ERROR_DOES_NOT_EXIST /* Index5 - Storage entity remove fails */
-},
-};
-#endif /* _TEST_S006_ITS_DATA_TESTS_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s006/test_ps_data.h b/api-tests/dev_apis/internal_trusted_storage/test_s006/test_ps_data.h
deleted file mode 100755
index 0bf7305..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s006/test_ps_data.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_S006_PS_DATA_TESTS_H_
-#define _TEST_S006_PS_DATA_TESTS_H_
-
-#include "val_protected_storage.h"
-
-#define SST_FUNCTION val->ps_function
-
-typedef struct {
- enum ps_function_code api;
- psa_status_t status;
-} test_data;
-
-static struct psa_storage_info_t info;
-static const test_data s006_data[] = {
-{
- 0, 0 /* This is dummy for Index0 */
-},
-{
- VAL_PS_SET, PSA_SUCCESS /* Index1 - Create a valid storage entity with different flag values */
-},
-{
- VAL_PS_GET_INFO, PSA_SUCCESS /* Index2 - Validate the flag value get_info API */
-},
-{
- 0, 0 /* This is dummy for Index3 */
-},
-{
- VAL_PS_REMOVE, PSA_SUCCESS /* Index4 - Remove the storage entity */
-},
-{
- VAL_PS_REMOVE, PSA_ERROR_DOES_NOT_EXIST /* Index5 - Storage entity remove fails */
-}
-};
-#endif /* _TEST_S006_PS_DATA_TESTS_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s006/test_s006.c b/api-tests/dev_apis/internal_trusted_storage/test_s006/test_s006.c
deleted file mode 100755
index bda5fcc..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s006/test_s006.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-
-#include "val_interfaces.h"
-#include "val_target.h"
-#include "test_s006.h"
-#ifdef ITS_TEST
-#include "test_its_data.h"
-#elif PS_TEST
-#include "test_ps_data.h"
-#endif
-
-#define TEST_BUFF_SIZE 30
-
-client_test_t test_s006_sst_list[] = {
- NULL,
- psa_sst_flags_not_supported,
- NULL,
-};
-
-static uint8_t write_buff[TEST_BUFF_SIZE] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x23, 0xF6, 0x07, 0x08, 0x0D, 0x0A, 0x1B, 0x0C, 0x5D, 0x0E,\
- 0x70, 0xA1, 0xFF, 0xFF, 0x14, 0x73, 0x46, 0x97, 0xE8, 0xDD, 0xCA, 0x0B, 0x3C, 0x0D, 0x2E};
-
-static int32_t psa_sst_remove_api(psa_storage_uid_t uid, uint32_t data_len,
- uint8_t *data_buff, psa_storage_create_flags_t create_flag)
-{
- uint32_t status;
-
- /* Call the get_info function and match the attributes */
- status = SST_FUNCTION(s006_data[2].api, uid, &info);
- TEST_ASSERT_EQUAL(status, s006_data[2].status, TEST_CHECKPOINT_NUM(1));
- if ((create_flag != PSA_STORAGE_FLAG_NO_CONFIDENTIALITY) ||
- (create_flag != PSA_STORAGE_FLAG_NO_REPLAY_PROTECTION))
- {
- TEST_ASSERT_EQUAL(info.flags, create_flag, TEST_CHECKPOINT_NUM(2));
- }
-
- /* Remove the UID */
- status = SST_FUNCTION(s006_data[4].api, uid);
- TEST_ASSERT_EQUAL(status, s006_data[4].status, TEST_CHECKPOINT_NUM(3));
-
- return VAL_STATUS_SUCCESS;
-}
-
-static int32_t psa_sst_create_storage_api(psa_storage_uid_t uid, uint32_t data_len,
- uint8_t *data_buff, psa_storage_create_flags_t create_flag)
-{
- uint32_t status;
- int32_t test_status;
-
- status = SST_FUNCTION(s006_data[1].api, uid, data_len, data_buff, create_flag);
- if (status == s006_data[1].status)
- {
- test_status = psa_sst_remove_api(uid, data_len, data_buff, create_flag);
- if (test_status != VAL_STATUS_SUCCESS)
- {
- return test_status;
- }
- }
- else
- {
- /* Remove UID should fail */
- status = SST_FUNCTION(s006_data[5].api, uid);
- TEST_ASSERT_EQUAL(status, s006_data[5].status, TEST_CHECKPOINT_NUM(4));
- }
-
- return VAL_STATUS_SUCCESS;
-}
-
-int32_t psa_sst_flags_not_supported(caller_security_t caller)
-{
- psa_storage_create_flags_t flag;
- uint32_t status = VAL_STATUS_SUCCESS;
- psa_storage_uid_t uid = UID_BASE_VALUE + 5;
- int32_t test_status;
-
- /* Calling set function with different create flag value */
-
- val->print(PRINT_TEST, "[Check 1] Call set API with flag - PSA_STORAGE_FLAG_NONE\n", 0);
- /* Create storage with flag value */
- flag = PSA_STORAGE_FLAG_NONE;
- test_status = psa_sst_create_storage_api(uid, TEST_BUFF_SIZE, write_buff, flag);
- if (test_status != VAL_STATUS_SUCCESS)
- {
- return test_status;
- }
-
- val->print(PRINT_TEST, "[Check 2] Call set API with flag - "
- "PSA_STORAGE_FLAG_NO_CONFIDENTIALITY\n", 0);
- /* Create storage with flag value */
- flag = PSA_STORAGE_FLAG_NO_CONFIDENTIALITY;
- test_status = psa_sst_create_storage_api(uid, TEST_BUFF_SIZE, write_buff, flag);
- if (test_status != VAL_STATUS_SUCCESS)
- {
- return test_status;
- }
-
- val->print(PRINT_TEST, "[Check 3] Call set API with flag - "
- "PSA_STORAGE_FLAG_NO_REPLAY_PROTECTION\n", 0);
- /* Create storage with flag value */
- flag = PSA_STORAGE_FLAG_NO_REPLAY_PROTECTION;
- test_status = psa_sst_create_storage_api(uid, TEST_BUFF_SIZE, write_buff, flag);
- if (test_status != VAL_STATUS_SUCCESS)
- {
- return test_status;
- }
-
- return status;
-}
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s007/test.cmake b/api-tests/dev_apis/internal_trusted_storage/test_s007/test.cmake
deleted file mode 100644
index cee8525..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s007/test.cmake
+++ /dev/null
@@ -1,24 +0,0 @@
-#/** @file
-# * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
-# * SPDX-License-Identifier : Apache-2.0
-# *
-# * Licensed under the Apache License, Version 2.0 (the "License");
-# * you may not use this file except in compliance with the License.
-# * You may obtain a copy of the License at
-# *
-# * http://www.apache.org/licenses/LICENSE-2.0
-# *
-# * Unless required by applicable law or agreed to in writing, software
-# * distributed under the License is distributed on an "AS IS" BASIS,
-# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# * See the License for the specific language governing permissions and
-# * limitations under the License.
-#**/
-
-list(APPEND CC_SOURCE
- test_entry_s007.c
- test_s007.c
-)
-list(APPEND CC_OPTIONS -DITS_TEST)
-list(APPEND AS_SOURCE )
-list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s007/test_its_data.h b/api-tests/dev_apis/internal_trusted_storage/test_s007/test_its_data.h
deleted file mode 100755
index b5be47e..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s007/test_its_data.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_S007_ITS_DATA_TESTS_H_
-#define _TEST_S007_ITS_DATA_TESTS_H_
-
-#include "val_internal_trusted_storage.h"
-
-#define SST_FUNCTION val->its_function
-
-typedef struct {
- enum its_function_code api;
- psa_status_t status;
-} test_data;
-
-static const test_data s007_data[] = {
-{
- 0, 0 /* This is dummy for Index0 */
-},
-{
- VAL_ITS_SET, PSA_SUCCESS /* Index1 - Create a valid storage entity */
-},
-{
- VAL_ITS_SET, PSA_SUCCESS /* Index2 - Increase the length of storage */
-},
-{
- VAL_ITS_GET, PSA_SUCCESS /* Index3 - Try to access old length */
-},
-{
- VAL_ITS_GET, PSA_SUCCESS /* Index4 - Try to access valid length less than set length */
-},
-{
- 0, 0 /* This is dummy for Index5 */
-},
-{
- VAL_ITS_SET, PSA_SUCCESS /* Index6 - Decrease the length of storage */
-},
-{
- VAL_ITS_GET, PSA_SUCCESS /* Index7 - Try to access old length */
-},
-{
- VAL_ITS_GET, PSA_SUCCESS /* Index8 - Try to access old length */
-},
-{
- VAL_ITS_GET, PSA_SUCCESS /* Index9 - Try to access data with correct length */
-},
-{
- VAL_ITS_REMOVE, PSA_SUCCESS /* Index10 - Remove the storage entity */
-},
-};
-#endif /* _TEST_S007_ITS_DATA_TESTS_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s007/test_ps_data.h b/api-tests/dev_apis/internal_trusted_storage/test_s007/test_ps_data.h
deleted file mode 100755
index 6414d2c..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s007/test_ps_data.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_S007_PS_DATA_TESTS_H_
-#define _TEST_S007_PS_DATA_TESTS_H_
-
-#include "val_protected_storage.h"
-
-#define SST_FUNCTION val->ps_function
-
-typedef struct {
- enum ps_function_code api;
- psa_status_t status;
-} test_data;
-
-static const test_data s007_data[] = {
-{
- 0, 0 /* This is dummy for Index0 */
-},
-{
- VAL_PS_SET, PSA_SUCCESS /* Index1 - Create a valid storage entity */
-},
-{
- VAL_PS_SET, PSA_SUCCESS /* Index2 - Increase the length of storage */
-},
-{
- VAL_PS_GET, PSA_SUCCESS /* Index3 - Try to access old length */
-},
-{
- VAL_PS_GET, PSA_SUCCESS /* Index4 - Try to access valid length less than set length */
-},
-{
- 0, 0 /* This is dummy for Index5 */
-},
-{
- VAL_PS_SET, PSA_SUCCESS /* Index6 - Decrease the length of storage */
-},
-{
- VAL_PS_GET, PSA_SUCCESS /* Index7 - Try to access old length */
-},
-{
- VAL_PS_GET, PSA_SUCCESS /* Index8 - Try to access old length */
-},
-{
- VAL_PS_GET, PSA_SUCCESS /* Index9 - Try to access data with correct length */
-},
-{
- VAL_PS_REMOVE, PSA_SUCCESS /* Index10 - Remove the storage entity */
-},
-};
-#endif /* _TEST_S007_PS_DATA_TESTS_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s007/test_s007.c b/api-tests/dev_apis/internal_trusted_storage/test_s007/test_s007.c
deleted file mode 100755
index 610e045..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s007/test_s007.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-
-#include "val_interfaces.h"
-#include "val_target.h"
-#include "test_s007.h"
-#ifdef ITS_TEST
-#include "test_its_data.h"
-#elif PS_TEST
-#include "test_ps_data.h"
-#endif
-
-#define TEST_BUFF_SIZE 30
-
-client_test_t test_s007_sst_list[] = {
- NULL,
- psa_sst_get_incorrect_size,
- NULL,
-};
-
-static uint8_t write_buff[TEST_BUFF_SIZE] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x23, 0xF6, 0x07, 0x08, 0x0D, 0x0A, 0x1B, 0x0C, 0x5D, 0x0E,\
- 0x70, 0xA1, 0xFF, 0xFF, 0x14, 0x73, 0x46, 0x97, 0xE8, 0xDD, 0xCA, 0x0B, 0x3C, 0x0D, 0x2E};
-static uint8_t read_buff[TEST_BUFF_SIZE];
-
-int32_t psa_sst_get_incorrect_size(caller_security_t caller)
-{
- psa_storage_uid_t uid = UID_BASE_VALUE + 5;
- uint32_t status = VAL_STATUS_SUCCESS, p_data_length = 0;
-
- /* Set the UID with the data_len and data_buff */
- val->print(PRINT_TEST, "Create a valid Storage - TEST_BUFF_SIZE/2\n", 0);
- status = SST_FUNCTION(s007_data[1].api, uid, TEST_BUFF_SIZE/2, write_buff,
- PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, s007_data[1].status, TEST_CHECKPOINT_NUM(1));
-
- /* Call set for same UID and increase the length */
- val->print(PRINT_TEST, "Increase the length of storage - TEST_BUFF_SIZE\n", 0);
- status = SST_FUNCTION(s007_data[2].api, uid, TEST_BUFF_SIZE, write_buff,
- PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, s007_data[2].status, TEST_CHECKPOINT_NUM(2));
-
- /* Access data using get API and old length */
- val->print(PRINT_TEST, "[Check 1] Call get API with old length - TEST_BUFF_SIZE/2\n", 0);
- status = SST_FUNCTION(s007_data[3].api, uid, 0, TEST_BUFF_SIZE/2, read_buff, &p_data_length);
- TEST_ASSERT_EQUAL(status, s007_data[3].status, TEST_CHECKPOINT_NUM(3));
- TEST_ASSERT_MEMCMP(read_buff, write_buff, TEST_BUFF_SIZE/2, TEST_CHECKPOINT_NUM(4));
- TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE/2, TEST_CHECKPOINT_NUM(5));
-
- /* Access data using get API and valid length */
- val->print(PRINT_TEST, "[Check 2] Call get API with old length - TEST_BUFF_SIZE/4\n", 0);
- memset(read_buff, 0x0, TEST_BUFF_SIZE);
- status = SST_FUNCTION(s007_data[4].api, uid, 0, TEST_BUFF_SIZE/4, read_buff, &p_data_length);
- TEST_ASSERT_EQUAL(status, s007_data[4].status, TEST_CHECKPOINT_NUM(6));
- TEST_ASSERT_MEMCMP(read_buff, write_buff, TEST_BUFF_SIZE/4, TEST_CHECKPOINT_NUM(7));
- TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE/4, TEST_CHECKPOINT_NUM(8));
-
- /* Decrease the length again */
- val->print(PRINT_TEST, "Decrease the length of storage - TEST_BUFF_SIZE/4\n", 0);
- status = SST_FUNCTION(s007_data[6].api, uid, TEST_BUFF_SIZE/4, write_buff,
- PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, s007_data[6].status, TEST_CHECKPOINT_NUM(9));
-
- /* Access data using get API and old length */
- val->print(PRINT_TEST, "[Check 3] Call get API with old length - TEST_BUFF_SIZE/2\n", 0);
- memset(read_buff, 0x0, TEST_BUFF_SIZE);
- status = SST_FUNCTION(s007_data[7].api, uid, 0, TEST_BUFF_SIZE/2, read_buff, &p_data_length);
- TEST_ASSERT_EQUAL(status, s007_data[7].status, TEST_CHECKPOINT_NUM(10));
- TEST_ASSERT_MEMCMP(read_buff, write_buff, TEST_BUFF_SIZE/4, TEST_CHECKPOINT_NUM(11));
- TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE/4, TEST_CHECKPOINT_NUM(12));
-
- /* Access data using get API and old length */
- val->print(PRINT_TEST, "[Check 4] Call get API with old length - TEST_BUFF_SIZE\n", 0);
- memset(read_buff, 0x0, TEST_BUFF_SIZE);
- status = SST_FUNCTION(s007_data[8].api, uid, 0, TEST_BUFF_SIZE, read_buff, &p_data_length);
- TEST_ASSERT_EQUAL(status, s007_data[8].status, TEST_CHECKPOINT_NUM(13));
- TEST_ASSERT_MEMCMP(read_buff, write_buff, TEST_BUFF_SIZE/4, TEST_CHECKPOINT_NUM(14));
- TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE/4, TEST_CHECKPOINT_NUM(15));
-
- /* Access data using correct length */
- val->print(PRINT_TEST, "[Check 5] Call get API with valid length - TEST_BUFF_SIZE/4\n", 0);
- memset(read_buff, 0x0, TEST_BUFF_SIZE);
- status = SST_FUNCTION(s007_data[9].api, uid, 0, TEST_BUFF_SIZE/4, read_buff, &p_data_length);
- TEST_ASSERT_EQUAL(status, s007_data[9].status, TEST_CHECKPOINT_NUM(16));
- TEST_ASSERT_MEMCMP(read_buff, write_buff, TEST_BUFF_SIZE/4, TEST_CHECKPOINT_NUM(17));
- TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE/4, TEST_CHECKPOINT_NUM(18));
-
- /* Remove the UID */
- status = SST_FUNCTION(s007_data[10].api, uid);
- TEST_ASSERT_EQUAL(status, s007_data[10].status, TEST_CHECKPOINT_NUM(19));
-
- return status;
-}
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s008/test_its_data.h b/api-tests/dev_apis/internal_trusted_storage/test_s008/test_its_data.h
deleted file mode 100755
index f5476c3..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s008/test_its_data.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_S008_ITS_DATA_TESTS_H_
-#define _TEST_S008_ITS_DATA_TESTS_H_
-
-#include "val_internal_trusted_storage.h"
-
-#define SST_FUNCTION val->its_function
-
-typedef struct {
- enum its_function_code api;
- psa_status_t status;
-} test_data;
-
-static const test_data s008_data[] = {
-{
- 0, 0 /* This is dummy for Index0 */
-},
-{
- VAL_ITS_SET, PSA_SUCCESS /* Index1 - Create a valid storage entity with zero flag value */
-},
-{
- VAL_ITS_GET, PSA_SUCCESS /* Index2 - Call get API with offset + data_len = total_size */
-},
-{
- 0, 0 /* This is dummy for Index3 */
-},
-{
- VAL_ITS_GET, PSA_SUCCESS /* Index4 - Call get API with offset + data_len < total_size */
-},
-{
- 0, 0 /* This is dummy for Index5 */
-},
-{
- VAL_ITS_GET, PSA_SUCCESS /* Index6 - Call get API with offset = total data_size + 1 */
-},
-{
- 0, 0 /* This is dummy for Index7 */
-},
-{
- VAL_ITS_GET, PSA_SUCCESS /* Index8 - get API with offset = total data_size */
-},
-{
- 0, 0 /* This is dummy for Index9 */
-},
-{
- VAL_ITS_GET, PSA_SUCCESS /* Index10 - Call get API with invalid data len and offset zero */
-},
-{
- 0, 0 /* This is dummy for Index11 */
-},
-{
- VAL_ITS_GET, PSA_ERROR_INVALID_ARGUMENT /* Index12 - Call get API with offset = MAX_UINT32 */
-},
-{
- VAL_ITS_REMOVE, PSA_SUCCESS /* Index13 - Remove the storage entity */
-},
-};
-#endif /* _TEST_S008_ITS_DATA_TESTS_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s008/test_ps_data.h b/api-tests/dev_apis/internal_trusted_storage/test_s008/test_ps_data.h
deleted file mode 100755
index e994592..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s008/test_ps_data.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_S008_PS_DATA_TESTS_H_
-#define _TEST_S008_PS_DATA_TESTS_H_
-
-#include "val_protected_storage.h"
-
-#define SST_FUNCTION val->ps_function
-
-typedef struct {
- enum ps_function_code api;
- psa_status_t status;
-} test_data;
-
-static const test_data s008_data[] = {
-{
- 0, 0 /* This is dummy for Index0 */
-},
-{
- VAL_PS_SET, PSA_SUCCESS /* Index1 - Create a valid storage entity with zero flag value */
-},
-{
- VAL_PS_GET, PSA_SUCCESS /* Index2 - Call get API with offset + data_len = total_size */
-},
-{
- 0, 0 /* This is dummy for Index3 */
-},
-{
- VAL_PS_GET, PSA_SUCCESS /* Index4 - Call get API with offset + data_len < total_size */
-},
-{
- 0, 0 /* This is dummy for Index5 */
-},
-{
- VAL_PS_GET, PSA_SUCCESS/* Index6 - Call get API with offset = total data_size + 1 */
-},
-{
- 0, 0 /* This is dummy for Index7 */
-},
-{
- VAL_PS_GET, PSA_SUCCESS /* Index8 - get API with offset = total data_size */
-},
-{
- 0, 0 /* This is dummy for Index9 */
-},
-{
- VAL_PS_GET, PSA_SUCCESS /* Index10 - Call get API with invalid data len and offset zero */
-},
-{
- 0, 0 /* This is dummy for Index11 */
-},
-{
- VAL_PS_GET, PSA_ERROR_INVALID_ARGUMENT /* Index12 - Call get API with offset = MAX_UINT32 */
-},
-{
- VAL_PS_REMOVE, PSA_SUCCESS /* Index13 - Remove the storage entity */
-},
-};
-#endif /* _TEST_S008_PS_DATA_TESTS_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s008/test_s008.c b/api-tests/dev_apis/internal_trusted_storage/test_s008/test_s008.c
deleted file mode 100755
index 32ddfc5..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s008/test_s008.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-
-#include "val_interfaces.h"
-#include "val_target.h"
-#include "test_s008.h"
-#ifdef ITS_TEST
-#include "test_its_data.h"
-#elif PS_TEST
-#include "test_ps_data.h"
-#endif
-
-#define TEST_BUFF_SIZE 20
-#define TEST_MAX_UINT32 0xFFFFFFFF
-
-client_test_t test_s008_sst_list[] = {
- NULL,
- psa_sst_valid_offset_success,
- psa_sst_invalid_offset_failure,
- NULL,
-};
-
-static psa_storage_uid_t uid = UID_BASE_VALUE + 5;
-static uint8_t read_buff[TEST_BUFF_SIZE];
-static uint8_t write_buff[TEST_BUFF_SIZE] = {0x99, 0x01, 0x02, 0x03, 0x04, 0x23, 0xF6, 0x07, 0x08, \
- 0x0D, 0x70, 0xA1, 0xFF, 0xFF, 0x14, 0x73, 0x46, 0x97, 0xE8, 0xDD};
-
-int32_t psa_sst_invalid_offset_failure(caller_security_t caller)
-{
- uint32_t status, j, p_data_length = 0;
-
- /* Case where offset = data_size +1 , data_len 0. Also check nothing is returned in read buff */
- val->print(PRINT_TEST, "[Check 2] Try to access data with varying invalid offset\n", 0);
- memset(read_buff, 0, TEST_BUFF_SIZE);
- status = SST_FUNCTION(s008_data[6].api, uid, TEST_BUFF_SIZE+1, 0, read_buff, &p_data_length);
- TEST_ASSERT_NOT_EQUAL(status, s008_data[6].status, TEST_CHECKPOINT_NUM(8));
- TEST_ASSERT_EQUAL(p_data_length, 0, TEST_CHECKPOINT_NUM(9));
- for (j = 0; j < TEST_BUFF_SIZE; j++)
- {
- TEST_ASSERT_EQUAL(read_buff[j], 0x00, TEST_CHECKPOINT_NUM(10));
- }
-
- /* Case where offset = data_size , data_len= 1 Also check nothing is returned in read buff */
- memset(read_buff, 0xCD, TEST_BUFF_SIZE);
- p_data_length = 0xFF;
- status = SST_FUNCTION(s008_data[8].api, uid, TEST_BUFF_SIZE, 1, read_buff, &p_data_length);
- TEST_ASSERT_EQUAL(status, s008_data[8].status, TEST_CHECKPOINT_NUM(11));
- TEST_ASSERT_EQUAL(p_data_length, 0, TEST_CHECKPOINT_NUM(12));
-
- /* Case where offset = 0, data_len > data_size, check if just data_size is returned */
- status = SST_FUNCTION(s008_data[10].api, uid, 0, TEST_BUFF_SIZE+1, read_buff, &p_data_length);
- TEST_ASSERT_EQUAL(status, s008_data[10].status, TEST_CHECKPOINT_NUM(13));
- TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(14));
- TEST_ASSERT_MEMCMP(read_buff, write_buff, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(15));
-
- /* Try to access data with offset as MAX_UINT32 and length less than buffer size */
- status = SST_FUNCTION(s008_data[12].api, uid, TEST_MAX_UINT32, TEST_BUFF_SIZE/2, read_buff,
- &p_data_length);
- TEST_ASSERT_EQUAL(status, s008_data[12].status, TEST_CHECKPOINT_NUM(16));
-
- /* Remove the UID */
- status = SST_FUNCTION(s008_data[13].api, uid);
- TEST_ASSERT_EQUAL(status, s008_data[13].status, TEST_CHECKPOINT_NUM(17));
-
- return VAL_STATUS_SUCCESS;
-}
-
-int32_t psa_sst_valid_offset_success(caller_security_t caller)
-{
- uint32_t status, data_len, offset = TEST_BUFF_SIZE;
- uint32_t p_data_length = 0;
-
- /* Set data for UID */
- status = SST_FUNCTION(s008_data[1].api, uid, TEST_BUFF_SIZE, write_buff, PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, s008_data[1].status, TEST_CHECKPOINT_NUM(1));
-
- /* Case where offset + datalen = data_size */
- val->print(PRINT_TEST, "[Check 1] Try to access data with varying valid offset\n", 0);
- while (offset > 0)
- {
- data_len = TEST_BUFF_SIZE - offset;
- memset(read_buff, 0, TEST_BUFF_SIZE);
- status = SST_FUNCTION(s008_data[2].api, uid, offset, data_len, read_buff, &p_data_length);
- TEST_ASSERT_EQUAL(status, s008_data[2].status, TEST_CHECKPOINT_NUM(2));
- TEST_ASSERT_MEMCMP(read_buff, write_buff + offset, data_len, TEST_CHECKPOINT_NUM(3));
- TEST_ASSERT_EQUAL(p_data_length, data_len, TEST_CHECKPOINT_NUM(4));
- offset >>= 1;
- }
-
- offset = TEST_BUFF_SIZE - 2;
- data_len = 1;
- /* Case where offset + datalen < data_size */
- while (offset > 0)
- {
- status = SST_FUNCTION(s008_data[4].api, uid, offset, data_len, read_buff, &p_data_length);
- TEST_ASSERT_EQUAL(status, s008_data[4].status, TEST_CHECKPOINT_NUM(5));
- TEST_ASSERT_MEMCMP(read_buff, write_buff + offset, data_len, TEST_CHECKPOINT_NUM(6));
- TEST_ASSERT_EQUAL(p_data_length, data_len, TEST_CHECKPOINT_NUM(7));
- offset >>= 1;
- data_len <<= 1;
- }
-
- return VAL_STATUS_SUCCESS;
-}
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s008/test_s008.h b/api-tests/dev_apis/internal_trusted_storage/test_s008/test_s008.h
deleted file mode 100755
index c4426d8..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s008/test_s008.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * SPDX-License-Identifier : Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_S008_CLIENT_TESTS_H_
-#define _TEST_S008_CLIENT_TESTS_H_
-
-#ifdef ITS_TEST
-#define VAL_STORAGE_BASE VAL_INTERNAL_TRUSTED_STORAGE_BASE
-#define test_entry CONCAT(test_entry_, s008)
-#elif PS_TEST
-#define VAL_STORAGE_BASE VAL_PROTECTED_STORAGE_BASE
-#define test_entry CONCAT(test_entry_, p008)
-#endif
-#define val CONCAT(val, test_entry)
-#define psa CONCAT(psa, test_entry)
-
-extern val_api_t *val;
-extern psa_api_t *psa;
-extern client_test_t test_s008_sst_list[];
-
-int32_t psa_sst_valid_offset_success(caller_security_t caller);
-int32_t psa_sst_invalid_offset_failure(caller_security_t caller);
-
-#endif /* _TEST_S008_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s009/test.cmake b/api-tests/dev_apis/internal_trusted_storage/test_s009/test.cmake
deleted file mode 100644
index e5fe7ee..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s009/test.cmake
+++ /dev/null
@@ -1,24 +0,0 @@
-#/** @file
-# * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
-# * SPDX-License-Identifier : Apache-2.0
-# *
-# * Licensed under the Apache License, Version 2.0 (the "License");
-# * you may not use this file except in compliance with the License.
-# * You may obtain a copy of the License at
-# *
-# * http://www.apache.org/licenses/LICENSE-2.0
-# *
-# * Unless required by applicable law or agreed to in writing, software
-# * distributed under the License is distributed on an "AS IS" BASIS,
-# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# * See the License for the specific language governing permissions and
-# * limitations under the License.
-#**/
-
-list(APPEND CC_SOURCE
- test_entry_s009.c
- test_s009.c
-)
-list(APPEND CC_OPTIONS -DITS_TEST)
-list(APPEND AS_SOURCE )
-list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s009/test_its_data.h b/api-tests/dev_apis/internal_trusted_storage/test_s009/test_its_data.h
deleted file mode 100755
index 606f02e..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s009/test_its_data.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_S009_ITS_DATA_TESTS_H_
-#define _TEST_S009_ITS_DATA_TESTS_H_
-
-#include "val_internal_trusted_storage.h"
-
-#define SST_FUNCTION val->its_function
-
-typedef struct {
- enum its_function_code api;
- psa_status_t status;
-} test_data;
-
-static struct psa_storage_info_t info;
-static const test_data s009_data[] = {
-{
- 0, 0 /* This is dummy for Index0 */
-},
-{
- VAL_ITS_SET, PSA_SUCCESS /* Index1 - Call set API with NULL write buffer and 0 length */
-},
-{
- VAL_ITS_GET_INFO, PSA_SUCCESS /* Index2 - Verify UID is created */
-},
-{
- VAL_ITS_GET, PSA_SUCCESS /* Index3 - Call get API with NULL write buffer and 0 length */
-},
-{
- VAL_ITS_REMOVE, PSA_SUCCESS /* Index4 - Remove the storage entity */
-},
-{
- VAL_ITS_GET_INFO, PSA_ERROR_DOES_NOT_EXIST /* Index5 - Verify UID is removed */
-},
-{
- VAL_ITS_SET, PSA_SUCCESS /* Index6 - Create storage of zero size and valid write buffer */
-},
-{
- VAL_ITS_GET_INFO, PSA_SUCCESS /* Index7 - Call get_info API to check data size */
-},
-{
- 0, 0 /* This is dummy for Index8 */
-},
-{
- VAL_ITS_GET, PSA_SUCCESS /* Index9 - Call get API with 0 length and NULL read buffer */
-},
-{
- VAL_ITS_SET, PSA_SUCCESS /* Index10 - Increase the asset size */
-},
-{
- VAL_ITS_REMOVE, PSA_SUCCESS /* Index11 - Remove the storage entity */
-},
-};
-#endif /* _TEST_S009_ITS_DATA_TESTS_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s009/test_ps_data.h b/api-tests/dev_apis/internal_trusted_storage/test_s009/test_ps_data.h
deleted file mode 100755
index efc8a2c..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s009/test_ps_data.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_S009_PS_DATA_TESTS_H_
-#define _TEST_S009_PS_DATA_TESTS_H_
-
-#include "val_protected_storage.h"
-
-#define SST_FUNCTION val->ps_function
-
-typedef struct {
- enum ps_function_code api;
- psa_status_t status;
-} test_data;
-
-static struct psa_storage_info_t info;
-static const test_data s009_data[] = {
-{
- 0, 0 /* This is dummy for Index0 */
-},
-{
- VAL_PS_SET, PSA_SUCCESS /* Index1 - Call set API with NULL write buffer and 0 length */
-},
-{
- VAL_PS_GET_INFO, PSA_SUCCESS /* Index2 - Verify UID is created */
-},
-{
- VAL_PS_GET, PSA_SUCCESS /* Index3 - Call get API with NULL write buffer and 0 length */
-},
-{
- VAL_PS_REMOVE, PSA_SUCCESS /* Index4 - Remove the storage entity */
-},
-{
- VAL_PS_GET_INFO, PSA_ERROR_DOES_NOT_EXIST /* Index5 - Verify UID is removed */
-},
-{
- VAL_PS_SET, PSA_SUCCESS /* Index6 - Create storage of zero size and valid write buffer */
-},
-{
- VAL_PS_GET_INFO, PSA_SUCCESS /* Index7 - Call get_info API to check data size */
-},
-{
- 0, 0 /* This is dummy for Index8 */
-},
-{
- VAL_PS_GET, PSA_SUCCESS /* Index9 - Call get API with 0 length and NULL read buffer */
-},
-{
- VAL_PS_SET, PSA_SUCCESS /* Index10 - Increase the asset size */
-},
-{
- VAL_PS_REMOVE, PSA_SUCCESS /* Index11 - Remove the storage entity */
-},
-};
-#endif /* _TEST_S009_PS_DATA_TESTS_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s009/test_s009.c b/api-tests/dev_apis/internal_trusted_storage/test_s009/test_s009.c
deleted file mode 100755
index f3e103c..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s009/test_s009.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * SPDX-License-Identifier : Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-
-#include "val_interfaces.h"
-#include "val_target.h"
-#include "test_s009.h"
-#ifdef ITS_TEST
-#include "test_its_data.h"
-#elif PS_TEST
-#include "test_ps_data.h"
-#endif
-
-#define TEST_BUFF_SIZE 20
-
-client_test_t test_s009_sst_list[] = {
- NULL,
- psa_sst_zero_length_check,
- NULL,
-};
-
-static psa_storage_uid_t uid = UID_BASE_VALUE + 5;
-static uint8_t write_buff[TEST_BUFF_SIZE] = {0x99, 0x01, 0x02, 0x03, 0x04, 0x23, 0xF6, 0x07, 0x08, \
- 0x0D, 0x70, 0xA1, 0xFF, 0xFF, 0x14, 0x73, 0x46, 0x97, 0xE8, 0xDD};
-
-int32_t psa_sst_zero_length_check(caller_security_t caller)
-{
- uint32_t status, p_data_length = 0;
-
- /* Set data for UID with length 0 and NULL pointer */
- val->print(PRINT_TEST, "[Check 1] Call set API with NULL pointer and data length 0\n", 0);
- status = SST_FUNCTION(s009_data[1].api, uid, 0, NULL, PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, s009_data[1].status, TEST_CHECKPOINT_NUM(1));
-
- /* Call the get_info function to verify UID created */
- status = SST_FUNCTION(s009_data[2].api, uid, &info);
- TEST_ASSERT_EQUAL(status, s009_data[2].status, TEST_CHECKPOINT_NUM(2));
-
- /* Call get API with NULL read buffer */
- val->print(PRINT_TEST, "[Check 2] Call get API with NULL read buffer and data length 0\n", 0);
- status = SST_FUNCTION(s009_data[3].api, uid, 0, 0, NULL, &p_data_length);
- TEST_ASSERT_EQUAL(status, s009_data[3].status, TEST_CHECKPOINT_NUM(3));
- TEST_ASSERT_EQUAL(p_data_length, 0, TEST_CHECKPOINT_NUM(4));
-
- /* Remove the UID */
- val->print(PRINT_TEST, "[Check 3] Remove the UID\n", 0);
- status = SST_FUNCTION(s009_data[4].api, uid);
- TEST_ASSERT_EQUAL(status, s009_data[4].status, TEST_CHECKPOINT_NUM(5));
-
- /* Call the get_info function to verify UID is removed */
- val->print(PRINT_TEST, "[Check 4] Call get_info API to verify UID removed\n", 0);
- status = SST_FUNCTION(s009_data[5].api, uid, &info);
- TEST_ASSERT_EQUAL(status, s009_data[5].status, TEST_CHECKPOINT_NUM(6));
-
- /* Create UID with length 0 and valid write buffer */
- val->print(PRINT_TEST, "[Check 5] Create UID with zero data_len and valid write buffer\n", 0);
- status = SST_FUNCTION(s009_data[6].api, uid, 0, write_buff, PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, s009_data[6].status, TEST_CHECKPOINT_NUM(7));
-
- /* Call the get_info function and match the attributes */
- status = SST_FUNCTION(s009_data[7].api, uid, &info);
- TEST_ASSERT_EQUAL(status, s009_data[7].status, TEST_CHECKPOINT_NUM(8));
- TEST_ASSERT_EQUAL(info.size, 0, TEST_CHECKPOINT_NUM(9));
-
- /* Call get API with NULL read buffer and valid UID */
- val->print(PRINT_TEST, "[Check 8] Call get API with NULL read buffer and data length 0\n", 0);
- status = SST_FUNCTION(s009_data[9].api, uid, 0, 0, NULL, &p_data_length);
- TEST_ASSERT_EQUAL(status, s009_data[9].status, TEST_CHECKPOINT_NUM(10));
- TEST_ASSERT_EQUAL(p_data_length, 0, TEST_CHECKPOINT_NUM(11));
-
- /* Change the length to test_buff_size */
- val->print(PRINT_TEST, "[Check 9] Increase the length\n", 0);
- status = SST_FUNCTION(s009_data[10].api, uid, TEST_BUFF_SIZE, write_buff,
- PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, s009_data[10].status, TEST_CHECKPOINT_NUM(12));
-
- /* Remove the UID */
- status = SST_FUNCTION(s009_data[11].api, uid);
- TEST_ASSERT_EQUAL(status, s009_data[11].status, TEST_CHECKPOINT_NUM(13));
-
- return VAL_STATUS_SUCCESS;
-}
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s010/test_its_data.h b/api-tests/dev_apis/internal_trusted_storage/test_s010/test_its_data.h
deleted file mode 100644
index 8dd4cb8..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s010/test_its_data.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_S010_ITS_DATA_TESTS_H_
-#define _TEST_S010_ITS_DATA_TESTS_H_
-
-#include "val_internal_trusted_storage.h"
-
-#define SST_FUNCTION val->its_function
-
-typedef struct {
- enum its_function_code api;
- psa_status_t status;
-} test_data;
-
-static const test_data s010_data[] = {
-{
- VAL_ITS_SET, PSA_ERROR_INVALID_ARGUMENT /* Index0 - Create with UID value zero should fail */
-},
-{
- VAL_ITS_GET_INFO, PSA_ERROR_INVALID_ARGUMENT /* Index1 - Call to get_info API for UID 0
- should fail */
-},
-{
- VAL_ITS_REMOVE, PSA_ERROR_INVALID_ARGUMENT /* Index2 - Call to remove API UID value zero
- should fail */
-},
-};
-#endif /* _TEST_S010_ITS_DATA_TESTS_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s010/test_ps_data.h b/api-tests/dev_apis/internal_trusted_storage/test_s010/test_ps_data.h
deleted file mode 100644
index 2c7f149..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s010/test_ps_data.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_S010_PS_DATA_TESTS_H_
-#define _TEST_S010_PS_DATA_TESTS_H_
-
-#include "val_protected_storage.h"
-
-#define SST_FUNCTION val->ps_function
-
-typedef struct {
- enum ps_function_code api;
- psa_status_t status;
-} test_data;
-
-static const test_data s010_data[] = {
-{
- VAL_PS_SET, PSA_ERROR_INVALID_ARGUMENT /* Index0 - Create with UID value zero should fail */
-},
-{
- VAL_PS_GET_INFO, PSA_ERROR_INVALID_ARGUMENT /* Index1 - Call to get_info API for UID 0
- should fail */
-},
-{
- VAL_PS_REMOVE, PSA_ERROR_INVALID_ARGUMENT /* Index2 - Call to remove API UID value zero
- should fail */
-},
-};
-#endif /* _TEST_S010_PS_DATA_TESTS_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s010/test_s010.c b/api-tests/dev_apis/internal_trusted_storage/test_s010/test_s010.c
deleted file mode 100644
index 5cff99c..0000000
--- a/api-tests/dev_apis/internal_trusted_storage/test_s010/test_s010.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * SPDX-License-Identifier : Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-
-#include "val_interfaces.h"
-#include "val_target.h"
-#include "test_s010.h"
-#ifdef ITS_TEST
-#include "test_its_data.h"
-#elif PS_TEST
-#include "test_ps_data.h"
-#endif
-
-#define TEST_BUFF_SIZE 1
-
-client_test_t test_s010_sst_list[] = {
- NULL,
- psa_sst_uid_value_zero_check,
- NULL,
-};
-
-static uint8_t write_buff[TEST_BUFF_SIZE] = {0xFF};
-
-int32_t psa_sst_uid_value_zero_check(caller_security_t caller)
-{
- int32_t status;
- psa_storage_uid_t uid = 0;
- struct psa_storage_info_t info;
-
- /* Set with UID value zero should fail */
- val->print(PRINT_TEST, "[Check 1] Creating storage with UID 0 should fail\n", 0);
- status = SST_FUNCTION(s010_data[0].api, uid, TEST_BUFF_SIZE, write_buff, PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, s010_data[0].status, TEST_CHECKPOINT_NUM(1));
-
- /* Call to get_info call with UID zero should fail */
- val->print(PRINT_TEST, "[Check 2] Get_info for UID 0 should fail\n", 0);
- status = SST_FUNCTION(s010_data[1].api, uid, &info);
- TEST_ASSERT_EQUAL(status, s010_data[1].status, TEST_CHECKPOINT_NUM(2));
-
- /* UID removal should fail */
- val->print(PRINT_TEST, "[Check 3] Removing storage with UID 0 should fail\n", 0);
- status = SST_FUNCTION(s010_data[2].api, uid);
- TEST_ASSERT_EQUAL(status, s010_data[2].status, TEST_CHECKPOINT_NUM(3));
-
- return VAL_STATUS_SUCCESS;
-}
-
diff --git a/api-tests/dev_apis/protected_storage/README.md b/api-tests/dev_apis/protected_storage/README.md
deleted file mode 100644
index a03221a..0000000
--- a/api-tests/dev_apis/protected_storage/README.md
+++ /dev/null
@@ -1,12 +0,0 @@
-
-# Protected Storage Test Suite
-
-## Common tests
-Since Protected Storage(PS) and Internal Trusted Storage(ITS) APIs shares the similar API prototypes and return values, some of the ITS tests are reused for PS also. The reused tests are available with ``test_s[x]`` (where, x= test_num) directory name syntax in protected_storage/. The source code of these tests are located in internal_trusted_storage/ dir with same test name.
-
-## License
-
-Arm PSA test suite is distributed under Apache v2.0 License.
---------------
-
-*Copyright (c) 2018-2019, Arm Limited and Contributors. All rights reserved.*
diff --git a/api-tests/dev_apis/protected_storage/suite.cmake b/api-tests/dev_apis/protected_storage/suite.cmake
deleted file mode 100644
index 6daf170..0000000
--- a/api-tests/dev_apis/protected_storage/suite.cmake
+++ /dev/null
@@ -1,72 +0,0 @@
-#/** @file
-# * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
-# * SPDX-License-Identifier : Apache-2.0
-# *
-# * Licensed under the Apache License, Version 2.0 (the "License");
-# * you may not use this file except in compliance with the License.
-# * You may obtain a copy of the License at
-# *
-# * http://www.apache.org/licenses/LICENSE-2.0
-# *
-# * Unless required by applicable law or agreed to in writing, software
-# * distributed under the License is distributed on an "AS IS" BASIS,
-# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# * See the License for the specific language governing permissions and
-# * limitations under the License.
-#**/
-
-foreach(test ${PSA_TEST_LIST})
- string(SUBSTRING ${test} 0 6 ITS_TEST_STR)
- if(${ITS_TEST_STR} STREQUAL "test_s")
- string(REPLACE ${SUITE_LOWER} "internal_trusted_storage" ACTUAL_PSA_SUITE_DIR ${PSA_SUITE_DIR})
- else()
- set(ACTUAL_PSA_SUITE_DIR ${PSA_SUITE_DIR})
- endif()
- include(${PSA_SUITE_DIR}/${test}/test.cmake)
- foreach(source_file ${CC_SOURCE})
- list(APPEND SUITE_CC_SOURCE
- ${ACTUAL_PSA_SUITE_DIR}/${test}/${source_file}
- )
- endforeach()
- foreach(asm_file ${AS_SOURCE})
- list(APPEND SUITE_AS_SOURCE
- ${ACTUAL_PSA_SUITE_DIR}/${test}/${asm_file}
- )
- endforeach()
- unset(CC_SOURCE)
- unset(AS_SOURCE)
- unset(ACTUAL_PSA_SUITE_DIR)
-endforeach()
-
-add_definitions(${CC_OPTIONS})
-add_definitions(${AS_OPTIONS})
-add_library(${PSA_TARGET_TEST_COMBINE_LIB} STATIC ${SUITE_CC_SOURCE} ${SUITE_AS_SOURCE})
-
-# Test related Include directories
-foreach(test ${PSA_TEST_LIST})
- string(SUBSTRING ${test} 0 6 ITS_TEST_STR)
- if(${ITS_TEST_STR} STREQUAL "test_s")
- string(REPLACE ${SUITE_LOWER} "internal_trusted_storage" ACTUAL_PSA_SUITE_DIR ${PSA_SUITE_DIR})
- else()
- set(ACTUAL_PSA_SUITE_DIR ${PSA_SUITE_DIR})
- endif()
- target_include_directories(${PSA_TARGET_TEST_COMBINE_LIB} PRIVATE ${ACTUAL_PSA_SUITE_DIR}/${test})
- unset(ACTUAL_PSA_SUITE_DIR)
-endforeach()
-
-# PSA Include directories
-foreach(psa_inc_path ${PSA_INCLUDE_PATHS})
- target_include_directories(${PSA_TARGET_TEST_COMBINE_LIB} PRIVATE
- ${psa_inc_path}
- )
-endforeach()
-
-target_include_directories(${PSA_TARGET_TEST_COMBINE_LIB} PRIVATE
- ${CMAKE_CURRENT_BINARY_DIR}
- ${PSA_ROOT_DIR}/val/common
- ${PSA_ROOT_DIR}/val/nspe
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/common
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/crypto
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/protected_storage
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/internal_trusted_storage
-)
diff --git a/api-tests/dev_apis/protected_storage/test_p011/test.cmake b/api-tests/dev_apis/protected_storage/test_p011/test.cmake
deleted file mode 100644
index 67884da..0000000
--- a/api-tests/dev_apis/protected_storage/test_p011/test.cmake
+++ /dev/null
@@ -1,24 +0,0 @@
-#/** @file
-# * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
-# * SPDX-License-Identifier : Apache-2.0
-# *
-# * Licensed under the Apache License, Version 2.0 (the "License");
-# * you may not use this file except in compliance with the License.
-# * You may obtain a copy of the License at
-# *
-# * http://www.apache.org/licenses/LICENSE-2.0
-# *
-# * Unless required by applicable law or agreed to in writing, software
-# * distributed under the License is distributed on an "AS IS" BASIS,
-# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# * See the License for the specific language governing permissions and
-# * limitations under the License.
-#**/
-
-list(APPEND CC_SOURCE
- test_entry_p011.c
- test_p011.c
-)
-list(APPEND CC_OPTIONS -DPS_TEST)
-list(APPEND AS_SOURCE )
-list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/protected_storage/test_p011/test_p011.c b/api-tests/dev_apis/protected_storage/test_p011/test_p011.c
deleted file mode 100644
index 83aa410..0000000
--- a/api-tests/dev_apis/protected_storage/test_p011/test_p011.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * SPDX-License-Identifier : Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-
-#include "val_interfaces.h"
-#include "val_target.h"
-#include "test_p011.h"
-#include "test_ps_data.h"
-
-#define TEST_BUFF_SIZE 16
-
-client_test_t test_p011_sst_list[] = {
- NULL,
- psa_sst_optional_api_uid_not_found,
- NULL,
-};
-
-static uint8_t write_buff[TEST_BUFF_SIZE] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F};
-static uint8_t read_buff[TEST_BUFF_SIZE] = {0};
-
-static int32_t psa_sst_uid_not_found()
-{
- uint32_t status, j, p_data_length = 0;
- psa_storage_uid_t p_uid = UID_BASE_VALUE + 5;
- struct psa_storage_info_t orig_info;
-
- /* Call the set_extended API with UID which is not created */
- val->print(PRINT_TEST, "[Check 1] Call set_extended API for UID %d which is not set\n", p_uid);
- status = SST_FUNCTION(p011_data[1].api, p_uid, 0, TEST_BUFF_SIZE, write_buff);
- TEST_ASSERT_EQUAL(status, p011_data[1].status, TEST_CHECKPOINT_NUM(1));
-
- /* Create a valid storage with set API */
- status = SST_FUNCTION(p011_data[2].api, p_uid, TEST_BUFF_SIZE, write_buff,
- PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, p011_data[2].status, TEST_CHECKPOINT_NUM(2));
-
- /* Try to change data length for same UID using create API */
- val->print(PRINT_TEST, "[Check 2] Call create API with length different than original\n", 0);
- status = SST_FUNCTION(p011_data[3].api, p_uid, TEST_BUFF_SIZE/2, PSA_STORAGE_FLAG_WRITE_ONCE);
- TEST_ASSERT_EQUAL(status, p011_data[3].status, TEST_CHECKPOINT_NUM(3));
-
- /* Try to change flag value associated with the UID */
- val->print(PRINT_TEST, "[Check 3] Call create API with flag value different than original\n", 0);
- status = SST_FUNCTION(p011_data[4].api, p_uid, TEST_BUFF_SIZE, PSA_STORAGE_FLAG_WRITE_ONCE);
- TEST_ASSERT_EQUAL(status, p011_data[4].status, TEST_CHECKPOINT_NUM(4));
-
- /* Check the flag value should be same as original*/
- status = SST_FUNCTION(p011_data[5].api, p_uid, &orig_info);
- TEST_ASSERT_EQUAL(status, p011_data[5].status, TEST_CHECKPOINT_NUM(5));
- TEST_ASSERT_EQUAL(orig_info.size, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(6));
- TEST_ASSERT_EQUAL(orig_info.flags, PSA_STORAGE_FLAG_NONE, TEST_CHECKPOINT_NUM(7));
-
- /* Remove the UID */
- status = SST_FUNCTION(p011_data[8].api, p_uid);
- TEST_ASSERT_EQUAL(status, p011_data[8].status, TEST_CHECKPOINT_NUM(8));
-
- /* Create a valid storage */
- status = SST_FUNCTION(p011_data[9].api, p_uid, TEST_BUFF_SIZE/2, PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, p011_data[9].status, TEST_CHECKPOINT_NUM(9));
-
- /* Try to change length using create API */
- val->print(PRINT_TEST, "[Check 4] Call create API with parameters different than original\n", 0);
- status = SST_FUNCTION(p011_data[10].api, p_uid, TEST_BUFF_SIZE, PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, p011_data[10].status, TEST_CHECKPOINT_NUM(10));
-
- /* Check the storage should be empty */
- status = SST_FUNCTION(p011_data[11].api, p_uid, 0, TEST_BUFF_SIZE, read_buff, &p_data_length);
- TEST_ASSERT_EQUAL(status, p011_data[11].status, TEST_CHECKPOINT_NUM(11));
- for (j = 0; j < TEST_BUFF_SIZE; j++)
- {
- TEST_ASSERT_EQUAL(read_buff[j], 0, TEST_CHECKPOINT_NUM(12));
- }
- TEST_ASSERT_EQUAL(p_data_length, 0, TEST_CHECKPOINT_NUM(13));
-
- /* Remove the UID */
- status = SST_FUNCTION(p011_data[13].api, p_uid);
- TEST_ASSERT_EQUAL(status, p011_data[13].status, TEST_CHECKPOINT_NUM(14));
-
- /* Call the set_extended API with UID which is removed */
- val->print(PRINT_TEST, "[Check 5] Call set_extended API for UID %d which is removed\n", p_uid);
- status = SST_FUNCTION(p011_data[14].api, p_uid, 0, TEST_BUFF_SIZE, write_buff);
- TEST_ASSERT_EQUAL(status, p011_data[14].status, TEST_CHECKPOINT_NUM(15));
-
- return VAL_STATUS_SUCCESS;
-}
-
-int32_t psa_sst_optional_api_uid_not_found(caller_security_t caller)
-{
- uint32_t status;
- int32_t test_status;
-
- /* Call the get_support API and check if create and set_extended API are supported */
- status = SST_FUNCTION(p011_data[0].api);
-
- if (status == p011_data[0].status)
- {
- val->print(PRINT_INFO, "Optional PS APIs are supported.\n", 0);
- test_status = psa_sst_uid_not_found();
- if (test_status != VAL_STATUS_SUCCESS)
- return test_status;
- }
- else
- {
- val->print(PRINT_TEST, "Test Case skipped as Optional PS APIs are not supported.\n", 0);
- return RESULT_SKIP(VAL_STATUS_UNSUPPORTED);
- }
-
- return VAL_STATUS_SUCCESS;
-}
diff --git a/api-tests/dev_apis/protected_storage/test_p011/test_p011.h b/api-tests/dev_apis/protected_storage/test_p011/test_p011.h
deleted file mode 100644
index 73aba0d..0000000
--- a/api-tests/dev_apis/protected_storage/test_p011/test_p011.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * SPDX-License-Identifier : Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_P011_CLIENT_TESTS_H_
-#define _TEST_P011_CLIENT_TESTS_H_
-
-#define test_entry CONCAT(test_entry_, p011)
-#define val CONCAT(val, test_entry)
-#define psa CONCAT(psa, test_entry)
-
-extern val_api_t *val;
-extern psa_api_t *psa;
-extern client_test_t test_p011_sst_list[];
-
-int32_t psa_sst_optional_api_uid_not_found(caller_security_t caller);
-#endif /* _TEST_P011_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_p011/test_ps_data.h b/api-tests/dev_apis/protected_storage/test_p011/test_ps_data.h
deleted file mode 100644
index 97ac2dc..0000000
--- a/api-tests/dev_apis/protected_storage/test_p011/test_ps_data.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_P011_PS_DATA_TESTS_H_
-#define _TEST_P011_PS_DATA_TESTS_H_
-
-#include "val_protected_storage.h"
-
-#define SST_FUNCTION val->ps_function
-
-typedef struct {
- enum ps_function_code api;
- psa_status_t status;
-} test_data;
-
-static const test_data p011_data[] = {
-{
- VAL_PS_GET_SUPPORT, PSA_STORAGE_SUPPORT_SET_EXTENDED /* Index0 - Check if optional PS API
- supported */
-},
-{
- VAL_PS_SET_EXTENDED, PSA_ERROR_DOES_NOT_EXIST /* Index1 - Call set_extended call for
- non-existing UID */
-},
-{
- VAL_PS_SET, PSA_SUCCESS /* Index2 - Create valid storage using set API */
-},
-{
- VAL_PS_CREATE, PSA_ERROR_INVALID_ARGUMENT /* Index3 - Create API for present UID with different
- length */
-},
-{
- VAL_PS_CREATE, PSA_ERROR_INVALID_ARGUMENT /* Index4 - Call create API for to set WRITE_ONCE flag */
-},
-{
- VAL_PS_GET_INFO, PSA_SUCCESS /* Index5 - Validate existing UID attributes maintained */
-},
-{
- 0, 0 /* This is dummy for Index6 */
-},
-{
- 0, 0 /* This is dummy for Index7 */
-},
-{
- VAL_PS_REMOVE, PSA_SUCCESS /* Index8 - Remove the UID */
-},
-{
- VAL_PS_CREATE, PSA_SUCCESS /* Index9 - Create valid storage using create API */
-},
-{
- VAL_PS_CREATE, PSA_ERROR_INVALID_ARGUMENT /* Index10 - Again call create API with different
- length */
-},
-{
- VAL_PS_GET, PSA_SUCCESS /* Index11 - Validate the storage is empty */
-},
-{
- 0, 0 /* This is dummy for Index12 */
-},
-{
- VAL_PS_REMOVE, PSA_SUCCESS /* Index13 - Remove the UID */
-},
-{
- VAL_PS_SET_EXTENDED, PSA_ERROR_DOES_NOT_EXIST /* Index14 - Set_extended call for removed UID */
-}
-};
-#endif /* _TEST_P011_PS_DATA_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_p012/test.cmake b/api-tests/dev_apis/protected_storage/test_p012/test.cmake
deleted file mode 100644
index 28b4103..0000000
--- a/api-tests/dev_apis/protected_storage/test_p012/test.cmake
+++ /dev/null
@@ -1,24 +0,0 @@
-#/** @file
-# * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
-# * SPDX-License-Identifier : Apache-2.0
-# *
-# * Licensed under the Apache License, Version 2.0 (the "License");
-# * you may not use this file except in compliance with the License.
-# * You may obtain a copy of the License at
-# *
-# * http://www.apache.org/licenses/LICENSE-2.0
-# *
-# * Unless required by applicable law or agreed to in writing, software
-# * distributed under the License is distributed on an "AS IS" BASIS,
-# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# * See the License for the specific language governing permissions and
-# * limitations under the License.
-#**/
-
-list(APPEND CC_SOURCE
- test_entry_p012.c
- test_p012.c
-)
-list(APPEND CC_OPTIONS -DPS_TEST)
-list(APPEND AS_SOURCE )
-list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/protected_storage/test_p012/test_p012.c b/api-tests/dev_apis/protected_storage/test_p012/test_p012.c
deleted file mode 100644
index 93d786f..0000000
--- a/api-tests/dev_apis/protected_storage/test_p012/test_p012.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * SPDX-License-Identifier : Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-
-#include "val_interfaces.h"
-#include "val_target.h"
-#include "test_p012.h"
-#include "test_ps_data.h"
-
-#define TEST_BUFF_SIZE 16
-
-client_test_t test_p012_sst_list[] = {
- NULL,
- psa_sst_optional_api_offset_invalid,
- NULL,
-};
-
-static psa_storage_uid_t p_uid = UID_BASE_VALUE + 6;
-static uint8_t write_buff[TEST_BUFF_SIZE] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F};
-static uint8_t read_buff[TEST_BUFF_SIZE] = {0};
-static uint8_t write_buff_2[TEST_BUFF_SIZE] = {0xFF, 0xC1, 0xA2, 0xE3, 0x04, 0x05, 0x06, 0x07,
- 0x03, 0x09, 0x0A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F};
-
-int32_t psa_sst_offset_invalid()
-{
- uint32_t status, p_data_length = 0;
-
- /* Create valid storage using create API */
- status = SST_FUNCTION(p012_data[1].api, p_uid, TEST_BUFF_SIZE, PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, p012_data[1].status, TEST_CHECKPOINT_NUM(1));
-
- /* Set some data in the storage created */
- status = SST_FUNCTION(p012_data[2].api, p_uid, TEST_BUFF_SIZE/2, 5, write_buff);
- TEST_ASSERT_EQUAL(status, p012_data[2].status, TEST_CHECKPOINT_NUM(2));
-
- /* Try to set data at invalid location with incorrect data len + offset */
- val->print(PRINT_TEST, "[Check 1] Call set_extended API with invalid offset + length\n", 0);
- status = SST_FUNCTION(p012_data[3].api, p_uid, TEST_BUFF_SIZE, 2, write_buff);
- TEST_ASSERT_EQUAL(status, p012_data[3].status, TEST_CHECKPOINT_NUM(3));
-
- /* Try to set data at invalid location with incorrect offset */
- val->print(PRINT_TEST, "[Check 2] Call set_extended API with invalid offset\n", 0);
- status = SST_FUNCTION(p012_data[4].api, p_uid, TEST_BUFF_SIZE + 2, 0, write_buff);
- TEST_ASSERT_EQUAL(status, p012_data[4].status, TEST_CHECKPOINT_NUM(4));
-
- /* 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 = SST_FUNCTION(p012_data[5].api, p_uid, TEST_BUFF_SIZE, 0, write_buff);
- TEST_ASSERT_EQUAL(status, p012_data[5].status, TEST_CHECKPOINT_NUM(5));
-
- /* Try to set data at invalid location with incorrect data len + offset */
- val->print(PRINT_TEST, "[Check 4] Call set_extended API with invalid offset + length\n", 0);
- status = SST_FUNCTION(p012_data[6].api, p_uid, 1, TEST_BUFF_SIZE, write_buff);
- TEST_ASSERT_EQUAL(status, p012_data[6].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 = SST_FUNCTION(p012_data[7].api, p_uid, 0, TEST_BUFF_SIZE + 1, write_buff);
- TEST_ASSERT_EQUAL(status, p012_data[7].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 = SST_FUNCTION(p012_data[8].api, p_uid, TEST_BUFF_SIZE, write_buff,
- PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, p012_data[8].status, TEST_CHECKPOINT_NUM(8));
-
- /* Call the get function to check data is correctly overwritten */
- status = SST_FUNCTION(p012_data[9].api, p_uid, 0, TEST_BUFF_SIZE, read_buff, &p_data_length);
- TEST_ASSERT_EQUAL(status, p012_data[9].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));
-
- return VAL_STATUS_SUCCESS;
-}
-
-static int32_t psa_sst_bad_pointer()
-{
- uint32_t status;
-
- /* Call create API with UID value 0 */
- val->print(PRINT_TEST, "[Check 7] Call create API with UID 0\n", 0);
- status = SST_FUNCTION(p012_data[11].api, 0, 0, TEST_BUFF_SIZE, write_buff);
- TEST_ASSERT_EQUAL(status, p012_data[11].status, TEST_CHECKPOINT_NUM(12));
-
- /* Call set extended API with UID value 0 */
- val->print(PRINT_TEST, "[Check 8] Call set_extended API with UID 0\n", 0);
- status = SST_FUNCTION(p012_data[12].api, 0, 0, TEST_BUFF_SIZE, write_buff_2);
- TEST_ASSERT_EQUAL(status, p012_data[12].status, TEST_CHECKPOINT_NUM(13));
-
- /* Call remove API with UID value 0 */
- val->print(PRINT_TEST, "[Check 9] Call remove API with UID 0\n", 0);
- status = SST_FUNCTION(p012_data[13].api, 0);
- TEST_ASSERT_EQUAL(status, p012_data[13].status, TEST_CHECKPOINT_NUM(14));
-
- /* Remove the UID */
- status = SST_FUNCTION(p012_data[14].api, p_uid);
- TEST_ASSERT_EQUAL(status, p012_data[14].status, TEST_CHECKPOINT_NUM(15));
-
- return VAL_STATUS_SUCCESS;
-}
-
-int32_t psa_sst_optional_api_offset_invalid(caller_security_t caller)
-{
- uint32_t status;
- int32_t test_status;
-
- /* Call the get_support API and check if create and set_extended API are supported */
- status = SST_FUNCTION(p012_data[0].api);
-
- if (status == p012_data[0].status)
- {
- val->print(PRINT_INFO, "Optional PS APIs are supported.\n", 0);
- test_status = psa_sst_offset_invalid();
- if (test_status != VAL_STATUS_SUCCESS)
- return test_status;
-
- test_status = psa_sst_bad_pointer();
- if (test_status != VAL_STATUS_SUCCESS)
- return test_status;
- }
- else
- {
- val->print(PRINT_TEST, "Test Case skipped as Optional PS APIs are not supported.\n", 0);
- return RESULT_SKIP(VAL_STATUS_UNSUPPORTED);
- }
-
- return VAL_STATUS_SUCCESS;
-}
diff --git a/api-tests/dev_apis/protected_storage/test_p012/test_p012.h b/api-tests/dev_apis/protected_storage/test_p012/test_p012.h
deleted file mode 100644
index 7754a44..0000000
--- a/api-tests/dev_apis/protected_storage/test_p012/test_p012.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * SPDX-License-Identifier : Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_P012_CLIENT_TESTS_H_
-#define _TEST_P012_CLIENT_TESTS_H_
-
-#define test_entry CONCAT(test_entry_, p012)
-#define val CONCAT(val, test_entry)
-#define psa CONCAT(psa, test_entry)
-
-extern val_api_t *val;
-extern psa_api_t *psa;
-extern client_test_t test_p012_sst_list[];
-
-int32_t psa_sst_optional_api_offset_invalid(caller_security_t caller);
-#endif /* _TEST_P012_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_p012/test_ps_data.h b/api-tests/dev_apis/protected_storage/test_p012/test_ps_data.h
deleted file mode 100644
index 1372ab7..0000000
--- a/api-tests/dev_apis/protected_storage/test_p012/test_ps_data.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_P012_PS_DATA_TESTS_H_
-#define _TEST_P012_PS_DATA_TESTS_H_
-
-#include "val_protected_storage.h"
-
-#define SST_FUNCTION val->ps_function
-
-typedef struct {
- enum ps_function_code api;
- psa_status_t status;
-} test_data;
-
-static const test_data p012_data[] = {
-{
- VAL_PS_GET_SUPPORT, PSA_STORAGE_SUPPORT_SET_EXTENDED /* Index0 -Check if optional PS API
- supported */
-},
-{
- VAL_PS_CREATE, PSA_SUCCESS /* Index1 - Create valid storage */
-},
-{
- VAL_PS_SET_EXTENDED, PSA_SUCCESS /* Index2 - Set data using set_extended API */
-},
-{
- VAL_PS_SET_EXTENDED, PSA_ERROR_INVALID_ARGUMENT /* Index3 - Set_extended with invalid offset +
- length */
-},
-{
- VAL_PS_SET_EXTENDED, PSA_ERROR_INVALID_ARGUMENT /* Index4 - Set_extended call with invalid
- offset */
-},
-{
- VAL_PS_SET_EXTENDED, PSA_SUCCESS /* Index5 - Set_extended call with valid offset and zero length */
-},
-{
- VAL_PS_SET_EXTENDED, PSA_ERROR_INVALID_ARGUMENT /* Index6 - Set_extended with invalid offset +
- length */
-},
-{
- VAL_PS_SET_EXTENDED, PSA_ERROR_INVALID_ARGUMENT /* Index7 - Set_extended with invalid length */
-},
-{
- VAL_PS_SET, PSA_SUCCESS /* Index8 - Write data using set API */
-},
-{
- VAL_PS_GET, PSA_SUCCESS /* Index9 - Check data validity using get API */
-},
-{
- 0, 0 /* This is dummy for Index10 */
-},
-{
- VAL_PS_CREATE, PSA_ERROR_INVALID_ARGUMENT /* Index11 - Create call with UID 0 */
-},
-{
- VAL_PS_SET_EXTENDED, PSA_ERROR_INVALID_ARGUMENT /* Index12 - Call set_extended with UID 0 */
-},
-{
- VAL_PS_REMOVE, PSA_ERROR_INVALID_ARGUMENT /* Index13 - Call remove with UID 0 */
-},
-{
- VAL_PS_REMOVE, PSA_SUCCESS /* Index14 - Remove with UID */
-},
-};
-#endif /* _TEST_P012_PS_DATA_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_p013/test.cmake b/api-tests/dev_apis/protected_storage/test_p013/test.cmake
deleted file mode 100644
index 6c1913f..0000000
--- a/api-tests/dev_apis/protected_storage/test_p013/test.cmake
+++ /dev/null
@@ -1,24 +0,0 @@
-#/** @file
-# * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
-# * SPDX-License-Identifier : Apache-2.0
-# *
-# * Licensed under the Apache License, Version 2.0 (the "License");
-# * you may not use this file except in compliance with the License.
-# * You may obtain a copy of the License at
-# *
-# * http://www.apache.org/licenses/LICENSE-2.0
-# *
-# * Unless required by applicable law or agreed to in writing, software
-# * distributed under the License is distributed on an "AS IS" BASIS,
-# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# * See the License for the specific language governing permissions and
-# * limitations under the License.
-#**/
-
-list(APPEND CC_SOURCE
- test_entry_p013.c
- test_p013.c
-)
-list(APPEND CC_OPTIONS -DPS_TEST)
-list(APPEND AS_SOURCE )
-list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/protected_storage/test_p013/test_p013.c b/api-tests/dev_apis/protected_storage/test_p013/test_p013.c
deleted file mode 100644
index d4d5026..0000000
--- a/api-tests/dev_apis/protected_storage/test_p013/test_p013.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-
-#include "val_interfaces.h"
-#include "val_target.h"
-#include "test_p013.h"
-#include "test_ps_data.h"
-
-#define TEST_BUFF_SIZE 16
-
-client_test_t test_p013_sst_list[] = {
- NULL,
- psa_sst_optional_api_success_check,
- NULL,
-};
-
-static psa_storage_uid_t p_uid = UID_BASE_VALUE + 4;
-static uint8_t write_buff[TEST_BUFF_SIZE/2] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07};
-static uint8_t write_buff_2[TEST_BUFF_SIZE/2] = {0xFF, 0x11, 0xA2, 0xE3, 0x04, 0xA5, 0xD6, 0x97};
-static uint8_t read_buff[TEST_BUFF_SIZE] = {0};
-static uint8_t write_buff_3[TEST_BUFF_SIZE] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F};
-
-static int32_t psa_sst_set_extended_create_success()
-{
- uint32_t status, p_data_length = 0;
- struct psa_storage_info_t info;
-
- /* Create storage of zero length using create API */
- val->print(PRINT_TEST, "[Check 1] Create storage using create API for 0 length\n", 0);
- status = SST_FUNCTION(p013_data[1].api, p_uid, 0, PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, p013_data[1].status, TEST_CHECKPOINT_NUM(1));
-
- /* Set some data in the storage created */
- val->print(PRINT_TEST, "[Check 2] Call set_extended for zero storage length\n", 0);
- status = SST_FUNCTION(p013_data[2].api, p_uid, 0, 0, write_buff);
- TEST_ASSERT_EQUAL(status, p013_data[2].status, TEST_CHECKPOINT_NUM(2));
-
- /* Call the get_info function to match attributes */
- status = SST_FUNCTION(p013_data[3].api, p_uid, &info);
- TEST_ASSERT_EQUAL(status, p013_data[3].status, TEST_CHECKPOINT_NUM(3));
- TEST_ASSERT_EQUAL(info.flags, PSA_STORAGE_FLAG_NONE, TEST_CHECKPOINT_NUM(4));
- TEST_ASSERT_EQUAL(info.size, 0, TEST_CHECKPOINT_NUM(5));
-
- /* Remove the storage */
- val->print(PRINT_TEST, "[Check 3] Remove the storage\n", 0);
- status = SST_FUNCTION(p013_data[6].api, p_uid);
- TEST_ASSERT_EQUAL(status, p013_data[6].status, TEST_CHECKPOINT_NUM(6));
-
- /* Create a valid storage */
- status = SST_FUNCTION(p013_data[7].api, p_uid, TEST_BUFF_SIZE, PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, p013_data[7].status, TEST_CHECKPOINT_NUM(7));
-
- /* Try to set data in first half of buffer */
- status = SST_FUNCTION(p013_data[8].api, p_uid, 0, TEST_BUFF_SIZE/2, write_buff);
- TEST_ASSERT_EQUAL(status, p013_data[8].status, TEST_CHECKPOINT_NUM(8));
-
- /* Try to set data in second half of buffer */
- status = SST_FUNCTION(p013_data[9].api, p_uid, TEST_BUFF_SIZE/2, TEST_BUFF_SIZE/2,\
- write_buff_2);
- TEST_ASSERT_EQUAL(status, p013_data[9].status, TEST_CHECKPOINT_NUM(9));
-
- /* Call the get function to match the data */
- val->print(PRINT_TEST, "[Check 4] Valid data written by multiple set_extended\n", 0);
- status = SST_FUNCTION(p013_data[10].api, p_uid, 0, TEST_BUFF_SIZE, read_buff, &p_data_length);
- TEST_ASSERT_EQUAL(status, p013_data[10].status, TEST_CHECKPOINT_NUM(10));
- TEST_ASSERT_MEMCMP(read_buff, write_buff, TEST_BUFF_SIZE/2, TEST_CHECKPOINT_NUM(11));
- TEST_ASSERT_MEMCMP(read_buff + TEST_BUFF_SIZE/2, write_buff_2, TEST_BUFF_SIZE/2,\
- TEST_CHECKPOINT_NUM(12));
- TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(13));
-
- /* Overwrite data using set API */
- val->print(PRINT_TEST, "[Check 5] Overwrite whole data using SET API\n", 0);
- status = SST_FUNCTION(p013_data[13].api, p_uid, TEST_BUFF_SIZE, write_buff_3,
- PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, p013_data[13].status, TEST_CHECKPOINT_NUM(14));
-
- /* Call the get function to match the data */
- val->print(PRINT_TEST, "[Check 6] Validate the data using get API\n", 0);
- status = SST_FUNCTION(p013_data[14].api, p_uid, 0, TEST_BUFF_SIZE, read_buff, &p_data_length);
- TEST_ASSERT_EQUAL(status, p013_data[14].status, TEST_CHECKPOINT_NUM(15));
- TEST_ASSERT_MEMCMP(read_buff, write_buff_3, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(16));
- TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(17));
-
- /* Call create API for existing UID with same parameters */
- val->print(PRINT_TEST, "[Check 7] Call create API for existing UID with same parameters\n", 0);
- status = SST_FUNCTION(p013_data[16].api, p_uid, TEST_BUFF_SIZE, PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, p013_data[16].status, TEST_CHECKPOINT_NUM(18));
-
- /* Call the get function to match the data */
- val->print(PRINT_TEST, "[Check 8] Validity of data after create API call\n", 0);
- status = SST_FUNCTION(p013_data[17].api, p_uid, 0, TEST_BUFF_SIZE, read_buff, &p_data_length);
- TEST_ASSERT_EQUAL(status, p013_data[17].status, TEST_CHECKPOINT_NUM(19));
- TEST_ASSERT_MEMCMP(read_buff, write_buff_3, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(20));
- TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(21));
-
- /* Remove the storage */
- val->print(PRINT_TEST, "[Check 9] Remove the UID\n", 0);
- status = SST_FUNCTION(p013_data[19].api, p_uid);
- TEST_ASSERT_EQUAL(status, p013_data[19].status, TEST_CHECKPOINT_NUM(22));
-
- /* Validate there should not be duplicate UID present */
- val->print(PRINT_TEST, "[Check 10] No duplicate entry of UID present\n", 0);
- status = SST_FUNCTION(p013_data[20].api, p_uid, 0, TEST_BUFF_SIZE, read_buff);
- TEST_ASSERT_EQUAL(status, p013_data[20].status, TEST_CHECKPOINT_NUM(23));
-
- return VAL_STATUS_SUCCESS;
-}
-
-int32_t psa_sst_optional_api_success_check(caller_security_t caller)
-{
- uint32_t status;
- int32_t test_status;
-
- /* Call the get_support API and check if create and set_extended API are supported */
- status = SST_FUNCTION(p013_data[0].api);
-
- if (status == p013_data[0].status)
- {
- val->print(PRINT_INFO, "Optional PS APIs are supported.\n", 0);
- test_status = psa_sst_set_extended_create_success();
- if (test_status != VAL_STATUS_SUCCESS)
- return test_status;
- }
- else
- {
- val->print(PRINT_TEST, "Test Case skipped as Optional PS APIs are not supported.\n", 0);
- return RESULT_SKIP(VAL_STATUS_UNSUPPORTED);
- }
-
- return VAL_STATUS_SUCCESS;
-}
diff --git a/api-tests/dev_apis/protected_storage/test_p013/test_p013.h b/api-tests/dev_apis/protected_storage/test_p013/test_p013.h
deleted file mode 100644
index 7324776..0000000
--- a/api-tests/dev_apis/protected_storage/test_p013/test_p013.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * SPDX-License-Identifier : Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_P013_CLIENT_TESTS_H_
-#define _TEST_P013_CLIENT_TESTS_H_
-
-#define test_entry CONCAT(test_entry_, p013)
-#define val CONCAT(val, test_entry)
-#define psa CONCAT(psa, test_entry)
-
-extern val_api_t *val;
-extern psa_api_t *psa;
-extern client_test_t test_p013_sst_list[];
-
-int32_t psa_sst_optional_api_success_check(caller_security_t caller);
-
-#endif /* _TEST_P013_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_p013/test_ps_data.h b/api-tests/dev_apis/protected_storage/test_p013/test_ps_data.h
deleted file mode 100644
index b2c58fa..0000000
--- a/api-tests/dev_apis/protected_storage/test_p013/test_ps_data.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_P013_PS_DATA_TESTS_H_
-#define _TEST_P013_PS_DATA_TESTS_H_
-
-#include "val_protected_storage.h"
-
-#define SST_FUNCTION val->ps_function
-
-typedef struct {
- enum ps_function_code api;
- psa_status_t status;
-} test_data;
-
-static const test_data p013_data[] = {
-{
- VAL_PS_GET_SUPPORT, PSA_STORAGE_SUPPORT_SET_EXTENDED /* Index0 - Check if optional PS API
- supported */
-},
-{
- VAL_PS_CREATE, PSA_SUCCESS /* Index1 - Create storage of zero length */
-},
-{
- VAL_PS_SET_EXTENDED, PSA_SUCCESS /* Index2 - Call set_extended with zero length */
-},
-{
- VAL_PS_GET_INFO, PSA_SUCCESS /* Index3 - Validate the storage attributes */
-},
-{
- 0, 0 /* This is dummy for Index4 */
-},
-{
- 0, 0 /* This is dummy for Index5 */
-},
-{
- VAL_PS_REMOVE, PSA_SUCCESS /* Index6 - Remove the UID */
-},
-{
- VAL_PS_CREATE, PSA_SUCCESS /* Index7 - Create storage of non-zero length */
-},
-{
- VAL_PS_SET_EXTENDED, PSA_SUCCESS /* Index8 - Call set_extended to write data in first half of
- buffer */
-},
-{
- VAL_PS_SET_EXTENDED, PSA_SUCCESS /* Index9 - Call set_extended to write data in second half of
- buffer */
-},
-{
- VAL_PS_GET, PSA_SUCCESS /* Index10 - Validate the data stored */
-},
-{
- 0, 0 /* This is dummy for Index11 */
-},
-{
- 0, 0 /* This is dummy for Index12 */
-},
-{
- VAL_PS_SET, PSA_SUCCESS /* Index13 - Overwrite data with set API */
-},
-{
- VAL_PS_GET, PSA_SUCCESS /* Index14 - Validate the data written */
-},
-{
- 0, 0 /* This is dummy for Index15 */
-},
-{
- VAL_PS_CREATE, PSA_SUCCESS /* Index16 - Call Create API for existing UID with same parameters */
-},
-{
- VAL_PS_GET, PSA_SUCCESS /* Index17 - Validate the data */
-},
-{
- 0, 0 /* This is dummy for Index18 */
-},
-{
- VAL_PS_REMOVE, PSA_SUCCESS /* Index19 - Remove the UID */
-},
-{
- VAL_PS_GET, PSA_ERROR_DOES_NOT_EXIST /* Index20 - Check no duplicate entry of UID present */
-}
-};
-#endif /* _TEST_P013_PS_DATA_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_p014/test.cmake b/api-tests/dev_apis/protected_storage/test_p014/test.cmake
deleted file mode 100644
index a794d8c..0000000
--- a/api-tests/dev_apis/protected_storage/test_p014/test.cmake
+++ /dev/null
@@ -1,24 +0,0 @@
-#/** @file
-# * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
-# * SPDX-License-Identifier : Apache-2.0
-# *
-# * Licensed under the Apache License, Version 2.0 (the "License");
-# * you may not use this file except in compliance with the License.
-# * You may obtain a copy of the License at
-# *
-# * http://www.apache.org/licenses/LICENSE-2.0
-# *
-# * Unless required by applicable law or agreed to in writing, software
-# * distributed under the License is distributed on an "AS IS" BASIS,
-# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# * See the License for the specific language governing permissions and
-# * limitations under the License.
-#**/
-
-list(APPEND CC_SOURCE
- test_entry_p014.c
- test_p014.c
-)
-list(APPEND CC_OPTIONS -DPS_TEST)
-list(APPEND AS_SOURCE )
-list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/protected_storage/test_p014/test_p014.c b/api-tests/dev_apis/protected_storage/test_p014/test_p014.c
deleted file mode 100644
index d210c2f..0000000
--- a/api-tests/dev_apis/protected_storage/test_p014/test_p014.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * SPDX-License-Identifier : Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-
-#include "val_interfaces.h"
-#include "val_target.h"
-#include "test_p014.h"
-#include "test_ps_data.h"
-
-#define TEST_BUFF_SIZE 16
-
-client_test_t test_p014_sst_list[] = {
- NULL,
- psa_sst_optional_api_not_supported_check,
- NULL,
-};
-
-static psa_storage_uid_t p_uid = UID_BASE_VALUE + 5;
-static uint8_t write_buff[TEST_BUFF_SIZE/4] = { 0x03, 0x04, 0x05, 0x07};
-static uint8_t read_buff[TEST_BUFF_SIZE/4] = {0};
-
-static int32_t psa_sst_optional_api_not_supported()
-{
- uint32_t status, p_data_length = 0;
- struct psa_storage_info_t info;
-
- /* Try to create storage using create API */
- val->print(PRINT_TEST, "[Check 1] Call to create API should fail as API not supported\n", 0);
- status = SST_FUNCTION(p014_data[1].api, p_uid, TEST_BUFF_SIZE, PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, p014_data[1].status, TEST_CHECKPOINT_NUM(1));
-
- /* Verify that UID doesn't exist */
- status = SST_FUNCTION(p014_data[2].api, p_uid, &info);
- TEST_ASSERT_EQUAL(status, p014_data[2].status, TEST_CHECKPOINT_NUM(2));
-
- /* Create a valid storage using set API */
- val->print(PRINT_TEST, "[Check 2] Create valid storage with set API\n", 0);
- status = SST_FUNCTION(p014_data[3].api, p_uid, TEST_BUFF_SIZE/4, write_buff,
- PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, p014_data[3].status, TEST_CHECKPOINT_NUM(3));
-
- /* Partial data write with set_extended API should fail */
- val->print(PRINT_TEST, "[Check 3] Call to set_extended API call should fail\n", 0);
- status = SST_FUNCTION(p014_data[4].api, p_uid, 0, 2, write_buff);
- TEST_ASSERT_EQUAL(status, p014_data[4].status, TEST_CHECKPOINT_NUM(4));
-
- /* Call the get function to match the data */
- val->print(PRINT_TEST, "[Check 4] Verify data is unchanged\n", 0);
- status = SST_FUNCTION(p014_data[5].api, p_uid, 0, TEST_BUFF_SIZE/4, read_buff, &p_data_length);
- TEST_ASSERT_EQUAL(status, p014_data[5].status, TEST_CHECKPOINT_NUM(5));
- TEST_ASSERT_MEMCMP(read_buff, write_buff, TEST_BUFF_SIZE/4, TEST_CHECKPOINT_NUM(6));
- TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE/4, TEST_CHECKPOINT_NUM(7));
-
- /* Remove the storage */
- status = SST_FUNCTION(p014_data[7].api, p_uid);
- TEST_ASSERT_EQUAL(status, p014_data[7].status, TEST_CHECKPOINT_NUM(8));
-
- return VAL_STATUS_SUCCESS;
-}
-
-int32_t psa_sst_optional_api_not_supported_check(caller_security_t caller)
-{
- uint32_t status;
- int32_t test_status;
-
- /* Call the get_support API and check if create and set_extended API are supported */
- status = SST_FUNCTION(p014_data[0].api);
-
- if (status == p014_data[0].status)
- {
- val->print(PRINT_INFO, "Test Case skipped as Optional PS APIs are supported.\n", 0);
- return RESULT_SKIP(VAL_STATUS_UNSUPPORTED);
- }
- else
- {
- val->print(PRINT_TEST, "Optional PS APIs are not supported.\n", 0);
- test_status = psa_sst_optional_api_not_supported();
- if (test_status != VAL_STATUS_SUCCESS)
- return test_status;
- }
-
- return VAL_STATUS_SUCCESS;
-}
diff --git a/api-tests/dev_apis/protected_storage/test_p014/test_p014.h b/api-tests/dev_apis/protected_storage/test_p014/test_p014.h
deleted file mode 100644
index 7b2b0f0..0000000
--- a/api-tests/dev_apis/protected_storage/test_p014/test_p014.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * SPDX-License-Identifier : Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_P014_CLIENT_TESTS_H_
-#define _TEST_P014_CLIENT_TESTS_H_
-
-#define test_entry CONCAT(test_entry_, p014)
-#define val CONCAT(val, test_entry)
-#define psa CONCAT(psa, test_entry)
-
-extern val_api_t *val;
-extern psa_api_t *psa;
-extern client_test_t test_p014_sst_list[];
-
-int32_t psa_sst_optional_api_not_supported_check(caller_security_t caller);
-
-#endif /* _TEST_P014_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_p014/test_ps_data.h b/api-tests/dev_apis/protected_storage/test_p014/test_ps_data.h
deleted file mode 100644
index 0ee29e4..0000000
--- a/api-tests/dev_apis/protected_storage/test_p014/test_ps_data.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_P014_PS_DATA_TESTS_H_
-#define _TEST_P014_PS_DATA_TESTS_H_
-
-#include "val_protected_storage.h"
-
-#define SST_FUNCTION val->ps_function
-
-typedef struct {
- enum ps_function_code api;
- psa_status_t status;
-} test_data;
-
-static const test_data p014_data[] = {
-{
- VAL_PS_GET_SUPPORT, PSA_STORAGE_SUPPORT_SET_EXTENDED /* Index0 -Check if Optional API supported */
-},
-{
- VAL_PS_CREATE, PSA_ERROR_NOT_SUPPORTED /* Index1 - Create API call should fail */
-},
-{
- VAL_PS_GET_INFO, PSA_ERROR_DOES_NOT_EXIST /* Index2 - UID should not exist */
-},
-{
- VAL_PS_SET, PSA_SUCCESS /* Index3 - Create storage of non-zero length */
-},
-{
- VAL_PS_SET_EXTENDED, PSA_ERROR_NOT_SUPPORTED /* Index4 - Set_extended API call should fail */
-},
-{
- VAL_PS_GET, PSA_SUCCESS /* Index5 - Validate the data should not changed */
-},
-{
- 0, 0 /* Unused Index6 */
-},
-{
- VAL_PS_REMOVE, PSA_SUCCESS /* Index7 - Remove the UID */
-},
-};
-#endif /* _TEST_P014_PS_DATA_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_p015/test.cmake b/api-tests/dev_apis/protected_storage/test_p015/test.cmake
deleted file mode 100644
index b2a8b62..0000000
--- a/api-tests/dev_apis/protected_storage/test_p015/test.cmake
+++ /dev/null
@@ -1,24 +0,0 @@
-#/** @file
-# * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
-# * SPDX-License-Identifier : Apache-2.0
-# *
-# * Licensed under the Apache License, Version 2.0 (the "License");
-# * you may not use this file except in compliance with the License.
-# * You may obtain a copy of the License at
-# *
-# * http://www.apache.org/licenses/LICENSE-2.0
-# *
-# * Unless required by applicable law or agreed to in writing, software
-# * distributed under the License is distributed on an "AS IS" BASIS,
-# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# * See the License for the specific language governing permissions and
-# * limitations under the License.
-#**/
-
-list(APPEND CC_SOURCE
- test_entry_p015.c
- test_p015.c
-)
-list(APPEND CC_OPTIONS -DPS_TEST)
-list(APPEND AS_SOURCE )
-list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/protected_storage/test_p015/test_p015.c b/api-tests/dev_apis/protected_storage/test_p015/test_p015.c
deleted file mode 100644
index 54b45ce..0000000
--- a/api-tests/dev_apis/protected_storage/test_p015/test_p015.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * SPDX-License-Identifier : Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-
-#include "val_interfaces.h"
-#include "val_target.h"
-#include "test_p015.h"
-#include "test_ps_data.h"
-
-#define TEST_BUFF_SIZE 5
-
-client_test_t test_p015_sst_list[] = {
- NULL,
- psa_sst_create_api_write_once_flag_check,
- NULL,
-};
-
-static psa_storage_uid_t p_uid = UID_BASE_VALUE + 5;
-
-int32_t psa_sst_create_api_write_once_flag_check(caller_security_t caller)
-{
- uint32_t status;
-
- /* Call the get_support API and check if optional APIs are supported */
- status = SST_FUNCTION(p015_data[0].api);
-
- if (status == p015_data[0].status)
- {
- /* Call create API with write_once flag */
- val->print(PRINT_TEST, "[Check 1] Call create API with write_once flag\n", 0);
- status = SST_FUNCTION(p015_data[1].api, p_uid, TEST_BUFF_SIZE, PSA_STORAGE_FLAG_WRITE_ONCE);
- TEST_ASSERT_EQUAL(status, p015_data[1].status, TEST_CHECKPOINT_NUM(1));
- }
- else
- {
- val->print(PRINT_TEST, "Test Case skipped as Optional PS APIs are not supported.\n", 0);
- return RESULT_SKIP(VAL_STATUS_UNSUPPORTED);
- }
-
- return VAL_STATUS_SUCCESS;
-}
diff --git a/api-tests/dev_apis/protected_storage/test_p015/test_p015.h b/api-tests/dev_apis/protected_storage/test_p015/test_p015.h
deleted file mode 100644
index 2f21d39..0000000
--- a/api-tests/dev_apis/protected_storage/test_p015/test_p015.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * SPDX-License-Identifier : Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_P015_CLIENT_TESTS_H_
-#define _TEST_P015_CLIENT_TESTS_H_
-
-#define test_entry CONCAT(test_entry_, p015)
-#define val CONCAT(val, test_entry)
-#define psa CONCAT(psa, test_entry)
-
-extern val_api_t *val;
-extern psa_api_t *psa;
-extern client_test_t test_p015_sst_list[];
-
-int32_t psa_sst_create_api_write_once_flag_check(caller_security_t caller);
-
-#endif /* _TEST_P015_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_p015/test_ps_data.h b/api-tests/dev_apis/protected_storage/test_p015/test_ps_data.h
deleted file mode 100644
index 716e4d3..0000000
--- a/api-tests/dev_apis/protected_storage/test_p015/test_ps_data.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_P015_PS_DATA_TESTS_H_
-#define _TEST_P015_PS_DATA_TESTS_H_
-
-#include "val_protected_storage.h"
-
-#define SST_FUNCTION val->ps_function
-
-typedef struct {
- enum ps_function_code api;
- psa_status_t status;
-} test_data;
-
-static const test_data p015_data[] = {
-{
- VAL_PS_GET_SUPPORT, PSA_STORAGE_SUPPORT_SET_EXTENDED /* Index0 - Check if optional PS API
- supported */
-},
-{
- VAL_PS_CREATE, PSA_ERROR_NOT_SUPPORTED /* Index1 - Call create API with write_once flag */
-},
-};
-#endif /* _TEST_P015_PS_DATA_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_p016/test.cmake b/api-tests/dev_apis/protected_storage/test_p016/test.cmake
deleted file mode 100644
index b2c7a02..0000000
--- a/api-tests/dev_apis/protected_storage/test_p016/test.cmake
+++ /dev/null
@@ -1,24 +0,0 @@
-#/** @file
-# * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
-# * SPDX-License-Identifier : Apache-2.0
-# *
-# * Licensed under the Apache License, Version 2.0 (the "License");
-# * you may not use this file except in compliance with the License.
-# * You may obtain a copy of the License at
-# *
-# * http://www.apache.org/licenses/LICENSE-2.0
-# *
-# * Unless required by applicable law or agreed to in writing, software
-# * distributed under the License is distributed on an "AS IS" BASIS,
-# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# * See the License for the specific language governing permissions and
-# * limitations under the License.
-#**/
-
-list(APPEND CC_SOURCE
- test_entry_p016.c
- test_p016.c
-)
-list(APPEND CC_OPTIONS -DPS_TEST)
-list(APPEND AS_SOURCE )
-list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/protected_storage/test_p016/test_entry_p016.c b/api-tests/dev_apis/protected_storage/test_p016/test_entry_p016.c
deleted file mode 100644
index 8bf29b0..0000000
--- a/api-tests/dev_apis/protected_storage/test_p016/test_entry_p016.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * SPDX-License-Identifier : Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-
-#include "val_interfaces.h"
-#include "val_target.h"
-#include "test_p016.h"
-
-#define TEST_NUM VAL_CREATE_TEST_ID(VAL_PROTECTED_STORAGE_BASE, 16)
-#define TEST_DESC "Storage assest capacity modification check\n"
-
-TEST_PUBLISH(TEST_NUM, test_entry);
-val_api_t *val = NULL;
-psa_api_t *psa = NULL;
-
-void test_entry(val_api_t *val_api, psa_api_t *psa_api)
-{
- int32_t status = VAL_STATUS_SUCCESS;
-
- val = val_api;
- psa = psa_api;
-
- /* test init */
- val->test_init(TEST_NUM, TEST_DESC, TEST_FIELD(TEST_ISOLATION_L1, WD_HIGH_TIMEOUT));
- if (!IS_TEST_START(val->get_status()))
- {
- goto test_exit;
- }
-
- /* Execute list of tests available in test[num]_protected_storage_list from Non-secure side*/
- status = val->execute_non_secure_tests(TEST_NUM, test_p016_sst_list, FALSE);
-
- if (VAL_ERROR(status))
- {
- goto test_exit;
- }
-
-test_exit:
- val->test_exit();
-}
diff --git a/api-tests/dev_apis/protected_storage/test_p016/test_p016.c b/api-tests/dev_apis/protected_storage/test_p016/test_p016.c
deleted file mode 100644
index d9d953a..0000000
--- a/api-tests/dev_apis/protected_storage/test_p016/test_p016.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-
-#include "val_interfaces.h"
-#include "val_target.h"
-#include "test_p016.h"
-#include "test_ps_data.h"
-
-#define TEST_BUFF_SIZE_1 10
-#define TEST_BUFF_SIZE_2 14
-#define TEST_BUFF_SIZE_3 8
-
-client_test_t test_p016_sst_list[] = {
- NULL,
- psa_sst_optional_api_sst_capacity_check,
- NULL,
-};
-
-static psa_storage_uid_t p_uid = UID_BASE_VALUE + 5;
-static uint8_t write_buff[TEST_BUFF_SIZE_2] = {0x03, 0x04, 0x05, 0x07, 0xFF, 0x00, 0x32, 0x67,
- 0x99, 0x78, 0x43, 0x20, 0xFF, 0x91};
-
-static int32_t psa_sst_optional_api_sst_capacity(void)
-{
- uint32_t status;
- struct psa_storage_info_t info;
-
- /* Try to create storage using create API */
- status = SST_FUNCTION(p016_data[1].api, p_uid, TEST_BUFF_SIZE_1, PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, p016_data[1].status, TEST_CHECKPOINT_NUM(1));
-
- /* Call to create API for existing UID should fail */
- val->print(PRINT_TEST, "[Check 1] Create API call for existing UID\n", 0);
- status = SST_FUNCTION(p016_data[2].api, p_uid, TEST_BUFF_SIZE_2, PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, p016_data[2].status, TEST_CHECKPOINT_NUM(2));
-
- /* Check the attributes of storage are unchanged */
- status = SST_FUNCTION(p016_data[3].api, p_uid, &info);
- TEST_ASSERT_EQUAL(status, p016_data[3].status, TEST_CHECKPOINT_NUM(3));
- TEST_ASSERT_EQUAL(info.capacity, TEST_BUFF_SIZE_1, TEST_CHECKPOINT_NUM(4));
- TEST_ASSERT_EQUAL(info.size, 0, TEST_CHECKPOINT_NUM(5));
-
- /* Override storage using set API */
- val->print(PRINT_TEST, "[Check 2] Call to set API call for existing UID\n", 0);
- status = SST_FUNCTION(p016_data[6].api, p_uid, TEST_BUFF_SIZE_3, write_buff,
- PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, p016_data[6].status, TEST_CHECKPOINT_NUM(6));
-
- /* Check the attributes of storage are changed */
- status = SST_FUNCTION(p016_data[7].api, p_uid, &info);
- TEST_ASSERT_EQUAL(status, p016_data[7].status, TEST_CHECKPOINT_NUM(7));
- TEST_ASSERT_EQUAL(info.capacity, TEST_BUFF_SIZE_3, TEST_CHECKPOINT_NUM(8));
- TEST_ASSERT_EQUAL(info.size, TEST_BUFF_SIZE_3, TEST_CHECKPOINT_NUM(9));
-
- /* Accessing old capacity with set_extended API should fail */
- val->print(PRINT_TEST, "[Check 3] Access old capacity using set_extended API\n", 0);
- status = SST_FUNCTION(p016_data[10].api, p_uid, 0, TEST_BUFF_SIZE_1, write_buff);
- TEST_ASSERT_EQUAL(status, p016_data[10].status, TEST_CHECKPOINT_NUM(10));
-
- /* Remove the storage */
- status = SST_FUNCTION(p016_data[11].api, p_uid);
- TEST_ASSERT_EQUAL(status, p016_data[11].status, TEST_CHECKPOINT_NUM(11));
-
- /* Create new storage assest using set API */
- val->print(PRINT_TEST, "[Check 4] Creation of new storage assest\n", 0);
- status = SST_FUNCTION(p016_data[12].api, p_uid, TEST_BUFF_SIZE_2, write_buff,
- PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, p016_data[12].status, TEST_CHECKPOINT_NUM(12));
-
- /* Call to create API for existing UID should fail */
- val->print(PRINT_TEST, "[Check 5] Create API call for existing UID\n", 0);
- status = SST_FUNCTION(p016_data[13].api, p_uid, TEST_BUFF_SIZE_2, PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, p016_data[13].status, TEST_CHECKPOINT_NUM(13));
-
- /* Remove the storage */
- status = SST_FUNCTION(p016_data[14].api, p_uid);
- TEST_ASSERT_EQUAL(status, p016_data[14].status, TEST_CHECKPOINT_NUM(14));
-
- return VAL_STATUS_SUCCESS;
-}
-
-int32_t psa_sst_optional_api_sst_capacity_check(caller_security_t caller)
-{
- uint32_t status;
- int32_t test_status;
-
- /* Call the get_support API and check if create and set_extended API are supported */
- status = SST_FUNCTION(p016_data[0].api);
-
- if (status != p016_data[0].status)
- {
- val->print(PRINT_TEST, "Test Case skipped as Optional PS APIs not are supported.\n", 0);
- return RESULT_SKIP(VAL_STATUS_UNSUPPORTED);
- } else {
- val->print(PRINT_TEST, "Optional PS APIs are supported.\n", 0);
- test_status = psa_sst_optional_api_sst_capacity();
- if (test_status != VAL_STATUS_SUCCESS)
- {
- return test_status;
- }
- }
-
- return VAL_STATUS_SUCCESS;
-}
diff --git a/api-tests/dev_apis/protected_storage/test_p016/test_p016.h b/api-tests/dev_apis/protected_storage/test_p016/test_p016.h
deleted file mode 100644
index 6e1bf93..0000000
--- a/api-tests/dev_apis/protected_storage/test_p016/test_p016.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * SPDX-License-Identifier : Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_P016_CLIENT_TESTS_H_
-#define _TEST_P016_CLIENT_TESTS_H_
-
-#define test_entry CONCAT(test_entry_, p016)
-#define val CONCAT(val, test_entry)
-#define psa CONCAT(psa, test_entry)
-
-extern val_api_t *val;
-extern psa_api_t *psa;
-extern client_test_t test_p016_sst_list[];
-
-int32_t psa_sst_optional_api_sst_capacity_check(caller_security_t caller);
-
-#endif /* _TEST_P016_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_p016/test_ps_data.h b/api-tests/dev_apis/protected_storage/test_p016/test_ps_data.h
deleted file mode 100644
index 7f16787..0000000
--- a/api-tests/dev_apis/protected_storage/test_p016/test_ps_data.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_P016_PS_DATA_TESTS_H_
-#define _TEST_P016_PS_DATA_TESTS_H_
-
-#include "val_protected_storage.h"
-
-#define SST_FUNCTION val->ps_function
-
-typedef struct {
- enum ps_function_code api;
- psa_status_t status;
-} test_data;
-
-static const test_data p016_data[] = {
-{
- VAL_PS_GET_SUPPORT, PSA_STORAGE_SUPPORT_SET_EXTENDED /* Index0 - Check if Optional API supported */
-},
-{
- VAL_PS_CREATE, PSA_SUCCESS /* Index1 - Storage creation */
-},
-{
- VAL_PS_CREATE, PSA_ERROR_ALREADY_EXISTS /* Index2 - Calling create API for existing UID should
- fail */
-},
-{
- VAL_PS_GET_INFO, PSA_SUCCESS /* Index3 - Check the storage attributes are unchanged */
-},
-{
- 0, 0 /* Unused Index4 */
-},
-{
- 0, 0 /* Unused Index5 */
-},
-{
- VAL_PS_SET, PSA_SUCCESS /* Index6 - Set API can change capacity of storage */
-},
-{
- VAL_PS_GET_INFO, PSA_SUCCESS /* Index7 - Check the storage attributes are changed */
-},
-{
- 0, 0 /* Unused Index8 */
-},
-{
- 0, 0 /* Unused Index9 */
-},
-{
- VAL_PS_SET_EXTENDED, PSA_ERROR_STORAGE_FAILURE /* Index10 - Set_extended on old capacity should
- not work */
-},
-{
- VAL_PS_REMOVE, PSA_SUCCESS /* Index11 - Remove the UID */
-},
-{
- VAL_PS_SET, PSA_SUCCESS /* Index12 - Storage creation */
-},
-{
- VAL_PS_CREATE, PSA_ERROR_ALREADY_EXISTS /* Index13 - Calling create API for existing UID should
- fail */
-},
-{
- VAL_PS_REMOVE, PSA_SUCCESS /* Index14 - Remove the UID */
-},
-};
-#endif /* _TEST_P016_PS_DATA_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_p017/test.cmake b/api-tests/dev_apis/protected_storage/test_p017/test.cmake
deleted file mode 100644
index cb1bda9..0000000
--- a/api-tests/dev_apis/protected_storage/test_p017/test.cmake
+++ /dev/null
@@ -1,24 +0,0 @@
-#/** @file
-# * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
-# * SPDX-License-Identifier : Apache-2.0
-# *
-# * Licensed under the Apache License, Version 2.0 (the "License");
-# * you may not use this file except in compliance with the License.
-# * You may obtain a copy of the License at
-# *
-# * http://www.apache.org/licenses/LICENSE-2.0
-# *
-# * Unless required by applicable law or agreed to in writing, software
-# * distributed under the License is distributed on an "AS IS" BASIS,
-# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# * See the License for the specific language governing permissions and
-# * limitations under the License.
-#**/
-
-list(APPEND CC_SOURCE
- test_entry_p017.c
- test_p017.c
-)
-list(APPEND CC_OPTIONS -DPS_TEST)
-list(APPEND AS_SOURCE )
-list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/protected_storage/test_p017/test_p017.c b/api-tests/dev_apis/protected_storage/test_p017/test_p017.c
deleted file mode 100644
index e1643c1..0000000
--- a/api-tests/dev_apis/protected_storage/test_p017/test_p017.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-
-#include "val_interfaces.h"
-#include "val_target.h"
-#include "test_p017.h"
-#include "test_ps_data.h"
-
-#define TEST_BUFF_SIZE_1 14
-#define TEST_BUFF_SIZE_2 10
-
-client_test_t test_p017_sst_list[] = {
- NULL,
- psa_sst_optional_api_partial_write_check,
- NULL,
-};
-
-static psa_storage_uid_t p_uid = UID_BASE_VALUE + 5;
-static uint8_t write_buff[TEST_BUFF_SIZE_1] = {0x03, 0x04, 0x05, 0x07, 0xFF, 0x00, 0x32, 0x67,
- 0x99, 0x78, 0x43, 0x20, 0xFF, 0x91};
-
-static int32_t psa_sst_optional_api_partial_write(void)
-{
- uint32_t status;
- struct psa_storage_info_t info;
-
- /* Try to create storage using create API */
- status = SST_FUNCTION(p017_data[1].api, p_uid, TEST_BUFF_SIZE_1, PSA_STORAGE_FLAG_NONE);
- TEST_ASSERT_EQUAL(status, p017_data[1].status, TEST_CHECKPOINT_NUM(1));
-
- /* Call set extended API to set data in first half */
- val->print(PRINT_TEST, "[Check 1] Set data in first half of storage\n", 0);
- status = SST_FUNCTION(p017_data[2].api, p_uid, 0, TEST_BUFF_SIZE_1/2, write_buff);
- TEST_ASSERT_EQUAL(status, p017_data[2].status, TEST_CHECKPOINT_NUM(2));
-
- /* Call set extended API to set data with gaps */
- val->print(PRINT_TEST, "[Check 2] Set data having gap with existing data \n", 0);
- status = SST_FUNCTION(p017_data[3].api, p_uid, (TEST_BUFF_SIZE_1/2) + 2, 2, write_buff);
- TEST_ASSERT_EQUAL(status, p017_data[3].status, TEST_CHECKPOINT_NUM(3));
-
- /* Call set extended API to overwrite and extend the existing data */
- val->print(PRINT_TEST, "[Check 3] Overwrite and extend existing data\n", 0);
- status = SST_FUNCTION(p017_data[4].api, p_uid, 0, TEST_BUFF_SIZE_2, write_buff);
- TEST_ASSERT_EQUAL(status, p017_data[4].status, TEST_CHECKPOINT_NUM(4));
-
- /* Check the attributes of existing storage */
- val->print(PRINT_TEST, "[Check 4] Check the storage attributes\n", 0);
- status = SST_FUNCTION(p017_data[5].api, p_uid, &info);
- TEST_ASSERT_EQUAL(status, p017_data[5].status, TEST_CHECKPOINT_NUM(5));
- TEST_ASSERT_EQUAL(info.size, TEST_BUFF_SIZE_2, TEST_CHECKPOINT_NUM(6));
- TEST_ASSERT_EQUAL(info.capacity, TEST_BUFF_SIZE_1, TEST_CHECKPOINT_NUM(7));
-
- /* Remove the storage */
- status = SST_FUNCTION(p017_data[8].api, p_uid);
- TEST_ASSERT_EQUAL(status, p017_data[8].status, TEST_CHECKPOINT_NUM(8));
-
- return VAL_STATUS_SUCCESS;
-}
-
-int32_t psa_sst_optional_api_partial_write_check(caller_security_t caller)
-{
- uint32_t status;
- int32_t test_status;
-
- /* Call the get_support API and check if create and set_extended API are supported */
- status = SST_FUNCTION(p017_data[0].api);
-
- if (status != p017_data[0].status)
- {
- val->print(PRINT_TEST, "Test Case skipped as Optional PS APIs not are supported.\n", 0);
- return RESULT_SKIP(VAL_STATUS_UNSUPPORTED);
- } else {
- val->print(PRINT_TEST, "Optional PS APIs are supported.\n", 0);
- test_status = psa_sst_optional_api_partial_write();
- if (test_status != VAL_STATUS_SUCCESS)
- {
- return test_status;
- }
- }
-
- return VAL_STATUS_SUCCESS;
-}
diff --git a/api-tests/dev_apis/protected_storage/test_p017/test_p017.h b/api-tests/dev_apis/protected_storage/test_p017/test_p017.h
deleted file mode 100644
index 61beae7..0000000
--- a/api-tests/dev_apis/protected_storage/test_p017/test_p017.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * SPDX-License-Identifier : Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_P017_CLIENT_TESTS_H_
-#define _TEST_P017_CLIENT_TESTS_H_
-
-#define test_entry CONCAT(test_entry_, p017)
-#define val CONCAT(val, test_entry)
-#define psa CONCAT(psa, test_entry)
-
-extern val_api_t *val;
-extern psa_api_t *psa;
-extern client_test_t test_p017_sst_list[];
-
-int32_t psa_sst_optional_api_partial_write_check(caller_security_t caller);
-
-#endif /* _TEST_P017_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_p017/test_ps_data.h b/api-tests/dev_apis/protected_storage/test_p017/test_ps_data.h
deleted file mode 100644
index 9677e90..0000000
--- a/api-tests/dev_apis/protected_storage/test_p017/test_ps_data.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/** @file
- * 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");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _TEST_P017_PS_DATA_TESTS_H_
-#define _TEST_P017_PS_DATA_TESTS_H_
-
-#include "val_protected_storage.h"
-
-#define SST_FUNCTION val->ps_function
-
-typedef struct {
- enum ps_function_code api;
- psa_status_t status;
-} test_data;
-
-static const test_data p017_data[] = {
-{
- VAL_PS_GET_SUPPORT, PSA_STORAGE_SUPPORT_SET_EXTENDED /* Index0 - Check if Optional API supported */
-},
-{
- VAL_PS_CREATE, PSA_SUCCESS /* Index1 - Storage creation */
-},
-{
- VAL_PS_SET_EXTENDED, PSA_SUCCESS /* Index2 - Write data in created storage */
-},
-{
- VAL_PS_SET_EXTENDED, PSA_ERROR_STORAGE_FAILURE /* Index3 - Try to set data in noncontinous
- manner */
-},
-{
- VAL_PS_SET_EXTENDED, PSA_SUCCESS /* Index4 - Overwrite the existing data */
-},
-{
- VAL_PS_GET_INFO, PSA_SUCCESS /* Index5 - Check for valid storage attributes */
-},
-{
- 0, 0 /* Unused Index6 */
-},
-{
- 0, 0 /* Unused Index7 */
-},
-{
- VAL_PS_REMOVE, PSA_SUCCESS /* Index8 - Remove the UID */
-},
-};
-#endif /* _TEST_P017_PS_DATA_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_s008/test.cmake b/api-tests/dev_apis/protected_storage/test_s008/test.cmake
deleted file mode 100644
index b91d92d..0000000
--- a/api-tests/dev_apis/protected_storage/test_s008/test.cmake
+++ /dev/null
@@ -1,24 +0,0 @@
-#/** @file
-# * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
-# * SPDX-License-Identifier : Apache-2.0
-# *
-# * Licensed under the Apache License, Version 2.0 (the "License");
-# * you may not use this file except in compliance with the License.
-# * You may obtain a copy of the License at
-# *
-# * http://www.apache.org/licenses/LICENSE-2.0
-# *
-# * Unless required by applicable law or agreed to in writing, software
-# * distributed under the License is distributed on an "AS IS" BASIS,
-# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# * See the License for the specific language governing permissions and
-# * limitations under the License.
-#**/
-
-list(APPEND CC_SOURCE
- test_entry_s008.c
- test_s008.c
-)
-list(APPEND CC_OPTIONS -DPS_TEST)
-list(APPEND AS_SOURCE )
-list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/protected_storage/test_s010/test.cmake b/api-tests/dev_apis/protected_storage/test_s010/test.cmake
deleted file mode 100644
index b36e23f..0000000
--- a/api-tests/dev_apis/protected_storage/test_s010/test.cmake
+++ /dev/null
@@ -1,24 +0,0 @@
-#/** @file
-# * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
-# * SPDX-License-Identifier : Apache-2.0
-# *
-# * Licensed under the Apache License, Version 2.0 (the "License");
-# * you may not use this file except in compliance with the License.
-# * You may obtain a copy of the License at
-# *
-# * http://www.apache.org/licenses/LICENSE-2.0
-# *
-# * Unless required by applicable law or agreed to in writing, software
-# * distributed under the License is distributed on an "AS IS" BASIS,
-# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# * See the License for the specific language governing permissions and
-# * limitations under the License.
-#**/
-
-list(APPEND CC_SOURCE
- test_entry_s010.c
- test_s010.c
-)
-list(APPEND CC_OPTIONS -DPS_TEST)
-list(APPEND AS_SOURCE )
-list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/protected_storage/testsuite.db b/api-tests/dev_apis/protected_storage/testsuite.db
deleted file mode 100644
index 2e95c62..0000000
--- a/api-tests/dev_apis/protected_storage/testsuite.db
+++ /dev/null
@@ -1,41 +0,0 @@
-#/** @file
-# * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
-# * SPDX-License-Identifier : Apache-2.0
-# *
-# * Licensed under the Apache License, Version 2.0 (the "License");
-# * you may not use this file except in compliance with the License.
-# * You may obtain a copy of the License at
-# *
-# * http://www.apache.org/licenses/LICENSE-2.0
-# *
-# * Unless required by applicable law or agreed to in writing, software
-# * distributed under the License is distributed on an "AS IS" BASIS,
-# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# * See the License for the specific language governing permissions and
-# * limitations under the License.
-#**/
-
-
-#List of tests to be compiled and run as part of protected storage suite
-
-(START)
-
-test_s001
-test_s002
-test_s003
-test_s004
-test_s005
-test_s006
-test_s007
-test_s008
-test_s009
-test_s010
-test_p011
-test_p012
-test_p013
-test_p014
-test_p015
-test_p016
-test_p017
-
-(END)
diff --git a/api-tests/dev_apis/internal_trusted_storage/testsuite.db b/api-tests/dev_apis/storage/its_testsuite.db
similarity index 90%
rename from api-tests/dev_apis/internal_trusted_storage/testsuite.db
rename to api-tests/dev_apis/storage/its_testsuite.db
index d516619..8b5c5b6 100644
--- a/api-tests/dev_apis/internal_trusted_storage/testsuite.db
+++ b/api-tests/dev_apis/storage/its_testsuite.db
@@ -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");
diff --git a/api-tests/dev_apis/internal_trusted_storage/testsuite.db b/api-tests/dev_apis/storage/ps_testsuite.db
similarity index 85%
copy from api-tests/dev_apis/internal_trusted_storage/testsuite.db
copy to api-tests/dev_apis/storage/ps_testsuite.db
index d516619..6af00b5 100644
--- a/api-tests/dev_apis/internal_trusted_storage/testsuite.db
+++ b/api-tests/dev_apis/storage/ps_testsuite.db
@@ -1,5 +1,5 @@
#/** @file
-# * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
+# * Copyright (c) 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");
@@ -30,5 +30,12 @@
test_s008
test_s009
test_s010
+test_s011
+test_s012
+test_s013
+test_s014
+test_s015
+test_s016
+test_s017
(END)
diff --git a/api-tests/dev_apis/internal_trusted_storage/suite.cmake b/api-tests/dev_apis/storage/suite.cmake
similarity index 84%
rename from api-tests/dev_apis/internal_trusted_storage/suite.cmake
rename to api-tests/dev_apis/storage/suite.cmake
index e4de40c..2d3d9a5 100644
--- a/api-tests/dev_apis/internal_trusted_storage/suite.cmake
+++ b/api-tests/dev_apis/storage/suite.cmake
@@ -1,5 +1,5 @@
#/** @file
-# * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
+# * Copyright (c) 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");
@@ -43,15 +43,15 @@
# PSA Include directories
foreach(psa_inc_path ${PSA_INCLUDE_PATHS})
target_include_directories(${PSA_TARGET_TEST_COMBINE_LIB} PRIVATE
- ${psa_inc_path}
- )
+ ${psa_inc_path})
endforeach()
target_include_directories(${PSA_TARGET_TEST_COMBINE_LIB} PRIVATE
+ ${PSA_SUITE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${PSA_ROOT_DIR}/val/common
${PSA_ROOT_DIR}/val/nspe
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/common
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/crypto
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/internal_trusted_storage
+ ${PSA_ROOT_DIR}/platform/targets/common/nspe
+ ${PSA_ROOT_DIR}/platform/targets/common/nspe/crypto
+ ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe
)
diff --git a/api-tests/dev_apis/protected_storage/test_s001/test.cmake b/api-tests/dev_apis/storage/test_s001/test.cmake
similarity index 86%
rename from api-tests/dev_apis/protected_storage/test_s001/test.cmake
rename to api-tests/dev_apis/storage/test_s001/test.cmake
index ee15ef4..d0dd06a 100644
--- a/api-tests/dev_apis/protected_storage/test_s001/test.cmake
+++ b/api-tests/dev_apis/storage/test_s001/test.cmake
@@ -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");
@@ -19,6 +19,6 @@
test_entry_s001.c
test_s001.c
)
-list(APPEND CC_OPTIONS -DPS_TEST)
+list(APPEND CC_OPTIONS )
list(APPEND AS_SOURCE )
list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/storage/test_s001/test_data.h b/api-tests/dev_apis/storage/test_s001/test_data.h
new file mode 100644
index 0000000..ce40cec
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s001/test_data.h
@@ -0,0 +1,88 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+#ifndef _S001_TEST_DATA_H_
+#define _S001_TEST_DATA_H_
+
+#include "test_s001.h"
+
+static const test_data_t s001_data[] = {
+{
+ VAL_TEST_IDX0, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Call the get API when no UID is set */
+ VAL_TEST_IDX1, {VAL_ITS_GET, VAL_PS_GET}, PSA_ERROR_DOES_NOT_EXIST
+},
+{
+ /* Call the get_info API when no UID is set */
+ VAL_TEST_IDX2, {VAL_ITS_GET_INFO, VAL_PS_GET_INFO}, PSA_ERROR_DOES_NOT_EXIST
+},
+{
+ /* Call the remove API when no UID is set */
+ VAL_TEST_IDX3, {VAL_ITS_REMOVE, VAL_PS_REMOVE}, PSA_ERROR_DOES_NOT_EXIST
+},
+{
+ /* Create a valid storage entity with UID1 */
+ VAL_TEST_IDX4, {VAL_ITS_SET, VAL_PS_SET}, PSA_SUCCESS
+},
+{
+ /* Create a valid storage entity with UID2 */
+ VAL_TEST_IDX5, {VAL_ITS_SET, VAL_PS_SET}, PSA_SUCCESS
+},
+{
+ /* Remove UID1 */
+ VAL_TEST_IDX6, {VAL_ITS_REMOVE, VAL_PS_REMOVE}, PSA_SUCCESS
+},
+{
+ /* Call get API for UID1 */
+ VAL_TEST_IDX7, {VAL_ITS_GET, VAL_PS_GET}, PSA_ERROR_DOES_NOT_EXIST
+},
+{
+ /* Call get_info API for UID1 */
+ VAL_TEST_IDX8, {VAL_ITS_GET_INFO, VAL_PS_GET_INFO}, PSA_ERROR_DOES_NOT_EXIST
+},
+{
+ /* Call remove API for UID1 */
+ VAL_TEST_IDX9, {VAL_ITS_REMOVE, VAL_PS_REMOVE}, PSA_ERROR_DOES_NOT_EXIST
+},
+{
+ /* Create a valid storage entity again with UID1 */
+ VAL_TEST_IDX10, {VAL_ITS_SET, VAL_PS_SET}, PSA_SUCCESS
+},
+{
+ /* Call get API for UID not same as UID1 or UID2 */
+ VAL_TEST_IDX11, {VAL_ITS_GET, VAL_PS_GET}, PSA_ERROR_DOES_NOT_EXIST
+},
+{
+ /* Call get_info for UID not same as UID1 or UID2 */
+ VAL_TEST_IDX12, {VAL_ITS_GET_INFO, VAL_PS_GET_INFO}, PSA_ERROR_DOES_NOT_EXIST
+},
+{
+ /* Call remove API for UID not same as UID1 or UID2 */
+ VAL_TEST_IDX13, {VAL_ITS_REMOVE, VAL_PS_REMOVE}, PSA_ERROR_DOES_NOT_EXIST
+},
+{
+ /* Remove UID1 */
+ VAL_TEST_IDX14, {VAL_ITS_REMOVE, VAL_PS_REMOVE}, PSA_SUCCESS
+},
+{
+ /* Remove UID2 */
+ VAL_TEST_IDX15, {VAL_ITS_REMOVE, VAL_PS_REMOVE}, PSA_SUCCESS
+},
+};
+#endif /* _S001_TEST_DATA_H_ */
+
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s001/test_entry_s001.c b/api-tests/dev_apis/storage/test_s001/test_entry_s001.c
similarity index 89%
rename from api-tests/dev_apis/internal_trusted_storage/test_s001/test_entry_s001.c
rename to api-tests/dev_apis/storage/test_s001/test_entry_s001.c
index 8b8aed9..b7dd733 100644
--- a/api-tests/dev_apis/internal_trusted_storage/test_s001/test_entry_s001.c
+++ b/api-tests/dev_apis/storage/test_s001/test_entry_s001.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");
@@ -41,7 +41,7 @@
}
/* Execute list of tests available in test[num]_secure_storage_list from Non-secure side*/
- status = val->execute_non_secure_tests(TEST_NUM, test_s001_sst_list, FALSE);
+ status = val->execute_non_secure_tests(TEST_NUM, s001_storage_test_list, FALSE);
if (VAL_ERROR(status))
{
diff --git a/api-tests/dev_apis/storage/test_s001/test_s001.c b/api-tests/dev_apis/storage/test_s001/test_s001.c
new file mode 100644
index 0000000..e20a212
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s001/test_s001.c
@@ -0,0 +1,199 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+
+#include "val_interfaces.h"
+#include "val_target.h"
+#include "test_s001.h"
+#include "test_data.h"
+
+#define TEST_BUFF_SIZE 16
+
+static struct psa_storage_info_t info;
+static uint8_t write_buff[TEST_BUFF_SIZE] = {0x00, 0x01, 0x02, 0x03,
+ 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0A, 0x0B,
+ 0x0C, 0x0D, 0x0E, 0x0F};
+static uint8_t read_buff[TEST_BUFF_SIZE] = {0};
+const client_test_t s001_storage_test_list[] = {
+ NULL,
+ s001_storage_test,
+ NULL,
+};
+
+static int32_t sst_calls_without_set_call(storage_function_code_t fCode, psa_storage_uid_t p_uid)
+{
+ int32_t status;
+ uint32_t p_data_length = 0;
+
+ /* get() without using set() before */
+ val->print(PRINT_TEST, "[Check 1] Call get API for UID %d which is not set\n", p_uid);
+ status = STORAGE_FUNCTION(s001_data[VAL_TEST_IDX1].api[fCode], p_uid, 0, TEST_BUFF_SIZE,
+ read_buff, &p_data_length);
+ TEST_ASSERT_EQUAL(status, s001_data[VAL_TEST_IDX1].status, TEST_CHECKPOINT_NUM(1));
+
+ /* get_info() without using set() before */
+ val->print(PRINT_TEST, "[Check 2] Call get_info API for UID %d which is not set\n", p_uid);
+ status = STORAGE_FUNCTION(s001_data[VAL_TEST_IDX2].api[fCode], p_uid, &info);
+ TEST_ASSERT_EQUAL(status, s001_data[VAL_TEST_IDX2].status, TEST_CHECKPOINT_NUM(2));
+
+ /* remove() without using set() before */
+ val->print(PRINT_TEST, "[Check 3] Call remove API for UID %d which is not set\n", p_uid);
+ status = STORAGE_FUNCTION(s001_data[VAL_TEST_IDX3].api[fCode], p_uid);
+ TEST_ASSERT_EQUAL(status, s001_data[VAL_TEST_IDX3].status, TEST_CHECKPOINT_NUM(3));
+
+ return VAL_STATUS_SUCCESS;
+}
+
+static int32_t sst_set_and_remove(storage_function_code_t fCode, psa_storage_uid_t p_uid)
+{
+ int32_t status;
+
+ /* set() a UID1 */
+ status = STORAGE_FUNCTION(s001_data[VAL_TEST_IDX4].api[fCode], p_uid, TEST_BUFF_SIZE,
+ write_buff, PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s001_data[VAL_TEST_IDX4].status, TEST_CHECKPOINT_NUM(4));
+
+ /* Also set() with a different UID */
+ status = STORAGE_FUNCTION(s001_data[VAL_TEST_IDX5].api[fCode], p_uid + 1, TEST_BUFF_SIZE,
+ write_buff, PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s001_data[VAL_TEST_IDX5].status, TEST_CHECKPOINT_NUM(5));
+
+ /* remove() UID1 */
+ status = STORAGE_FUNCTION(s001_data[VAL_TEST_IDX6].api[fCode], p_uid);
+ TEST_ASSERT_EQUAL(status, s001_data[VAL_TEST_IDX6].status, TEST_CHECKPOINT_NUM(6));
+
+ return VAL_STATUS_SUCCESS;
+}
+
+static int32_t sst_calls_after_uid_remove(storage_function_code_t fCode, psa_storage_uid_t p_uid)
+{
+ int32_t status;
+ uint32_t p_data_length = 0;
+
+ /* get() for UID which is removed */
+ val->print(PRINT_TEST, "[Check 4] Call get API for UID %d which is removed\n", p_uid);
+ status = STORAGE_FUNCTION(s001_data[VAL_TEST_IDX7].api[fCode], p_uid, 0, TEST_BUFF_SIZE,
+ read_buff, &p_data_length);
+ TEST_ASSERT_EQUAL(status, s001_data[VAL_TEST_IDX7].status, TEST_CHECKPOINT_NUM(7));
+
+ /* get_info() for UID which is removed */
+ val->print(PRINT_TEST, "[Check 5] Call get_info API for UID %d which is removed\n", p_uid);
+ status = STORAGE_FUNCTION(s001_data[VAL_TEST_IDX8].api[fCode], p_uid, &info);
+ TEST_ASSERT_EQUAL(status, s001_data[VAL_TEST_IDX8].status, TEST_CHECKPOINT_NUM(8));
+
+ /* remove() for UID which is removed */
+ val->print(PRINT_TEST, "[Check 6] Call remove API for UID %d which is removed\n", p_uid);
+ status = STORAGE_FUNCTION(s001_data[VAL_TEST_IDX9].api[fCode], p_uid);
+ TEST_ASSERT_EQUAL(status, s001_data[VAL_TEST_IDX9].status, TEST_CHECKPOINT_NUM(9));
+
+ return VAL_STATUS_SUCCESS;
+}
+
+static int32_t sst_calls_with_different_uid(storage_function_code_t fCode, psa_storage_uid_t p_uid)
+{
+ int32_t status;
+ uint32_t p_data_length = 0;
+
+ /* set() a UID */
+ val->print(PRINT_TEST, "Set storage for UID %d\n", p_uid);
+ status = STORAGE_FUNCTION(s001_data[VAL_TEST_IDX10].api[fCode], p_uid, TEST_BUFF_SIZE,
+ write_buff, PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s001_data[VAL_TEST_IDX10].status, TEST_CHECKPOINT_NUM(10));
+
+ /* get() for different UID then set UID */
+ val->print(PRINT_TEST, "[Check 7] Call get API for different UID %d\n", p_uid-1);
+ status = STORAGE_FUNCTION(s001_data[VAL_TEST_IDX11].api[fCode], p_uid-1, 0, TEST_BUFF_SIZE - 1,
+ read_buff, &p_data_length);
+ TEST_ASSERT_EQUAL(status, s001_data[VAL_TEST_IDX11].status, TEST_CHECKPOINT_NUM(11));
+
+ /* get_info() for different UID then set UID */
+ val->print(PRINT_TEST, "[Check 8] Call get_info API for different UID %d\n", p_uid-1);
+ status = STORAGE_FUNCTION(s001_data[VAL_TEST_IDX12].api[fCode], p_uid-1, &info);
+ TEST_ASSERT_EQUAL(status, s001_data[VAL_TEST_IDX12].status, TEST_CHECKPOINT_NUM(12));
+
+ /* remove() for different UID then set UID */
+ val->print(PRINT_TEST, "[Check 9] Call remove API for different UID %d\n", p_uid-1);
+ status = STORAGE_FUNCTION(s001_data[VAL_TEST_IDX13].api[fCode], p_uid-1);
+ TEST_ASSERT_EQUAL(status, s001_data[VAL_TEST_IDX13].status, TEST_CHECKPOINT_NUM(13));
+
+ /* remove() the set UID */
+ status = STORAGE_FUNCTION(s001_data[VAL_TEST_IDX14].api[fCode], p_uid);
+ TEST_ASSERT_EQUAL(status, s001_data[VAL_TEST_IDX14].status, TEST_CHECKPOINT_NUM(14));
+
+ return VAL_STATUS_SUCCESS;
+}
+
+static int32_t sst_remove_stray_uid(storage_function_code_t fCode, psa_storage_uid_t p_uid)
+{
+ int32_t status;
+
+ /* Remove UID + 1 */
+ status = STORAGE_FUNCTION(s001_data[VAL_TEST_IDX15].api[fCode], p_uid);
+ TEST_ASSERT_EQUAL(status, s001_data[VAL_TEST_IDX15].status, TEST_CHECKPOINT_NUM(15));
+ return VAL_STATUS_SUCCESS;
+}
+
+int32_t psa_sst_uid_not_found(storage_function_code_t fCode)
+{
+ int32_t test_status;
+ psa_storage_uid_t uid = UID_BASE_VALUE + 6;
+
+ test_status = sst_calls_without_set_call(fCode, uid);
+ if (test_status != VAL_STATUS_SUCCESS)
+ return test_status;
+
+ test_status = sst_set_and_remove(fCode, uid);
+ if (test_status != VAL_STATUS_SUCCESS)
+ return test_status;
+
+ test_status = sst_calls_after_uid_remove(fCode, uid);
+ if (test_status != VAL_STATUS_SUCCESS)
+ return test_status;
+
+ test_status = sst_calls_with_different_uid(fCode, uid);
+ if (test_status != VAL_STATUS_SUCCESS)
+ return test_status;
+
+ test_status = sst_remove_stray_uid(fCode, (uid + 1));
+ if (test_status != VAL_STATUS_SUCCESS)
+ return test_status;
+
+ return VAL_STATUS_SUCCESS;
+}
+
+int32_t s001_storage_test(caller_security_t caller)
+{
+ int32_t status;
+
+#if defined(STORAGE) || defined(INTERNAL_TRUSTED_STORAGE)
+ val->print(PRINT_TEST, ITS_TEST_MESSAGE, 0);
+ status = psa_sst_uid_not_found(VAL_ITS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+#endif
+
+#if defined(STORAGE) || defined(PROTECTED_STORAGE)
+ val->print(PRINT_TEST, PS_TEST_MESSAGE, 0);
+ status = psa_sst_uid_not_found(VAL_PS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+#endif
+
+ return VAL_STATUS_SUCCESS;
+}
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s001/test_s001.h b/api-tests/dev_apis/storage/test_s001/test_s001.h
similarity index 61%
rename from api-tests/dev_apis/internal_trusted_storage/test_s001/test_s001.h
rename to api-tests/dev_apis/storage/test_s001/test_s001.h
index eef582a..2c16a71 100644
--- a/api-tests/dev_apis/internal_trusted_storage/test_s001/test_s001.h
+++ b/api-tests/dev_apis/storage/test_s001/test_s001.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");
@@ -17,19 +17,12 @@
#ifndef _TEST_S001_CLIENT_TESTS_H_
#define _TEST_S001_CLIENT_TESTS_H_
-#ifdef ITS_TEST
-#define VAL_STORAGE_BASE VAL_INTERNAL_TRUSTED_STORAGE_BASE
#define test_entry CONCAT(test_entry_, s001)
-#elif PS_TEST
-#define VAL_STORAGE_BASE VAL_PROTECTED_STORAGE_BASE
-#define test_entry CONCAT(test_entry_, p001)
-#endif
-#define val CONCAT(val, test_entry)
-#define psa CONCAT(psa, test_entry)
-extern val_api_t *val;
-extern psa_api_t *psa;
-extern client_test_t test_s001_sst_list[];
+#include "test_storage_common.h"
-int32_t psa_sst_uid_not_found(caller_security_t caller);
+extern const client_test_t s001_storage_test_list[];
+
+int32_t s001_storage_test(caller_security_t caller);
+
#endif /* _TEST_S001_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_s002/test.cmake b/api-tests/dev_apis/storage/test_s002/test.cmake
similarity index 86%
rename from api-tests/dev_apis/protected_storage/test_s002/test.cmake
rename to api-tests/dev_apis/storage/test_s002/test.cmake
index c588caa..cf21898 100644
--- a/api-tests/dev_apis/protected_storage/test_s002/test.cmake
+++ b/api-tests/dev_apis/storage/test_s002/test.cmake
@@ -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");
@@ -19,6 +19,6 @@
test_entry_s002.c
test_s002.c
)
-list(APPEND CC_OPTIONS -DPS_TEST)
+list(APPEND CC_OPTIONS )
list(APPEND AS_SOURCE )
list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/storage/test_s002/test_data.h b/api-tests/dev_apis/storage/test_s002/test_data.h
new file mode 100644
index 0000000..fe9fe57
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s002/test_data.h
@@ -0,0 +1,137 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+#ifndef _S002_TEST_DATA_H_
+#define _S002_TEST_DATA_H_
+
+#include "test_s002.h"
+
+static struct psa_storage_info_t orig_info;
+static struct psa_storage_info_t new_info;
+static const test_data_t s002_data[] = {
+{
+ VAL_TEST_IDX0, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Create a valid storage with create flag value 0 */
+ VAL_TEST_IDX1, {VAL_ITS_SET, VAL_PS_SET}, PSA_SUCCESS
+},
+{
+ /* Call the get_info API to validate the attributes */
+ VAL_TEST_IDX2, {VAL_ITS_GET_INFO, VAL_PS_GET_INFO}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX3, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ VAL_TEST_IDX4, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Validate the data using get API */
+ VAL_TEST_IDX5, {VAL_ITS_GET, VAL_PS_GET}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX6, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Change the flag to WRITE_ONCE using set API */
+ VAL_TEST_IDX7, {VAL_ITS_SET, VAL_PS_SET}, PSA_SUCCESS
+},
+{
+ /* Call the get_info API to validate the flag change */
+ VAL_TEST_IDX8, {VAL_ITS_GET_INFO, VAL_PS_GET_INFO}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX9, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ VAL_TEST_IDX10, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Validate the data using get API after flag change */
+ VAL_TEST_IDX11, {VAL_ITS_GET, VAL_PS_GET}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX12, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Storage should not be removed after WRITE_ONCE flag */
+ VAL_TEST_IDX13, {VAL_ITS_REMOVE, VAL_PS_REMOVE}, PSA_ERROR_NOT_PERMITTED
+},
+{
+ /* Create a storage with different UID and flag value WRITE_ONCE */
+ VAL_TEST_IDX14, {VAL_ITS_SET, VAL_PS_SET}, PSA_SUCCESS
+},
+{
+ /* Storage should not be removed */
+ VAL_TEST_IDX15, {VAL_ITS_REMOVE, VAL_PS_REMOVE}, PSA_ERROR_NOT_PERMITTED
+},
+{
+ /* Validate the data using get API after flag change */
+ VAL_TEST_IDX16, {VAL_ITS_GET, VAL_PS_GET}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX17, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Call the get_info API to validate the flag change */
+ VAL_TEST_IDX18, {VAL_ITS_GET_INFO, VAL_PS_GET_INFO}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX19, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ VAL_TEST_IDX20, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Try to set different size for same UID and flag value */
+ VAL_TEST_IDX21, {VAL_ITS_SET, VAL_PS_SET}, PSA_ERROR_NOT_PERMITTED
+},
+{
+ /* Storage should not be removed */
+ VAL_TEST_IDX22, {VAL_ITS_REMOVE, VAL_PS_REMOVE}, PSA_ERROR_NOT_PERMITTED
+},
+{
+ /* Call the get_info API to validate the flag change */
+ VAL_TEST_IDX23, {VAL_ITS_GET_INFO, VAL_PS_GET_INFO}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX24, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ VAL_TEST_IDX25, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Validate the data using get API after flag change */
+ VAL_TEST_IDX26, {VAL_ITS_GET, VAL_PS_GET}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX27, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Setting flag to zero for UID should fail */
+ VAL_TEST_IDX28, {VAL_ITS_SET, VAL_PS_SET}, PSA_ERROR_NOT_PERMITTED
+},
+{
+ /* Storage should not be removed */
+ VAL_TEST_IDX29, {VAL_ITS_REMOVE, VAL_PS_REMOVE}, PSA_ERROR_NOT_PERMITTED
+},
+{
+ /* Check that the WRITE_ONCE flag is preserved */
+ VAL_TEST_IDX30, {VAL_ITS_GET_INFO, VAL_PS_GET_INFO}, PSA_SUCCESS
+},
+};
+#endif /* _S002_TEST_DATA_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s002/test_entry_s002.c b/api-tests/dev_apis/storage/test_s002/test_entry_s002.c
similarity index 89%
rename from api-tests/dev_apis/internal_trusted_storage/test_s002/test_entry_s002.c
rename to api-tests/dev_apis/storage/test_s002/test_entry_s002.c
index 538a41f..43a3552 100755
--- a/api-tests/dev_apis/internal_trusted_storage/test_s002/test_entry_s002.c
+++ b/api-tests/dev_apis/storage/test_s002/test_entry_s002.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");
@@ -41,7 +41,7 @@
}
/* Execute list of tests available in test[num]_secure_storage_list from Non-secure side*/
- status = val->execute_non_secure_tests(TEST_NUM, test_s002_sst_list, FALSE);
+ status = val->execute_non_secure_tests(TEST_NUM, s002_storage_test_list, FALSE);
if (VAL_ERROR(status))
{
diff --git a/api-tests/dev_apis/storage/test_s002/test_s002.c b/api-tests/dev_apis/storage/test_s002/test_s002.c
new file mode 100644
index 0000000..2e4b2e7
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s002/test_s002.c
@@ -0,0 +1,205 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+
+#include "val_interfaces.h"
+#include "val_target.h"
+#include "test_s002.h"
+#include "test_data.h"
+
+#define UID_WRITE_ONCE_1 UID_BASE_VALUE + 1
+#define UID_WRITE_ONCE_2 UID_BASE_VALUE + 2
+#define TEST_BUFF_SIZE 16
+
+const client_test_t s002_storage_test_list[] = {
+ NULL,
+ s002_storage_test,
+ NULL,
+};
+
+static int32_t psa_sst_update_write_once_flag_after_create(storage_function_code_t fCode)
+{
+ int32_t status;
+ uint32_t p_data_length = 0;
+ psa_storage_uid_t uid = UID_WRITE_ONCE_1;
+ uint8_t write_buff[TEST_BUFF_SIZE/2] = {0xDE, 0xAD, 0xBE, 0xEF,
+ 0xCA, 0xFE, 0xBA, 0xBE};
+ uint8_t read_buff[TEST_BUFF_SIZE/2] = {0};
+ uint8_t write_buff_new[TEST_BUFF_SIZE/4] = {0xFF, 0xFF, 0xFF, 0xFF};
+
+ /* set() data without a WRITE_ONCE flag */
+ status = STORAGE_FUNCTION(s002_data[VAL_TEST_IDX1].api[fCode], uid, TEST_BUFF_SIZE/2,
+ write_buff, PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s002_data[VAL_TEST_IDX1].status, TEST_CHECKPOINT_NUM(1));
+
+ /* Check that get_info() returns correct attributes; also store for reference for later */
+ status = STORAGE_FUNCTION(s002_data[VAL_TEST_IDX2].api[fCode], uid, &orig_info);
+ TEST_ASSERT_EQUAL(status, s002_data[VAL_TEST_IDX2].status, TEST_CHECKPOINT_NUM(2));
+ TEST_ASSERT_EQUAL(orig_info.size, TEST_BUFF_SIZE/2, TEST_CHECKPOINT_NUM(3));
+ TEST_ASSERT_EQUAL(orig_info.flags, PSA_STORAGE_FLAG_NONE, TEST_CHECKPOINT_NUM(4));
+
+ /* Check for data consistency using get() */
+ status = STORAGE_FUNCTION(s002_data[VAL_TEST_IDX5].api[fCode], uid, 0, TEST_BUFF_SIZE/2,
+ read_buff, &p_data_length);
+ TEST_ASSERT_EQUAL(status, s002_data[VAL_TEST_IDX5].status, TEST_CHECKPOINT_NUM(5));
+ TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE/2, TEST_CHECKPOINT_NUM(6));
+ TEST_ASSERT_MEMCMP(write_buff, read_buff, TEST_BUFF_SIZE/2, TEST_CHECKPOINT_NUM(7));
+
+ /* set() with WRITE_ONCE_FLAG */
+ val->print(PRINT_TEST, "[Check 1] Update the flag of UID %d with WRITE_ONCE flag\n", uid);
+ status = STORAGE_FUNCTION(s002_data[VAL_TEST_IDX7].api[fCode], uid, TEST_BUFF_SIZE/4,
+ write_buff_new, PSA_STORAGE_FLAG_WRITE_ONCE);
+ TEST_ASSERT_EQUAL(status, s002_data[VAL_TEST_IDX7].status, TEST_CHECKPOINT_NUM(8));
+
+ /* Check that info is updated, after new set */
+ status = STORAGE_FUNCTION(s002_data[VAL_TEST_IDX8].api[fCode], uid, &new_info);
+ TEST_ASSERT_EQUAL(status, s002_data[VAL_TEST_IDX8].status, TEST_CHECKPOINT_NUM(9));
+ TEST_ASSERT_EQUAL(new_info.size, TEST_BUFF_SIZE/4, TEST_CHECKPOINT_NUM(10));
+ TEST_ASSERT_EQUAL(new_info.flags, PSA_STORAGE_FLAG_WRITE_ONCE, TEST_CHECKPOINT_NUM(11));
+
+ /* Check that data contents are preserved which were written with WRITE_ONCE_FLAG originally */
+ status = STORAGE_FUNCTION(s002_data[VAL_TEST_IDX11].api[fCode], uid, 0, TEST_BUFF_SIZE/4,
+ read_buff, &p_data_length);
+ TEST_ASSERT_EQUAL(status, s002_data[VAL_TEST_IDX11].status, TEST_CHECKPOINT_NUM(12));
+ TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE/4, TEST_CHECKPOINT_NUM(13));
+ TEST_ASSERT_MEMCMP(write_buff_new, read_buff, TEST_BUFF_SIZE/4, TEST_CHECKPOINT_NUM(14));
+
+ /* remove() the UID */
+ val->print(PRINT_TEST, "[Check 2] Try to remove the UID %d having WRITE_ONCE flag\n", uid);
+ status = STORAGE_FUNCTION(s002_data[VAL_TEST_IDX13].api[fCode], uid);
+ TEST_ASSERT_EQUAL(status, s002_data[VAL_TEST_IDX13].status, TEST_CHECKPOINT_NUM(15));
+
+ return VAL_STATUS_SUCCESS;
+}
+
+
+static int32_t psa_sst_create_with_write_once_flag(storage_function_code_t fCode)
+{
+ int32_t status;
+ uint32_t p_data_length = 0;
+ psa_storage_uid_t uid = UID_WRITE_ONCE_2;
+ uint8_t write_buff[TEST_BUFF_SIZE] = {0x00, 0x01, 0x02, 0x03,
+ 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0A, 0x0B,
+ 0x0C, 0x0D, 0x0E, 0x0F};
+ uint8_t read_buff[TEST_BUFF_SIZE] = {0};
+ uint8_t write_buff_new[TEST_BUFF_SIZE + 1] = {0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+
+ /* Set data for a UID using WRITE_ONCE flag */
+ val->print(PRINT_TEST, "[Check 3] Create a new UID %d with WRITE_ONCE flag\n", uid);
+ status = STORAGE_FUNCTION(s002_data[VAL_TEST_IDX14].api[fCode], uid, TEST_BUFF_SIZE, write_buff,
+ PSA_STORAGE_FLAG_WRITE_ONCE);
+ TEST_ASSERT_EQUAL(status, s002_data[VAL_TEST_IDX14].status, TEST_CHECKPOINT_NUM(16));
+
+ /* Check that remove() fails with PSA_SST_ERROR_WRITE_ONCE */
+ val->print(PRINT_TEST, "[Check 4] Try to remove the UID %d having WRITE_ONCE flag\n", uid);
+ status = STORAGE_FUNCTION(s002_data[VAL_TEST_IDX15].api[fCode], uid);
+ TEST_ASSERT_EQUAL(status, s002_data[VAL_TEST_IDX15].status, TEST_CHECKPOINT_NUM(17));
+
+ /* Check data consistency using get()*/
+ status = STORAGE_FUNCTION(s002_data[VAL_TEST_IDX16].api[fCode], uid, 0, TEST_BUFF_SIZE,
+ read_buff, &p_data_length);
+ TEST_ASSERT_EQUAL(status, s002_data[VAL_TEST_IDX16].status, TEST_CHECKPOINT_NUM(18));
+ TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(19));
+ TEST_ASSERT_MEMCMP(write_buff, read_buff, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(20));
+
+ /* Check that info values is as expected */
+ status = STORAGE_FUNCTION(s002_data[VAL_TEST_IDX18].api[fCode], uid, &orig_info);
+ TEST_ASSERT_EQUAL(status, s002_data[VAL_TEST_IDX18].status, TEST_CHECKPOINT_NUM(21));
+ TEST_ASSERT_EQUAL(orig_info.size, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(22));
+ TEST_ASSERT_EQUAL(orig_info.flags, PSA_STORAGE_FLAG_WRITE_ONCE, TEST_CHECKPOINT_NUM(23));
+
+ /* Try to overwrite using set() with same UID as used before with WRITE_ONCE_FLAG */
+ val->print(PRINT_TEST, "[Check 5] Try to change the length of write_once UID %d\n", uid);
+ status = STORAGE_FUNCTION(s002_data[VAL_TEST_IDX21].api[fCode], uid, (TEST_BUFF_SIZE + 1),
+ write_buff_new, PSA_STORAGE_FLAG_WRITE_ONCE);
+ TEST_ASSERT_EQUAL(status, s002_data[VAL_TEST_IDX21].status, TEST_CHECKPOINT_NUM(24));
+
+ /* Check that remove() still fails with PSA_SST_ERROR_WRITE_ONCE */
+ val->print(PRINT_TEST, "[Check 6] Check UID removal still fails\n", 0);
+ status = STORAGE_FUNCTION(s002_data[VAL_TEST_IDX22].api[fCode], uid);
+ TEST_ASSERT_EQUAL(status, s002_data[VAL_TEST_IDX22].status, TEST_CHECKPOINT_NUM(25));
+
+ /* Check that info is preserved */
+ status = STORAGE_FUNCTION(s002_data[VAL_TEST_IDX23].api[fCode], uid, &new_info);
+ TEST_ASSERT_EQUAL(status, s002_data[VAL_TEST_IDX23].status, TEST_CHECKPOINT_NUM(26));
+ TEST_ASSERT_EQUAL(new_info.size, orig_info.size, TEST_CHECKPOINT_NUM(27));
+ TEST_ASSERT_EQUAL(new_info.flags, orig_info.flags, TEST_CHECKPOINT_NUM(28));
+
+ /* Check that data contents are preserved which were written with WRITE_ONCE_FLAG originally */
+ status = STORAGE_FUNCTION(s002_data[VAL_TEST_IDX26].api[fCode], uid, 0, TEST_BUFF_SIZE,
+ read_buff, &p_data_length);
+ TEST_ASSERT_EQUAL(status, s002_data[VAL_TEST_IDX26].status, TEST_CHECKPOINT_NUM(29));
+ TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(30));
+ TEST_ASSERT_MEMCMP(write_buff, read_buff, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(31));
+
+ /* Try to overwrite using set() with same UID as used before without WRITE_ONCE_FLAG */
+ val->print(PRINT_TEST, "[Check 7] Try to change the WRITE_ONCE flag to None for UID %d\n", uid);
+ new_info.size = 0;
+ new_info.flags = 0;
+ status = STORAGE_FUNCTION(s002_data[VAL_TEST_IDX28].api[fCode], uid, (TEST_BUFF_SIZE - 1),
+ write_buff_new, PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s002_data[VAL_TEST_IDX28].status, TEST_CHECKPOINT_NUM(32));
+
+ /* Check that remove() still fails with PSA_SST_ERROR_WRITE_ONCE */
+ val->print(PRINT_TEST, "[Check 8] Check UID removal still fails\n", 0);
+ status = STORAGE_FUNCTION(s002_data[VAL_TEST_IDX29].api[fCode], uid);
+ TEST_ASSERT_EQUAL(status, s002_data[VAL_TEST_IDX29].status, TEST_CHECKPOINT_NUM(33));
+
+ /* Check that info is preserved */
+ status = STORAGE_FUNCTION(s002_data[VAL_TEST_IDX30].api[fCode], uid, &new_info);
+ TEST_ASSERT_EQUAL(status, s002_data[VAL_TEST_IDX30].status, TEST_CHECKPOINT_NUM(34));
+ TEST_ASSERT_EQUAL(new_info.size, orig_info.size, TEST_CHECKPOINT_NUM(35));
+ TEST_ASSERT_EQUAL(new_info.flags, orig_info.flags, TEST_CHECKPOINT_NUM(36));
+
+ return VAL_STATUS_SUCCESS;
+}
+
+int32_t s002_storage_test(caller_security_t caller)
+{
+ int32_t status;
+
+#if defined(STORAGE) || defined(INTERNAL_TRUSTED_STORAGE)
+ val->print(PRINT_TEST, ITS_TEST_MESSAGE, 0);
+ status = psa_sst_update_write_once_flag_after_create(VAL_ITS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+
+ status = psa_sst_create_with_write_once_flag(VAL_ITS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+#endif
+
+#if defined(STORAGE) || defined(PROTECTED_STORAGE)
+ val->print(PRINT_TEST, PS_TEST_MESSAGE, 0);
+ status = psa_sst_update_write_once_flag_after_create(VAL_PS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+
+ status = psa_sst_create_with_write_once_flag(VAL_PS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+#endif
+
+ return VAL_STATUS_SUCCESS;
+}
diff --git a/api-tests/dev_apis/storage/test_s002/test_s002.h b/api-tests/dev_apis/storage/test_s002/test_s002.h
new file mode 100644
index 0000000..1442700
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s002/test_s002.h
@@ -0,0 +1,28 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+#ifndef _TEST_S002_CLIENT_TESTS_H_
+#define _TEST_S002_CLIENT_TESTS_H_
+
+#define test_entry CONCAT(test_entry_, s002)
+
+#include "test_storage_common.h"
+
+extern const client_test_t s002_storage_test_list[];
+
+int32_t s002_storage_test(caller_security_t caller);
+
+#endif /* _TEST_S002_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_s003/test.cmake b/api-tests/dev_apis/storage/test_s003/test.cmake
similarity index 86%
rename from api-tests/dev_apis/protected_storage/test_s003/test.cmake
rename to api-tests/dev_apis/storage/test_s003/test.cmake
index 6a38d56..d6b945c 100644
--- a/api-tests/dev_apis/protected_storage/test_s003/test.cmake
+++ b/api-tests/dev_apis/storage/test_s003/test.cmake
@@ -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");
@@ -19,6 +19,6 @@
test_entry_s003.c
test_s003.c
)
-list(APPEND CC_OPTIONS -DPS_TEST)
+list(APPEND CC_OPTIONS )
list(APPEND AS_SOURCE )
list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/storage/test_s003/test_data.h b/api-tests/dev_apis/storage/test_s003/test_data.h
new file mode 100644
index 0000000..f4f54d5
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s003/test_data.h
@@ -0,0 +1,35 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+#ifndef _S003_TEST_DATA_H_
+#define _S003_TEST_DATA_H_
+
+#include "test_s003.h"
+
+static const test_data_t s003_data[] = {
+{
+ VAL_TEST_IDX0, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Call set API till insufficent space */
+ VAL_TEST_IDX1, {VAL_ITS_SET, VAL_PS_SET}, PSA_ERROR_INSUFFICIENT_STORAGE
+},
+{
+ /* Remove the UID created */
+ VAL_TEST_IDX2, {VAL_ITS_REMOVE, VAL_PS_REMOVE}, PSA_SUCCESS
+},
+};
+#endif /* _S003_TEST_DATA_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s003/test_entry_s003.c b/api-tests/dev_apis/storage/test_s003/test_entry_s003.c
similarity index 89%
rename from api-tests/dev_apis/internal_trusted_storage/test_s003/test_entry_s003.c
rename to api-tests/dev_apis/storage/test_s003/test_entry_s003.c
index 30dcbde..99807e2 100755
--- a/api-tests/dev_apis/internal_trusted_storage/test_s003/test_entry_s003.c
+++ b/api-tests/dev_apis/storage/test_s003/test_entry_s003.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");
@@ -41,7 +41,7 @@
}
/* Execute list of tests available in test[num]_secure_storage_list from Non-secure side*/
- status = val->execute_non_secure_tests(TEST_NUM, test_s003_sst_list, FALSE);
+ status = val->execute_non_secure_tests(TEST_NUM, s003_storage_test_list, FALSE);
if (VAL_ERROR(status))
{
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s003/test_s003.c b/api-tests/dev_apis/storage/test_s003/test_s003.c
similarity index 60%
rename from api-tests/dev_apis/internal_trusted_storage/test_s003/test_s003.c
rename to api-tests/dev_apis/storage/test_s003/test_s003.c
index 9057316..282f326 100755
--- a/api-tests/dev_apis/internal_trusted_storage/test_s003/test_s003.c
+++ b/api-tests/dev_apis/storage/test_s003/test_s003.c
@@ -18,32 +18,29 @@
#include "val_interfaces.h"
#include "val_target.h"
#include "test_s003.h"
-#if ITS_TEST
-#include "test_its_data.h"
-#elif PS_TEST
-#include "test_ps_data.h"
-#endif
+#include "test_data.h"
#define NUM_ITERATIONS 2
#define TEST_BASE_UID_VALUE UID_BASE_VALUE + 5
-client_test_t test_s003_sst_list[] = {
+const client_test_t s003_storage_test_list[] = {
NULL,
- psa_sst_insufficient_space,
+ s003_storage_test,
NULL,
};
-static uint8_t write_buff[PLATFORM_MAX_UID_SIZE];
-static char test_desc[2][80] = {
+static uint8_t write_buff[ARCH_TEST_STORAGE_UID_MAX_SIZE];
+static char test_desc[2][80] = {
"Overload storage space\n",
"Overload storage again to verify all previous UID removed\n"};
-int32_t psa_sst_insufficient_space(caller_security_t caller)
+int32_t psa_sst_insufficient_space(storage_function_code_t fCode)
{
- uint32_t status = PSA_SUCCESS;
+ int32_t status = PSA_SUCCESS;
psa_storage_uid_t uid;
- uint32_t count = 0, results[NUM_ITERATIONS] = {0};
- int i = 0;
+ uint32_t count = 0;
+ uint32_t results[NUM_ITERATIONS] = {0};
+ int i = 0;
/* Saturate the storage for NUM_ITERATION times, and remove them after */
for (i = 0 ; i < NUM_ITERATIONS; i++)
@@ -52,33 +49,36 @@
val->print(PRINT_TEST, &test_desc[i][0], 0);
for (uid = TEST_BASE_UID_VALUE; status == PSA_SUCCESS; uid++)
{
- val->print(PRINT_INFO, "Setting 0x%x bytes for ", PLATFORM_MAX_UID_SIZE);
+ val->print(PRINT_INFO, "Setting 0x%x bytes for ", ARCH_TEST_STORAGE_UID_MAX_SIZE);
val->print(PRINT_INFO, "UID %d\n", uid);
- status = SST_FUNCTION(s003_data[1].api, uid, PLATFORM_MAX_UID_SIZE, write_buff,
- PSA_STORAGE_FLAG_NONE);
+ status = STORAGE_FUNCTION(s003_data[VAL_TEST_IDX1].api[fCode], uid,
+ ARCH_TEST_STORAGE_UID_MAX_SIZE, write_buff,
+ PSA_STORAGE_FLAG_NONE);
if (status != PSA_SUCCESS)
{
val->print(PRINT_TEST, "UID %d set failed due to insufficient space\n", uid);
break;
}
}
- TEST_ASSERT_EQUAL(status, s003_data[1].status, TEST_CHECKPOINT_NUM(1));
+ TEST_ASSERT_EQUAL(status, s003_data[VAL_TEST_IDX1].status, TEST_CHECKPOINT_NUM(1));
/* Store number of set()s it took to saturate the storage */
count = uid - (TEST_BASE_UID_VALUE);
results[i] = uid - (TEST_BASE_UID_VALUE);
- if (count)
+ if (count) {
val->print(PRINT_TEST, "Remove all registered UIDs\n", 0);
+ }
for (uid = TEST_BASE_UID_VALUE; uid < (count + TEST_BASE_UID_VALUE); uid++)
{
val->print(PRINT_INFO, "Removing UID %d\n", uid);
- status = SST_FUNCTION(s003_data[2].api, uid);
+ status = STORAGE_FUNCTION(s003_data[VAL_TEST_IDX2].api[fCode], uid);
if (status != PSA_SUCCESS)
break;
}
- if (count)
- TEST_ASSERT_EQUAL(status, s003_data[2].status, TEST_CHECKPOINT_NUM(2));
+ if (count) {
+ TEST_ASSERT_EQUAL(status, s003_data[VAL_TEST_IDX2].status, TEST_CHECKPOINT_NUM(2));
+ }
}
/* Check that it takes equal number of UIDs to fill up the storage each time */
@@ -94,3 +94,26 @@
}
return VAL_STATUS_SUCCESS;
}
+
+int32_t s003_storage_test(caller_security_t caller)
+{
+ int32_t status;
+
+#if defined(STORAGE) || defined(INTERNAL_TRUSTED_STORAGE)
+ val->print(PRINT_TEST, ITS_TEST_MESSAGE, 0);
+ status = psa_sst_insufficient_space(VAL_ITS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+#endif
+
+#if defined(STORAGE) || defined(PROTECTED_STORAGE)
+ val->print(PRINT_TEST, PS_TEST_MESSAGE, 0);
+ status = psa_sst_insufficient_space(VAL_PS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+#endif
+
+ return VAL_STATUS_SUCCESS;
+}
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s003/test_s003.h b/api-tests/dev_apis/storage/test_s003/test_s003.h
similarity index 61%
rename from api-tests/dev_apis/internal_trusted_storage/test_s003/test_s003.h
rename to api-tests/dev_apis/storage/test_s003/test_s003.h
index e022142..d9e78af 100755
--- a/api-tests/dev_apis/internal_trusted_storage/test_s003/test_s003.h
+++ b/api-tests/dev_apis/storage/test_s003/test_s003.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");
@@ -17,19 +17,12 @@
#ifndef _TEST_S003_CLIENT_TESTS_H_
#define _TEST_S003_CLIENT_TESTS_H_
-#ifdef ITS_TEST
-#define VAL_STORAGE_BASE VAL_INTERNAL_TRUSTED_STORAGE_BASE
#define test_entry CONCAT(test_entry_, s003)
-#elif PS_TEST
-#define VAL_STORAGE_BASE VAL_PROTECTED_STORAGE_BASE
-#define test_entry CONCAT(test_entry_, p003)
-#endif
-#define val CONCAT(val, test_entry)
-#define psa CONCAT(psa, test_entry)
-extern val_api_t *val;
-extern psa_api_t *psa;
-extern client_test_t test_s003_sst_list[];
+#include "test_storage_common.h"
-int32_t psa_sst_insufficient_space(caller_security_t caller);
+extern const client_test_t s003_storage_test_list[];
+
+int32_t s003_storage_test(caller_security_t caller);
+
#endif /* _TEST_S003_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_s004/test.cmake b/api-tests/dev_apis/storage/test_s004/test.cmake
similarity index 86%
rename from api-tests/dev_apis/protected_storage/test_s004/test.cmake
rename to api-tests/dev_apis/storage/test_s004/test.cmake
index 1210631..775473f 100644
--- a/api-tests/dev_apis/protected_storage/test_s004/test.cmake
+++ b/api-tests/dev_apis/storage/test_s004/test.cmake
@@ -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");
@@ -19,6 +19,6 @@
test_entry_s004.c
test_s004.c
)
-list(APPEND CC_OPTIONS -DPS_TEST)
+list(APPEND CC_OPTIONS )
list(APPEND AS_SOURCE )
list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/storage/test_s004/test_data.h b/api-tests/dev_apis/storage/test_s004/test_data.h
new file mode 100644
index 0000000..8baf212
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s004/test_data.h
@@ -0,0 +1,53 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+#ifndef _S004_TEST_DATA_H_
+#define _S004_TEST_DATA_H_
+
+#include "test_s004.h"
+
+static const test_data_t s004_data[] = {
+{
+ VAL_TEST_IDX0, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Create a valid storage entity */
+ VAL_TEST_IDX1, {VAL_ITS_SET, VAL_PS_SET}, PSA_SUCCESS
+},
+{
+ /* Validate the data using get API after set API failure */
+ VAL_TEST_IDX2, {VAL_ITS_GET, VAL_PS_GET}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX3, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* For same UID set the length as half of previous */
+ VAL_TEST_IDX4, {VAL_ITS_SET, VAL_PS_SET}, PSA_SUCCESS
+},
+{
+ /* Call get with incorrect length */
+ VAL_TEST_IDX5, {VAL_ITS_GET, VAL_PS_GET}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX6, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Remove the valid storage entity */
+ VAL_TEST_IDX7, {VAL_ITS_REMOVE, VAL_PS_REMOVE}, PSA_SUCCESS
+},
+};
+#endif /* _S004_TEST_DATA_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s004/test_entry_s004.c b/api-tests/dev_apis/storage/test_s004/test_entry_s004.c
similarity index 89%
rename from api-tests/dev_apis/internal_trusted_storage/test_s004/test_entry_s004.c
rename to api-tests/dev_apis/storage/test_s004/test_entry_s004.c
index a6afc24..a7861ef 100755
--- a/api-tests/dev_apis/internal_trusted_storage/test_s004/test_entry_s004.c
+++ b/api-tests/dev_apis/storage/test_s004/test_entry_s004.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");
@@ -41,7 +41,7 @@
}
/* Execute list of tests available in test[num]_secure_storage_list from Non-secure side*/
- status = val->execute_non_secure_tests(TEST_NUM, test_s004_sst_list, FALSE);
+ status = val->execute_non_secure_tests(TEST_NUM, s004_storage_test_list, FALSE);
if (VAL_ERROR(status))
{
diff --git a/api-tests/dev_apis/storage/test_s004/test_s004.c b/api-tests/dev_apis/storage/test_s004/test_s004.c
new file mode 100644
index 0000000..ee470ac
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s004/test_s004.c
@@ -0,0 +1,98 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+
+#include "val_interfaces.h"
+#include "val_target.h"
+#include "test_s004.h"
+#include "test_data.h"
+
+#define TEST_BUFF_SIZE 20
+
+const client_test_t s004_storage_test_list[] = {
+ NULL,
+ s004_storage_test,
+ NULL,
+};
+
+static psa_storage_uid_t uid = UID_BASE_VALUE + 5;
+static uint8_t read_buff[TEST_BUFF_SIZE] = {0};
+static uint8_t write_buff[TEST_BUFF_SIZE] = {0x99, 0x01, 0x30, 0x50, 0x04,
+ 0x23, 0xF6, 0x07, 0x08, 0x0D,
+ 0x70, 0xA1, 0xFF, 0xFF, 0x14,
+ 0x73, 0x46, 0x97, 0xE8, 0xDD};
+
+static int32_t psa_sst_get_data_check(storage_function_code_t fCode)
+{
+ int32_t status;
+ uint32_t p_data_length = 0;
+
+ /* Set data for UID */
+ status = STORAGE_FUNCTION(s004_data[VAL_TEST_IDX1].api[fCode], uid, TEST_BUFF_SIZE, write_buff,
+ PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s004_data[VAL_TEST_IDX1].status, TEST_CHECKPOINT_NUM(1));
+
+ /* Call get function and check the data consistency */
+ status = STORAGE_FUNCTION(s004_data[VAL_TEST_IDX2].api[fCode], uid, 0, TEST_BUFF_SIZE,
+ read_buff, &p_data_length);
+ TEST_ASSERT_EQUAL(status, s004_data[VAL_TEST_IDX2].status, TEST_CHECKPOINT_NUM(2));
+ TEST_ASSERT_MEMCMP(read_buff, write_buff, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(3));
+ TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(4));
+
+ /* Call the set again for same uid and set the length as half */
+ val->print(PRINT_TEST, "[Check 1] Call set API with reduced length - TEST_BUFF_SIZE/2\n", 0);
+ status = STORAGE_FUNCTION(s004_data[VAL_TEST_IDX4].api[fCode], uid, TEST_BUFF_SIZE/2,
+ write_buff, PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s004_data[VAL_TEST_IDX4].status, TEST_CHECKPOINT_NUM(5));
+
+ /* Call get function with incorrect buffer length */
+ val->print(PRINT_TEST, "[Check 2] Call get API with default length - TEST_BUFF_SIZE\n", 0);
+ status = STORAGE_FUNCTION(s004_data[VAL_TEST_IDX5].api[fCode], uid, 0, TEST_BUFF_SIZE,
+ read_buff, &p_data_length);
+ TEST_ASSERT_EQUAL(status, s004_data[VAL_TEST_IDX5].status, TEST_CHECKPOINT_NUM(6));
+ TEST_ASSERT_MEMCMP(read_buff, write_buff, TEST_BUFF_SIZE/2, TEST_CHECKPOINT_NUM(7));
+ /* Expect p_data_length = TEST_BUFF_SIZE/2 */
+ TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE/2, TEST_CHECKPOINT_NUM(8));
+
+ /* Remove the UID */
+ status = STORAGE_FUNCTION(s004_data[VAL_TEST_IDX7].api[fCode], uid);
+ TEST_ASSERT_EQUAL(status, s004_data[VAL_TEST_IDX7].status, TEST_CHECKPOINT_NUM(9));
+
+ return VAL_STATUS_SUCCESS;
+}
+
+int32_t s004_storage_test(caller_security_t caller)
+{
+ int32_t status;
+
+#if defined(STORAGE) || defined(INTERNAL_TRUSTED_STORAGE)
+ val->print(PRINT_TEST, ITS_TEST_MESSAGE, 0);
+ status = psa_sst_get_data_check(VAL_ITS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+#endif
+
+#if defined(STORAGE) || defined(PROTECTED_STORAGE)
+ val->print(PRINT_TEST, PS_TEST_MESSAGE, 0);
+ status = psa_sst_get_data_check(VAL_PS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+#endif
+
+ return VAL_STATUS_SUCCESS;
+}
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s004/test_s004.h b/api-tests/dev_apis/storage/test_s004/test_s004.h
similarity index 61%
rename from api-tests/dev_apis/internal_trusted_storage/test_s004/test_s004.h
rename to api-tests/dev_apis/storage/test_s004/test_s004.h
index 85e6c34..2b44076 100755
--- a/api-tests/dev_apis/internal_trusted_storage/test_s004/test_s004.h
+++ b/api-tests/dev_apis/storage/test_s004/test_s004.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");
@@ -17,19 +17,12 @@
#ifndef _TEST_S004_CLIENT_TESTS_H_
#define _TEST_S004_CLIENT_TESTS_H_
-#ifdef ITS_TEST
-#define VAL_STORAGE_BASE VAL_INTERNAL_TRUSTED_STORAGE_BASE
#define test_entry CONCAT(test_entry_, s004)
-#elif PS_TEST
-#define VAL_STORAGE_BASE VAL_PROTECTED_STORAGE_BASE
-#define test_entry CONCAT(test_entry_, p004)
-#endif
-#define val CONCAT(val, test_entry)
-#define psa CONCAT(psa, test_entry)
-extern val_api_t *val;
-extern psa_api_t *psa;
-extern client_test_t test_s004_sst_list[];
+#include "test_storage_common.h"
-int32_t psa_sst_get_data_check(caller_security_t caller);
+extern const client_test_t s004_storage_test_list[];
+
+int32_t s004_storage_test(caller_security_t caller);
+
#endif /* _TEST_S004_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_s005/test.cmake b/api-tests/dev_apis/storage/test_s005/test.cmake
similarity index 86%
rename from api-tests/dev_apis/protected_storage/test_s005/test.cmake
rename to api-tests/dev_apis/storage/test_s005/test.cmake
index bf3786a..28e59cf 100644
--- a/api-tests/dev_apis/protected_storage/test_s005/test.cmake
+++ b/api-tests/dev_apis/storage/test_s005/test.cmake
@@ -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");
@@ -19,6 +19,6 @@
test_entry_s005.c
test_s005.c
)
-list(APPEND CC_OPTIONS -DPS_TEST)
+list(APPEND CC_OPTIONS )
list(APPEND AS_SOURCE )
list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/storage/test_s005/test_data.h b/api-tests/dev_apis/storage/test_s005/test_data.h
new file mode 100644
index 0000000..3ac7fe1
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s005/test_data.h
@@ -0,0 +1,53 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+#ifndef _S005_TEST_DATA_H_
+#define _S005_TEST_DATA_H_
+
+#include "test_s005.h"
+
+static struct psa_storage_info_t info;
+static const test_data_t s005_data[] = {
+{
+ VAL_TEST_IDX0, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Create a valid storage entity */
+ VAL_TEST_IDX1, {VAL_ITS_SET, VAL_PS_SET}, PSA_SUCCESS
+},
+{
+ /* Validate the data using get API */
+ VAL_TEST_IDX2, {VAL_ITS_GET, VAL_PS_GET}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX3, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Validate the data attributes get_info API */
+ VAL_TEST_IDX4, {VAL_ITS_GET_INFO, VAL_PS_GET_INFO}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX5, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ VAL_TEST_IDX6, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Remove the valid storage entity */
+ VAL_TEST_IDX7, {VAL_ITS_REMOVE, VAL_PS_REMOVE}, PSA_SUCCESS
+},
+};
+#endif /* _S005_TEST_DATA_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s005/test_entry_s005.c b/api-tests/dev_apis/storage/test_s005/test_entry_s005.c
similarity index 89%
rename from api-tests/dev_apis/internal_trusted_storage/test_s005/test_entry_s005.c
rename to api-tests/dev_apis/storage/test_s005/test_entry_s005.c
index 36dcbaa..d41b0b8 100755
--- a/api-tests/dev_apis/internal_trusted_storage/test_s005/test_entry_s005.c
+++ b/api-tests/dev_apis/storage/test_s005/test_entry_s005.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");
@@ -41,7 +41,7 @@
}
/* Execute list of tests available in test[num]_secure_storage_list from Non-secure side*/
- status = val->execute_non_secure_tests(TEST_NUM, test_s005_sst_list, FALSE);
+ status = val->execute_non_secure_tests(TEST_NUM, s005_storage_test_list, FALSE);
if (VAL_ERROR(status))
{
goto test_exit;
diff --git a/api-tests/dev_apis/storage/test_s005/test_s005.c b/api-tests/dev_apis/storage/test_s005/test_s005.c
new file mode 100644
index 0000000..0945bc0
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s005/test_s005.c
@@ -0,0 +1,116 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+
+#include "val_interfaces.h"
+#include "val_target.h"
+#include "test_s005.h"
+#include "test_data.h"
+
+#define TEST_BUFF_SIZE 30
+
+const client_test_t s005_storage_test_list[] = {
+ NULL,
+ s005_storage_test,
+ NULL,
+};
+
+static uint8_t read_buff[TEST_BUFF_SIZE];
+static uint8_t write_buff[TEST_BUFF_SIZE] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x23, 0xF6, 0x07, 0x08, 0x0D, 0x0A, 0x1B, 0x0C, 0x5D, 0x0E,\
+ 0x70, 0xA1, 0xFF, 0xFF, 0x14, 0x73, 0x46, 0x97, 0xE8, 0xDD, 0xCA, 0x0B, 0x3C, 0x0D, 0x2E};
+
+static int32_t psa_sst_apis_check(storage_function_code_t fCode,
+ psa_storage_uid_t uid,
+ uint32_t data_len,
+ uint8_t *data_buff,
+ psa_storage_create_flags_t create_flag)
+{
+ int32_t status;
+ uint32_t p_data_length = 0;
+
+ /* Set the UID with the data_len and data_buff */
+ status = STORAGE_FUNCTION(s005_data[VAL_TEST_IDX1].api[fCode], uid, data_len, data_buff,
+ create_flag);
+ TEST_ASSERT_EQUAL(status, s005_data[VAL_TEST_IDX1].status, TEST_CHECKPOINT_NUM(1));
+
+ /* Call the get function to get the data buffer and match the buffer */
+ status = STORAGE_FUNCTION(s005_data[VAL_TEST_IDX2].api[fCode], uid, 0, data_len, read_buff,
+ &p_data_length);
+ TEST_ASSERT_EQUAL(status, s005_data[VAL_TEST_IDX2].status, TEST_CHECKPOINT_NUM(2));
+ TEST_ASSERT_MEMCMP(read_buff, data_buff, data_len, TEST_CHECKPOINT_NUM(3));
+ TEST_ASSERT_EQUAL(p_data_length, data_len, TEST_CHECKPOINT_NUM(4));
+
+ /* Call the get_info function and match the attributes */
+ status = STORAGE_FUNCTION(s005_data[VAL_TEST_IDX4].api[fCode], uid, &info);
+ TEST_ASSERT_EQUAL(status, s005_data[VAL_TEST_IDX4].status, TEST_CHECKPOINT_NUM(5));
+ TEST_ASSERT_EQUAL(info.size, data_len, TEST_CHECKPOINT_NUM(6));
+ TEST_ASSERT_EQUAL(info.flags, create_flag, TEST_CHECKPOINT_NUM(7));
+
+ /* Remove the UID */
+ status = STORAGE_FUNCTION(s005_data[VAL_TEST_IDX7].api[fCode], uid);
+ TEST_ASSERT_EQUAL(status, s005_data[VAL_TEST_IDX7].status, TEST_CHECKPOINT_NUM(8));
+
+ return VAL_STATUS_SUCCESS;
+}
+
+static int32_t psa_sst_apis_check_success_case(storage_function_code_t fCode)
+{
+ psa_storage_uid_t uid = UID_BASE_VALUE + 4;
+ uint32_t data_len = 0;
+ int32_t status = VAL_STATUS_SUCCESS;
+
+ /* Calling set function with data_len 1 and valid data pointer */
+ val->print(PRINT_TEST, "[Check 1] Set UID with data length zero and call storage APIs\n", 0);
+ if (psa_sst_apis_check(fCode, uid, data_len, write_buff, PSA_STORAGE_FLAG_NONE))
+ {
+ val->print(PRINT_ERROR, "Data Len = %d\n", data_len);
+ return VAL_STATUS_ERROR;
+ }
+
+ data_len = TEST_BUFF_SIZE/2;
+ val->print(PRINT_TEST, "[Check 2] Resetting the length check\n", 0);
+ if (psa_sst_apis_check(fCode, uid, data_len, write_buff, PSA_STORAGE_FLAG_NONE))
+ {
+ val->print(PRINT_ERROR, "Data Len = %d\n", data_len);
+ return VAL_STATUS_ERROR;
+ }
+
+ return status;
+}
+
+int32_t s005_storage_test(caller_security_t caller)
+{
+ int32_t status;
+
+#if defined(STORAGE) || defined(INTERNAL_TRUSTED_STORAGE)
+ val->print(PRINT_TEST, ITS_TEST_MESSAGE, 0);
+ status = psa_sst_apis_check_success_case(VAL_ITS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+#endif
+
+#if defined(STORAGE) || defined(PROTECTED_STORAGE)
+ val->print(PRINT_TEST, PS_TEST_MESSAGE, 0);
+ status = psa_sst_apis_check_success_case(VAL_PS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+#endif
+
+ return VAL_STATUS_SUCCESS;
+}
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s005/test_s005.h b/api-tests/dev_apis/storage/test_s005/test_s005.h
similarity index 60%
rename from api-tests/dev_apis/internal_trusted_storage/test_s005/test_s005.h
rename to api-tests/dev_apis/storage/test_s005/test_s005.h
index 453bb92..362c92f 100755
--- a/api-tests/dev_apis/internal_trusted_storage/test_s005/test_s005.h
+++ b/api-tests/dev_apis/storage/test_s005/test_s005.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");
@@ -17,20 +17,12 @@
#ifndef _TEST_S005_CLIENT_TESTS_H_
#define _TEST_S005_CLIENT_TESTS_H_
-#ifdef ITS_TEST
-#define VAL_STORAGE_BASE VAL_INTERNAL_TRUSTED_STORAGE_BASE
#define test_entry CONCAT(test_entry_, s005)
-#elif PS_TEST
-#define VAL_STORAGE_BASE VAL_PROTECTED_STORAGE_BASE
-#define test_entry CONCAT(test_entry_, p005)
-#endif
-#define val CONCAT(val, test_entry)
-#define psa CONCAT(psa, test_entry)
-extern val_api_t *val;
-extern psa_api_t *psa;
-extern client_test_t test_s005_sst_list[];
+#include "test_storage_common.h"
-int32_t psa_sst_apis_check_success_case(caller_security_t caller);
+extern const client_test_t s005_storage_test_list[];
+
+int32_t s005_storage_test(caller_security_t caller);
#endif /* _TEST_S005_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_s006/test.cmake b/api-tests/dev_apis/storage/test_s006/test.cmake
similarity index 86%
rename from api-tests/dev_apis/protected_storage/test_s006/test.cmake
rename to api-tests/dev_apis/storage/test_s006/test.cmake
index c661ac3..0fecdc3 100644
--- a/api-tests/dev_apis/protected_storage/test_s006/test.cmake
+++ b/api-tests/dev_apis/storage/test_s006/test.cmake
@@ -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");
@@ -19,6 +19,6 @@
test_entry_s006.c
test_s006.c
)
-list(APPEND CC_OPTIONS -DPS_TEST)
+list(APPEND CC_OPTIONS )
list(APPEND AS_SOURCE )
list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/storage/test_s006/test_data.h b/api-tests/dev_apis/storage/test_s006/test_data.h
new file mode 100755
index 0000000..d54547a
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s006/test_data.h
@@ -0,0 +1,47 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+#ifndef _S006_TEST_DATA_H_
+#define _S006_TEST_DATA_H_
+
+#include "test_s006.h"
+
+static struct psa_storage_info_t info;
+static const test_data_t s006_data[] = {
+{
+ VAL_TEST_IDX0, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Create a valid storage entity with different flag values */
+ VAL_TEST_IDX1, {VAL_ITS_SET, VAL_PS_SET}, PSA_SUCCESS
+},
+{
+ /* Validate the flag value get_info API */
+ VAL_TEST_IDX2, {VAL_ITS_GET_INFO, VAL_PS_GET_INFO}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX3, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Remove the storage entity */
+ VAL_TEST_IDX4, {VAL_ITS_REMOVE, VAL_PS_REMOVE}, PSA_SUCCESS
+},
+{
+ /* Storage entity remove fails */
+ VAL_TEST_IDX5, {VAL_ITS_REMOVE, VAL_PS_REMOVE}, PSA_ERROR_DOES_NOT_EXIST
+},
+};
+#endif /* _S006_TEST_DATA_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s006/test_entry_s006.c b/api-tests/dev_apis/storage/test_s006/test_entry_s006.c
similarity index 89%
rename from api-tests/dev_apis/internal_trusted_storage/test_s006/test_entry_s006.c
rename to api-tests/dev_apis/storage/test_s006/test_entry_s006.c
index f3f2af3..09d90d0 100755
--- a/api-tests/dev_apis/internal_trusted_storage/test_s006/test_entry_s006.c
+++ b/api-tests/dev_apis/storage/test_s006/test_entry_s006.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");
@@ -41,7 +41,7 @@
}
/* Execute list of tests available in test[num]_secure_storage_list from Non-secure side*/
- status = val->execute_non_secure_tests(TEST_NUM, test_s006_sst_list, FALSE);
+ status = val->execute_non_secure_tests(TEST_NUM, s006_storage_test_list, FALSE);
if (VAL_ERROR(status))
{
goto test_exit;
diff --git a/api-tests/dev_apis/storage/test_s006/test_s006.c b/api-tests/dev_apis/storage/test_s006/test_s006.c
new file mode 100755
index 0000000..d5a4100
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s006/test_s006.c
@@ -0,0 +1,150 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+
+#include "val_interfaces.h"
+#include "val_target.h"
+#include "test_s006.h"
+#include "test_data.h"
+
+#define TEST_BUFF_SIZE 30
+
+const client_test_t s006_storage_test_list[] = {
+ NULL,
+ s006_storage_test,
+ NULL,
+};
+
+static uint8_t write_buff[TEST_BUFF_SIZE] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x23, 0xF6, 0x07, 0x08, 0x0D, 0x0A, 0x1B, 0x0C, 0x5D, 0x0E,\
+ 0x70, 0xA1, 0xFF, 0xFF, 0x14, 0x73, 0x46, 0x97, 0xE8, 0xDD, 0xCA, 0x0B, 0x3C, 0x0D, 0x2E};
+
+static int32_t psa_sst_remove_api(storage_function_code_t fCode,
+ psa_storage_uid_t uid,
+ uint32_t data_len,
+ uint8_t *data_buff,
+ psa_storage_create_flags_t create_flag)
+{
+ int32_t status;
+
+ /* Call the get_info function and match the attributes */
+ status = STORAGE_FUNCTION(s006_data[VAL_TEST_IDX2].api[fCode], uid, &info);
+ TEST_ASSERT_EQUAL(status, s006_data[VAL_TEST_IDX2].status, TEST_CHECKPOINT_NUM(1));
+ if ((create_flag != PSA_STORAGE_FLAG_NO_CONFIDENTIALITY) ||
+ (create_flag != PSA_STORAGE_FLAG_NO_REPLAY_PROTECTION))
+ {
+ TEST_ASSERT_EQUAL(info.flags, create_flag, TEST_CHECKPOINT_NUM(2));
+ }
+
+ /* Remove the UID */
+ status = STORAGE_FUNCTION(s006_data[VAL_TEST_IDX4].api[fCode], uid);
+ TEST_ASSERT_EQUAL(status, s006_data[VAL_TEST_IDX4].status, TEST_CHECKPOINT_NUM(3));
+
+ return VAL_STATUS_SUCCESS;
+}
+
+static int32_t psa_sst_create_storage_api(storage_function_code_t fCode,
+ psa_storage_uid_t uid,
+ uint32_t data_len,
+ uint8_t *data_buff,
+ psa_storage_create_flags_t create_flag)
+{
+ int32_t status;
+ int32_t test_status;
+
+ status = STORAGE_FUNCTION(s006_data[VAL_TEST_IDX1].api[fCode], uid, data_len, data_buff,
+ create_flag);
+ if (status == s006_data[VAL_TEST_IDX1].status)
+ {
+ test_status = psa_sst_remove_api(fCode, uid, data_len, data_buff, create_flag);
+ if (test_status != VAL_STATUS_SUCCESS)
+ {
+ return test_status;
+ }
+ }
+ else
+ {
+ /* Remove UID should fail */
+ status = STORAGE_FUNCTION(s006_data[VAL_TEST_IDX5].api[fCode], uid);
+ TEST_ASSERT_EQUAL(status, s006_data[VAL_TEST_IDX5].status, TEST_CHECKPOINT_NUM(4));
+ }
+
+ return VAL_STATUS_SUCCESS;
+}
+
+static int32_t psa_sst_flags_not_supported(storage_function_code_t fCode)
+{
+ psa_storage_create_flags_t flag;
+ uint32_t status = VAL_STATUS_SUCCESS;
+ psa_storage_uid_t uid = UID_BASE_VALUE + 5;
+ int32_t test_status;
+
+ /* Calling set function with different create flag value */
+
+ val->print(PRINT_TEST, "[Check 1] Call set API with flag - PSA_STORAGE_FLAG_NONE\n", 0);
+ /* Create storage with flag value */
+ flag = PSA_STORAGE_FLAG_NONE;
+ test_status = psa_sst_create_storage_api(fCode, uid, TEST_BUFF_SIZE, write_buff, flag);
+ if (test_status != VAL_STATUS_SUCCESS)
+ {
+ return test_status;
+ }
+
+ val->print(PRINT_TEST, "[Check 2] Call set API with flag - "
+ "PSA_STORAGE_FLAG_NO_CONFIDENTIALITY\n", 0);
+ /* Create storage with flag value */
+ flag = PSA_STORAGE_FLAG_NO_CONFIDENTIALITY;
+ test_status = psa_sst_create_storage_api(fCode, uid, TEST_BUFF_SIZE, write_buff, flag);
+ if (test_status != VAL_STATUS_SUCCESS)
+ {
+ return test_status;
+ }
+
+ val->print(PRINT_TEST, "[Check 3] Call set API with flag - "
+ "PSA_STORAGE_FLAG_NO_REPLAY_PROTECTION\n", 0);
+ /* Create storage with flag value */
+ flag = PSA_STORAGE_FLAG_NO_REPLAY_PROTECTION;
+ test_status = psa_sst_create_storage_api(fCode, uid, TEST_BUFF_SIZE, write_buff, flag);
+ if (test_status != VAL_STATUS_SUCCESS)
+ {
+ return test_status;
+ }
+
+ return status;
+}
+
+int32_t s006_storage_test(caller_security_t caller)
+{
+ int32_t status;
+
+#if defined(STORAGE) || defined(INTERNAL_TRUSTED_STORAGE)
+ val->print(PRINT_TEST, ITS_TEST_MESSAGE, 0);
+ status = psa_sst_flags_not_supported(VAL_ITS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+#endif
+
+#if defined(STORAGE) || defined(PROTECTED_STORAGE)
+ val->print(PRINT_TEST, PS_TEST_MESSAGE, 0);
+ status = psa_sst_flags_not_supported(VAL_PS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+#endif
+
+ return VAL_STATUS_SUCCESS;
+}
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s006/test_s006.h b/api-tests/dev_apis/storage/test_s006/test_s006.h
similarity index 60%
rename from api-tests/dev_apis/internal_trusted_storage/test_s006/test_s006.h
rename to api-tests/dev_apis/storage/test_s006/test_s006.h
index 8b9b2ba..4774d80 100755
--- a/api-tests/dev_apis/internal_trusted_storage/test_s006/test_s006.h
+++ b/api-tests/dev_apis/storage/test_s006/test_s006.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");
@@ -17,20 +17,12 @@
#ifndef _TEST_S006_CLIENT_TESTS_H_
#define _TEST_S006_CLIENT_TESTS_H_
-#ifdef ITS_TEST
-#define VAL_STORAGE_BASE VAL_INTERNAL_TRUSTED_STORAGE_BASE
#define test_entry CONCAT(test_entry_, s006)
-#elif PS_TEST
-#define VAL_STORAGE_BASE VAL_PROTECTED_STORAGE_BASE
-#define test_entry CONCAT(test_entry_, p006)
-#endif
-#define val CONCAT(val, test_entry)
-#define psa CONCAT(psa, test_entry)
-extern val_api_t *val;
-extern psa_api_t *psa;
-extern client_test_t test_s006_sst_list[];
+#include "test_storage_common.h"
-int32_t psa_sst_flags_not_supported(caller_security_t caller);
+extern const client_test_t s006_storage_test_list[];
+
+int32_t s006_storage_test(caller_security_t caller);
#endif /* _TEST_S006_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_s007/test.cmake b/api-tests/dev_apis/storage/test_s007/test.cmake
similarity index 86%
rename from api-tests/dev_apis/protected_storage/test_s007/test.cmake
rename to api-tests/dev_apis/storage/test_s007/test.cmake
index 5c6606d..599088f 100644
--- a/api-tests/dev_apis/protected_storage/test_s007/test.cmake
+++ b/api-tests/dev_apis/storage/test_s007/test.cmake
@@ -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");
@@ -19,6 +19,6 @@
test_entry_s007.c
test_s007.c
)
-list(APPEND CC_OPTIONS -DPS_TEST)
+list(APPEND CC_OPTIONS )
list(APPEND AS_SOURCE )
list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/storage/test_s007/test_data.h b/api-tests/dev_apis/storage/test_s007/test_data.h
new file mode 100644
index 0000000..d0b6145
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s007/test_data.h
@@ -0,0 +1,66 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+#ifndef _S007_TEST_DATA_H_
+#define _S007_TEST_DATA_H_
+
+#include "test_s007.h"
+
+static const test_data_t s007_data[] = {
+{
+ VAL_TEST_IDX0, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Create a valid storage entity */
+ VAL_TEST_IDX1, {VAL_ITS_SET, VAL_PS_SET}, PSA_SUCCESS
+},
+{
+ /* Increase the length of storage */
+ VAL_TEST_IDX2, {VAL_ITS_SET, VAL_PS_SET}, PSA_SUCCESS
+},
+{
+ /* Try to access old length */
+ VAL_TEST_IDX3, {VAL_ITS_GET, VAL_PS_GET}, PSA_SUCCESS
+},
+{
+ /* Try to access valid length less than set length */
+ VAL_TEST_IDX4, {VAL_ITS_GET, VAL_PS_GET}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX5, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Decrease the length of storage */
+ VAL_TEST_IDX6, {VAL_ITS_SET, VAL_PS_SET}, PSA_SUCCESS
+},
+{
+ /* Try to access old length */
+ VAL_TEST_IDX7, {VAL_ITS_GET, VAL_PS_GET}, PSA_SUCCESS
+},
+{
+ /* Try to access old length */
+ VAL_TEST_IDX8, {VAL_ITS_GET, VAL_PS_GET}, PSA_SUCCESS
+},
+{
+ /* Try to access data with correct length */
+ VAL_TEST_IDX9, {VAL_ITS_GET, VAL_PS_GET}, PSA_SUCCESS
+},
+{
+ /* Remove the storage entity */
+ VAL_TEST_IDX10, {VAL_ITS_REMOVE, VAL_PS_REMOVE}, PSA_SUCCESS
+},
+};
+#endif /* _S007_TEST_DATA_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s007/test_entry_s007.c b/api-tests/dev_apis/storage/test_s007/test_entry_s007.c
similarity index 89%
rename from api-tests/dev_apis/internal_trusted_storage/test_s007/test_entry_s007.c
rename to api-tests/dev_apis/storage/test_s007/test_entry_s007.c
index f6005a1..a2e8120 100755
--- a/api-tests/dev_apis/internal_trusted_storage/test_s007/test_entry_s007.c
+++ b/api-tests/dev_apis/storage/test_s007/test_entry_s007.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");
@@ -41,7 +41,7 @@
}
/* Execute list of tests available in test[num]_secure_storage_list from Non-secure side*/
- status = val->execute_non_secure_tests(TEST_NUM, test_s007_sst_list, FALSE);
+ status = val->execute_non_secure_tests(TEST_NUM, s007_storage_test_list, FALSE);
if (VAL_ERROR(status))
{
goto test_exit;
diff --git a/api-tests/dev_apis/storage/test_s007/test_s007.c b/api-tests/dev_apis/storage/test_s007/test_s007.c
new file mode 100755
index 0000000..048109e
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s007/test_s007.c
@@ -0,0 +1,132 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+
+#include "val_interfaces.h"
+#include "val_target.h"
+#include "test_s007.h"
+#include "test_data.h"
+
+#define TEST_BUFF_SIZE 30
+
+const client_test_t s007_storage_test_list[] = {
+ NULL,
+ s007_storage_test,
+ NULL,
+};
+
+static uint8_t write_buff[TEST_BUFF_SIZE] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x23, 0xF6, 0x07, 0x08, 0x0D, 0x0A, 0x1B, 0x0C, 0x5D, 0x0E,\
+ 0x70, 0xA1, 0xFF, 0xFF, 0x14, 0x73, 0x46, 0x97, 0xE8, 0xDD, 0xCA, 0x0B, 0x3C, 0x0D, 0x2E};
+static uint8_t read_buff[TEST_BUFF_SIZE];
+
+static int32_t psa_sst_get_incorrect_size(storage_function_code_t fCode)
+{
+ psa_storage_uid_t uid = UID_BASE_VALUE + 5;
+ uint32_t p_data_length = 0;
+ int32_t status = VAL_STATUS_SUCCESS;
+
+ /* Set the UID with the data_len and data_buff */
+ val->print(PRINT_TEST, "Create a valid Storage - TEST_BUFF_SIZE/2\n", 0);
+ status = STORAGE_FUNCTION(s007_data[VAL_TEST_IDX1].api[fCode], uid, TEST_BUFF_SIZE/2,
+ write_buff, PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s007_data[VAL_TEST_IDX1].status, TEST_CHECKPOINT_NUM(1));
+
+ /* Call set for same UID and increase the length */
+ val->print(PRINT_TEST, "Increase the length of storage - TEST_BUFF_SIZE\n", 0);
+ status = STORAGE_FUNCTION(s007_data[VAL_TEST_IDX2].api[fCode], uid, TEST_BUFF_SIZE,
+ write_buff, PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s007_data[VAL_TEST_IDX2].status, TEST_CHECKPOINT_NUM(2));
+
+ /* Access data using get API and old length */
+ val->print(PRINT_TEST, "[Check 1] Call get API with old length - TEST_BUFF_SIZE/2\n", 0);
+ status = STORAGE_FUNCTION(s007_data[VAL_TEST_IDX3].api[fCode], uid, 0, TEST_BUFF_SIZE/2,
+ read_buff, &p_data_length);
+ TEST_ASSERT_EQUAL(status, s007_data[VAL_TEST_IDX3].status, TEST_CHECKPOINT_NUM(3));
+ TEST_ASSERT_MEMCMP(read_buff, write_buff, TEST_BUFF_SIZE/2, TEST_CHECKPOINT_NUM(4));
+ TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE/2, TEST_CHECKPOINT_NUM(5));
+
+ /* Access data using get API and valid length */
+ val->print(PRINT_TEST, "[Check 2] Call get API with old length - TEST_BUFF_SIZE/4\n", 0);
+ memset(read_buff, 0x0, TEST_BUFF_SIZE);
+ status = STORAGE_FUNCTION(s007_data[VAL_TEST_IDX4].api[fCode], uid, 0, TEST_BUFF_SIZE/4,
+ read_buff, &p_data_length);
+ TEST_ASSERT_EQUAL(status, s007_data[VAL_TEST_IDX4].status, TEST_CHECKPOINT_NUM(6));
+ TEST_ASSERT_MEMCMP(read_buff, write_buff, TEST_BUFF_SIZE/4, TEST_CHECKPOINT_NUM(7));
+ TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE/4, TEST_CHECKPOINT_NUM(8));
+
+ /* Decrease the length again */
+ val->print(PRINT_TEST, "Decrease the length of storage - TEST_BUFF_SIZE/4\n", 0);
+ status = STORAGE_FUNCTION(s007_data[VAL_TEST_IDX6].api[fCode], uid, TEST_BUFF_SIZE/4,
+ write_buff, PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s007_data[VAL_TEST_IDX6].status, TEST_CHECKPOINT_NUM(9));
+
+ /* Access data using get API and old length */
+ val->print(PRINT_TEST, "[Check 3] Call get API with old length - TEST_BUFF_SIZE/2\n", 0);
+ memset(read_buff, 0x0, TEST_BUFF_SIZE);
+ status = STORAGE_FUNCTION(s007_data[VAL_TEST_IDX7].api[fCode], uid, 0, TEST_BUFF_SIZE/2,
+ read_buff, &p_data_length);
+ TEST_ASSERT_EQUAL(status, s007_data[VAL_TEST_IDX7].status, TEST_CHECKPOINT_NUM(10));
+ TEST_ASSERT_MEMCMP(read_buff, write_buff, TEST_BUFF_SIZE/4, TEST_CHECKPOINT_NUM(11));
+ TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE/4, TEST_CHECKPOINT_NUM(12));
+
+ /* Access data using get API and old length */
+ val->print(PRINT_TEST, "[Check 4] Call get API with old length - TEST_BUFF_SIZE\n", 0);
+ memset(read_buff, 0x0, TEST_BUFF_SIZE);
+ status = STORAGE_FUNCTION(s007_data[VAL_TEST_IDX8].api[fCode], uid, 0, TEST_BUFF_SIZE,
+ read_buff, &p_data_length);
+ TEST_ASSERT_EQUAL(status, s007_data[VAL_TEST_IDX8].status, TEST_CHECKPOINT_NUM(13));
+ TEST_ASSERT_MEMCMP(read_buff, write_buff, TEST_BUFF_SIZE/4, TEST_CHECKPOINT_NUM(14));
+ TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE/4, TEST_CHECKPOINT_NUM(15));
+
+ /* Access data using correct length */
+ val->print(PRINT_TEST, "[Check 5] Call get API with valid length - TEST_BUFF_SIZE/4\n", 0);
+ memset(read_buff, 0x0, TEST_BUFF_SIZE);
+ status = STORAGE_FUNCTION(s007_data[VAL_TEST_IDX9].api[fCode], uid, 0, TEST_BUFF_SIZE/4,
+ read_buff, &p_data_length);
+ TEST_ASSERT_EQUAL(status, s007_data[VAL_TEST_IDX9].status, TEST_CHECKPOINT_NUM(16));
+ TEST_ASSERT_MEMCMP(read_buff, write_buff, TEST_BUFF_SIZE/4, TEST_CHECKPOINT_NUM(17));
+ TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE/4, TEST_CHECKPOINT_NUM(18));
+
+ /* Remove the UID */
+ status = STORAGE_FUNCTION(s007_data[VAL_TEST_IDX10].api[fCode], uid);
+ TEST_ASSERT_EQUAL(status, s007_data[VAL_TEST_IDX10].status, TEST_CHECKPOINT_NUM(19));
+
+ return status;
+}
+
+int32_t s007_storage_test(caller_security_t caller)
+{
+ int32_t status;
+
+#if defined(STORAGE) || defined(INTERNAL_TRUSTED_STORAGE)
+ val->print(PRINT_TEST, ITS_TEST_MESSAGE, 0);
+ status = psa_sst_get_incorrect_size(VAL_ITS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+#endif
+
+#if defined(STORAGE) || defined(PROTECTED_STORAGE)
+ val->print(PRINT_TEST, PS_TEST_MESSAGE, 0);
+ status = psa_sst_get_incorrect_size(VAL_PS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+#endif
+
+ return VAL_STATUS_SUCCESS;
+}
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s007/test_s007.h b/api-tests/dev_apis/storage/test_s007/test_s007.h
similarity index 61%
rename from api-tests/dev_apis/internal_trusted_storage/test_s007/test_s007.h
rename to api-tests/dev_apis/storage/test_s007/test_s007.h
index 1fe0b5f..39eeb08 100755
--- a/api-tests/dev_apis/internal_trusted_storage/test_s007/test_s007.h
+++ b/api-tests/dev_apis/storage/test_s007/test_s007.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");
@@ -17,20 +17,12 @@
#ifndef _TEST_S007_CLIENT_TESTS_H_
#define _TEST_S007_CLIENT_TESTS_H_
-#ifdef ITS_TEST
-#define VAL_STORAGE_BASE VAL_INTERNAL_TRUSTED_STORAGE_BASE
#define test_entry CONCAT(test_entry_, s007)
-#elif PS_TEST
-#define VAL_STORAGE_BASE VAL_PROTECTED_STORAGE_BASE
-#define test_entry CONCAT(test_entry_, p007)
-#endif
-#define val CONCAT(val, test_entry)
-#define psa CONCAT(psa, test_entry)
-extern val_api_t *val;
-extern psa_api_t *psa;
-extern client_test_t test_s007_sst_list[];
+#include "test_storage_common.h"
-int32_t psa_sst_get_incorrect_size(caller_security_t caller);
+extern const client_test_t s007_storage_test_list[];
+
+int32_t s007_storage_test(caller_security_t caller);
#endif /* _TEST_S007_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s008/test.cmake b/api-tests/dev_apis/storage/test_s008/test.cmake
similarity index 86%
rename from api-tests/dev_apis/internal_trusted_storage/test_s008/test.cmake
rename to api-tests/dev_apis/storage/test_s008/test.cmake
index ecba9c3..92b13e8 100644
--- a/api-tests/dev_apis/internal_trusted_storage/test_s008/test.cmake
+++ b/api-tests/dev_apis/storage/test_s008/test.cmake
@@ -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");
@@ -19,6 +19,6 @@
test_entry_s008.c
test_s008.c
)
-list(APPEND CC_OPTIONS -DITS_TEST)
+list(APPEND CC_OPTIONS )
list(APPEND AS_SOURCE )
list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/storage/test_s008/test_data.h b/api-tests/dev_apis/storage/test_s008/test_data.h
new file mode 100644
index 0000000..9729ab2
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s008/test_data.h
@@ -0,0 +1,74 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+#ifndef _S008_TEST_DATA_H_
+#define _S008_TEST_DATA_H_
+
+#include "test_s008.h"
+
+static const test_data_t s008_data[] = {
+{
+ VAL_TEST_IDX0, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Create a valid storage entity with zero flag value */
+ VAL_TEST_IDX1, {VAL_ITS_SET, VAL_PS_SET}, PSA_SUCCESS
+},
+{
+ /* Call get API with offset + data_len = total_size */
+ VAL_TEST_IDX2, {VAL_ITS_GET, VAL_PS_GET}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX3, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Call get API with offset + data_len < total_size */
+ VAL_TEST_IDX4, {VAL_ITS_GET, VAL_PS_GET}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX5, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Call get API with offset = total data_size + 1 */
+ VAL_TEST_IDX6, {VAL_ITS_GET, VAL_PS_GET}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX7, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* get API with offset = total data_size */
+ VAL_TEST_IDX8, {VAL_ITS_GET, VAL_PS_GET}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX9, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Call get API with invalid data len and offset zero */
+ VAL_TEST_IDX10, {VAL_ITS_GET, VAL_PS_GET}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX11, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Call get API with offset = MAX_UINT32 */
+ VAL_TEST_IDX12, {VAL_ITS_GET, VAL_PS_GET}, PSA_ERROR_INVALID_ARGUMENT
+},
+{
+ /* Remove the storage entity */
+ VAL_TEST_IDX13, {VAL_ITS_REMOVE, VAL_PS_REMOVE}, PSA_SUCCESS
+},
+};
+#endif /* _S008_TEST_DATA_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s008/test_entry_s008.c b/api-tests/dev_apis/storage/test_s008/test_entry_s008.c
similarity index 89%
rename from api-tests/dev_apis/internal_trusted_storage/test_s008/test_entry_s008.c
rename to api-tests/dev_apis/storage/test_s008/test_entry_s008.c
index f531881..98540df 100755
--- a/api-tests/dev_apis/internal_trusted_storage/test_s008/test_entry_s008.c
+++ b/api-tests/dev_apis/storage/test_s008/test_entry_s008.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");
@@ -41,7 +41,7 @@
}
/* Execute list of tests available in test[num]_secure_storage_list from Non-secure side*/
- status = val->execute_non_secure_tests(TEST_NUM, test_s008_sst_list, FALSE);
+ status = val->execute_non_secure_tests(TEST_NUM, s008_storage_test_list, FALSE);
if (VAL_ERROR(status))
{
diff --git a/api-tests/dev_apis/storage/test_s008/test_s008.c b/api-tests/dev_apis/storage/test_s008/test_s008.c
new file mode 100644
index 0000000..a3ac971
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s008/test_s008.c
@@ -0,0 +1,156 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+
+#include "val_interfaces.h"
+#include "val_target.h"
+#include "test_s008.h"
+#include "test_data.h"
+
+#define TEST_BUFF_SIZE 20
+#define TEST_MAX_UINT32 0xFFFFFFFF
+
+const client_test_t s008_storage_test_list[] = {
+ NULL,
+ s008_storage_test,
+ NULL,
+};
+
+static psa_storage_uid_t uid = UID_BASE_VALUE + 5;
+static uint8_t read_buff[TEST_BUFF_SIZE];
+static uint8_t write_buff[TEST_BUFF_SIZE] = {0x99, 0x01, 0x02, 0x03, 0x04,
+ 0x23, 0xF6, 0x07, 0x08, 0x0D,
+ 0x70, 0xA1, 0xFF, 0xFF, 0x14,
+ 0x73, 0x46, 0x97, 0xE8, 0xDD};
+
+static int32_t psa_sst_invalid_offset_failure(storage_function_code_t fCode)
+{
+ uint32_t j, p_data_length = 0;
+ int32_t status;
+
+ /* Case where offset = data_size +1 , data_len 0. Also check nothing is returned in read buff */
+ val->print(PRINT_TEST, "[Check 2] Try to access data with varying invalid offset\n", 0);
+ memset(read_buff, 0, TEST_BUFF_SIZE);
+ status = STORAGE_FUNCTION(s008_data[VAL_TEST_IDX6].api[fCode], uid, TEST_BUFF_SIZE+1, 0,
+ read_buff, &p_data_length);
+ TEST_ASSERT_NOT_EQUAL(status, s008_data[VAL_TEST_IDX6].status, TEST_CHECKPOINT_NUM(8));
+ TEST_ASSERT_EQUAL(p_data_length, 0, TEST_CHECKPOINT_NUM(9));
+ for (j = 0; j < TEST_BUFF_SIZE; j++)
+ {
+ TEST_ASSERT_EQUAL(read_buff[j], 0x00, TEST_CHECKPOINT_NUM(10));
+ }
+
+ /* Case where offset = data_size , data_len= 1 Also check nothing is returned in read buff */
+ memset(read_buff, 0xCD, TEST_BUFF_SIZE);
+ p_data_length = 0xFF;
+ status = STORAGE_FUNCTION(s008_data[VAL_TEST_IDX8].api[fCode], uid, TEST_BUFF_SIZE, 1,
+ read_buff, &p_data_length);
+ TEST_ASSERT_EQUAL(status, s008_data[VAL_TEST_IDX8].status, TEST_CHECKPOINT_NUM(11));
+ TEST_ASSERT_EQUAL(p_data_length, 0, TEST_CHECKPOINT_NUM(12));
+
+ /* Case where offset = 0, data_len > data_size, check if just data_size is returned */
+ status = STORAGE_FUNCTION(s008_data[VAL_TEST_IDX10].api[fCode], uid, 0, TEST_BUFF_SIZE+1,
+ read_buff, &p_data_length);
+ TEST_ASSERT_EQUAL(status, s008_data[VAL_TEST_IDX10].status, TEST_CHECKPOINT_NUM(13));
+ TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(14));
+ TEST_ASSERT_MEMCMP(read_buff, write_buff, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(15));
+
+ /* Try to access data with offset as MAX_UINT32 and length less than buffer size */
+ status = STORAGE_FUNCTION(s008_data[VAL_TEST_IDX12].api[fCode], uid, TEST_MAX_UINT32,
+ TEST_BUFF_SIZE/2, read_buff, &p_data_length);
+ TEST_ASSERT_EQUAL(status, s008_data[VAL_TEST_IDX12].status, TEST_CHECKPOINT_NUM(16));
+
+ /* Remove the UID */
+ status = STORAGE_FUNCTION(s008_data[VAL_TEST_IDX13].api[fCode], uid);
+ TEST_ASSERT_EQUAL(status, s008_data[VAL_TEST_IDX13].status, TEST_CHECKPOINT_NUM(17));
+
+ return VAL_STATUS_SUCCESS;
+}
+
+static int32_t psa_sst_valid_offset_success(storage_function_code_t fCode)
+{
+ int32_t status;
+ uint32_t data_len, offset = TEST_BUFF_SIZE;
+ uint32_t p_data_length = 0;
+
+ /* Set data for UID */
+ status = STORAGE_FUNCTION(s008_data[VAL_TEST_IDX1].api[fCode], uid, TEST_BUFF_SIZE, write_buff,
+ PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s008_data[VAL_TEST_IDX1].status, TEST_CHECKPOINT_NUM(1));
+
+ /* Case where offset + datalen = data_size */
+ val->print(PRINT_TEST, "[Check 1] Try to access data with varying valid offset\n", 0);
+ while (offset > 0)
+ {
+ data_len = TEST_BUFF_SIZE - offset;
+ memset(read_buff, 0, TEST_BUFF_SIZE);
+ status = STORAGE_FUNCTION(s008_data[VAL_TEST_IDX2].api[fCode], uid, offset, data_len,
+ read_buff, &p_data_length);
+ TEST_ASSERT_EQUAL(status, s008_data[VAL_TEST_IDX2].status, TEST_CHECKPOINT_NUM(2));
+ TEST_ASSERT_MEMCMP(read_buff, write_buff + offset, data_len, TEST_CHECKPOINT_NUM(3));
+ TEST_ASSERT_EQUAL(p_data_length, data_len, TEST_CHECKPOINT_NUM(4));
+ offset >>= 1;
+ }
+
+ offset = TEST_BUFF_SIZE - 2;
+ data_len = 1;
+ /* Case where offset + datalen < data_size */
+ while (offset > 0)
+ {
+ status = STORAGE_FUNCTION(s008_data[VAL_TEST_IDX4].api[fCode], uid, offset, data_len,
+ read_buff, &p_data_length);
+ TEST_ASSERT_EQUAL(status, s008_data[VAL_TEST_IDX4].status, TEST_CHECKPOINT_NUM(5));
+ TEST_ASSERT_MEMCMP(read_buff, write_buff + offset, data_len, TEST_CHECKPOINT_NUM(6));
+ TEST_ASSERT_EQUAL(p_data_length, data_len, TEST_CHECKPOINT_NUM(7));
+ offset >>= 1;
+ data_len <<= 1;
+ }
+
+ return VAL_STATUS_SUCCESS;
+}
+
+int32_t s008_storage_test(caller_security_t caller)
+{
+ int32_t status;
+
+#if defined(STORAGE) || defined(INTERNAL_TRUSTED_STORAGE)
+ val->print(PRINT_TEST, ITS_TEST_MESSAGE, 0);
+ status = psa_sst_valid_offset_success(VAL_ITS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+
+ status = psa_sst_invalid_offset_failure(VAL_ITS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+#endif
+
+#if defined(STORAGE) || defined(PROTECTED_STORAGE)
+ val->print(PRINT_TEST, PS_TEST_MESSAGE, 0);
+ status = psa_sst_valid_offset_success(VAL_PS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+
+ status = psa_sst_invalid_offset_failure(VAL_PS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+#endif
+
+ return VAL_STATUS_SUCCESS;
+}
diff --git a/api-tests/dev_apis/storage/test_s008/test_s008.h b/api-tests/dev_apis/storage/test_s008/test_s008.h
new file mode 100644
index 0000000..8c51dc4
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s008/test_s008.h
@@ -0,0 +1,28 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+#ifndef _TEST_S008_CLIENT_TESTS_H_
+#define _TEST_S008_CLIENT_TESTS_H_
+
+#define test_entry CONCAT(test_entry_, s008)
+
+#include "test_storage_common.h"
+
+extern const client_test_t s008_storage_test_list[];
+
+int32_t s008_storage_test(caller_security_t caller);
+
+#endif /* _TEST_S008_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_s009/test.cmake b/api-tests/dev_apis/storage/test_s009/test.cmake
similarity index 86%
rename from api-tests/dev_apis/protected_storage/test_s009/test.cmake
rename to api-tests/dev_apis/storage/test_s009/test.cmake
index 9d66436..729f5bf 100644
--- a/api-tests/dev_apis/protected_storage/test_s009/test.cmake
+++ b/api-tests/dev_apis/storage/test_s009/test.cmake
@@ -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");
@@ -19,6 +19,6 @@
test_entry_s009.c
test_s009.c
)
-list(APPEND CC_OPTIONS -DPS_TEST)
+list(APPEND CC_OPTIONS )
list(APPEND AS_SOURCE )
list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/storage/test_s009/test_data.h b/api-tests/dev_apis/storage/test_s009/test_data.h
new file mode 100644
index 0000000..1561048
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s009/test_data.h
@@ -0,0 +1,71 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+#ifndef _S009_TEST_DATA_H_
+#define _S009_TEST_DATA_H_
+
+#include "test_s009.h"
+
+static struct psa_storage_info_t info;
+static const test_data_t s009_data[] = {
+{
+ VAL_TEST_IDX0, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Call set API with NULL write buffer and 0 length */
+ VAL_TEST_IDX1, {VAL_ITS_SET, VAL_PS_SET}, PSA_SUCCESS
+},
+{
+ /* Verify UID is created */
+ VAL_TEST_IDX2, {VAL_ITS_GET_INFO, VAL_PS_GET_INFO}, PSA_SUCCESS
+},
+{
+ /* Call get API with NULL write buffer and 0 length */
+ VAL_TEST_IDX3, {VAL_ITS_GET, VAL_PS_GET}, PSA_SUCCESS
+},
+{
+ /* Remove the storage entity */
+ VAL_TEST_IDX4, {VAL_ITS_REMOVE, VAL_PS_REMOVE}, PSA_SUCCESS
+},
+{
+ /* Verify UID is removed */
+ VAL_TEST_IDX5, {VAL_ITS_GET_INFO, VAL_PS_GET_INFO}, PSA_ERROR_DOES_NOT_EXIST
+},
+{
+ /* Create storage of zero size and valid write buffer */
+ VAL_TEST_IDX6, {VAL_ITS_SET, VAL_PS_SET}, PSA_SUCCESS
+},
+{
+ /* Call get_info API to check data size */
+ VAL_TEST_IDX7, {VAL_ITS_GET_INFO, VAL_PS_GET_INFO}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX8, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Call get API with 0 length and NULL read buffer */
+ VAL_TEST_IDX9, {VAL_ITS_GET, VAL_PS_GET}, PSA_SUCCESS
+},
+{
+ /* Increase the asset size */
+ VAL_TEST_IDX10, {VAL_ITS_SET, VAL_PS_SET}, PSA_SUCCESS
+},
+{
+ /* Remove the storage entity */
+ VAL_TEST_IDX11, {VAL_ITS_REMOVE, VAL_PS_REMOVE}, PSA_SUCCESS
+},
+};
+#endif /* _S009_TEST_DATA_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s009/test_entry_s009.c b/api-tests/dev_apis/storage/test_s009/test_entry_s009.c
similarity index 94%
rename from api-tests/dev_apis/internal_trusted_storage/test_s009/test_entry_s009.c
rename to api-tests/dev_apis/storage/test_s009/test_entry_s009.c
index 37883fb..6a1da17 100755
--- a/api-tests/dev_apis/internal_trusted_storage/test_s009/test_entry_s009.c
+++ b/api-tests/dev_apis/storage/test_s009/test_entry_s009.c
@@ -41,7 +41,7 @@
}
/* Execute list of tests available in test[num]_secure_storage_list from Non-secure side*/
- status = val->execute_non_secure_tests(TEST_NUM, test_s009_sst_list, FALSE);
+ status = val->execute_non_secure_tests(TEST_NUM, s009_storage_test_list, FALSE);
if (VAL_ERROR(status))
{
diff --git a/api-tests/dev_apis/storage/test_s009/test_s009.c b/api-tests/dev_apis/storage/test_s009/test_s009.c
new file mode 100644
index 0000000..e767f10
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s009/test_s009.c
@@ -0,0 +1,119 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+
+#include "val_interfaces.h"
+#include "val_target.h"
+#include "test_s009.h"
+#include "test_data.h"
+
+#define TEST_BUFF_SIZE 20
+
+const client_test_t s009_storage_test_list[] = {
+ NULL,
+ s009_storage_test,
+ NULL,
+};
+
+static psa_storage_uid_t uid = UID_BASE_VALUE + 5;
+static uint8_t write_buff[TEST_BUFF_SIZE] = {0x99, 0x01, 0x02, 0x03, 0x04,
+ 0x23, 0xF6, 0x07, 0x08, 0x0D,
+ 0x70, 0xA1, 0xFF, 0xFF, 0x14,
+ 0x73, 0x46, 0x97, 0xE8, 0xDD};
+
+static int32_t psa_sst_zero_length_check(storage_function_code_t fCode)
+{
+ int32_t status;
+ uint32_t p_data_length = 0;
+
+ /* Set data for UID with length 0 and NULL pointer */
+ val->print(PRINT_TEST, "[Check 1] Call set API with NULL pointer and data length 0\n", 0);
+ status = STORAGE_FUNCTION(s009_data[VAL_TEST_IDX1].api[fCode], uid, 0, NULL,
+ PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s009_data[VAL_TEST_IDX1].status, TEST_CHECKPOINT_NUM(1));
+
+ /* Call the get_info function to verify UID created */
+ status = STORAGE_FUNCTION(s009_data[VAL_TEST_IDX2].api[fCode], uid, &info);
+ TEST_ASSERT_EQUAL(status, s009_data[VAL_TEST_IDX2].status, TEST_CHECKPOINT_NUM(2));
+
+ /* Call get API with NULL read buffer */
+ val->print(PRINT_TEST, "[Check 2] Call get API with NULL read buffer and data length 0\n", 0);
+ status = STORAGE_FUNCTION(s009_data[VAL_TEST_IDX3].api[fCode], uid, 0, 0, NULL, &p_data_length);
+ TEST_ASSERT_EQUAL(status, s009_data[VAL_TEST_IDX3].status, TEST_CHECKPOINT_NUM(3));
+ TEST_ASSERT_EQUAL(p_data_length, 0, TEST_CHECKPOINT_NUM(4));
+
+ /* Remove the UID */
+ val->print(PRINT_TEST, "[Check 3] Remove the UID\n", 0);
+ status = STORAGE_FUNCTION(s009_data[VAL_TEST_IDX4].api[fCode], uid);
+ TEST_ASSERT_EQUAL(status, s009_data[VAL_TEST_IDX4].status, TEST_CHECKPOINT_NUM(5));
+
+ /* Call the get_info function to verify UID is removed */
+ val->print(PRINT_TEST, "[Check 4] Call get_info API to verify UID removed\n", 0);
+ status = STORAGE_FUNCTION(s009_data[VAL_TEST_IDX5].api[fCode], uid, &info);
+ TEST_ASSERT_EQUAL(status, s009_data[VAL_TEST_IDX5].status, TEST_CHECKPOINT_NUM(6));
+
+ /* Create UID with length 0 and valid write buffer */
+ val->print(PRINT_TEST, "[Check 5] Create UID with zero data_len and valid write buffer\n", 0);
+ status = STORAGE_FUNCTION(s009_data[VAL_TEST_IDX6].api[fCode], uid, 0, write_buff,
+ PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s009_data[VAL_TEST_IDX6].status, TEST_CHECKPOINT_NUM(7));
+
+ /* Call the get_info function and match the attributes */
+ status = STORAGE_FUNCTION(s009_data[VAL_TEST_IDX7].api[fCode], uid, &info);
+ TEST_ASSERT_EQUAL(status, s009_data[VAL_TEST_IDX7].status, TEST_CHECKPOINT_NUM(8));
+ TEST_ASSERT_EQUAL(info.size, 0, TEST_CHECKPOINT_NUM(9));
+
+ /* Call get API with NULL read buffer and valid UID */
+ val->print(PRINT_TEST, "[Check 8] Call get API with NULL read buffer and data length 0\n", 0);
+ status = STORAGE_FUNCTION(s009_data[VAL_TEST_IDX9].api[fCode], uid, 0, 0, NULL, &p_data_length);
+ TEST_ASSERT_EQUAL(status, s009_data[VAL_TEST_IDX9].status, TEST_CHECKPOINT_NUM(10));
+ TEST_ASSERT_EQUAL(p_data_length, 0, TEST_CHECKPOINT_NUM(11));
+
+ /* Change the length to test_buff_size */
+ val->print(PRINT_TEST, "[Check 9] Increase the length\n", 0);
+ status = STORAGE_FUNCTION(s009_data[VAL_TEST_IDX10].api[fCode], uid, TEST_BUFF_SIZE, write_buff,
+ PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s009_data[VAL_TEST_IDX10].status, TEST_CHECKPOINT_NUM(12));
+
+ /* Remove the UID */
+ status = STORAGE_FUNCTION(s009_data[VAL_TEST_IDX11].api[fCode], uid);
+ TEST_ASSERT_EQUAL(status, s009_data[VAL_TEST_IDX11].status, TEST_CHECKPOINT_NUM(13));
+
+ return VAL_STATUS_SUCCESS;
+}
+
+int32_t s009_storage_test(caller_security_t caller)
+{
+ int32_t status;
+
+#if defined(STORAGE) || defined(INTERNAL_TRUSTED_STORAGE)
+ val->print(PRINT_TEST, ITS_TEST_MESSAGE, 0);
+ status = psa_sst_zero_length_check(VAL_ITS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+#endif
+
+#if defined(STORAGE) || defined(PROTECTED_STORAGE)
+ val->print(PRINT_TEST, PS_TEST_MESSAGE, 0);
+ status = psa_sst_zero_length_check(VAL_PS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+#endif
+
+ return VAL_STATUS_SUCCESS;
+}
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s009/test_s009.h b/api-tests/dev_apis/storage/test_s009/test_s009.h
similarity index 61%
rename from api-tests/dev_apis/internal_trusted_storage/test_s009/test_s009.h
rename to api-tests/dev_apis/storage/test_s009/test_s009.h
index f1c396a..b34a1bc 100755
--- a/api-tests/dev_apis/internal_trusted_storage/test_s009/test_s009.h
+++ b/api-tests/dev_apis/storage/test_s009/test_s009.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");
@@ -17,20 +17,12 @@
#ifndef _TEST_S009_CLIENT_TESTS_H_
#define _TEST_S009_CLIENT_TESTS_H_
-#ifdef ITS_TEST
-#define VAL_STORAGE_BASE VAL_INTERNAL_TRUSTED_STORAGE_BASE
#define test_entry CONCAT(test_entry_, s009)
-#elif PS_TEST
-#define VAL_STORAGE_BASE VAL_PROTECTED_STORAGE_BASE
-#define test_entry CONCAT(test_entry_, p009)
-#endif
-#define val CONCAT(val, test_entry)
-#define psa CONCAT(psa, test_entry)
-extern val_api_t *val;
-extern psa_api_t *psa;
-extern client_test_t test_s009_sst_list[];
+#include "test_storage_common.h"
-int32_t psa_sst_zero_length_check(caller_security_t caller);
+extern const client_test_t s009_storage_test_list[];
+
+int32_t s009_storage_test(caller_security_t caller);
#endif /* _TEST_S009_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s010/test.cmake b/api-tests/dev_apis/storage/test_s010/test.cmake
similarity index 86%
rename from api-tests/dev_apis/internal_trusted_storage/test_s010/test.cmake
rename to api-tests/dev_apis/storage/test_s010/test.cmake
index 4c3dc6a..983eefa 100644
--- a/api-tests/dev_apis/internal_trusted_storage/test_s010/test.cmake
+++ b/api-tests/dev_apis/storage/test_s010/test.cmake
@@ -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");
@@ -19,6 +19,6 @@
test_entry_s010.c
test_s010.c
)
-list(APPEND CC_OPTIONS -DITS_TEST)
+list(APPEND CC_OPTIONS )
list(APPEND AS_SOURCE )
list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/storage/test_s010/test_data.h b/api-tests/dev_apis/storage/test_s010/test_data.h
new file mode 100644
index 0000000..1caf600
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s010/test_data.h
@@ -0,0 +1,36 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+#ifndef _S010_TEST_DATA_H_
+#define _S010_TEST_DATA_H_
+
+#include "test_s010.h"
+
+static const test_data_t s010_data[] = {
+{
+ /* Create with UID value zero should fail */
+ VAL_TEST_IDX0, {VAL_ITS_SET, VAL_PS_SET}, PSA_ERROR_INVALID_ARGUMENT
+},
+{
+ /* Call to get_info API for UID 0 should fail */
+ VAL_TEST_IDX1, {VAL_ITS_GET_INFO, VAL_PS_GET_INFO}, PSA_ERROR_INVALID_ARGUMENT
+},
+{
+ /* Call to remove API UID value zero should fail */
+ VAL_TEST_IDX2, {VAL_ITS_REMOVE, VAL_PS_REMOVE}, PSA_ERROR_INVALID_ARGUMENT
+},
+};
+#endif /* _S010_TEST_DATA_H_ */
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s010/test_entry_s010.c b/api-tests/dev_apis/storage/test_s010/test_entry_s010.c
similarity index 89%
rename from api-tests/dev_apis/internal_trusted_storage/test_s010/test_entry_s010.c
rename to api-tests/dev_apis/storage/test_s010/test_entry_s010.c
index 82623c6..8cdd70b 100644
--- a/api-tests/dev_apis/internal_trusted_storage/test_s010/test_entry_s010.c
+++ b/api-tests/dev_apis/storage/test_s010/test_entry_s010.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");
@@ -41,7 +41,7 @@
}
/* Execute list of tests available in test[num]_secure_storage_list from Non-secure side*/
- status = val->execute_non_secure_tests(TEST_NUM, test_s010_sst_list, FALSE);
+ status = val->execute_non_secure_tests(TEST_NUM, s010_storage_test_list, FALSE);
if (VAL_ERROR(status))
{
diff --git a/api-tests/dev_apis/storage/test_s010/test_s010.c b/api-tests/dev_apis/storage/test_s010/test_s010.c
new file mode 100644
index 0000000..abcdb12
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s010/test_s010.c
@@ -0,0 +1,79 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+
+#include "val_interfaces.h"
+#include "val_target.h"
+#include "test_s010.h"
+#include "test_data.h"
+
+#define TEST_BUFF_SIZE 1
+
+const client_test_t s010_storage_test_list[] = {
+ NULL,
+ s010_storage_test,
+ NULL,
+};
+
+static uint8_t write_buff[TEST_BUFF_SIZE] = {0xFF};
+
+int32_t psa_sst_uid_value_zero_check(storage_function_code_t fCode)
+{
+ int32_t status;
+ psa_storage_uid_t uid = 0;
+ struct psa_storage_info_t info;
+
+ /* Set with UID value zero should fail */
+ val->print(PRINT_TEST, "[Check 1] Creating storage with UID 0 should fail\n", 0);
+ status = STORAGE_FUNCTION(s010_data[VAL_TEST_IDX0].api[fCode], uid, TEST_BUFF_SIZE,
+ write_buff, PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s010_data[VAL_TEST_IDX0].status, TEST_CHECKPOINT_NUM(1));
+
+ /* Call to get_info call with UID zero should fail */
+ val->print(PRINT_TEST, "[Check 2] Get_info for UID 0 should fail\n", 0);
+ status = STORAGE_FUNCTION(s010_data[VAL_TEST_IDX1].api[fCode], uid, &info);
+ TEST_ASSERT_EQUAL(status, s010_data[VAL_TEST_IDX1].status, TEST_CHECKPOINT_NUM(2));
+
+ /* UID removal should fail */
+ val->print(PRINT_TEST, "[Check 3] Removing storage with UID 0 should fail\n", 0);
+ status = STORAGE_FUNCTION(s010_data[VAL_TEST_IDX2].api[fCode], uid);
+ TEST_ASSERT_EQUAL(status, s010_data[VAL_TEST_IDX2].status, TEST_CHECKPOINT_NUM(3));
+
+ return VAL_STATUS_SUCCESS;
+}
+
+int32_t s010_storage_test(caller_security_t caller)
+{
+ int32_t status;
+
+#if defined(STORAGE) || defined(INTERNAL_TRUSTED_STORAGE)
+ val->print(PRINT_TEST, ITS_TEST_MESSAGE, 0);
+ status = psa_sst_uid_value_zero_check(VAL_ITS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+#endif
+
+#if defined(STORAGE) || defined(PROTECTED_STORAGE)
+ val->print(PRINT_TEST, PS_TEST_MESSAGE, 0);
+ status = psa_sst_uid_value_zero_check(VAL_PS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+#endif
+
+ return VAL_STATUS_SUCCESS;
+}
diff --git a/api-tests/dev_apis/internal_trusted_storage/test_s010/test_s010.h b/api-tests/dev_apis/storage/test_s010/test_s010.h
similarity index 60%
rename from api-tests/dev_apis/internal_trusted_storage/test_s010/test_s010.h
rename to api-tests/dev_apis/storage/test_s010/test_s010.h
index ef4202e..61b5eaa 100644
--- a/api-tests/dev_apis/internal_trusted_storage/test_s010/test_s010.h
+++ b/api-tests/dev_apis/storage/test_s010/test_s010.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");
@@ -17,19 +17,12 @@
#ifndef _TEST_S010_CLIENT_TESTS_H_
#define _TEST_S010_CLIENT_TESTS_H_
-#ifdef ITS_TEST
-#define VAL_STORAGE_BASE VAL_INTERNAL_TRUSTED_STORAGE_BASE
#define test_entry CONCAT(test_entry_, s010)
-#elif PS_TEST
-#define VAL_STORAGE_BASE VAL_PROTECTED_STORAGE_BASE
-#define test_entry CONCAT(test_entry_, p010)
-#endif
-#define val CONCAT(val, test_entry)
-#define psa CONCAT(psa, test_entry)
-extern val_api_t *val;
-extern psa_api_t *psa;
-extern client_test_t test_s010_sst_list[];
+#include "test_storage_common.h"
-int32_t psa_sst_uid_value_zero_check(caller_security_t caller);
+extern const client_test_t s010_storage_test_list[];
+
+int32_t s010_storage_test(caller_security_t caller);
+
#endif /* _TEST_S010_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_s009/test.cmake b/api-tests/dev_apis/storage/test_s011/test.cmake
similarity index 82%
copy from api-tests/dev_apis/protected_storage/test_s009/test.cmake
copy to api-tests/dev_apis/storage/test_s011/test.cmake
index 9d66436..d776d75 100644
--- a/api-tests/dev_apis/protected_storage/test_s009/test.cmake
+++ b/api-tests/dev_apis/storage/test_s011/test.cmake
@@ -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");
@@ -16,9 +16,9 @@
#**/
list(APPEND CC_SOURCE
- test_entry_s009.c
- test_s009.c
+ test_entry_s011.c
+ test_s011.c
)
-list(APPEND CC_OPTIONS -DPS_TEST)
+list(APPEND CC_OPTIONS )
list(APPEND AS_SOURCE )
list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/storage/test_s011/test_data.h b/api-tests/dev_apis/storage/test_s011/test_data.h
new file mode 100644
index 0000000..4921d2d
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s011/test_data.h
@@ -0,0 +1,81 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+#ifndef _S011_TEST_DATA_H_
+#define _S011_TEST_DATA_H_
+
+#include "test_s011.h"
+
+static const test_data_t s011_data[] = {
+{
+ /* Check if optional PS API supported */
+ VAL_TEST_IDX0, {VAL_API_UNUSED, VAL_PS_GET_SUPPORT}, PSA_STORAGE_SUPPORT_SET_EXTENDED
+},
+{
+ /* Call set_extended call for non-existing UID */
+ VAL_TEST_IDX1, {VAL_API_UNUSED, VAL_PS_SET_EXTENDED}, PSA_ERROR_DOES_NOT_EXIST
+},
+{
+ /* Create valid storage using set API */
+ VAL_TEST_IDX2, {VAL_API_UNUSED, VAL_PS_SET}, PSA_SUCCESS
+},
+{
+ /* Create API for present UID with different length */
+ VAL_TEST_IDX3, {VAL_API_UNUSED, VAL_PS_CREATE}, PSA_ERROR_INVALID_ARGUMENT
+},
+{
+ /* Call create API for to set WRITE_ONCE flag */
+ VAL_TEST_IDX4, {VAL_API_UNUSED, VAL_PS_CREATE}, PSA_ERROR_INVALID_ARGUMENT
+},
+{
+ /* Validate existing UID attributes maintained */
+ VAL_TEST_IDX5, {VAL_API_UNUSED, VAL_PS_GET_INFO}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX6, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ VAL_TEST_IDX7, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Remove the UID */
+ VAL_TEST_IDX8, {VAL_API_UNUSED, VAL_PS_REMOVE}, PSA_SUCCESS
+},
+{
+ /* Create valid storage using create API */
+ VAL_TEST_IDX9, {VAL_API_UNUSED, VAL_PS_CREATE}, PSA_SUCCESS
+},
+{
+ /* Again call create API with different length */
+ VAL_TEST_IDX10, {VAL_API_UNUSED, VAL_PS_CREATE}, PSA_ERROR_INVALID_ARGUMENT
+},
+{
+ /* Validate the storage is empty */
+ VAL_TEST_IDX11, {VAL_API_UNUSED, VAL_PS_GET}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX12, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Remove the UID */
+ VAL_TEST_IDX13, {VAL_API_UNUSED, VAL_PS_REMOVE}, PSA_SUCCESS
+},
+{
+ /* Set_extended call for removed UID */
+ VAL_TEST_IDX14, {VAL_API_UNUSED, VAL_PS_SET_EXTENDED}, PSA_ERROR_DOES_NOT_EXIST
+}
+};
+#endif /* _S011_TEST_DATA_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_p011/test_entry_p011.c b/api-tests/dev_apis/storage/test_s011/test_entry_s011.c
similarity index 83%
rename from api-tests/dev_apis/protected_storage/test_p011/test_entry_p011.c
rename to api-tests/dev_apis/storage/test_s011/test_entry_s011.c
index daa7ef2..082eea4 100644
--- a/api-tests/dev_apis/protected_storage/test_p011/test_entry_p011.c
+++ b/api-tests/dev_apis/storage/test_s011/test_entry_s011.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");
@@ -17,9 +17,9 @@
#include "val_interfaces.h"
#include "val_target.h"
-#include "test_p011.h"
+#include "test_s011.h"
-#define TEST_NUM VAL_CREATE_TEST_ID(VAL_PROTECTED_STORAGE_BASE, 11)
+#define TEST_NUM VAL_CREATE_TEST_ID(VAL_STORAGE_BASE, 11)
#define TEST_DESC "Optional APIs: UID not found check\n"
TEST_PUBLISH(TEST_NUM, test_entry);
@@ -41,7 +41,7 @@
}
/* Execute list of tests available in test[num]_protected_storage_list from Non-secure side*/
- status = val->execute_non_secure_tests(TEST_NUM, test_p011_sst_list, FALSE);
+ status = val->execute_non_secure_tests(TEST_NUM, s011_storage_test_list, FALSE);
if (VAL_ERROR(status))
{
diff --git a/api-tests/dev_apis/storage/test_s011/test_s011.c b/api-tests/dev_apis/storage/test_s011/test_s011.c
new file mode 100644
index 0000000..a18bb65
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s011/test_s011.c
@@ -0,0 +1,146 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+
+#include "val_interfaces.h"
+#include "val_target.h"
+#include "test_s011.h"
+#include "test_data.h"
+
+#define TEST_BUFF_SIZE 16
+
+const client_test_t s011_storage_test_list[] = {
+ NULL,
+ s011_storage_test,
+ NULL,
+};
+
+static uint8_t write_buff[TEST_BUFF_SIZE] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F};
+static uint8_t read_buff[TEST_BUFF_SIZE] = {0};
+
+static int32_t psa_sst_uid_not_found(storage_function_code_t fCode)
+{
+ int32_t status;
+ uint32_t j, p_data_length = 0;
+ psa_storage_uid_t p_uid = UID_BASE_VALUE + 5;
+ struct psa_storage_info_t orig_info;
+
+ /* Call the set_extended API with UID which is not created */
+ val->print(PRINT_TEST, "[Check 1] Call set_extended API for UID %d which is not set\n", p_uid);
+ status = STORAGE_FUNCTION(s011_data[VAL_TEST_IDX1].api[fCode], p_uid, 0, TEST_BUFF_SIZE,
+ write_buff);
+ TEST_ASSERT_EQUAL(status, s011_data[VAL_TEST_IDX1].status, TEST_CHECKPOINT_NUM(1));
+
+ /* Create a valid storage with set API */
+ status = STORAGE_FUNCTION(s011_data[VAL_TEST_IDX2].api[fCode], p_uid, TEST_BUFF_SIZE,
+ write_buff, PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s011_data[VAL_TEST_IDX2].status, TEST_CHECKPOINT_NUM(2));
+
+ /* Try to change data length for same UID using create API */
+ val->print(PRINT_TEST, "[Check 2] Call create API with length different than original\n", 0);
+ status = STORAGE_FUNCTION(s011_data[VAL_TEST_IDX3].api[fCode], p_uid, TEST_BUFF_SIZE/2,
+ PSA_STORAGE_FLAG_WRITE_ONCE);
+ TEST_ASSERT_EQUAL(status, s011_data[VAL_TEST_IDX3].status, TEST_CHECKPOINT_NUM(3));
+
+ /* Try to change flag value associated with the UID */
+ val->print(PRINT_TEST, "[Check 3] Call create API with flag value different than original\n",
+ 0);
+ status = STORAGE_FUNCTION(s011_data[VAL_TEST_IDX4].api[fCode], p_uid, TEST_BUFF_SIZE,
+ PSA_STORAGE_FLAG_WRITE_ONCE);
+ TEST_ASSERT_EQUAL(status, s011_data[VAL_TEST_IDX4].status, TEST_CHECKPOINT_NUM(4));
+
+ /* Check the flag value should be same as original*/
+ status = STORAGE_FUNCTION(s011_data[VAL_TEST_IDX5].api[fCode], p_uid, &orig_info);
+ TEST_ASSERT_EQUAL(status, s011_data[VAL_TEST_IDX5].status, TEST_CHECKPOINT_NUM(5));
+ TEST_ASSERT_EQUAL(orig_info.size, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(6));
+ TEST_ASSERT_EQUAL(orig_info.flags, PSA_STORAGE_FLAG_NONE, TEST_CHECKPOINT_NUM(7));
+
+ /* Remove the UID */
+ status = STORAGE_FUNCTION(s011_data[VAL_TEST_IDX8].api[fCode], p_uid);
+ TEST_ASSERT_EQUAL(status, s011_data[VAL_TEST_IDX8].status, TEST_CHECKPOINT_NUM(8));
+
+ /* Create a valid storage */
+ status = STORAGE_FUNCTION(s011_data[VAL_TEST_IDX9].api[fCode], p_uid, TEST_BUFF_SIZE/2,
+ PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s011_data[VAL_TEST_IDX9].status, TEST_CHECKPOINT_NUM(9));
+
+ /* Try to change length using create API */
+ val->print(PRINT_TEST, "[Check 4] Call create API with parameters different than original\n",
+ 0);
+ status = STORAGE_FUNCTION(s011_data[VAL_TEST_IDX10].api[fCode], p_uid, TEST_BUFF_SIZE,
+ PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s011_data[VAL_TEST_IDX10].status, TEST_CHECKPOINT_NUM(10));
+
+ /* Check the storage should be empty */
+ status = STORAGE_FUNCTION(s011_data[VAL_TEST_IDX11].api[fCode], p_uid, 0, TEST_BUFF_SIZE,
+ read_buff, &p_data_length);
+ TEST_ASSERT_EQUAL(status, s011_data[VAL_TEST_IDX11].status, TEST_CHECKPOINT_NUM(11));
+ for (j = 0; j < TEST_BUFF_SIZE; j++)
+ {
+ TEST_ASSERT_EQUAL(read_buff[j], 0, TEST_CHECKPOINT_NUM(12));
+ }
+ TEST_ASSERT_EQUAL(p_data_length, 0, TEST_CHECKPOINT_NUM(13));
+
+ /* Remove the UID */
+ status = STORAGE_FUNCTION(s011_data[VAL_TEST_IDX13].api[fCode], p_uid);
+ TEST_ASSERT_EQUAL(status, s011_data[VAL_TEST_IDX13].status, TEST_CHECKPOINT_NUM(14));
+
+ /* Call the set_extended API with UID which is removed */
+ val->print(PRINT_TEST, "[Check 5] Call set_extended API for UID %d which is removed\n", p_uid);
+ status = STORAGE_FUNCTION(s011_data[VAL_TEST_IDX14].api[fCode], p_uid, 0, TEST_BUFF_SIZE,
+ write_buff);
+ TEST_ASSERT_EQUAL(status, s011_data[VAL_TEST_IDX14].status, TEST_CHECKPOINT_NUM(15));
+
+ return VAL_STATUS_SUCCESS;
+}
+
+static int32_t psa_sst_optional_api_uid_not_found(storage_function_code_t fCode)
+{
+ uint32_t status;
+ int32_t test_status;
+
+ /* Call the get_support API and check if create and set_extended API are supported */
+ status = STORAGE_FUNCTION(s011_data[VAL_TEST_IDX0].api[fCode]);
+
+ if (status == s011_data[VAL_TEST_IDX0].status)
+ {
+ val->print(PRINT_INFO, "Optional PS APIs are supported.\n", 0);
+ test_status = psa_sst_uid_not_found(fCode);
+ if (test_status != VAL_STATUS_SUCCESS)
+ return test_status;
+ }
+ else
+ {
+ val->print(PRINT_TEST, "Test Case skipped as Optional PS APIs are not supported.\n", 0);
+ return RESULT_SKIP(VAL_STATUS_UNSUPPORTED);
+ }
+
+ return VAL_STATUS_SUCCESS;
+}
+
+int32_t s011_storage_test(caller_security_t caller)
+{
+ int32_t status;
+
+ val->print(PRINT_TEST, PS_TEST_MESSAGE, 0);
+ status = psa_sst_optional_api_uid_not_found(VAL_PS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+
+ return VAL_STATUS_SUCCESS;
+}
diff --git a/api-tests/dev_apis/storage/test_s011/test_s011.h b/api-tests/dev_apis/storage/test_s011/test_s011.h
new file mode 100644
index 0000000..04f10d6
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s011/test_s011.h
@@ -0,0 +1,28 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+#ifndef _TEST_S011_CLIENT_TESTS_H_
+#define _TEST_S011_CLIENT_TESTS_H_
+
+#define test_entry CONCAT(test_entry_, s011)
+
+#include "test_storage_common.h"
+
+extern const client_test_t s011_storage_test_list[];
+
+int32_t s011_storage_test(caller_security_t caller);
+
+#endif /* _TEST_S011_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_s009/test.cmake b/api-tests/dev_apis/storage/test_s012/test.cmake
similarity index 82%
copy from api-tests/dev_apis/protected_storage/test_s009/test.cmake
copy to api-tests/dev_apis/storage/test_s012/test.cmake
index 9d66436..2eeec7f 100644
--- a/api-tests/dev_apis/protected_storage/test_s009/test.cmake
+++ b/api-tests/dev_apis/storage/test_s012/test.cmake
@@ -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");
@@ -16,9 +16,9 @@
#**/
list(APPEND CC_SOURCE
- test_entry_s009.c
- test_s009.c
+ test_entry_s012.c
+ test_s012.c
)
-list(APPEND CC_OPTIONS -DPS_TEST)
+list(APPEND CC_OPTIONS )
list(APPEND AS_SOURCE )
list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/storage/test_s012/test_data.h b/api-tests/dev_apis/storage/test_s012/test_data.h
new file mode 100644
index 0000000..8e8c66c
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s012/test_data.h
@@ -0,0 +1,84 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+#ifndef _S012_TEST_DATA_H_
+#define _S012_TEST_DATA_H_
+
+#include "test_s012.h"
+
+static const test_data_t s012_data[] = {
+{
+ /* Check if optional PS API supported */
+ VAL_TEST_IDX0, {VAL_API_UNUSED, VAL_PS_GET_SUPPORT}, PSA_STORAGE_SUPPORT_SET_EXTENDED
+},
+{
+ /* Create valid storage */
+ VAL_TEST_IDX1, {VAL_API_UNUSED, VAL_PS_CREATE}, PSA_SUCCESS
+
+},
+{
+ /* Set data using set_extended API */
+ VAL_TEST_IDX2, {VAL_API_UNUSED, VAL_PS_SET_EXTENDED}, PSA_SUCCESS
+},
+{
+ /* Set_extended with invalid offset + length */
+ VAL_TEST_IDX3, {VAL_API_UNUSED, VAL_PS_SET_EXTENDED}, PSA_ERROR_INVALID_ARGUMENT
+},
+{
+ /* Set_extended call with invalid offset */
+ VAL_TEST_IDX4, {VAL_API_UNUSED, VAL_PS_SET_EXTENDED}, PSA_ERROR_INVALID_ARGUMENT
+},
+{
+ /* Set_extended call with valid offset and zero length */
+ VAL_TEST_IDX5, {VAL_API_UNUSED, VAL_PS_SET_EXTENDED}, PSA_SUCCESS
+},
+{
+ /* Set_extended with invalid offset + length */
+ 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
+},
+{
+ /* Check data validity using get API */
+ VAL_TEST_IDX9, {VAL_API_UNUSED, VAL_PS_GET}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX10, {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
+},
+{
+ /* Call set_extended with UID 0 */
+ VAL_TEST_IDX12, {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
+},
+{
+ /* Remove with UID */
+ VAL_TEST_IDX14, {VAL_API_UNUSED, VAL_PS_REMOVE}, PSA_SUCCESS
+},
+};
+#endif /* _S012_TEST_DATA_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_p012/test_entry_p012.c b/api-tests/dev_apis/storage/test_s012/test_entry_s012.c
similarity index 83%
rename from api-tests/dev_apis/protected_storage/test_p012/test_entry_p012.c
rename to api-tests/dev_apis/storage/test_s012/test_entry_s012.c
index df4c4a8..4bded12 100644
--- a/api-tests/dev_apis/protected_storage/test_p012/test_entry_p012.c
+++ b/api-tests/dev_apis/storage/test_s012/test_entry_s012.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");
@@ -17,9 +17,9 @@
#include "val_interfaces.h"
#include "val_target.h"
-#include "test_p012.h"
+#include "test_s012.h"
-#define TEST_NUM VAL_CREATE_TEST_ID(VAL_PROTECTED_STORAGE_BASE, 12)
+#define TEST_NUM VAL_CREATE_TEST_ID(VAL_STORAGE_BASE, 12)
#define TEST_DESC "Optional APIs: Invalid arguments and offset invalid\n"
TEST_PUBLISH(TEST_NUM, test_entry);
@@ -41,7 +41,7 @@
}
/* Execute list of tests available in test[num]_protected_storage_list from Non-secure side*/
- status = val->execute_non_secure_tests(TEST_NUM, test_p012_sst_list, FALSE);
+ status = val->execute_non_secure_tests(TEST_NUM, s012_storage_test_list, FALSE);
if (VAL_ERROR(status))
{
diff --git a/api-tests/dev_apis/storage/test_s012/test_s012.c b/api-tests/dev_apis/storage/test_s012/test_s012.c
new file mode 100644
index 0000000..27508a8
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s012/test_s012.c
@@ -0,0 +1,170 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+
+#include "val_interfaces.h"
+#include "val_target.h"
+#include "test_s012.h"
+#include "test_data.h"
+
+#define TEST_BUFF_SIZE 16
+
+const client_test_t s012_storage_test_list[] = {
+ NULL,
+ s012_storage_test,
+ NULL,
+};
+
+static psa_storage_uid_t p_uid = UID_BASE_VALUE + 6;
+static uint8_t write_buff[TEST_BUFF_SIZE] = {0x00, 0x01, 0x02, 0x03,
+ 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0A, 0x0B,
+ 0x0C, 0x0D, 0x0E, 0x0F};
+static uint8_t read_buff[TEST_BUFF_SIZE] = {0};
+static uint8_t write_buff_2[TEST_BUFF_SIZE] = {0xFF, 0xC1, 0xA2, 0xE3,
+ 0x04, 0x05, 0x06, 0x07,
+ 0x03, 0x09, 0x0A, 0x1B,
+ 0x0C, 0x0D, 0x0E, 0x0F};
+
+static int32_t psa_sst_offset_invalid(storage_function_code_t fCode)
+{
+ int32_t status;
+ uint32_t p_data_length = 0;
+
+ /* Create valid storage using create API */
+ status = STORAGE_FUNCTION(s012_data[VAL_TEST_IDX1].api[fCode], p_uid, TEST_BUFF_SIZE,
+ PSA_STORAGE_FLAG_NONE);
+ 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,
+ write_buff);
+ TEST_ASSERT_EQUAL(status, s012_data[VAL_TEST_IDX2].status, TEST_CHECKPOINT_NUM(2));
+
+ /* Try to set data at invalid location with incorrect data len + offset */
+ val->print(PRINT_TEST, "[Check 1] Call set_extended API with invalid offset + length\n", 0);
+ status = STORAGE_FUNCTION(s012_data[VAL_TEST_IDX3].api[fCode], p_uid, TEST_BUFF_SIZE, 2,
+ write_buff);
+ TEST_ASSERT_EQUAL(status, s012_data[VAL_TEST_IDX3].status, TEST_CHECKPOINT_NUM(3));
+
+ /* Try to set data at invalid location with incorrect offset */
+ val->print(PRINT_TEST, "[Check 2] Call set_extended API with invalid offset\n", 0);
+ status = STORAGE_FUNCTION(s012_data[VAL_TEST_IDX4].api[fCode], p_uid, TEST_BUFF_SIZE + 2, 0,
+ write_buff);
+ TEST_ASSERT_EQUAL(status, s012_data[VAL_TEST_IDX4].status, TEST_CHECKPOINT_NUM(4));
+
+ /* 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,
+ write_buff);
+ TEST_ASSERT_EQUAL(status, s012_data[VAL_TEST_IDX5].status, TEST_CHECKPOINT_NUM(5));
+
+ /* Try to set data at invalid location with incorrect data len + offset */
+ val->print(PRINT_TEST, "[Check 4] Call set_extended API with invalid offset + length\n", 0);
+ status = STORAGE_FUNCTION(s012_data[VAL_TEST_IDX6].api[fCode], p_uid, 1, TEST_BUFF_SIZE,
+ 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);
+ 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,
+ 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));
+
+ return VAL_STATUS_SUCCESS;
+}
+
+static int32_t psa_sst_bad_pointer(storage_function_code_t fCode)
+{
+ int32_t status;
+
+ /* 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], 0, 0, TEST_BUFF_SIZE,
+ write_buff);
+ TEST_ASSERT_EQUAL(status, s012_data[VAL_TEST_IDX11].status, TEST_CHECKPOINT_NUM(12));
+
+ /* 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], 0, 0, TEST_BUFF_SIZE,
+ write_buff_2);
+ TEST_ASSERT_EQUAL(status, s012_data[VAL_TEST_IDX12].status, TEST_CHECKPOINT_NUM(13));
+
+ /* 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], 0);
+ TEST_ASSERT_EQUAL(status, s012_data[VAL_TEST_IDX13].status, TEST_CHECKPOINT_NUM(14));
+
+ /* 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));
+
+ return VAL_STATUS_SUCCESS;
+}
+
+static int32_t psa_sst_optional_api_offset_invalid(storage_function_code_t fCode)
+{
+ int32_t status;
+ int32_t test_status;
+
+ /* Call the get_support API and check if create and set_extended API are supported */
+ status = STORAGE_FUNCTION(s012_data[VAL_TEST_IDX0].api[fCode]);
+
+ if (status == s012_data[VAL_TEST_IDX0].status)
+ {
+ val->print(PRINT_INFO, "Optional PS APIs are supported.\n", 0);
+ test_status = psa_sst_offset_invalid(fCode);
+ if (test_status != VAL_STATUS_SUCCESS)
+ return test_status;
+
+ test_status = psa_sst_bad_pointer(fCode);
+ if (test_status != VAL_STATUS_SUCCESS)
+ return test_status;
+ }
+ else
+ {
+ val->print(PRINT_TEST, "Test Case skipped as Optional PS APIs are not supported.\n", 0);
+ return RESULT_SKIP(VAL_STATUS_UNSUPPORTED);
+ }
+
+ return VAL_STATUS_SUCCESS;
+}
+
+int32_t s012_storage_test(caller_security_t caller)
+{
+ int32_t status;
+
+ val->print(PRINT_TEST, PS_TEST_MESSAGE, 0);
+ status = psa_sst_optional_api_offset_invalid(VAL_PS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+
+ return VAL_STATUS_SUCCESS;
+}
diff --git a/api-tests/dev_apis/storage/test_s012/test_s012.h b/api-tests/dev_apis/storage/test_s012/test_s012.h
new file mode 100644
index 0000000..582ba80
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s012/test_s012.h
@@ -0,0 +1,28 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+#ifndef _TEST_S012_CLIENT_TESTS_H_
+#define _TEST_S012_CLIENT_TESTS_H_
+
+#define test_entry CONCAT(test_entry_, s012)
+
+#include "test_storage_common.h"
+
+extern const client_test_t s012_storage_test_list[];
+
+int32_t s012_storage_test(caller_security_t caller);
+
+#endif /* _TEST_S012_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_s009/test.cmake b/api-tests/dev_apis/storage/test_s013/test.cmake
similarity index 82%
copy from api-tests/dev_apis/protected_storage/test_s009/test.cmake
copy to api-tests/dev_apis/storage/test_s013/test.cmake
index 9d66436..589c300 100644
--- a/api-tests/dev_apis/protected_storage/test_s009/test.cmake
+++ b/api-tests/dev_apis/storage/test_s013/test.cmake
@@ -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");
@@ -16,9 +16,9 @@
#**/
list(APPEND CC_SOURCE
- test_entry_s009.c
- test_s009.c
+ test_entry_s013.c
+ test_s013.c
)
-list(APPEND CC_OPTIONS -DPS_TEST)
+list(APPEND CC_OPTIONS )
list(APPEND AS_SOURCE )
list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/storage/test_s013/test_data.h b/api-tests/dev_apis/storage/test_s013/test_data.h
new file mode 100644
index 0000000..652a2c1
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s013/test_data.h
@@ -0,0 +1,101 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+#ifndef _S013_TEST_DATA_H_
+#define _S013_TEST_DATA_H_
+
+#include "test_s013.h"
+
+static const test_data_t s013_data[] = {
+{
+ /* Check if optional PS API supported */
+ VAL_TEST_IDX0, {VAL_API_UNUSED, VAL_PS_GET_SUPPORT}, PSA_STORAGE_SUPPORT_SET_EXTENDED
+},
+{
+ /* Create storage of zero length */
+ VAL_TEST_IDX1, {VAL_API_UNUSED, VAL_PS_CREATE}, PSA_SUCCESS
+},
+{
+ /* Call set_extended with zero length */
+ VAL_TEST_IDX2, {VAL_API_UNUSED, VAL_PS_SET_EXTENDED}, PSA_SUCCESS
+},
+{
+ /* Validate the storage attributes */
+ VAL_TEST_IDX3, {VAL_API_UNUSED, VAL_PS_GET_INFO}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX4, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ VAL_TEST_IDX5, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ VAL_TEST_IDX6, {VAL_API_UNUSED, VAL_PS_REMOVE}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX7, {VAL_API_UNUSED, VAL_PS_CREATE}, PSA_SUCCESS
+},
+{
+ /* Call set_extended to write data in first half of buffer */
+ VAL_TEST_IDX8, {VAL_API_UNUSED, VAL_PS_SET_EXTENDED}, PSA_SUCCESS
+},
+{
+ /* Call set_extended to write data in second half of buffer */
+ VAL_TEST_IDX9, {VAL_API_UNUSED, VAL_PS_SET_EXTENDED}, PSA_SUCCESS
+},
+{
+ /* Validate the data stored */
+ VAL_TEST_IDX10, {VAL_API_UNUSED, VAL_PS_GET}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX11, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ VAL_TEST_IDX12, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Overwrite data with set API */
+ VAL_TEST_IDX13, {VAL_API_UNUSED, VAL_PS_SET}, PSA_SUCCESS
+
+},
+{
+ /* Validate the data written */
+ VAL_TEST_IDX14, {VAL_API_UNUSED, VAL_PS_GET}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX15, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Call Create API for existing UID with same parameters */
+ VAL_TEST_IDX16, {VAL_API_UNUSED, VAL_PS_CREATE}, PSA_SUCCESS
+},
+{
+ /* Validate the data */
+ VAL_TEST_IDX17, {VAL_API_UNUSED, VAL_PS_GET}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX18, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Remove the UID */
+ VAL_TEST_IDX19, {VAL_API_UNUSED, VAL_PS_REMOVE}, PSA_SUCCESS
+},
+{
+ /* Check no duplicate entry of UID present */
+ VAL_TEST_IDX20, {VAL_API_UNUSED, VAL_PS_GET}, PSA_ERROR_DOES_NOT_EXIST
+}
+};
+#endif /* _S013_TEST_DATA_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_p013/test_entry_p013.c b/api-tests/dev_apis/storage/test_s013/test_entry_s013.c
similarity index 83%
rename from api-tests/dev_apis/protected_storage/test_p013/test_entry_p013.c
rename to api-tests/dev_apis/storage/test_s013/test_entry_s013.c
index 4a2acac..0c3fa8f 100644
--- a/api-tests/dev_apis/protected_storage/test_p013/test_entry_p013.c
+++ b/api-tests/dev_apis/storage/test_s013/test_entry_s013.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");
@@ -17,9 +17,9 @@
#include "val_interfaces.h"
#include "val_target.h"
-#include "test_p013.h"
+#include "test_s013.h"
-#define TEST_NUM VAL_CREATE_TEST_ID(VAL_PROTECTED_STORAGE_BASE, 13)
+#define TEST_NUM VAL_CREATE_TEST_ID(VAL_STORAGE_BASE, 13)
#define TEST_DESC "Set_Extended and Create api : Success\n"
TEST_PUBLISH(TEST_NUM, test_entry);
@@ -41,7 +41,7 @@
}
/* Execute list of tests available in test[num]_protected_storage_list from Non-secure side*/
- status = val->execute_non_secure_tests(TEST_NUM, test_p013_sst_list, FALSE);
+ status = val->execute_non_secure_tests(TEST_NUM, s013_storage_test_list, FALSE);
if (VAL_ERROR(status))
{
diff --git a/api-tests/dev_apis/storage/test_s013/test_s013.c b/api-tests/dev_apis/storage/test_s013/test_s013.c
new file mode 100644
index 0000000..80cd0ec
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s013/test_s013.c
@@ -0,0 +1,171 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+
+#include "val_interfaces.h"
+#include "val_target.h"
+#include "test_s013.h"
+#include "test_data.h"
+
+#define TEST_BUFF_SIZE 16
+
+const client_test_t s013_storage_test_list[] = {
+ NULL,
+ s013_storage_test,
+ NULL,
+};
+
+static psa_storage_uid_t p_uid = UID_BASE_VALUE + 4;
+static uint8_t write_buff[TEST_BUFF_SIZE/2] = {0x00, 0x01, 0x02, 0x03,
+ 0x04, 0x05, 0x06, 0x07};
+static uint8_t write_buff_2[TEST_BUFF_SIZE/2] = {0xFF, 0x11, 0xA2, 0xE3,
+ 0x04, 0xA5, 0xD6, 0x97};
+static uint8_t read_buff[TEST_BUFF_SIZE] = {0};
+static uint8_t write_buff_3[TEST_BUFF_SIZE] = {0x00, 0x01, 0x02, 0x03,
+ 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0A, 0x0B,
+ 0x0C, 0x0D, 0x0E, 0x0F};
+
+static int32_t psa_sst_set_extended_create_success(storage_function_code_t fCode)
+{
+ int32_t status;
+ uint32_t p_data_length = 0;
+ struct psa_storage_info_t info;
+
+ /* Create storage of zero length using create API */
+ val->print(PRINT_TEST, "[Check 1] Create storage using create API for 0 length\n", 0);
+ status = STORAGE_FUNCTION(s013_data[VAL_TEST_IDX1].api[fCode], p_uid, 0, PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s013_data[VAL_TEST_IDX1].status, TEST_CHECKPOINT_NUM(1));
+
+ /* Set some data in the storage created */
+ val->print(PRINT_TEST, "[Check 2] Call set_extended for zero storage length\n", 0);
+ status = STORAGE_FUNCTION(s013_data[VAL_TEST_IDX2].api[fCode], p_uid, 0, 0, write_buff);
+ TEST_ASSERT_EQUAL(status, s013_data[VAL_TEST_IDX2].status, TEST_CHECKPOINT_NUM(2));
+
+ /* Call the get_info function to match attributes */
+ status = STORAGE_FUNCTION(s013_data[VAL_TEST_IDX3].api[fCode], p_uid, &info);
+ TEST_ASSERT_EQUAL(status, s013_data[VAL_TEST_IDX3].status, TEST_CHECKPOINT_NUM(3));
+ TEST_ASSERT_EQUAL(info.flags, PSA_STORAGE_FLAG_NONE, TEST_CHECKPOINT_NUM(4));
+ TEST_ASSERT_EQUAL(info.size, 0, TEST_CHECKPOINT_NUM(5));
+
+ /* Remove the storage */
+ val->print(PRINT_TEST, "[Check 3] Remove the storage\n", 0);
+ status = STORAGE_FUNCTION(s013_data[VAL_TEST_IDX6].api[fCode], p_uid);
+ TEST_ASSERT_EQUAL(status, s013_data[VAL_TEST_IDX6].status, TEST_CHECKPOINT_NUM(6));
+
+ /* Create a valid storage */
+ status = STORAGE_FUNCTION(s013_data[VAL_TEST_IDX7].api[fCode], p_uid, TEST_BUFF_SIZE,
+ PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s013_data[VAL_TEST_IDX7].status, TEST_CHECKPOINT_NUM(7));
+
+ /* Try to set data in first half of buffer */
+ status = STORAGE_FUNCTION(s013_data[VAL_TEST_IDX8].api[fCode], p_uid, 0, TEST_BUFF_SIZE/2,
+ write_buff);
+ TEST_ASSERT_EQUAL(status, s013_data[VAL_TEST_IDX8].status, TEST_CHECKPOINT_NUM(8));
+
+ /* Try to set data in second half of buffer */
+ status = STORAGE_FUNCTION(s013_data[VAL_TEST_IDX9].api[fCode], p_uid, TEST_BUFF_SIZE/2,
+ TEST_BUFF_SIZE/2, write_buff_2);
+ TEST_ASSERT_EQUAL(status, s013_data[VAL_TEST_IDX9].status, TEST_CHECKPOINT_NUM(9));
+
+ /* Call the get function to match the data */
+ val->print(PRINT_TEST, "[Check 4] Valid data written by multiple set_extended\n", 0);
+ status = STORAGE_FUNCTION(s013_data[VAL_TEST_IDX10].api[fCode], p_uid, 0, TEST_BUFF_SIZE,
+ read_buff, &p_data_length);
+ TEST_ASSERT_EQUAL(status, s013_data[VAL_TEST_IDX10].status, TEST_CHECKPOINT_NUM(10));
+ TEST_ASSERT_MEMCMP(read_buff, write_buff, TEST_BUFF_SIZE/2, TEST_CHECKPOINT_NUM(11));
+ TEST_ASSERT_MEMCMP(read_buff + TEST_BUFF_SIZE/2, write_buff_2, TEST_BUFF_SIZE/2,\
+ TEST_CHECKPOINT_NUM(12));
+ TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(13));
+
+ /* Overwrite data using set API */
+ val->print(PRINT_TEST, "[Check 5] Overwrite whole data using SET API\n", 0);
+ status = STORAGE_FUNCTION(s013_data[VAL_TEST_IDX13].api[fCode], p_uid, TEST_BUFF_SIZE,
+ write_buff_3, PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s013_data[VAL_TEST_IDX13].status, TEST_CHECKPOINT_NUM(14));
+
+ /* Call the get function to match the data */
+ val->print(PRINT_TEST, "[Check 6] Validate the data using get API\n", 0);
+ status = STORAGE_FUNCTION(s013_data[VAL_TEST_IDX14].api[fCode], p_uid, 0, TEST_BUFF_SIZE,
+ read_buff, &p_data_length);
+ TEST_ASSERT_EQUAL(status, s013_data[VAL_TEST_IDX14].status, TEST_CHECKPOINT_NUM(15));
+ TEST_ASSERT_MEMCMP(read_buff, write_buff_3, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(16));
+ TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(17));
+
+ /* Call create API for existing UID with same parameters */
+ val->print(PRINT_TEST, "[Check 7] Call create API for existing UID with same parameters\n", 0);
+ status = STORAGE_FUNCTION(s013_data[VAL_TEST_IDX16].api[fCode], p_uid, TEST_BUFF_SIZE,
+ PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s013_data[VAL_TEST_IDX16].status, TEST_CHECKPOINT_NUM(18));
+
+ /* Call the get function to match the data */
+ val->print(PRINT_TEST, "[Check 8] Validity of data after create API call\n", 0);
+ status = STORAGE_FUNCTION(s013_data[VAL_TEST_IDX17].api[fCode], p_uid, 0, TEST_BUFF_SIZE,
+ read_buff, &p_data_length);
+ TEST_ASSERT_EQUAL(status, s013_data[VAL_TEST_IDX17].status, TEST_CHECKPOINT_NUM(19));
+ TEST_ASSERT_MEMCMP(read_buff, write_buff_3, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(20));
+ TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE, TEST_CHECKPOINT_NUM(21));
+
+ /* Remove the storage */
+ val->print(PRINT_TEST, "[Check 9] Remove the UID\n", 0);
+ status = STORAGE_FUNCTION(s013_data[VAL_TEST_IDX19].api[fCode], p_uid);
+ TEST_ASSERT_EQUAL(status, s013_data[VAL_TEST_IDX19].status, TEST_CHECKPOINT_NUM(22));
+
+ /* Validate there should not be duplicate UID present */
+ val->print(PRINT_TEST, "[Check 10] No duplicate entry of UID present\n", 0);
+ status = STORAGE_FUNCTION(s013_data[VAL_TEST_IDX20].api[fCode], p_uid, 0, TEST_BUFF_SIZE,
+ read_buff);
+ TEST_ASSERT_EQUAL(status, s013_data[VAL_TEST_IDX20].status, TEST_CHECKPOINT_NUM(23));
+
+ return VAL_STATUS_SUCCESS;
+}
+
+int32_t psa_sst_optional_api_success_check(storage_function_code_t fCode)
+{
+ int32_t status;
+ int32_t test_status;
+
+ /* Call the get_support API and check if create and set_extended API are supported */
+ status = STORAGE_FUNCTION(s013_data[VAL_TEST_IDX0].api[fCode]);
+
+ if (status == s013_data[VAL_TEST_IDX0].status)
+ {
+ val->print(PRINT_INFO, "Optional PS APIs are supported.\n", 0);
+ test_status = psa_sst_set_extended_create_success(fCode);
+ if (test_status != VAL_STATUS_SUCCESS)
+ return test_status;
+ }
+ else
+ {
+ val->print(PRINT_TEST, "Test Case skipped as Optional PS APIs are not supported.\n", 0);
+ return RESULT_SKIP(VAL_STATUS_UNSUPPORTED);
+ }
+
+ return VAL_STATUS_SUCCESS;
+}
+
+int32_t s013_storage_test(caller_security_t caller)
+{
+ int32_t status;
+
+ val->print(PRINT_TEST, PS_TEST_MESSAGE, 0);
+ status = psa_sst_optional_api_success_check(VAL_PS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+
+ return VAL_STATUS_SUCCESS;
+}
diff --git a/api-tests/dev_apis/storage/test_s013/test_s013.h b/api-tests/dev_apis/storage/test_s013/test_s013.h
new file mode 100644
index 0000000..8cff9fa
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s013/test_s013.h
@@ -0,0 +1,28 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+#ifndef _TEST_S013_CLIENT_TESTS_H_
+#define _TEST_S013_CLIENT_TESTS_H_
+
+#define test_entry CONCAT(test_entry_, s013)
+
+#include "test_storage_common.h"
+
+extern const client_test_t s013_storage_test_list[];
+
+int32_t s013_storage_test(caller_security_t caller);
+
+#endif /* _TEST_S013_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_s009/test.cmake b/api-tests/dev_apis/storage/test_s014/test.cmake
similarity index 82%
copy from api-tests/dev_apis/protected_storage/test_s009/test.cmake
copy to api-tests/dev_apis/storage/test_s014/test.cmake
index 9d66436..acc0cd6 100644
--- a/api-tests/dev_apis/protected_storage/test_s009/test.cmake
+++ b/api-tests/dev_apis/storage/test_s014/test.cmake
@@ -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");
@@ -16,9 +16,9 @@
#**/
list(APPEND CC_SOURCE
- test_entry_s009.c
- test_s009.c
+ test_entry_s014.c
+ test_s014.c
)
-list(APPEND CC_OPTIONS -DPS_TEST)
+list(APPEND CC_OPTIONS )
list(APPEND AS_SOURCE )
list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/storage/test_s014/test_data.h b/api-tests/dev_apis/storage/test_s014/test_data.h
new file mode 100644
index 0000000..45b96ff
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s014/test_data.h
@@ -0,0 +1,54 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+#ifndef _S014_TEST_DATA_H_
+#define _S014_TEST_DATA_H_
+
+#include "test_s014.h"
+
+static const test_data_t s014_data[] = {
+{
+ /* Check if Optional API supported */
+ VAL_TEST_IDX0, {VAL_API_UNUSED, VAL_PS_GET_SUPPORT}, PSA_STORAGE_SUPPORT_SET_EXTENDED
+},
+{
+ /* Create API call should fail */
+ VAL_TEST_IDX1, {VAL_API_UNUSED, VAL_PS_CREATE}, PSA_ERROR_NOT_SUPPORTED
+},
+{
+ /* UID should not exist */
+ VAL_TEST_IDX2, {VAL_API_UNUSED, VAL_PS_GET_INFO}, PSA_ERROR_DOES_NOT_EXIST
+},
+{
+ /* Create storage of non-zero length */
+ VAL_TEST_IDX3, {VAL_API_UNUSED, VAL_PS_SET}, PSA_SUCCESS
+},
+{
+ /* Set_extended API call should fail */
+ VAL_TEST_IDX4, {VAL_API_UNUSED, VAL_PS_SET_EXTENDED}, PSA_ERROR_NOT_SUPPORTED
+},
+{
+ /* Validate the data should not changed */
+ VAL_TEST_IDX5, {VAL_API_UNUSED, VAL_PS_GET}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX6, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ VAL_TEST_IDX7, {VAL_API_UNUSED, VAL_PS_REMOVE}, PSA_SUCCESS
+},
+};
+#endif /* _S014_TEST_DATA_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_p014/test_entry_p014.c b/api-tests/dev_apis/storage/test_s014/test_entry_s014.c
similarity index 83%
rename from api-tests/dev_apis/protected_storage/test_p014/test_entry_p014.c
rename to api-tests/dev_apis/storage/test_s014/test_entry_s014.c
index ee39f86..5b01131 100644
--- a/api-tests/dev_apis/protected_storage/test_p014/test_entry_p014.c
+++ b/api-tests/dev_apis/storage/test_s014/test_entry_s014.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");
@@ -17,9 +17,9 @@
#include "val_interfaces.h"
#include "val_target.h"
-#include "test_p014.h"
+#include "test_s014.h"
-#define TEST_NUM VAL_CREATE_TEST_ID(VAL_PROTECTED_STORAGE_BASE, 14)
+#define TEST_NUM VAL_CREATE_TEST_ID(VAL_STORAGE_BASE, 14)
#define TEST_DESC "Optional APIs not supported check\n"
TEST_PUBLISH(TEST_NUM, test_entry);
@@ -41,7 +41,7 @@
}
/* Execute list of tests available in test[num]_protected_storage_list from Non-secure side*/
- status = val->execute_non_secure_tests(TEST_NUM, test_p014_sst_list, FALSE);
+ status = val->execute_non_secure_tests(TEST_NUM, s014_storage_test_list, FALSE);
if (VAL_ERROR(status))
{
diff --git a/api-tests/dev_apis/storage/test_s014/test_s014.c b/api-tests/dev_apis/storage/test_s014/test_s014.c
new file mode 100644
index 0000000..267fc85
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s014/test_s014.c
@@ -0,0 +1,112 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+
+#include "val_interfaces.h"
+#include "val_target.h"
+#include "test_s014.h"
+#include "test_data.h"
+
+#define TEST_BUFF_SIZE 16
+
+const client_test_t s014_storage_test_list[] = {
+ NULL,
+ s014_storage_test,
+ NULL,
+};
+
+static psa_storage_uid_t p_uid = UID_BASE_VALUE + 5;
+static uint8_t write_buff[TEST_BUFF_SIZE/4] = { 0x03, 0x04, 0x05, 0x07};
+static uint8_t read_buff[TEST_BUFF_SIZE/4] = {0};
+
+static int32_t psa_sst_optional_api_not_supported(storage_function_code_t fCode)
+{
+ int32_t status;
+ uint32_t p_data_length = 0;
+ struct psa_storage_info_t info;
+
+ /* Try to create storage using create API */
+ val->print(PRINT_TEST, "[Check 1] Call to create API should fail as API not supported\n", 0);
+ status = STORAGE_FUNCTION(s014_data[VAL_TEST_IDX1].api[fCode], p_uid, TEST_BUFF_SIZE,
+ PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s014_data[VAL_TEST_IDX1].status, TEST_CHECKPOINT_NUM(1));
+
+ /* Verify that UID doesn't exist */
+ status = STORAGE_FUNCTION(s014_data[VAL_TEST_IDX2].api[fCode], p_uid, &info);
+ TEST_ASSERT_EQUAL(status, s014_data[VAL_TEST_IDX2].status, TEST_CHECKPOINT_NUM(2));
+
+ /* Create a valid storage using set API */
+ val->print(PRINT_TEST, "[Check 2] Create valid storage with set API\n", 0);
+ status = STORAGE_FUNCTION(s014_data[VAL_TEST_IDX3].api[fCode], p_uid, TEST_BUFF_SIZE/4,
+ write_buff, PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s014_data[VAL_TEST_IDX3].status, TEST_CHECKPOINT_NUM(3));
+
+ /* Partial data write with set_extended API should fail */
+ val->print(PRINT_TEST, "[Check 3] Call to set_extended API call should fail\n", 0);
+ status = STORAGE_FUNCTION(s014_data[VAL_TEST_IDX4].api[fCode], p_uid, 0, 2, write_buff);
+ TEST_ASSERT_EQUAL(status, s014_data[VAL_TEST_IDX4].status, TEST_CHECKPOINT_NUM(4));
+
+ /* Call the get function to match the data */
+ val->print(PRINT_TEST, "[Check 4] Verify data is unchanged\n", 0);
+ status = STORAGE_FUNCTION(s014_data[VAL_TEST_IDX5].api[fCode], p_uid, 0, TEST_BUFF_SIZE/4,
+ read_buff, &p_data_length);
+ TEST_ASSERT_EQUAL(status, s014_data[VAL_TEST_IDX5].status, TEST_CHECKPOINT_NUM(5));
+ TEST_ASSERT_MEMCMP(read_buff, write_buff, TEST_BUFF_SIZE/4, TEST_CHECKPOINT_NUM(6));
+ TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE/4, TEST_CHECKPOINT_NUM(7));
+
+ /* Remove the storage */
+ status = STORAGE_FUNCTION(s014_data[VAL_TEST_IDX7].api[fCode], p_uid);
+ TEST_ASSERT_EQUAL(status, s014_data[VAL_TEST_IDX7].status, TEST_CHECKPOINT_NUM(8));
+
+ return VAL_STATUS_SUCCESS;
+}
+
+static int32_t psa_sst_optional_api_not_supported_check(storage_function_code_t fCode)
+{
+ int32_t status;
+ int32_t test_status;
+
+ /* Call the get_support API and check if create and set_extended API are supported */
+ status = STORAGE_FUNCTION(s014_data[VAL_TEST_IDX0].api[fCode]);
+
+ if (status == s014_data[VAL_TEST_IDX0].status)
+ {
+ val->print(PRINT_INFO, "Test Case skipped as Optional PS APIs are supported.\n", 0);
+ return RESULT_SKIP(VAL_STATUS_UNSUPPORTED);
+ }
+ else
+ {
+ val->print(PRINT_TEST, "Optional PS APIs are not supported.\n", 0);
+ test_status = psa_sst_optional_api_not_supported(fCode);
+ if (test_status != VAL_STATUS_SUCCESS)
+ return test_status;
+ }
+
+ return VAL_STATUS_SUCCESS;
+}
+
+int32_t s014_storage_test(caller_security_t caller)
+{
+ int32_t status;
+
+ val->print(PRINT_TEST, PS_TEST_MESSAGE, 0);
+ status = psa_sst_optional_api_not_supported_check(VAL_PS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+
+ return VAL_STATUS_SUCCESS;
+}
diff --git a/api-tests/dev_apis/storage/test_s014/test_s014.h b/api-tests/dev_apis/storage/test_s014/test_s014.h
new file mode 100644
index 0000000..4900f2b
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s014/test_s014.h
@@ -0,0 +1,28 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+#ifndef _TEST_S014_CLIENT_TESTS_H_
+#define _TEST_S014_CLIENT_TESTS_H_
+
+#define test_entry CONCAT(test_entry_, s014)
+
+#include "test_storage_common.h"
+
+extern const client_test_t s014_storage_test_list[];
+
+int32_t s014_storage_test(caller_security_t caller);
+
+#endif /* _TEST_S014_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_s009/test.cmake b/api-tests/dev_apis/storage/test_s015/test.cmake
similarity index 82%
copy from api-tests/dev_apis/protected_storage/test_s009/test.cmake
copy to api-tests/dev_apis/storage/test_s015/test.cmake
index 9d66436..2227088 100644
--- a/api-tests/dev_apis/protected_storage/test_s009/test.cmake
+++ b/api-tests/dev_apis/storage/test_s015/test.cmake
@@ -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");
@@ -16,9 +16,9 @@
#**/
list(APPEND CC_SOURCE
- test_entry_s009.c
- test_s009.c
+ test_entry_s015.c
+ test_s015.c
)
-list(APPEND CC_OPTIONS -DPS_TEST)
+list(APPEND CC_OPTIONS )
list(APPEND AS_SOURCE )
list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/storage/test_s015/test_data.h b/api-tests/dev_apis/storage/test_s015/test_data.h
new file mode 100644
index 0000000..64a6aec
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s015/test_data.h
@@ -0,0 +1,32 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+#ifndef _S015_TEST_DATA_H_
+#define _S015_TEST_DATA_H_
+
+#include "test_s015.h"
+
+static const test_data_t s015_data[] = {
+{
+ /* Check if optional PS API supported */
+ VAL_TEST_IDX0, {VAL_API_UNUSED, VAL_PS_GET_SUPPORT}, PSA_STORAGE_SUPPORT_SET_EXTENDED
+},
+{
+ /* Call create API with write_once flag */
+ VAL_TEST_IDX1, {VAL_API_UNUSED, VAL_PS_CREATE}, PSA_ERROR_NOT_SUPPORTED
+},
+};
+#endif /* _S015_TEST_DATA_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_p015/test_entry_p015.c b/api-tests/dev_apis/storage/test_s015/test_entry_s015.c
similarity index 83%
rename from api-tests/dev_apis/protected_storage/test_p015/test_entry_p015.c
rename to api-tests/dev_apis/storage/test_s015/test_entry_s015.c
index 785f8f8..567c981 100644
--- a/api-tests/dev_apis/protected_storage/test_p015/test_entry_p015.c
+++ b/api-tests/dev_apis/storage/test_s015/test_entry_s015.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");
@@ -17,9 +17,9 @@
#include "val_interfaces.h"
#include "val_target.h"
-#include "test_p015.h"
+#include "test_s015.h"
-#define TEST_NUM VAL_CREATE_TEST_ID(VAL_PROTECTED_STORAGE_BASE, 15)
+#define TEST_NUM VAL_CREATE_TEST_ID(VAL_STORAGE_BASE, 15)
#define TEST_DESC "Create API write_once flag value check\n"
TEST_PUBLISH(TEST_NUM, test_entry);
@@ -41,7 +41,7 @@
}
/* Execute list of tests available in test[num]_protected_storage_list from Non-secure side*/
- status = val->execute_non_secure_tests(TEST_NUM, test_p015_sst_list, FALSE);
+ status = val->execute_non_secure_tests(TEST_NUM, s015_storage_test_list, FALSE);
if (VAL_ERROR(status))
{
diff --git a/api-tests/dev_apis/storage/test_s015/test_s015.c b/api-tests/dev_apis/storage/test_s015/test_s015.c
new file mode 100644
index 0000000..a38991b
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s015/test_s015.c
@@ -0,0 +1,68 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+
+#include "val_interfaces.h"
+#include "val_target.h"
+#include "test_s015.h"
+#include "test_data.h"
+
+#define TEST_BUFF_SIZE 5
+
+const client_test_t s015_storage_test_list[] = {
+ NULL,
+ s015_storage_test,
+ NULL,
+};
+
+static psa_storage_uid_t p_uid = UID_BASE_VALUE + 5;
+
+static int32_t psa_sst_create_api_write_once_flag_check(storage_function_code_t fCode)
+{
+ int32_t status;
+
+ /* Call the get_support API and check if optional APIs are supported */
+ status = STORAGE_FUNCTION(s015_data[VAL_TEST_IDX0].api[fCode]);
+
+ if (status == s015_data[VAL_TEST_IDX0].status)
+ {
+ /* Call create API with write_once flag */
+ val->print(PRINT_TEST, "[Check 1] Call create API with write_once flag\n", 0);
+ status = STORAGE_FUNCTION(s015_data[VAL_TEST_IDX1].api[fCode], p_uid, TEST_BUFF_SIZE,
+ PSA_STORAGE_FLAG_WRITE_ONCE);
+ TEST_ASSERT_EQUAL(status, s015_data[VAL_TEST_IDX1].status, TEST_CHECKPOINT_NUM(1));
+ }
+ else
+ {
+ val->print(PRINT_TEST, "Test Case skipped as Optional PS APIs are not supported.\n", 0);
+ return RESULT_SKIP(VAL_STATUS_UNSUPPORTED);
+ }
+
+ return VAL_STATUS_SUCCESS;
+}
+
+int32_t s015_storage_test(caller_security_t caller)
+{
+ int32_t status;
+
+ val->print(PRINT_TEST, PS_TEST_MESSAGE, 0);
+ status = psa_sst_create_api_write_once_flag_check(VAL_PS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+
+ return VAL_STATUS_SUCCESS;
+}
diff --git a/api-tests/dev_apis/storage/test_s015/test_s015.h b/api-tests/dev_apis/storage/test_s015/test_s015.h
new file mode 100644
index 0000000..a8f0b33
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s015/test_s015.h
@@ -0,0 +1,28 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+#ifndef _TEST_S015_CLIENT_TESTS_H_
+#define _TEST_S015_CLIENT_TESTS_H_
+
+#define test_entry CONCAT(test_entry_, s015)
+
+#include "test_storage_common.h"
+
+extern const client_test_t s015_storage_test_list[];
+
+int32_t s015_storage_test(caller_security_t caller);
+
+#endif /* _TEST_S015_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_s009/test.cmake b/api-tests/dev_apis/storage/test_s016/test.cmake
similarity index 82%
copy from api-tests/dev_apis/protected_storage/test_s009/test.cmake
copy to api-tests/dev_apis/storage/test_s016/test.cmake
index 9d66436..810f1d1 100644
--- a/api-tests/dev_apis/protected_storage/test_s009/test.cmake
+++ b/api-tests/dev_apis/storage/test_s016/test.cmake
@@ -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");
@@ -16,9 +16,9 @@
#**/
list(APPEND CC_SOURCE
- test_entry_s009.c
- test_s009.c
+ test_entry_s016.c
+ test_s016.c
)
-list(APPEND CC_OPTIONS -DPS_TEST)
+list(APPEND CC_OPTIONS )
list(APPEND AS_SOURCE )
list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/storage/test_s016/test_data.h b/api-tests/dev_apis/storage/test_s016/test_data.h
new file mode 100644
index 0000000..61cd608
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s016/test_data.h
@@ -0,0 +1,80 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+#ifndef _S016_TEST_DATA_H_
+#define _S016_TEST_DATA_H_
+
+#include "test_s016.h"
+
+static const test_data_t s016_data[] = {
+{
+ /* Check if Optional API supported */
+ VAL_TEST_IDX0, {VAL_API_UNUSED, VAL_PS_GET_SUPPORT}, PSA_STORAGE_SUPPORT_SET_EXTENDED
+},
+{
+ /* Storage creation */
+ VAL_TEST_IDX1, {VAL_API_UNUSED, VAL_PS_CREATE}, PSA_SUCCESS
+},
+{
+ /* Calling create API for existing UID should fail */
+ VAL_TEST_IDX2, {VAL_API_UNUSED, VAL_PS_CREATE}, PSA_ERROR_ALREADY_EXISTS
+},
+{
+ /* Check the storage attributes are unchanged */
+ VAL_TEST_IDX3, {VAL_API_UNUSED, VAL_PS_GET_INFO}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX4, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ VAL_TEST_IDX5, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Set API can change capacity of storage */
+ VAL_TEST_IDX6, {VAL_API_UNUSED, VAL_PS_SET}, PSA_SUCCESS
+},
+{
+ /* Check the storage attributes are changed */
+ VAL_TEST_IDX7, {VAL_API_UNUSED, VAL_PS_GET_INFO}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX8, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ VAL_TEST_IDX9, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ /* Set_extended on old capacity should not work */
+ VAL_TEST_IDX10, {VAL_API_UNUSED, VAL_PS_SET_EXTENDED}, PSA_ERROR_STORAGE_FAILURE
+},
+{
+ /* Remove the UID */
+ VAL_TEST_IDX11, {VAL_API_UNUSED, VAL_PS_REMOVE}, PSA_SUCCESS
+},
+{
+ /* Storage creation */
+ VAL_TEST_IDX12, {VAL_API_UNUSED, VAL_PS_SET}, PSA_SUCCESS
+},
+{
+ /* Calling create API for existing UID should fail */
+ VAL_TEST_IDX13, {VAL_API_UNUSED, VAL_PS_CREATE}, PSA_ERROR_ALREADY_EXISTS
+},
+{
+ /* Remove the UID */
+ VAL_TEST_IDX14, {VAL_API_UNUSED, VAL_PS_REMOVE}, PSA_SUCCESS
+},
+};
+#endif /* _S016_TEST_DATA_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_p017/test_entry_p017.c b/api-tests/dev_apis/storage/test_s016/test_entry_s016.c
similarity index 83%
copy from api-tests/dev_apis/protected_storage/test_p017/test_entry_p017.c
copy to api-tests/dev_apis/storage/test_s016/test_entry_s016.c
index 134fd49..3aef53d 100644
--- a/api-tests/dev_apis/protected_storage/test_p017/test_entry_p017.c
+++ b/api-tests/dev_apis/storage/test_s016/test_entry_s016.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");
@@ -17,9 +17,9 @@
#include "val_interfaces.h"
#include "val_target.h"
-#include "test_p017.h"
+#include "test_s016.h"
-#define TEST_NUM VAL_CREATE_TEST_ID(VAL_PROTECTED_STORAGE_BASE, 17)
+#define TEST_NUM VAL_CREATE_TEST_ID(VAL_STORAGE_BASE, 16)
#define TEST_DESC "Storage assest capacity modification check\n"
TEST_PUBLISH(TEST_NUM, test_entry);
@@ -41,7 +41,7 @@
}
/* Execute list of tests available in test[num]_protected_storage_list from Non-secure side*/
- status = val->execute_non_secure_tests(TEST_NUM, test_p017_sst_list, FALSE);
+ status = val->execute_non_secure_tests(TEST_NUM, s016_storage_test_list, FALSE);
if (VAL_ERROR(status))
{
diff --git a/api-tests/dev_apis/storage/test_s016/test_s016.c b/api-tests/dev_apis/storage/test_s016/test_s016.c
new file mode 100644
index 0000000..aed4ecb
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s016/test_s016.c
@@ -0,0 +1,135 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+
+#include "val_interfaces.h"
+#include "val_target.h"
+#include "test_s016.h"
+#include "test_data.h"
+
+#define TEST_BUFF_SIZE_1 10
+#define TEST_BUFF_SIZE_2 14
+#define TEST_BUFF_SIZE_3 8
+
+const client_test_t s016_storage_test_list[] = {
+ NULL,
+ s016_storage_test,
+ NULL,
+};
+
+static psa_storage_uid_t p_uid = UID_BASE_VALUE + 5;
+static uint8_t write_buff[TEST_BUFF_SIZE_2] = {0x03, 0x04, 0x05, 0x07, 0xFF, 0x00, 0x32,
+ 0x67, 0x99, 0x78, 0x43, 0x20, 0xFF, 0x91};
+
+static int32_t psa_sst_optional_api_sst_capacity(storage_function_code_t fCode)
+{
+ int32_t status;
+ struct psa_storage_info_t info;
+
+ /* Try to create storage using create API */
+ status = STORAGE_FUNCTION(s016_data[VAL_TEST_IDX1].api[fCode], p_uid, TEST_BUFF_SIZE_1,
+ PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s016_data[VAL_TEST_IDX1].status, TEST_CHECKPOINT_NUM(1));
+
+ /* Call to create API for existing UID should fail */
+ val->print(PRINT_TEST, "[Check 1] Create API call for existing UID\n", 0);
+ status = STORAGE_FUNCTION(s016_data[VAL_TEST_IDX2].api[fCode], p_uid, TEST_BUFF_SIZE_2,
+ PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s016_data[VAL_TEST_IDX2].status, TEST_CHECKPOINT_NUM(2));
+
+ /* Check the attributes of storage are unchanged */
+ status = STORAGE_FUNCTION(s016_data[VAL_TEST_IDX3].api[fCode], p_uid, &info);
+ TEST_ASSERT_EQUAL(status, s016_data[VAL_TEST_IDX3].status, TEST_CHECKPOINT_NUM(3));
+ TEST_ASSERT_EQUAL(info.capacity, TEST_BUFF_SIZE_1, TEST_CHECKPOINT_NUM(4));
+ TEST_ASSERT_EQUAL(info.size, 0, TEST_CHECKPOINT_NUM(5));
+
+ /* Override storage using set API */
+ val->print(PRINT_TEST, "[Check 2] Call to set API call for existing UID\n", 0);
+ status = STORAGE_FUNCTION(s016_data[VAL_TEST_IDX6].api[fCode], p_uid, TEST_BUFF_SIZE_3,
+ write_buff, PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s016_data[VAL_TEST_IDX6].status, TEST_CHECKPOINT_NUM(6));
+
+ /* Check the attributes of storage are changed */
+ status = STORAGE_FUNCTION(s016_data[VAL_TEST_IDX7].api[fCode], p_uid, &info);
+ TEST_ASSERT_EQUAL(status, s016_data[VAL_TEST_IDX7].status, TEST_CHECKPOINT_NUM(7));
+ TEST_ASSERT_EQUAL(info.capacity, TEST_BUFF_SIZE_3, TEST_CHECKPOINT_NUM(8));
+ TEST_ASSERT_EQUAL(info.size, TEST_BUFF_SIZE_3, TEST_CHECKPOINT_NUM(9));
+
+ /* Accessing old capacity with set_extended API should fail */
+ val->print(PRINT_TEST, "[Check 3] Access old capacity using set_extended API\n", 0);
+ status = STORAGE_FUNCTION(s016_data[VAL_TEST_IDX10].api[fCode], p_uid, 0, TEST_BUFF_SIZE_1,
+ write_buff);
+ TEST_ASSERT_EQUAL(status, s016_data[VAL_TEST_IDX10].status, TEST_CHECKPOINT_NUM(10));
+
+ /* Remove the storage */
+ status = STORAGE_FUNCTION(s016_data[VAL_TEST_IDX11].api[fCode], p_uid);
+ TEST_ASSERT_EQUAL(status, s016_data[VAL_TEST_IDX11].status, TEST_CHECKPOINT_NUM(11));
+
+ /* Create new storage assest using set API */
+ val->print(PRINT_TEST, "[Check 4] Creation of new storage assest\n", 0);
+ status = STORAGE_FUNCTION(s016_data[VAL_TEST_IDX12].api[fCode], p_uid, TEST_BUFF_SIZE_2,
+ write_buff, PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s016_data[VAL_TEST_IDX12].status, TEST_CHECKPOINT_NUM(12));
+
+ /* Call to create API for existing UID should fail */
+ val->print(PRINT_TEST, "[Check 5] Create API call for existing UID\n", 0);
+ status = STORAGE_FUNCTION(s016_data[VAL_TEST_IDX13].api[fCode], p_uid, TEST_BUFF_SIZE_2,
+ PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s016_data[VAL_TEST_IDX13].status, TEST_CHECKPOINT_NUM(13));
+
+ /* Remove the storage */
+ status = STORAGE_FUNCTION(s016_data[VAL_TEST_IDX14].api[fCode], p_uid);
+ TEST_ASSERT_EQUAL(status, s016_data[VAL_TEST_IDX14].status, TEST_CHECKPOINT_NUM(14));
+
+ return VAL_STATUS_SUCCESS;
+}
+
+static int32_t psa_sst_optional_api_sst_capacity_check(storage_function_code_t fCode)
+{
+ int32_t status;
+ int32_t test_status;
+
+ /* Call the get_support API and check if create and set_extended API are supported */
+ status = STORAGE_FUNCTION(s016_data[VAL_TEST_IDX0].api[fCode]);
+
+ if (status != s016_data[VAL_TEST_IDX0].status)
+ {
+ val->print(PRINT_TEST, "Test Case skipped as Optional PS APIs not are supported.\n", 0);
+ return RESULT_SKIP(VAL_STATUS_UNSUPPORTED);
+ } else {
+ val->print(PRINT_TEST, "Optional PS APIs are supported.\n", 0);
+ test_status = psa_sst_optional_api_sst_capacity(fCode);
+ if (test_status != VAL_STATUS_SUCCESS)
+ {
+ return test_status;
+ }
+ }
+
+ return VAL_STATUS_SUCCESS;
+}
+
+int32_t s016_storage_test(caller_security_t caller)
+{
+ int32_t status;
+
+ val->print(PRINT_TEST, PS_TEST_MESSAGE, 0);
+ status = psa_sst_optional_api_sst_capacity_check(VAL_PS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+
+ return VAL_STATUS_SUCCESS;
+}
diff --git a/api-tests/dev_apis/storage/test_s016/test_s016.h b/api-tests/dev_apis/storage/test_s016/test_s016.h
new file mode 100644
index 0000000..376f7fe
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s016/test_s016.h
@@ -0,0 +1,28 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+#ifndef _TEST_S016_CLIENT_TESTS_H_
+#define _TEST_S016_CLIENT_TESTS_H_
+
+#define test_entry CONCAT(test_entry_, s016)
+
+#include "test_storage_common.h"
+
+extern const client_test_t s016_storage_test_list[];
+
+int32_t s016_storage_test(caller_security_t caller);
+
+#endif /* _TEST_S016_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_s009/test.cmake b/api-tests/dev_apis/storage/test_s017/test.cmake
similarity index 82%
copy from api-tests/dev_apis/protected_storage/test_s009/test.cmake
copy to api-tests/dev_apis/storage/test_s017/test.cmake
index 9d66436..66a76b4 100644
--- a/api-tests/dev_apis/protected_storage/test_s009/test.cmake
+++ b/api-tests/dev_apis/storage/test_s017/test.cmake
@@ -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");
@@ -16,9 +16,9 @@
#**/
list(APPEND CC_SOURCE
- test_entry_s009.c
- test_s009.c
+ test_entry_s017.c
+ test_s017.c
)
-list(APPEND CC_OPTIONS -DPS_TEST)
+list(APPEND CC_OPTIONS )
list(APPEND AS_SOURCE )
list(APPEND AS_OPTIONS )
diff --git a/api-tests/dev_apis/storage/test_s017/test_data.h b/api-tests/dev_apis/storage/test_s017/test_data.h
new file mode 100644
index 0000000..ab02d84
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s017/test_data.h
@@ -0,0 +1,57 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+#ifndef _S017_TEST_DATA_H_
+#define _S017_TEST_DATA_H_
+
+#include "test_s017.h"
+
+static const test_data_t s017_data[] = {
+{
+ /* Check if Optional API supported */
+ VAL_TEST_IDX0, {VAL_API_UNUSED, VAL_PS_GET_SUPPORT}, PSA_STORAGE_SUPPORT_SET_EXTENDED
+},
+{
+ /* Storage creation */
+ VAL_TEST_IDX1, {VAL_API_UNUSED, VAL_PS_CREATE}, PSA_SUCCESS
+},
+{
+ /* Write data in created storage */
+ VAL_TEST_IDX2, {VAL_API_UNUSED, VAL_PS_SET_EXTENDED}, PSA_SUCCESS
+},
+{
+ /* Try to set data in noncontinous manner */
+ VAL_TEST_IDX3, {VAL_API_UNUSED, VAL_PS_SET_EXTENDED}, PSA_ERROR_STORAGE_FAILURE
+},
+{
+ /* Overwrite the existing data */
+ VAL_TEST_IDX4, {VAL_API_UNUSED, VAL_PS_SET_EXTENDED}, PSA_SUCCESS
+},
+{
+ /* Check for valid storage attributes */
+ VAL_TEST_IDX5, {VAL_API_UNUSED, VAL_PS_GET_INFO}, PSA_SUCCESS
+},
+{
+ VAL_TEST_IDX6, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ VAL_TEST_IDX7, {VAL_API_UNUSED, VAL_API_UNUSED}, 0
+},
+{
+ VAL_TEST_IDX8, {VAL_API_UNUSED, VAL_PS_REMOVE}, PSA_SUCCESS
+},
+};
+#endif /* _S017_TEST_DATA_H_ */
diff --git a/api-tests/dev_apis/protected_storage/test_p017/test_entry_p017.c b/api-tests/dev_apis/storage/test_s017/test_entry_s017.c
similarity index 83%
rename from api-tests/dev_apis/protected_storage/test_p017/test_entry_p017.c
rename to api-tests/dev_apis/storage/test_s017/test_entry_s017.c
index 134fd49..9f7ea64 100644
--- a/api-tests/dev_apis/protected_storage/test_p017/test_entry_p017.c
+++ b/api-tests/dev_apis/storage/test_s017/test_entry_s017.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");
@@ -17,9 +17,9 @@
#include "val_interfaces.h"
#include "val_target.h"
-#include "test_p017.h"
+#include "test_s017.h"
-#define TEST_NUM VAL_CREATE_TEST_ID(VAL_PROTECTED_STORAGE_BASE, 17)
+#define TEST_NUM VAL_CREATE_TEST_ID(VAL_STORAGE_BASE, 17)
#define TEST_DESC "Storage assest capacity modification check\n"
TEST_PUBLISH(TEST_NUM, test_entry);
@@ -41,7 +41,7 @@
}
/* Execute list of tests available in test[num]_protected_storage_list from Non-secure side*/
- status = val->execute_non_secure_tests(TEST_NUM, test_p017_sst_list, FALSE);
+ status = val->execute_non_secure_tests(TEST_NUM, s017_storage_test_list, FALSE);
if (VAL_ERROR(status))
{
diff --git a/api-tests/dev_apis/storage/test_s017/test_s017.c b/api-tests/dev_apis/storage/test_s017/test_s017.c
new file mode 100644
index 0000000..10f240f
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s017/test_s017.c
@@ -0,0 +1,113 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+
+#include "val_interfaces.h"
+#include "val_target.h"
+#include "test_s017.h"
+#include "test_data.h"
+
+#define TEST_BUFF_SIZE_1 14
+#define TEST_BUFF_SIZE_2 10
+
+const client_test_t s017_storage_test_list[] = {
+ NULL,
+ s017_storage_test,
+ NULL,
+};
+
+static psa_storage_uid_t p_uid = UID_BASE_VALUE + 5;
+static uint8_t write_buff[TEST_BUFF_SIZE_1] = {0x03, 0x04, 0x05, 0x07, 0xFF, 0x00, 0x32,
+ 0x67, 0x99, 0x78, 0x43, 0x20, 0xFF, 0x91};
+
+static int32_t psa_sst_optional_api_partial_write(storage_function_code_t fCode)
+{
+ int32_t status;
+ struct psa_storage_info_t info;
+
+ /* Try to create storage using create API */
+ status = STORAGE_FUNCTION(s017_data[VAL_TEST_IDX1].api[fCode], p_uid, TEST_BUFF_SIZE_1,
+ PSA_STORAGE_FLAG_NONE);
+ TEST_ASSERT_EQUAL(status, s017_data[VAL_TEST_IDX1].status, TEST_CHECKPOINT_NUM(1));
+
+ /* Call set extended API to set data in first half */
+ val->print(PRINT_TEST, "[Check 1] Set data in first half of storage\n", 0);
+ status = STORAGE_FUNCTION(s017_data[VAL_TEST_IDX2].api[fCode], p_uid, 0, TEST_BUFF_SIZE_1/2,
+ write_buff);
+ TEST_ASSERT_EQUAL(status, s017_data[VAL_TEST_IDX2].status, TEST_CHECKPOINT_NUM(2));
+
+ /* Call set extended API to set data with gaps */
+ val->print(PRINT_TEST, "[Check 2] Set data having gap with existing data \n", 0);
+ status = STORAGE_FUNCTION(s017_data[VAL_TEST_IDX3].api[fCode], p_uid, (TEST_BUFF_SIZE_1/2) + 2,
+ 2, write_buff);
+ TEST_ASSERT_EQUAL(status, s017_data[VAL_TEST_IDX3].status, TEST_CHECKPOINT_NUM(3));
+
+ /* Call set extended API to overwrite and extend the existing data */
+ val->print(PRINT_TEST, "[Check 3] Overwrite and extend existing data\n", 0);
+ status = STORAGE_FUNCTION(s017_data[VAL_TEST_IDX4].api[fCode], p_uid, 0, TEST_BUFF_SIZE_2,
+ write_buff);
+ TEST_ASSERT_EQUAL(status, s017_data[VAL_TEST_IDX4].status, TEST_CHECKPOINT_NUM(4));
+
+ /* Check the attributes of existing storage */
+ val->print(PRINT_TEST, "[Check 4] Check the storage attributes\n", 0);
+ status = STORAGE_FUNCTION(s017_data[VAL_TEST_IDX5].api[fCode], p_uid, &info);
+ TEST_ASSERT_EQUAL(status, s017_data[VAL_TEST_IDX5].status, TEST_CHECKPOINT_NUM(5));
+ TEST_ASSERT_EQUAL(info.size, TEST_BUFF_SIZE_2, TEST_CHECKPOINT_NUM(6));
+ TEST_ASSERT_EQUAL(info.capacity, TEST_BUFF_SIZE_1, TEST_CHECKPOINT_NUM(7));
+
+ /* Remove the storage */
+ status = STORAGE_FUNCTION(s017_data[VAL_TEST_IDX8].api[fCode], p_uid);
+ TEST_ASSERT_EQUAL(status, s017_data[VAL_TEST_IDX8].status, TEST_CHECKPOINT_NUM(8));
+
+ return VAL_STATUS_SUCCESS;
+}
+
+static int32_t psa_sst_optional_api_partial_write_check(storage_function_code_t fCode)
+{
+ uint32_t status;
+ int32_t test_status;
+
+ /* Call the get_support API and check if create and set_extended API are supported */
+ status = STORAGE_FUNCTION(s017_data[VAL_TEST_IDX0].api[fCode]);
+
+ if (status != s017_data[VAL_TEST_IDX0].status)
+ {
+ val->print(PRINT_TEST, "Test Case skipped as Optional PS APIs not are supported.\n", 0);
+ return RESULT_SKIP(VAL_STATUS_UNSUPPORTED);
+ } else {
+ val->print(PRINT_TEST, "Optional PS APIs are supported.\n", 0);
+ test_status = psa_sst_optional_api_partial_write(fCode);
+ if (test_status != VAL_STATUS_SUCCESS)
+ {
+ return test_status;
+ }
+ }
+
+ return VAL_STATUS_SUCCESS;
+}
+
+int32_t s017_storage_test(caller_security_t caller)
+{
+ int32_t status;
+
+ val->print(PRINT_TEST, PS_TEST_MESSAGE, 0);
+ status = psa_sst_optional_api_partial_write_check(VAL_PS_FUNCTION);
+ if (status != VAL_STATUS_SUCCESS) {
+ return status;
+ }
+
+ return VAL_STATUS_SUCCESS;
+}
diff --git a/api-tests/dev_apis/storage/test_s017/test_s017.h b/api-tests/dev_apis/storage/test_s017/test_s017.h
new file mode 100644
index 0000000..162f395
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_s017/test_s017.h
@@ -0,0 +1,28 @@
+/** @file
+ * 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+#ifndef _TEST_S017_CLIENT_TESTS_H_
+#define _TEST_S017_CLIENT_TESTS_H_
+
+#define test_entry CONCAT(test_entry_, s017)
+
+#include "test_storage_common.h"
+
+extern const client_test_t s017_storage_test_list[];
+
+int32_t s017_storage_test(caller_security_t caller);
+
+#endif /* _TEST_S017_CLIENT_TESTS_H_ */
diff --git a/api-tests/dev_apis/storage/test_storage_common.h b/api-tests/dev_apis/storage/test_storage_common.h
new file mode 100644
index 0000000..7d1d4b1
--- /dev/null
+++ b/api-tests/dev_apis/storage/test_storage_common.h
@@ -0,0 +1,37 @@
+/** @file
+ * Copyright (c) 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");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+**/
+#ifndef _TEST_STORAGE_COMMON_H_
+#define _TEST_STORAGE_COMMON_H_
+
+#include "val_storage.h"
+
+#define val CONCAT(val, test_entry)
+#define psa CONCAT(psa, test_entry)
+#define STORAGE_FUNCTION val->storage_function
+#define ITS_TEST_MESSAGE "\n[Info] Executing ITS tests\n"
+#define PS_TEST_MESSAGE "\n[Info] Executing PS tests\n"
+
+extern val_api_t *val;
+extern psa_api_t *psa;
+
+typedef struct {
+ val_test_index_t idx;
+ storage_function_type_t api[2];
+ psa_status_t status;
+} test_data_t;
+
+#endif /* _TEST_STORAGE_COMMON_H_ */