Test: Remove Audit Log test cases
Audit Log partition is removed with Library Model deprecation.
So audit log tests are no longer needed any more.
Signed-off-by: Summer Qin <summer.qin@arm.com>
Change-Id: I37b39bd2d09acafa21bf5036d14dcdd4a55f1acd
diff --git a/test/config/check_config.cmake b/test/config/check_config.cmake
index 96857ce..5528c15 100644
--- a/test/config/check_config.cmake
+++ b/test/config/check_config.cmake
@@ -13,7 +13,6 @@
TEST_NS;
TEST_S;
TEST_NS_ATTESTATION;
- TEST_NS_AUDIT;
TEST_NS_CRYPTO;
TEST_NS_ITS;
TEST_NS_QCBOR;
@@ -29,7 +28,6 @@
TEST_NS_SFN_BACKEND;
TEST_NS_FPU;
TEST_S_ATTESTATION;
- TEST_S_AUDIT;
TEST_S_CRYPTO;
TEST_S_ITS;
TEST_S_PS;
@@ -49,7 +47,6 @@
tfm_invalid_config((NOT TFM_PARTITION_INITIAL_ATTESTATION) AND (TEST_NS_ATTESTATION OR TEST_S_ATTESTATION OR TEST_NS_QCBOR OR TEST_NS_T_COSE))
tfm_invalid_config((NOT TFM_PARTITION_PLATFORM) AND (TEST_NS_PLATFORM OR TEST_S_PLATFORM))
tfm_invalid_config(NOT TFM_PARTITION_FIRMWARE_UPDATE AND (TEST_NS_FWU OR TEST_S_FWU))
-tfm_invalid_config(NOT TFM_PARTITION_AUDIT_LOG AND (TEST_NS_AUDIT OR TEST_S_AUDIT))
tfm_invalid_config((TEST_NS_IPC OR TEST_S_IPC) AND CONFIG_TFM_SPM_BACKEND_SFN)
tfm_invalid_config(TEST_S_SFN_BACKEND AND CONFIG_TFM_SPM_BACKEND_IPC)
diff --git a/test/config/default_ns_test_config.cmake b/test/config/default_ns_test_config.cmake
index fcbef75..0fa95d7 100644
--- a/test/config/default_ns_test_config.cmake
+++ b/test/config/default_ns_test_config.cmake
@@ -14,7 +14,6 @@
set(TEST_NS_ATTESTATION ON CACHE BOOL "Whether to build NS regression Attestation tests")
set(TEST_NS_T_COSE ON CACHE BOOL "Whether to build NS regression t_cose tests")
set(TEST_NS_QCBOR ON CACHE BOOL "Whether to build NS regression QCBOR tests")
-set(TEST_NS_AUDIT ON CACHE BOOL "Whether to build NS regression Audit log tests")
set(TEST_NS_CRYPTO ON CACHE BOOL "Whether to build NS regression Crypto tests")
set(TEST_NS_ITS ON CACHE BOOL "Whether to build NS regression ITS tests")
set(TEST_NS_PS ON CACHE BOOL "Whether to build NS regression PS tests")
diff --git a/test/config/default_s_test_config.cmake b/test/config/default_s_test_config.cmake
index dfb103c..a0fa9ec 100644
--- a/test/config/default_s_test_config.cmake
+++ b/test/config/default_s_test_config.cmake
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2021, Arm Limited. All rights reserved.
+# Copyright (c) 2021-2022, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -12,7 +12,6 @@
########################## S test suites #######################################
set(TEST_S_ATTESTATION ON CACHE BOOL "Whether to build S regression Attestation tests")
-set(TEST_S_AUDIT ON CACHE BOOL "Whether to build S regression Audit log tests")
set(TEST_S_CRYPTO ON CACHE BOOL "Whether to build S regression Crypto tests")
set(TEST_S_ITS ON CACHE BOOL "Whether to build S regression ITS tests")
set(TEST_S_PS ON CACHE BOOL "Whether to build S regression PS tests")
diff --git a/test/config/default_test_config.cmake b/test/config/default_test_config.cmake
index a6c64bf..9268290 100644
--- a/test/config/default_test_config.cmake
+++ b/test/config/default_test_config.cmake
@@ -14,7 +14,6 @@
set(TEST_NS_ATTESTATION OFF CACHE BOOL "Whether to build NS regression Attestation tests")
set(TEST_NS_T_COSE OFF CACHE BOOL "Whether to build NS regression t_cose tests")
set(TEST_NS_QCBOR OFF CACHE BOOL "Whether to build NS regression QCBOR tests")
-set(TEST_NS_AUDIT OFF CACHE BOOL "Whether to build NS regression Audit log tests")
set(TEST_NS_CRYPTO OFF CACHE BOOL "Whether to build NS regression Crypto tests")
set(TEST_NS_ITS OFF CACHE BOOL "Whether to build NS regression ITS tests")
set(TEST_NS_PS OFF CACHE BOOL "Whether to build NS regression PS tests")
@@ -35,7 +34,6 @@
########################## S test suites #######################################
set(TEST_S_ATTESTATION OFF CACHE BOOL "Whether to build S regression Attestation tests")
-set(TEST_S_AUDIT OFF CACHE BOOL "Whether to build S regression Audit log tests")
set(TEST_S_CRYPTO OFF CACHE BOOL "Whether to build S regression Crypto tests")
set(TEST_S_ITS OFF CACHE BOOL "Whether to build S regression ITS tests")
set(TEST_S_PS OFF CACHE BOOL "Whether to build S regression PS tests")
diff --git a/test/config/set_config.cmake b/test/config/set_config.cmake
index c615725..f492593 100644
--- a/test/config/set_config.cmake
+++ b/test/config/set_config.cmake
@@ -46,11 +46,6 @@
set(TEST_S_FWU OFF CACHE BOOL "Whether to build S regression FWU tests")
endif()
-if (NOT TFM_PARTITION_AUDIT_LOG)
- set(TEST_NS_AUDIT OFF CACHE BOOL "Whether to build NS regression Audit log tests")
- set(TEST_S_AUDIT OFF CACHE BOOL "Whether to build S regression Audit log tests")
-endif()
-
if (NOT TFM_MULTI_CORE_TOPOLOGY)
set(TEST_NS_MULTI_CORE OFF CACHE BOOL "Whether to build NS regression multi-core tests")
endif()
diff --git a/test/secure_fw/non_secure_suites.c b/test/secure_fw/non_secure_suites.c
index 484697f..6432c61 100644
--- a/test/secure_fw/non_secure_suites.c
+++ b/test/secure_fw/non_secure_suites.c
@@ -39,9 +39,6 @@
#ifdef TEST_NS_IPC
#include "ipc_ns_tests.h"
#else
-#ifdef TEST_NS_AUDIT
-#include "audit_ns_tests.h"
-#endif
#endif /* TEST_NS_IPC */
#ifdef TEST_NS_MULTI_CORE
#include "multi_core_ns_test.h"
@@ -110,11 +107,6 @@
{®ister_testsuite_ns_t_cose, 0, 0, 0},
#endif
-#ifdef TEST_NS_AUDIT
- /* Non-secure Audit Logging test cases */
- {®ister_testsuite_ns_audit_interface, 0, 0, 0},
-#endif
-
#ifdef TEST_NS_FWU
/* Non-secure Firmware Update test cases */
{®ister_testsuite_ns_psa_fwu_interface, 0, 0, 0},
diff --git a/test/secure_fw/secure_suites.c b/test/secure_fw/secure_suites.c
index 5355990..0b3f8c1 100644
--- a/test/secure_fw/secure_suites.c
+++ b/test/secure_fw/secure_suites.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2021, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2022, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -28,9 +28,6 @@
#ifdef TEST_S_PLATFORM
#include "platform_s_tests.h"
#endif
-#ifdef TEST_S_AUDIT
-#include "audit_s_tests.h"
-#endif
#ifdef TEST_S_IPC
#include "ipc_s_tests.h"
#endif
@@ -85,11 +82,6 @@
{®ister_testsuite_s_platform_interface, 0, 0, 0},
#endif
-#ifdef TEST_S_AUDIT
- /* Secure Audit Logging test cases */
- {®ister_testsuite_s_audit_interface, 0, 0, 0},
-#endif
-
#ifdef TEST_S_FWU
/* Secure Firmware Update test cases */
{®ister_testsuite_s_psa_fwu_interface, 0, 0, 0},
diff --git a/test/secure_fw/secure_tests.cmake b/test/secure_fw/secure_tests.cmake
index b608a7f..c74ec5a 100644
--- a/test/secure_fw/secure_tests.cmake
+++ b/test/secure_fw/secure_tests.cmake
@@ -82,9 +82,6 @@
if (TEST_S_PS)
add_library(tfm_test_suite_ps_s STATIC EXCLUDE_FROM_ALL)
endif()
-if (TEST_S_AUDIT)
- add_library(tfm_test_suite_audit_s STATIC EXCLUDE_FROM_ALL)
-endif()
if (TEST_S_PLATFORM)
add_library(tfm_test_suite_platform_s STATIC EXCLUDE_FROM_ALL)
endif()
diff --git a/test/secure_fw/suites/CMakeLists.txt b/test/secure_fw/suites/CMakeLists.txt
index 8795e4a..e359e8d 100644
--- a/test/secure_fw/suites/CMakeLists.txt
+++ b/test/secure_fw/suites/CMakeLists.txt
@@ -68,7 +68,6 @@
# Add test suites.
# Secure test suite library targets shall already be added in secure_tests.cmake
add_subdirectory(attestation)
-add_subdirectory(audit)
add_subdirectory(crypto)
add_subdirectory(extra)
add_subdirectory(its)
diff --git a/test/secure_fw/suites/audit/CMakeLists.txt b/test/secure_fw/suites/audit/CMakeLists.txt
deleted file mode 100644
index 14b9421..0000000
--- a/test/secure_fw/suites/audit/CMakeLists.txt
+++ /dev/null
@@ -1,77 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2020-2021, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-cmake_policy(SET CMP0079 NEW)
-
-if (NOT TEST_NS_AUDIT AND NOT TEST_S_AUDIT)
- return()
-endif()
-
-####################### Non Secure #############################################
-
-if (TEST_NS_AUDIT)
- add_library(tfm_test_suite_audit_ns STATIC)
-
- target_sources(tfm_test_suite_audit_ns
- PRIVATE
- non_secure/audit_ns_interface_testsuite.c
- )
-
- target_include_directories(tfm_test_suite_audit_ns
- PUBLIC
- non_secure
- )
-
- target_compile_definitions(tfm_test_suite_audit_ns
- PRIVATE
- DOMAIN_NS=1
- $<$<BOOL:${TEST_FRAMEWORK_S}>:AUDIT_TEST_S_ENABLE>
- INTERFACE
- TEST_NS_AUDIT
- )
-
- target_link_libraries(tfm_test_suite_audit_ns
- PRIVATE
- tfm_test_framework_ns
- tfm_audit_logging_defs
- )
-
- target_link_libraries(tfm_ns_tests
- INTERFACE
- tfm_test_suite_audit_ns
- )
-endif()
-
-####################### Secure #################################################
-
-if (TEST_S_AUDIT)
- target_sources(tfm_test_suite_audit_s
- PRIVATE
- ${CMAKE_CURRENT_SOURCE_DIR}/secure/audit_s_interface_testsuite.c
- )
-
- target_include_directories(tfm_test_suite_audit_s
- PUBLIC
- ${CMAKE_CURRENT_SOURCE_DIR}/secure
- )
-
- target_compile_definitions(tfm_test_suite_audit_s
- INTERFACE
- TEST_S_AUDIT
- )
-
- target_link_libraries(tfm_test_suite_audit_s
- PRIVATE
- tfm_test_framework_s
- tfm_psa_rot_partition_audit
- )
-
- target_link_libraries(tfm_s_tests
- INTERFACE
- tfm_test_suite_audit_s
- )
-endif()
diff --git a/test/secure_fw/suites/audit/audit_tests_common.h b/test/secure_fw/suites/audit/audit_tests_common.h
deleted file mode 100644
index 93bd6a8..0000000
--- a/test/secure_fw/suites/audit/audit_tests_common.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef __AUDIT_TESTS_COMMON_H__
-#define __AUDIT_TESTS_COMMON_H__
-
-#include <stddef.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*!
- * \def STR(a)
- *
- * \brief A standard stringify macro
- */
-#define STR(a) _STR(a)
-#define _STR(a) #a
-
-/*!
- * \def LOCAL_BUFFER_SIZE
- *
- * \brief Size in bytes of the local buffer. Size accomodates two standard size
- * (no payload) log items, at maximum
- */
-#define LOCAL_BUFFER_SIZE (80)
-
-/*!
- * \def LOCAL_BUFFER_ITEMS
- *
- * \brief Number of items which can be held within a buffer of size
- * LOCAL_BUFFER_SIZE
- */
-#define LOCAL_BUFFER_ITEMS (2)
-
-/*!
- * \def STANDARD_LOG_ENTRY_SIZE
- *
- * \brief A log item with no payload (standard size) has the following size.
- * More details can be found observing \ref psa_audit_record
- * \ref log_tlr and \ref log_hdr
- */
-#define STANDARD_LOG_ENTRY_SIZE (28)
-
-/*!
- * \def INITIAL_LOGGING_REQUESTS
- *
- * \brief Number of initial consecutive logging requests to perform
- */
-#define INITIAL_LOGGING_REQUESTS (36)
-
-/*!
- * \def INITIAL_LOGGING_SIZE
- *
- * \brief Size of the initial consecutive logging requests
- */
-#define INITIAL_LOGGING_SIZE (1008)
-
-/*!
- * \def FINAL_LOGGING_REQUESTS
- *
- * \brief Number of final consecutive logging requests to perform
- *
- * \note This defines the state of the log when secure interface tests are
- * terminated
- */
-#define FINAL_LOGGING_REQUESTS (2)
-
-/*!
- * \def FINAL_LOGGING_SIZE
- *
- * \brief Size of the final consecutive logging requests
- *
- * \note This defines the state of the log when secure interface tests are
- * terminated
- */
-#define FINAL_LOGGING_SIZE (56)
-
-/*!
- * \def DUMMY_TEST_RECORD_ID_BASE
- *
- * \brief The log record is initialized with a dummy ID which uses this value as
- * base value
- */
-#define DUMMY_TEST_RECORD_ID_BASE (0xABCD0000)
-
-/*!
- * \def SECOND_ELEMENT_EXPECTED_CONTENT
- *
- * \brief Content of the log record in the second log item in the final request
- *
- */
-#define SECOND_ELEMENT_EXPECTED_CONTENT ( (DUMMY_TEST_RECORD_ID_BASE) + \
- (INITIAL_LOGGING_REQUESTS+1+FINAL_LOGGING_REQUESTS) )
-/*!
- * \def MAX_LOG_SIZE
- *
- * \brief The maximum possible log size in the current implementation
- *
- * \brief This parameter for tests has to be changed for the tests in case the
- * implementation is modified
- */
-#define MAX_LOG_SIZE (1024)
-
-/*!
- * \def MAX_LOG_RECORD_SIZE
- *
- * \brief The maximum possible log line size to fill a MAX_LOG_SIZE bytes log
- *
- * \note This takes into account additional fields that are concatenated to the
- * record in the header and trailer
- */
-#define MAX_LOG_RECORD_SIZE (1000)
-
-/*!
- * \def INITIAL_LOG_SIZE
- *
- * \brief Initial state of the log size in bytes
- *
- * \note This defines the state of the log when non-secure interface tests start
- */
-#define INITIAL_LOG_SIZE (FINAL_LOGGING_SIZE)
-
-/*!
- * \def INITIAL_LOG_RECORDS
- *
- * \brief Initial state of the log number of records
- *
- * \note This defines the state of the log when non-secure interface tests start
- */
-#define INITIAL_LOG_RECORDS (FINAL_LOGGING_REQUESTS)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __AUDIT_TESTS_COMMON_H__ */
diff --git a/test/secure_fw/suites/audit/non_secure/audit_ns_interface_testsuite.c b/test/secure_fw/suites/audit/non_secure/audit_ns_interface_testsuite.c
deleted file mode 100644
index c9d6b86..0000000
--- a/test/secure_fw/suites/audit/non_secure/audit_ns_interface_testsuite.c
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * Copyright (c) 2018-2022, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#include "test_framework_helpers.h"
-#include "psa_audit_api.h"
-#include "audit_ns_tests.h"
-#include "tfm_api.h"
-#include "audit_core.h"
-
-#include "../audit_tests_common.h"
-
-/*!
- * \def EMPTY_RETRIEVED_LOG_SIZE
- *
- * \brief Log size when the retrieved buffer is empty
- */
-#define EMPTY_RETRIEVED_LOG_SIZE (0)
-
-/*!
- * \def EMPTY_RETRIEVED_LOG_ITEMS
- *
- * \brief Number of log items when retrieved buffer is empty
- */
-#define EMPTY_RETRIEVED_LOG_ITEMS (0)
-
-/*!
- * \def SINGLE_RETRIEVED_LOG_SIZE
- *
- * \brief Log size when the retrieved buffer has 1 item
- * of standard size (no payload)
- */
-#define SINGLE_RETRIEVED_LOG_SIZE (STANDARD_LOG_ENTRY_SIZE)
-
-/*!
- * \def SINGLE_RETRIEVED_LOG_ITEMS
- *
- * \brief Number of log items when retrieved buffer has 1 item
- */
-#define SINGLE_RETRIEVED_LOG_ITEMS (1)
-
-/*!
- * \def SECOND_ELEMENT_START_INDEX
- *
- * \brief Index of the second item in the log
- */
-#define SECOND_ELEMENT_START_INDEX (1)
-
-/* List of tests */
-static void tfm_audit_test_1001(struct test_result_t *ret);
-
-static struct test_t audit_veneers_tests[] = {
- {&tfm_audit_test_1001, "TFM_NS_AUDIT_TEST_1001",
- "Non Secure functional"},
-};
-
-void register_testsuite_ns_audit_interface(struct test_suite_t *p_test_suite)
-{
- uint32_t list_size;
-
- list_size = (sizeof(audit_veneers_tests) /
- sizeof(audit_veneers_tests[0]));
-
- set_testsuite("AuditLog non-secure interface test (TFM_NS_AUDIT_TEST_1XXX)",
- audit_veneers_tests, list_size, p_test_suite);
-}
-
-#if AUDIT_TEST_S_ENABLE
-/**
- * \brief Functional test of NS API
- *
- * \note This is a functional test only and doesn't
- * mean to test all possible combinations of
- * input parameters and return values.
- * This tests the current status of the log as
- * it's been left from the Secure tests. In case
- * other tests are added in the Secure test suite,
- * the status of the log will change and these
- * tests may start failing.
- */
-static void tfm_audit_test_1001(struct test_result_t *ret)
-{
- psa_status_t status;
-
- uint8_t local_buffer[LOCAL_BUFFER_SIZE];
- uint32_t idx, stored_size, num_records, retrieved_size;
-
- struct psa_audit_record *retrieved_buffer;
-
- /* Get the log size (current state) */
- status = psa_audit_get_info(&num_records, &stored_size);
- if (status != PSA_SUCCESS) {
- TEST_FAIL("Getting log info has returned error");
- return;
- }
-
- if (stored_size != INITIAL_LOG_SIZE) {
- TEST_FAIL("Stored size different from " STR(INITIAL_LOG_SIZE));
- return;
- }
-
- if (num_records != INITIAL_LOG_RECORDS) {
- TEST_FAIL("Stored records different from " STR(INITIAL_LOG_RECORDS));
- return;
- }
-
- /* Check the length of each record individually */
- for (idx=0; idx<num_records; idx++) {
- status = psa_audit_get_record_info(idx, &stored_size);
- if (status != PSA_SUCCESS) {
- TEST_FAIL("Getting record size individually has returned error");
- return;
- }
-
- if (stored_size != STANDARD_LOG_ENTRY_SIZE) {
- TEST_FAIL("Unexpected record size for a single standard record");
- return;
- }
- }
-
- /* Check that if requesting length of a record which is not there fails */
- status = psa_audit_get_record_info(num_records, &stored_size);
- if (status == PSA_SUCCESS) {
- TEST_FAIL("Getting record size for non-existent record has not failed");
- return;
- }
-
- /* Log contains 2 items. Retrieve into buffer which is able to contain the
- * the full contents of the log, one record at a time
- */
- for (idx=0; idx<INITIAL_LOG_RECORDS; idx++) {
- status = psa_audit_retrieve_record(
- idx,
- LOCAL_BUFFER_SIZE,
- NULL,
- 0,
- &local_buffer[idx*STANDARD_LOG_ENTRY_SIZE],
- &retrieved_size);
-
- if (status != PSA_SUCCESS) {
- TEST_FAIL("Log retrieval from NS returned error");
- return;
- }
-
- if (retrieved_size != STANDARD_LOG_ENTRY_SIZE) {
- TEST_FAIL("Expected retrieve size: " STR(STANDARD_LOG_ENTRY_SIZE));
- return;
- }
- }
-
- /* Retrieve into a small buffer. It's not enough to store a single
- * item so the provided buffer must be empty after retrieval. We
- * check the info structure to count how many items and bytes have
- * been returned, and if they're zeros items / zero bytes, there is
- * no point in checking the contents of the local_buffer.
- */
- status = psa_audit_retrieve_record(0,
- LOCAL_BUFFER_SIZE/4,
- NULL,
- 0,
- &local_buffer[0],
- &retrieved_size);
-
- if (status == PSA_SUCCESS) {
- TEST_FAIL("Log retrieval from NS should fail, buffer too small");
- return;
- }
-
- if (retrieved_size != EMPTY_RETRIEVED_LOG_SIZE) {
- TEST_FAIL("Expected log size is " STR(EMPTY_RETRIEVED_LOG_SIZE));
- return;
- }
-
- /* Retrieve into a buffer which can hold a single element, but start from
- * the second element that is stored in the log
- */
- status = psa_audit_retrieve_record(1,
- STANDARD_LOG_ENTRY_SIZE,
- NULL,
- 0,
- &local_buffer[0],
- &retrieved_size);
-
- if (status != PSA_SUCCESS) {
- TEST_FAIL("Log retrieval from NS returned error");
- return;
- }
-
- if (retrieved_size != SINGLE_RETRIEVED_LOG_SIZE) {
- TEST_FAIL("Expected log size is " STR(SINGLE_RETRIEVED_LOG_SIZE));
- return;
- }
-
- /* Inspect the contents of the retrieved buffer, i.e. check the
- * retrieved log record contents
- */
- retrieved_buffer = (struct psa_audit_record *)
- &local_buffer[offsetof(struct log_hdr, size)];
-
- if (retrieved_buffer->id != SECOND_ELEMENT_EXPECTED_CONTENT) {
- TEST_FAIL("Unexpected argument in the first entry");
- return;
- }
-
- /* Delete oldest element in the log */
- status = psa_audit_delete_record(0, NULL, 0);
- if (status != PSA_SUCCESS) {
- TEST_FAIL("Log record deletion from NS returned error");
- return;
- }
-
- /* Get the log size (current state) */
- status = psa_audit_get_info(&num_records, &stored_size);
- if (status != PSA_SUCCESS) {
- TEST_FAIL("Getting log info has returned error");
- return;
- }
-
- if (num_records != 1) {
- TEST_FAIL("Unexpected number of records in the log after delete");
- return;
- }
-
- if (stored_size != STANDARD_LOG_ENTRY_SIZE) {
- TEST_FAIL("Unexpected size in the log after deletion");
- return;
- }
-
- /* Delete oldest element in the log. After this, the log will be empty */
- status = psa_audit_delete_record(0, NULL, 0);
- if (status != PSA_SUCCESS) {
- TEST_FAIL("Log record deletion from NS returned error");
- return;
- }
-
- /* Get the log size (current state) */
- status = psa_audit_get_info(&num_records, &stored_size);
- if (status != PSA_SUCCESS) {
- TEST_FAIL("Getting log info has returned error");
- return;
- }
-
- if (num_records != 0) {
- TEST_FAIL("Unexpected number of records in the log after deletion");
- return;
- }
-
- if (stored_size != 0) {
- TEST_FAIL("Unexpected size in the log after deletion");
- return;
- }
-
- ret->val = TEST_PASSED;
-}
-#else
-/**
- * \brief Functional test of NS API
- *
- * \note This test case relies on Secure audit logging test to prepare the
- * loggings. If Secure audit logging test is disabled, this test case
- * will always fail. Therefore skip this test case when Secure audit
- * logging is disabled.
- */
-static void tfm_audit_test_1001(struct test_result_t *ret)
-{
- TEST_LOG("Skipped when Secure audit logging test is disabled.\r\n");
-
- ret->val = TEST_PASSED;
-}
-#endif /* AUDIT_TEST_S_ENABLE */
diff --git a/test/secure_fw/suites/audit/non_secure/audit_ns_tests.h b/test/secure_fw/suites/audit/non_secure/audit_ns_tests.h
deleted file mode 100644
index 7c4c67c..0000000
--- a/test/secure_fw/suites/audit/non_secure/audit_ns_tests.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef __AUDIT_NS_TESTS_H__
-#define __AUDIT_NS_TESTS_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "test_framework.h"
-
-/**
- * \brief Register testsuite for audit logging non-secure interface.
- *
- * \param[in] p_test_suite The test suite to be executed.
- */
-void register_testsuite_ns_audit_interface(struct test_suite_t *p_test_suite);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __AUDIT_NS_TESTS_H__ */
diff --git a/test/secure_fw/suites/audit/secure/audit_s_interface_testsuite.c b/test/secure_fw/suites/audit/secure/audit_s_interface_testsuite.c
deleted file mode 100644
index 3f9618d..0000000
--- a/test/secure_fw/suites/audit/secure/audit_s_interface_testsuite.c
+++ /dev/null
@@ -1,397 +0,0 @@
-/*
- * Copyright (c) 2018-2022, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#include "test_framework_helpers.h"
-#include "psa_audit_api.h"
-#include "audit_s_tests.h"
-#include "tfm_api.h"
-#include "psa_audit_api.h"
-#include "audit_core.h"
-
-#include "../audit_tests_common.h"
-
-/*!
- * \def BASE_RETRIEVAL_LOG_INDEX
- *
- * \brief Base index from where to start elements retrieval
- */
-#define BASE_RETRIEVAL_LOG_INDEX (6)
-
-/*!
- * \def FIRST_RETRIEVAL_LOG_INDEX
- *
- * \brief Index of the first element in the log
- */
-#define FIRST_RETRIEVAL_LOG_INDEX (0)
-
-/* List of tests */
-static void tfm_audit_test_1001(struct test_result_t *ret);
-
-static struct test_t audit_veneers_tests[] = {
- {&tfm_audit_test_1001, "TFM_S_AUDIT_TEST_1001",
- "Secure functional"},
-};
-
-void register_testsuite_s_audit_interface(struct test_suite_t *p_test_suite)
-{
- uint32_t list_size;
-
- list_size = (sizeof(audit_veneers_tests) /
- sizeof(audit_veneers_tests[0]));
-
- set_testsuite("Audit Logging secure interface test (TFM_S_AUDIT_TEST_1XXX)",
- audit_veneers_tests, list_size, p_test_suite);
-}
-
-/**
- * \brief Functional test of the Secure interface
- *
- * \note This is a functional test only and doesn't
- * mean to test all possible combinations of
- * input parameters and return values.
- * This tests will leave the log in a certain
- * status which, in turn, will be evaluated by
- * the Non Secure functional tests. If any tests
- * are added here that will leave the log in a
- * different state, Non Secure functional tests
- * need to be amended accordingly.
- */
-static void tfm_audit_test_1001(struct test_result_t *ret)
-{
- psa_status_t status;
- uint8_t local_buffer[LOCAL_BUFFER_SIZE], idx;
- struct psa_audit_record *record = (struct psa_audit_record *)
- &local_buffer[0];
- uint32_t num_records, stored_size, record_size;
- struct psa_audit_record *retrieved_buffer;
-
- /* Fill the log with 36 records, each record is 28 bytes
- * we end up filling the log without wrapping
- */
- for (idx=0; idx<INITIAL_LOGGING_REQUESTS; idx++) {
- record->size = sizeof(struct psa_audit_record) - 4;
- record->id = DUMMY_TEST_RECORD_ID_BASE + idx;
-
- /* The record doesn't contain any payload */
- status = psa_audit_add_record(record);
- if (status != PSA_SUCCESS) {
- TEST_FAIL("Record addition has returned an error");
- return;
- }
- }
-
- /* Get the log size */
- status = psa_audit_get_info(&num_records, &stored_size);
- if (status != PSA_SUCCESS) {
- TEST_FAIL("Getting log info has returned error");
- return;
- }
-
- if (stored_size != INITIAL_LOGGING_SIZE) {
- TEST_FAIL("Expected log size is " STR(INITIAL_LOGGING_SIZE));
- return;
- }
-
- if (num_records != INITIAL_LOGGING_REQUESTS) {
- TEST_FAIL("Expected log records are " STR(INITIAL_LOGGING_REQUESTS));
- return;
- }
-
- /* Retrieve two log records starting from a given index */
- for (idx=BASE_RETRIEVAL_LOG_INDEX; idx<BASE_RETRIEVAL_LOG_INDEX+2; idx++) {
- uint8_t *p_buf =
- &local_buffer[(idx-BASE_RETRIEVAL_LOG_INDEX)*STANDARD_LOG_ENTRY_SIZE];
-
- status = psa_audit_retrieve_record(idx,
- LOCAL_BUFFER_SIZE,
- NULL,
- 0,
- p_buf,
- &record_size);
-
- if (status != PSA_SUCCESS) {
- TEST_FAIL("Retrieve indexes 6 or 7 has returned an error");
- return;
- }
-
- if (record_size != STANDARD_LOG_ENTRY_SIZE) {
- TEST_FAIL("Expected log size is " STR(STANDARD_LOG_ENTRY_SIZE));
- return;
- }
- }
-
- /* Inspect the content of the second log record retrieved */
- retrieved_buffer = (struct psa_audit_record *)
- &local_buffer[offsetof(struct log_hdr,size)+STANDARD_LOG_ENTRY_SIZE];
-
- if (retrieved_buffer->id != ( DUMMY_TEST_RECORD_ID_BASE +
- (BASE_RETRIEVAL_LOG_INDEX+1) )) {
- TEST_FAIL("Unexpected argument in the index 7 entry");
- return;
- }
-
- /* Retrieve the last two log records */
- for (idx=num_records-2; idx<num_records; idx++) {
- uint8_t *p_buf =
- &local_buffer[(idx-(num_records-2))*STANDARD_LOG_ENTRY_SIZE];
-
- status = psa_audit_retrieve_record(idx,
- LOCAL_BUFFER_SIZE,
- NULL,
- 0,
- p_buf,
- &record_size);
-
- if (status != PSA_SUCCESS) {
- TEST_FAIL("Retrieve of last two log records has returned error");
- return;
- }
-
- if (record_size != STANDARD_LOG_ENTRY_SIZE) {
- TEST_FAIL("Expected log size is " STR(STANDARD_LOG_ENTRY_SIZE));
- return;
- }
- }
-
- /* Inspect the first record retrieved in the local buffer */
- retrieved_buffer = (struct psa_audit_record *)
- &local_buffer[offsetof(struct log_hdr,size)];
-
- if (retrieved_buffer->id != ( DUMMY_TEST_RECORD_ID_BASE +
- (INITIAL_LOGGING_REQUESTS-2) )) {
- TEST_FAIL("Unexpected argument in the second last entry");
- return;
- }
-
- /* Retrieve the first log item */
- status = psa_audit_retrieve_record(0,
- LOCAL_BUFFER_SIZE,
- NULL,
- 0,
- &local_buffer[0],
- &record_size);
-
- if (status != PSA_SUCCESS) {
- TEST_FAIL("Retrieve of the first log entry has returned error");
- return;
- }
-
- if (record_size != STANDARD_LOG_ENTRY_SIZE) {
- TEST_FAIL("Expected log size is " STR(STANDARD_LOG_ENTRY_SIZE));
- return;
- }
-
- if (retrieved_buffer->id != DUMMY_TEST_RECORD_ID_BASE) {
- TEST_FAIL("Unexpected argument in the first entry");
- return;
- }
-
- status = psa_audit_retrieve_record(num_records - 1,
- LOCAL_BUFFER_SIZE,
- NULL,
- 0,
- &local_buffer[0],
- &record_size);
-
- if (status != PSA_SUCCESS) {
- TEST_FAIL("Retrieve of last two log entries has returned error");
- return;
- }
-
- if (record_size != STANDARD_LOG_ENTRY_SIZE) {
- TEST_FAIL("Expected log size is " STR(STANDARD_LOG_ENTRY_SIZE));
- return;
- }
-
- /* Inspect the item just retrieved */
- if (retrieved_buffer->id != ( DUMMY_TEST_RECORD_ID_BASE +
- (INITIAL_LOGGING_REQUESTS-1) )) {
- TEST_FAIL("Unexpected argument in the second last entry");
- return;
- }
-
- /* Fill one more log record, this will wrap */
- record->size = sizeof(struct psa_audit_record) - 4;
- record->id = DUMMY_TEST_RECORD_ID_BASE + INITIAL_LOGGING_REQUESTS;
-
- /* The addition of this new log item will wrap the log ending */
- status = psa_audit_add_record(record);
- if (status != PSA_SUCCESS) {
- TEST_FAIL("Record addition has returned an error");
- return;
- }
-
- /* Get the log size */
- status = psa_audit_get_info(&num_records, &stored_size);
- if (status != PSA_SUCCESS) {
- TEST_FAIL("Getting log info has returned error");
- return;
- }
-
- /* Check that the log state is the same, the item addition just performed
- * is resulted into the removal of the oldest entry, so log size and number
- * of log records is still the same as before
- */
- if (stored_size != INITIAL_LOGGING_SIZE) {
- TEST_FAIL("Expected log size is " STR(INITIAL_LOGGING_SIZE));
- return;
- }
-
- if (num_records != INITIAL_LOGGING_REQUESTS) {
- TEST_FAIL("Expected log records are " STR(INITIAL_LOGGING_REQUESTS));
- return;
- }
-
- /* Retrieve the last two log records */
- for (idx=num_records-2; idx<num_records; idx++) {
- uint8_t *p_buf =
- &local_buffer[(idx-(num_records-2))*STANDARD_LOG_ENTRY_SIZE];
-
- /* Retrieve the last two items */
- status = psa_audit_retrieve_record(idx,
- LOCAL_BUFFER_SIZE,
- NULL,
- 0,
- p_buf,
- &record_size);
-
- if (status != PSA_SUCCESS) {
- TEST_FAIL("Retrieve of last two log records has returned error");
- return;
- }
-
- if (record_size != STANDARD_LOG_ENTRY_SIZE) {
- TEST_FAIL("Expected record size is " STR(STANDARD_LOG_ENTRY_SIZE));
- return;
- }
- }
-
- /* Inspect the first record retrieved */
- if (retrieved_buffer->id != ( DUMMY_TEST_RECORD_ID_BASE +
- (INITIAL_LOGGING_REQUESTS-1) )) {
- TEST_FAIL("Unexpected argument in the second last entry");
- return;
- }
-
- /* Inspect the second record retrieved in the local buffer */
- retrieved_buffer = (struct psa_audit_record *)
- &local_buffer[offsetof(struct log_hdr,size)+STANDARD_LOG_ENTRY_SIZE];
-
- if (retrieved_buffer->id != ( DUMMY_TEST_RECORD_ID_BASE +
- (INITIAL_LOGGING_REQUESTS) )) {
- TEST_FAIL("Unexpected argument in the last entry");
- return;
- }
-
- /* Fill now one big record that will invalidate all existing records */
- record->size = MAX_LOG_RECORD_SIZE;
- record->id = DUMMY_TEST_RECORD_ID_BASE + INITIAL_LOGGING_REQUESTS + 1;
-
- /* The record has maximum possible payload for log size of 1024 */
- status = psa_audit_add_record(record);
- if (status != PSA_SUCCESS) {
- TEST_FAIL("Record addition has returned an error");
- return;
- }
-
- /* Get the log size */
- status = psa_audit_get_info(&num_records, &stored_size);
- if (status != PSA_SUCCESS) {
- TEST_FAIL("Getting log info has returned error");
- return;
- }
-
- /* Check that the log state has one element with maximum size */
- if (stored_size != MAX_LOG_SIZE) {
- TEST_FAIL("Expected log size is " STR(MAX_LOG_SIZE));
- return;
- }
-
- if (num_records != 1) {
- TEST_FAIL("Expected log records are 1");
- return;
- }
-
- /* Try to retrieve the maximum possible size that fits our buffer.
- * As there is just one big record filling the whole space, nothing
- * will be returned and the API will fail
- */
- status = psa_audit_retrieve_record(0,
- LOCAL_BUFFER_SIZE,
- NULL,
- 0,
- &local_buffer[0],
- &record_size);
-
- if (status == PSA_SUCCESS) {
- TEST_FAIL("Retrieve of index 0 should fail as it's too big");
- return;
- }
-
- if (record_size != 0) {
- TEST_FAIL("Retrieved log size has unexpected size instead of 0");
- return;
- }
-
- /* Add two standard length records again */
- for (idx=0; idx<2; idx++) {
- record->size = sizeof(struct psa_audit_record) - 4;
- record->id = DUMMY_TEST_RECORD_ID_BASE +
- INITIAL_LOGGING_REQUESTS + 2 + idx;
-
- /* The record doesn't contain any payload */
- status = psa_audit_add_record(record);
- if (status != PSA_SUCCESS) {
- TEST_FAIL("Record addition has returned an error");
- return;
- }
- }
-
- /* Get the log size */
- status = psa_audit_get_info(&num_records, &stored_size);
- if (status != PSA_SUCCESS) {
- TEST_FAIL("Getting log info has returned error");
- return;
- }
-
- /* As the log was full, the addition of the last two log records results
- * in the resetting of the log completely. The log will contain only
- * the last two items we have just added.
- */
- if (stored_size != FINAL_LOGGING_SIZE) {
- TEST_FAIL("Expected log size is " STR(FINAL_LOGGING_SIZE));
- return;
- }
-
- if (num_records != FINAL_LOGGING_REQUESTS) {
- TEST_FAIL("Expected log records are " STR(FINAL_LOGGING_REQUESTS));
- return;
- }
-
- /* Check the length of each record individually */
- for (idx=0; idx<num_records; idx++) {
- status = psa_audit_get_record_info(idx, &stored_size);
- if (status != PSA_SUCCESS) {
- TEST_FAIL("Getting record size individually has returned error");
- return;
- }
-
- if (stored_size != STANDARD_LOG_ENTRY_SIZE) {
- TEST_FAIL("Unexpected log record size for a single standard item");
- return;
- }
- }
-
- /* Check that if requesting length of a record which is not there fails */
- status = psa_audit_get_record_info(num_records, &stored_size);
- if (status == PSA_SUCCESS) {
- TEST_FAIL("Getting record size for non-existent record has not failed");
- return;
- }
-
- ret->val = TEST_PASSED;
-}
diff --git a/test/secure_fw/suites/audit/secure/audit_s_tests.h b/test/secure_fw/suites/audit/secure/audit_s_tests.h
deleted file mode 100644
index 70e5569..0000000
--- a/test/secure_fw/suites/audit/secure/audit_s_tests.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef __AUDIT_S_TESTS_H__
-#define __AUDIT_S_TESTS_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "test_framework.h"
-
-/**
- * \brief Register testsuite for audit logging secure interface.
- *
- * \param[in] p_test_suite The test suite to be executed.
- */
-void register_testsuite_s_audit_interface(struct test_suite_t *p_test_suite);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __AUDIT_S_TESTS_H__ */