Skip to content

Commit

Permalink
Merge branch 'master' into sdh_iotmbl_2572_psa_storage_building_test_…
Browse files Browse the repository at this point in the history
…binaries
  • Loading branch information
kotegowder authored Feb 19, 2020
2 parents b10a00e + bfcf2e3 commit ef66e16
Show file tree
Hide file tree
Showing 488 changed files with 4,854 additions and 8,079 deletions.
37 changes: 28 additions & 9 deletions api-tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@ list(APPEND PSA_SUITES
list(APPEND PSA_IPC_FILES
"psa/client.h"
"psa/service.h"
"psa/lifecycle.h"
"psa_manifest/sid.h"
"psa_manifest/pid.h"
"psa/lifecycle.h"
"psa_manifest/driver_partition_psa.h"
"psa_manifest/client_partition_psa.h"
"psa_manifest/server_partition_psa.h"
)

# list of crypto files required
Expand Down Expand Up @@ -88,6 +91,9 @@ list(APPEND PSA_CPU_ARCH_SUPPORT
# list of VERBOSE options
list(APPEND PSA_VERBOSE_OPTIONS 1 2 3 4 5)

# list of PLATFORM_PSA_ISOLATION_LEVEL options
list(APPEND PLATFORM_PSA_ISOLATION_LEVEL_OPTIONS 1 2 3)

message(STATUS "[PSA] : ----------Process input arguments- start-------------")

# Check for TARGET command line argument
Expand Down Expand Up @@ -154,7 +160,6 @@ set(TARGET_HEADER_GEN_INCLUDE_PATHS "${PSA_ROOT_DIR}/val/nspe|${PSA_ROOT_DIR
set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
if(${SUITE} STREQUAL "INITIAL_ATTESTATION")
set(PSA_QCBOR_GIT_REPO_LINK https://github.com/laurencelundblade/QCBOR.git)
set(PSA_QCBOR_GIT_REPO_TAG da53227db1488dde0952bdff66c3d904dce270b3)
set(PSA_QCBOR_INCLUDE_PATH ${CMAKE_CURRENT_BINARY_DIR}/src/psa_qcbor/inc)
endif()
set(PSA_TESTLIST_FILE ${CMAKE_CURRENT_BINARY_DIR}/testlist.txt)
Expand Down Expand Up @@ -203,16 +208,26 @@ endif()
# Check for VERBOSE
if(NOT DEFINED VERBOSE)
set(VERBOSE 3 CACHE INTERNAL "Default VERBOSE value" FORCE)
message(STATUS "[PSA] : Defaulting to VERBOSE=3")
message(STATUS "[PSA] : Defaulting to VERBOSE=${VERBOSE}")
else()
if(NOT ${VERBOSE} IN_LIST PSA_VERBOSE_OPTIONS)
message(FATAL_ERROR "[PSA] : Error: Unspported value for -DVERBOSE=, supported values are : ${PSA_VERBOSE_OPTIONS}")
endif()
endif()

# Check for PLATFORM_PSA_ISOLATION_LEVEL
if(NOT DEFINED PLATFORM_PSA_ISOLATION_LEVEL)
set(PLATFORM_PSA_ISOLATION_LEVEL 3 CACHE INTERNAL "Default PLATFORM_PSA_ISOLATION_LEVEL value" FORCE)
message(STATUS "[PSA] : Defaulting to PLATFORM_PSA_ISOLATION_LEVEL=${PLATFORM_PSA_ISOLATION_LEVEL}")
else()
if(NOT ${PLATFORM_PSA_ISOLATION_LEVEL} IN_LIST PLATFORM_PSA_ISOLATION_LEVEL_OPTIONS)
message(FATAL_ERROR "[PSA] : Error: Unspported value for -DPLATFORM_PSA_ISOLATION_LEVEL=, supported values are : ${PLATFORM_PSA_ISOLATION_LEVEL_OPTIONS}")
endif()
endif()

if(NOT DEFINED INCLUDE_PANIC_TESTS)
set(INCLUDE_PANIC_TESTS 0 CACHE INTERNAL "By default panic tests are disabled" FORCE)
message(STATUS "[PSA] : Defaulting to INCLUDE_PANIC_TESTS=0")
message(STATUS "[PSA] : Defaulting to INCLUDE_PANIC_TESTS=${INCLUDE_PANIC_TESTS}")
else()
if(INCLUDE_PANIC_TESTS EQUAL 1)
message(STATUS "[PSA] : Ensure you set watchdog.num to 1 in ${PSA_ROOT_DIR}/platform/targets/${TARGET}/target.cfg")
Expand All @@ -224,13 +239,13 @@ else()
endif()

if(NOT DEFINED WATCHDOG_AVAILABLE)
set(WATCHDOG_AVAILABLE 1 CACHE INTERNAL "By default watchdog is enabled" FORCE)
message(STATUS "[PSA] : Watchdog is enabled by default")
set(WATCHDOG_AVAILABLE 1 CACHE INTERNAL "Assuming watchdog is available to program by test suite" FORCE)
message(STATUS "[PSA] : Watchdog is available by default")
endif()

if((INCLUDE_PANIC_TESTS EQUAL 1) AND
(WATCHDOG_AVAILABLE EQUAL 0))
message(FATAL_ERROR "[PSA]: Panic test execution needs watchdog to be enabled! set -DWATCHDOG_AVAILABLE=1")
message(FATAL_ERROR "[PSA]: Panic test execution needs watchdog access. set -DWATCHDOG_AVAILABLE=1")
endif()

if(NOT DEFINED SP_HEAP_MEM_SUPP)
Expand All @@ -245,6 +260,9 @@ endif()

message(STATUS "[PSA] : ----------Process input arguments- complete-------------")

# Build PAL NSPE LIB
include(${PSA_ROOT_DIR}/platform/targets/${TARGET}/target.cmake)

# Create PSA clean list
list(APPEND PSA_CLEAN_LIST
${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_HEADER}
Expand All @@ -270,6 +288,7 @@ execute_process(COMMAND ${PYTHON_EXECUTABLE} ${PSA_TESTLIST_GENERATOR}
${PSA_CLIENT_TEST_LIST_INC}
${PSA_SERVER_TEST_LIST_DECLARE_INC}
${PSA_SERVER_TEST_LIST})

# Creating CMake list variable from file
file(READ ${PSA_TESTLIST_FILE} PSA_TEST_LIST)
string(REGEX REPLACE "\n" ";" PSA_TEST_LIST "${PSA_TEST_LIST}")
Expand Down Expand Up @@ -340,13 +359,12 @@ endif()
add_definitions(-DPSA_CMAKE_BUILD)
add_definitions(-D${SUITE})
add_definitions(-DVERBOSE=${VERBOSE})
add_definitions(-DPLATFORM_PSA_ISOLATION_LEVEL=${PLATFORM_PSA_ISOLATION_LEVEL})

if(${SP_HEAP_MEM_SUPP} EQUAL 1)
add_definitions(-DSP_HEAP_MEM_SUPP)
endif()

# Build PAL NSPE LIB
include(${PSA_ROOT_DIR}/platform/targets/${TARGET}/target.cmake)
# Build VAL NSPE LIB
#add_definitions(-DVAL_NSPE_BUILD)
include(${PSA_ROOT_DIR}/val/val_nspe.cmake)
Expand All @@ -362,6 +380,7 @@ add_dependencies(${PSA_TARGET_GENERATE_DATABASE_POST} ${PSA_TARGET_GENERATE_DATA
if(${SUITE} STREQUAL "INITIAL_ATTESTATION")
add_dependencies(${PSA_TARGET_QCBOR} ${PSA_TARGET_GENERATE_DATABASE_POST})
add_dependencies(${PSA_TARGET_PAL_NSPE_LIB} ${PSA_TARGET_QCBOR})
add_dependencies(${PSA_TARGET_VAL_NSPE_LIB} ${PSA_TARGET_QCBOR})
else()
add_dependencies(${PSA_TARGET_PAL_NSPE_LIB} ${PSA_TARGET_GENERATE_DATABASE_POST})
endif()
Expand Down
29 changes: 19 additions & 10 deletions api-tests/dev_apis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,23 @@ To build the test suite for your target platform, execute the following commands
cd api-tests
mkdir <build_dir>
cd <build_dir>
cmake ../ -G"<generator-name> -DTARGET=<platform_name> -DCPU_ARCH=<cpu_architecture_version> -DSUITE=<suite_name> -DPSA_INCLUDE_PATHS="<include_path1>;<include_path2>;...;<include_pathn>"
cmake ../ -G"<generator_name>" -DTARGET=<platform_name> -DCPU_ARCH=<cpu_architecture_version> -DSUITE=<suite_name> -DPSA_INCLUDE_PATHS="<include_path1>;<include_path2>;...;<include_pathn>"
cmake --build .
```
<br /> where:

- <generator-name> "Unix Makefiles" to generate Makefiles for Linux and Cygwin <br />
"MinGW Makefiles" to generate Makefiles for cmd.exe on Windows <br />
- <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.<br />
- <cpu_architecture_version> is the Arm Architecture version name for which the tests should be compiled. For example, Armv7M, Armv8M-Baseline and Armv8M-Mainline Architecture. <br />
- <suite_name> is the suite name that is the same as the suite name available in **dev_apis/** directory. <br />
- <include_path1>;<include_path2>;...;<include_pathn> is an additional directory to be included into the compiler search path.You must provide Developer APIs header file implementation to the test suite build system using this option. For example, to compile Crypto tests, the include path must point to the path where **psa/crypto.h** is located in your build system.<br />
<br />Options information:<br />

- -G"<generator_name>" : "Unix Makefiles" to generate Makefiles for Linux and Cygwin. "MinGW Makefiles" to generate Makefiles for cmd.exe on Windows <br />
- -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.<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 suite name that is the same as the suite name available in **dev_apis/** directory.<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 depend on the system reset conditions.
- -DPSA_INCLUDE_PATHS="<include_path1>;<include_path2>;...;<include_pathn>" is an additional directory to be included into the compiler search path.You must provide Developer APIs header files implementation to the test suite build system using this option. For example, to compile Crypto tests, the include path must point to the path where **psa/crypto.h** is located in your build system. Bydefault, PSA_INCLUDE_PATHS accepts absolute path. However, relative path can be provided using below format:<br />
```
-DPSA_INCLUDE_PATHS=`readlink -f <relative_include_path>`
```

To compile Crypto tests for **tgt_dev_apis_tfm_an521** platform, execute the following commands:
```
Expand Down Expand Up @@ -76,11 +82,14 @@ The following steps describe the execution flow before the test execution: <br /

For details on test suite integration, refer to the **Integrating the test suite with the SUT** section of [Validation Methodology](../docs/Arm_PSA_APIs_Arch_Test_Validation_Methodology.pdf).

## Security implication

PSA API test suite may run at higher privilege level. An attacker can utilize these tests as a means to elevate privilege which can potentially reveal the platform secure attests. To prevent such security vulnerabilities into the production system, it is strongly recommended that PSA API test suite is run on development platforms. If it is run on production system, make sure system is scrubbed after running the test suite.

## License

Arm PSA test suite is distributed under Apache v2.0 License.


## Feedback, contributions, and support

- For feedback, use the GitHub Issue Tracker that is associated with this repository.
Expand Down
2 changes: 1 addition & 1 deletion api-tests/dev_apis/crypto/test_c002/test_c002.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ int32_t psa_import_key_test(caller_security_t caller)

status = val->crypto_function(VAL_CRYPTO_IMPORT_KEY, &attributes, key_data,
check1[i].key_length, &check1[i].key_handle);
TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_ARGUMENT, TEST_CHECKPOINT_NUM(12));
TEST_ASSERT_NOT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(12));

TEST_ASSERT_EQUAL(check1[i].key_handle, 0, TEST_CHECKPOINT_NUM(13));
}
Expand Down
4 changes: 2 additions & 2 deletions api-tests/dev_apis/crypto/test_c009/test_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ static test_data check1[] = {
PSA_ALG_KEY_AGREEMENT(PSA_ALG_ECDH, PSA_ALG_HKDF(PSA_ALG_SHA_256)),
"abcdefghijklmnop", 16,
PSA_KEY_DERIVATION_INPUT_LABEL,
PSA_SUCCESS,
PSA_ERROR_INVALID_ARGUMENT,
},

{"Test psa_key_derivation_input_bytes - Step as seed\n",
PSA_ALG_KEY_AGREEMENT(PSA_ALG_ECDH, PSA_ALG_HKDF(PSA_ALG_SHA_256)),
"abcdefghijklmnop", 16,
PSA_KEY_DERIVATION_INPUT_SEED,
PSA_SUCCESS,
PSA_ERROR_INVALID_ARGUMENT,
},

{"Test psa_key_derivation_input_bytes - Invalid step\n",
Expand Down
8 changes: 7 additions & 1 deletion api-tests/dev_apis/crypto/test_c032/test_c032.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,14 @@ int32_t psa_cipher_encrypt_setup_test(caller_security_t caller)
status = val->crypto_function(VAL_CRYPTO_CIPHER_ENCRYPT_SETUP, &operation,
check1[i].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);
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);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(7));
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);
Expand Down Expand Up @@ -157,6 +160,9 @@ int32_t psa_cipher_encrypt_setup_negative_test(caller_security_t caller)
status = val->crypto_function(VAL_CRYPTO_CIPHER_ENCRYPT_SETUP, &operation,
0, check2[i].key_alg);
TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(4));

status = val->crypto_function(VAL_CRYPTO_CIPHER_ABORT, &operation);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(5));
}

return VAL_STATUS_SUCCESS;
Expand Down
8 changes: 7 additions & 1 deletion api-tests/dev_apis/crypto/test_c033/test_c033.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,15 @@ int32_t psa_cipher_decrypt_setup_test(caller_security_t caller)
status = val->crypto_function(VAL_CRYPTO_CIPHER_DECRYPT_SETUP, &operation,
check1[i].key_handle, check1[i].key_alg);
TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(6));

/* Abort a cipher operation */
status = val->crypto_function(VAL_CRYPTO_CIPHER_ABORT, &operation);
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);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(7));
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);
Expand Down Expand Up @@ -157,6 +161,8 @@ int32_t psa_cipher_decrypt_setup_negative_test(caller_security_t caller)
0, check2[i].key_alg);
TEST_ASSERT_EQUAL(status, PSA_ERROR_INVALID_HANDLE, TEST_CHECKPOINT_NUM(4));

status = val->crypto_function(VAL_CRYPTO_CIPHER_ABORT, &operation);
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(5));
}

return VAL_STATUS_SUCCESS;
Expand Down
1 change: 1 addition & 0 deletions api-tests/dev_apis/crypto/test_c037/test_c037.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ int32_t psa_cipher_finish_test(caller_security_t caller)
val->print(PRINT_TEST, "[Check %d] ", g_test_count++);
val->print(PRINT_TEST, check1[i].test_desc, 0);
memset(&operation, 0, sizeof(operation));
memset(&invalid_operation, 0, sizeof(invalid_operation));

/* Setting up the watchdog timer for each check */
status = val->wd_reprogram_timer(WD_CRYPTO_TIMEOUT);
Expand Down
4 changes: 2 additions & 2 deletions api-tests/dev_apis/crypto/test_c050/test_c050.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ client_test_t test_c050_crypto_list[] = {
NULL,
};

static int g_test_count = 1;
static int g_test_count = 1;
static uint8_t data[BUFFER_SIZE];

int32_t psa_open_key_test(caller_security_t caller)
{
int32_t status, i = 0;
uint8_t data[BUFFER_SIZE];
size_t length, get_key_bits;
const uint8_t *key_data;
psa_key_type_t get_key_type;
Expand Down
4 changes: 2 additions & 2 deletions api-tests/dev_apis/crypto/test_c059/test_c059.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ client_test_t test_c059_crypto_list[] = {
NULL,
};

static int g_test_count = 1;
static int g_test_count = 1;
static uint8_t output[BUFFER_SIZE], tag[SIZE_128B];

int32_t psa_aead_finish_test(caller_security_t caller)
{
int32_t i, status;
uint8_t output[BUFFER_SIZE], tag[SIZE_128B];
size_t length, tag_length;
int num_checks = sizeof(check1)/sizeof(check1[0]);
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
Expand Down
4 changes: 2 additions & 2 deletions api-tests/dev_apis/crypto/test_c061/test_c061.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ client_test_t test_c061_crypto_list[] = {
NULL,
};

static int g_test_count = 1;
static int g_test_count = 1;
static uint8_t output[BUFFER_SIZE], tag[SIZE_128B];

int32_t psa_aead_verify_test(caller_security_t caller)
{
int32_t i, status;
uint8_t output[BUFFER_SIZE], tag[SIZE_128B];
size_t length;
int num_checks = sizeof(check1)/sizeof(check1[0]);
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
Expand Down
6 changes: 6 additions & 0 deletions api-tests/dev_apis/initial_attestation/suite.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ add_definitions(${CC_OPTIONS})
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})
Expand Down
8 changes: 7 additions & 1 deletion api-tests/dev_apis/initial_attestation/test_a001/test_a001.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ int32_t psa_initial_attestation_get_token_test(caller_security_t caller)
int32_t status;
size_t token_buffer_size, token_size;
uint8_t challenge[PSA_INITIAL_ATTEST_CHALLENGE_SIZE_64+1];
uint8_t token_buffer[TOKEN_SIZE];
uint8_t token_buffer[PSA_INITIAL_ATTEST_MAX_TOKEN_SIZE];

for (i = 0; i < num_checks; i++)
{
Expand All @@ -61,6 +61,12 @@ int32_t psa_initial_attestation_get_token_test(caller_security_t caller)
return status;
}

if (token_buffer_size > PSA_INITIAL_ATTEST_MAX_TOKEN_SIZE)
{
val->print(PRINT_ERROR, "Insufficient token buffer size\n", 0);
return VAL_STATUS_INSUFFICIENT_SIZE;
}

status = val->attestation_function(VAL_INITIAL_ATTEST_GET_TOKEN, challenge,
check1[i].challenge_size, token_buffer, token_buffer_size, &token_size);
TEST_ASSERT_EQUAL(status, check1[i].expected_status, TEST_CHECKPOINT_NUM(1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "test_ps_data.h"
#endif

#define TEST_BUFF_SIZE 1024
#define TEST_BUFF_SIZE 512
#define NUM_ITERATIONS 2
#define TEST_BASE_UID_VALUE UID_BASE_VALUE + 5

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static const test_data s004_data[] = {
VAL_ITS_SET, PSA_SUCCESS /* For same UID set the length as half of previous */
},
{
VAL_ITS_GET, PSA_ERROR_INVALID_ARGUMENT /* Call get with incorrect length */
VAL_ITS_GET, PSA_SUCCESS /* Call get with incorrect length */
},
{
0, 0 /* No data should be returned */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static const test_data s004_data[] = {
VAL_PS_SET, PSA_SUCCESS /* For same UID set the length as half of previous */
},
{
VAL_PS_GET, PSA_ERROR_INVALID_ARGUMENT /* Call get with incorrect length */
VAL_PS_GET, PSA_SUCCESS /* Call get with incorrect length */
},
{
0, 0 /* No data should be returned */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,9 @@ int32_t psa_sst_get_data_check(caller_security_t caller)
memset(read_buff, 0, TEST_BUFF_SIZE);
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));
for (j = 0; j < TEST_BUFF_SIZE; j++)
{
TEST_ASSERT_EQUAL(read_buff[j], 0, TEST_CHECKPOINT_NUM(7));
}
/* Expect p_data_length = 0, when psa get function is not unsuccessful as in previous case */
TEST_ASSERT_EQUAL(p_data_length, 0, TEST_CHECKPOINT_NUM(8));
TEST_ASSERT_MEMCMP(read_buff, write_buff, TEST_BUFF_SIZE/2, TEST_CHECKPOINT_NUM(7));
/* Expect p_data_length = TEST_BUFF_SIZE/2, when psa get function is successful as in previous case */
TEST_ASSERT_EQUAL(p_data_length, TEST_BUFF_SIZE/2, TEST_CHECKPOINT_NUM(8));

/* Call get function with CORRECT buffer length */
status = SST_FUNCTION(s004_data[7].api, uid, 0, TEST_BUFF_SIZE/2, read_buff, &p_data_length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "test_s006.h"

#define TEST_NUM VAL_CREATE_TEST_ID(VAL_STORAGE_BASE, 6)
#define TEST_DESC "Flags not supported check\n"
#define TEST_DESC "Check for storage create flags\n"

TEST_PUBLISH(TEST_NUM, test_entry);
val_api_t *val = NULL;
Expand Down
Loading

0 comments on commit ef66e16

Please sign in to comment.