SST: Rename prepare and wipe interface names

This patch renames filenames and interface names to have a more
consistent names. It also updates the dependant tests.

The changes are:
 - sst_core_interface files to sst_object_system
 - sst_object_prepare interface to sst_system_prepare
 - sst_object_wipe_all interface to sst_system_wipe_all
 - asset to object
 - add missing platform/ext/driver directory in cmake

Change-Id: I975d60e6ececec05373bcf94d7bc2ddfe03ac7f6
Signed-off-by: Marc Moreno <marc.morenoberengue@arm.com>
diff --git a/secure_fw/services/secure_storage/CMakeLists.inc b/secure_fw/services/secure_storage/CMakeLists.inc
index f691085..05cc993 100644
--- a/secure_fw/services/secure_storage/CMakeLists.inc
+++ b/secure_fw/services/secure_storage/CMakeLists.inc
@@ -48,7 +48,7 @@
 	endif()
 
 	set (SECURE_STORAGE_C_SRC "${SECURE_STORAGE_DIR}/sst_core.c"
-		"${SECURE_STORAGE_DIR}/sst_core_interface.c"
+		"${SECURE_STORAGE_DIR}/sst_object_system.c"
 		"${SECURE_STORAGE_DIR}/sst_asset_management.c"
 		"${SECURE_STORAGE_DIR}/sst_utils.c"
 		"${SECURE_STORAGE_DIR}/assets/sst_asset_defs.c"
@@ -83,6 +83,7 @@
 	embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/spm ABSOLUTE)
 	embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/core ABSOLUTE)
 	embedded_include_directories(PATH ${TFM_ROOT_DIR}/platform/ext/common ABSOLUTE)
+	embedded_include_directories(PATH ${TFM_ROOT_DIR}/platform/ext/driver ABSOLUTE)
 
 	set(BUILD_CMSIS_CORE Off)
 	set(BUILD_RETARGET Off)
diff --git a/secure_fw/services/secure_storage/manifest.yaml b/secure_fw/services/secure_storage/manifest.yaml
index d9b65e0..cba3474 100644
--- a/secure_fw/services/secure_storage/manifest.yaml
+++ b/secure_fw/services/secure_storage/manifest.yaml
@@ -69,7 +69,7 @@
   "source_files": [
     "sst_core.c",
     "sst_utils.c",
-    "sst_core_interface.c",
+    "sst_object_system.c",
     "sst_asset_management.c",
     "assets/sst_asset_defs.c",
     "crypto/sst_crypto_interface.c",
diff --git a/secure_fw/services/secure_storage/sst_asset_management.c b/secure_fw/services/secure_storage/sst_asset_management.c
index df63b07..d3c114d 100644
--- a/secure_fw/services/secure_storage/sst_asset_management.c
+++ b/secure_fw/services/secure_storage/sst_asset_management.c
@@ -10,7 +10,7 @@
 #include <stddef.h>
 
 #include "assets/sst_asset_defs.h"
-#include "sst_core_interface.h"
+#include "sst_object_system.h"
 #include "sst_utils.h"
 #include "tfm_secure_api.h"
 #include "tfm_sst_defs.h"
@@ -237,16 +237,16 @@
     if (err != TFM_SST_ERR_SUCCESS) {
         return TFM_SST_ERR_SYSTEM_ERROR;
     }
-    err = sst_object_prepare();
+    err = sst_system_prepare();
 #ifdef SST_RAM_FS
     /* in case of RAM based system there wouldn't be
      * any content in the boot time. Call the wipe API
      * to create a storage structure.
      */
     if (err != TFM_SST_ERR_SUCCESS) {
-        sst_object_wipe_all();
+        sst_system_wipe_all();
         /* attempt to initialise again */
-        err = sst_object_prepare();
+        err = sst_system_prepare();
     }
 #endif
 
diff --git a/secure_fw/services/secure_storage/sst_core_interface.h b/secure_fw/services/secure_storage/sst_core_interface.h
deleted file mode 100644
index fbad367..0000000
--- a/secure_fw/services/secure_storage/sst_core_interface.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef __SST_CORE_INTERFACE_H__
-#define __SST_CORE_INTERFACE_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <inttypes.h>
-#include "tfm_sst_defs.h"
-
-/**
- * \brief Prepares the storage system for usage, populating internal structures.
- *        It identifies and validates the system metadata.
- *
- * \return Returns TFM_SST_ERR_SUCCESS or TFM_SST_ERR_INIT_FAILED
- */
-enum tfm_sst_err_t sst_object_prepare(void);
-
-/**
- * \brief Gets handler for the given asset uuid. If an asset is deleted, the
- *        linked asset handle reference is no longer valid and will give
- *        TFM_SST_ERR_ASSET_REF_INVALID if used.
- *
- * \param[in]  asset_uuid  Asset UUID
- * \param[out] hdl         handle if successful
- *
- * \return Returns asset handle. If asset is not found, it returns
- *         TFM_SST_ERR_ASSET_NOT_FOUND. If SST area is not prepared, it returns
- *         TFM_SST_ERR_ASSET_NOT_PREPARED.
- */
-enum tfm_sst_err_t sst_object_handle(uint16_t asset_uuid, uint32_t *hdl);
-
-/**
- * \brief Creates a new asset with given uuid.
- *
- * \param[in] asset_uuid  Asset UUID
- * \param[in] size        object size
- *
- * \return Returns error code specified in \ref tfm_sst_err_t
- */
-enum tfm_sst_err_t sst_object_create(uint16_t asset_uuid, uint32_t size);
-
-/**
- * \brief Gets asset's data referenced by asset handle, and stores it
- *        in the data buffer.
- *
- * \param[in]  asset_handle  Asset handler
- * \param[out] data          Data buffer to store the asset data
- * \param[in]  offset        Offset from where the read is going to start
- * \param[in]  size          Data buffer size
- *
- * \return Returns error code specified in \ref tfm_sst_err_t
- */
-enum tfm_sst_err_t sst_object_read(uint32_t asset_handle, uint8_t *data,
-                                   uint32_t offset, uint32_t size);
-
-/**
- * \brief Writes data into the asset referenced by asset uuid.
- *
- * \param[in] asset_handl  Asset handle
- * \param[in] data         Data buffer to write into asset object
- * \param[in] offset       Offset from where the write is going to start
- * \param[in] size         Data buffer size
- *
- * \return Returns number of bytes read or a relevant error \ref tfm_sst_err_t
- */
-enum tfm_sst_err_t sst_object_write(uint32_t asset_handle, const uint8_t *data,
-                                    uint32_t offset, uint32_t size);
-
-/**
- * \brief Deletes the asset referenced by asset handler.
- *
- * \param[in] asset_handle  Asset handler
- *
- * \return Returns error code specified in \ref tfm_sst_err_t
- */
-enum tfm_sst_err_t sst_object_delete(uint32_t asset_handle);
-
-/**
- * \brief Gets the asset attributes referenced by asset handler.
- *
- * \param[in]  asset_handle  Asset handler
- * \param[out] attributes    Pointer to the attributes structure to store the
- *                           attributes values
- *
- * \return Returns error code specified in \ref tfm_sst_err_t
- */
-enum tfm_sst_err_t sst_object_get_attributes(uint32_t asset_handle,
-                                          struct tfm_sst_attribs_t *attributes);
-
-/**
- * \brief Wipes storage system and all asset data.
- *
- * \return Returns error code specified in \ref sst_errno_t
- */
-enum tfm_sst_err_t sst_object_wipe_all(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __SST_CORE_INTERFACE_H__ */
diff --git a/secure_fw/services/secure_storage/sst_core_interface.c b/secure_fw/services/secure_storage/sst_object_system.c
similarity index 72%
rename from secure_fw/services/secure_storage/sst_core_interface.c
rename to secure_fw/services/secure_storage/sst_object_system.c
index 9d8df0c..b272ab6 100644
--- a/secure_fw/services/secure_storage/sst_core_interface.c
+++ b/secure_fw/services/secure_storage/sst_object_system.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  *
@@ -7,19 +7,18 @@
 
 #include <string.h>
 
-#include "sst_core_interface.h"
+#include "sst_object_system.h"
 #include "assets/sst_asset_defs.h"
 #include "sst_core.h"
 #include "sst_utils.h"
 
-#define ASSET_ID_ERROR  0xFFFF
-
-#define SST_SYSTEM_READY 1
+#define SST_SYSTEM_READY     1
 #define SST_SYSTEM_NOT_READY 0
-/* Set to 1 once sst_object_prepare has been called */
+
+/* Set to 1 once sst_system_prepare has been called */
 static uint8_t sst_system_ready = SST_SYSTEM_NOT_READY;
 
-enum tfm_sst_err_t sst_object_prepare(void)
+enum tfm_sst_err_t sst_system_prepare(void)
 {
     enum tfm_sst_err_t err;
 
@@ -33,27 +32,27 @@
     return err;
 }
 
-enum tfm_sst_err_t sst_object_handle(uint16_t asset_uuid, uint32_t *handle)
+enum tfm_sst_err_t sst_object_handle(uint16_t object_uuid, uint32_t *handle)
 {
     enum tfm_sst_err_t err = TFM_SST_ERR_SYSTEM_ERROR;
 
     if (sst_system_ready == SST_SYSTEM_READY) {
         sst_global_lock();
-        err = sst_core_object_handle(asset_uuid, handle);
+        err = sst_core_object_handle(object_uuid, handle);
         sst_global_unlock();
     }
 
     return err;
 }
 
-enum tfm_sst_err_t sst_object_read(uint32_t asset_handle, uint8_t *data,
+enum tfm_sst_err_t sst_object_read(uint32_t object_handle, uint8_t *data,
                                    uint32_t offset, uint32_t size)
 {
     enum tfm_sst_err_t err = TFM_SST_ERR_SYSTEM_ERROR;
 
     if (sst_system_ready == SST_SYSTEM_READY) {
         sst_global_lock();
-        err = sst_core_object_read(asset_handle, data, offset, size);
+        err = sst_core_object_read(object_handle, data, offset, size);
         sst_global_unlock();
     }
 
@@ -80,21 +79,21 @@
     return err;
 }
 
-enum tfm_sst_err_t sst_object_write(uint32_t asset_handle, const uint8_t *data,
+enum tfm_sst_err_t sst_object_write(uint32_t object_handle, const uint8_t *data,
                                     uint32_t offset, uint32_t size)
 {
     enum tfm_sst_err_t err = TFM_SST_ERR_SYSTEM_ERROR;
 
     if (sst_system_ready == SST_SYSTEM_READY) {
         sst_global_lock();
-        err = sst_core_object_write(asset_handle, data, offset, size);
+        err = sst_core_object_write(object_handle, data, offset, size);
         sst_global_unlock();
     }
 
     return err;
 }
 
-enum tfm_sst_err_t sst_object_get_attributes(uint32_t asset_handle,
+enum tfm_sst_err_t sst_object_get_attributes(uint32_t object_handle,
                                            struct tfm_sst_attribs_t *attributes)
 {
     enum tfm_sst_err_t err = TFM_SST_ERR_SYSTEM_ERROR;
@@ -105,14 +104,14 @@
     if (sst_system_ready == SST_SYSTEM_READY) {
         sst_global_lock();
         /* Get the meta data index */
-        object_index = sst_utils_extract_index_from_handle(asset_handle);
+        object_index = sst_utils_extract_index_from_handle(object_handle);
         /* Read object metadata */
         err = sst_meta_read_object_meta(object_index, &tmp_metadata);
         if (err == 0) {
-            /* Check if index is still referring to same asset */
-            uuid = sst_utils_extract_uuid_from_handle(asset_handle);
+            /* Check if index is still referring to same object */
+            uuid = sst_utils_extract_uuid_from_handle(object_handle);
             if (uuid != tmp_metadata.unique_id) {
-                /* Likely the asset has been deleted in another context
+                /* Likely the object has been deleted in another context
                  * this handle isn't valid anymore.
                  */
                 err = TFM_SST_ERR_INVALID_HANDLE;
@@ -127,20 +126,20 @@
     return err;
 }
 
-enum tfm_sst_err_t sst_object_delete(uint32_t asset_handle)
+enum tfm_sst_err_t sst_object_delete(uint32_t object_handle)
 {
     enum tfm_sst_err_t err = TFM_SST_ERR_SYSTEM_ERROR;
 
     if (sst_system_ready == SST_SYSTEM_READY) {
         sst_global_lock();
-        err = sst_core_object_delete(asset_handle);
+        err = sst_core_object_delete(object_handle);
         sst_global_unlock();
     }
 
     return err;
 }
 
-enum tfm_sst_err_t sst_object_wipe_all(void)
+enum tfm_sst_err_t sst_system_wipe_all(void)
 {
     enum tfm_sst_err_t err;
     /* This function may get called as a corrective action
diff --git a/secure_fw/services/secure_storage/sst_object_system.h b/secure_fw/services/secure_storage/sst_object_system.h
new file mode 100644
index 0000000..7139bf6
--- /dev/null
+++ b/secure_fw/services/secure_storage/sst_object_system.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __SST_OBJECT_SYSTEM_H__
+#define __SST_OBJECT_SYSTEM_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <inttypes.h>
+#include "tfm_sst_defs.h"
+
+/**
+ * \brief Prepares the secure storage system for usage, populating internal
+ *        structures.
+ *        It identifies and validates the system metadata.
+ *
+ * \return Returns TFM_SST_ERR_SUCCESS or TFM_SST_ERR_INIT_FAILED
+ */
+enum tfm_sst_err_t sst_system_prepare(void);
+
+/**
+ * \brief Gets handler for the given object uuid. If an object is deleted, the
+ *        linked object handle reference is no longer valid and will give
+ *        TFM_SST_ERR_ASSET_REF_INVALID if used.
+ *
+ * \param[in]  object_uuid  Object UUID
+ * \param[out] hdl          Handle if successful
+ *
+ * \return Returns object handle. If object is not found, it returns
+ *         TFM_SST_ERR_ASSET_NOT_FOUND. If SST area is not prepared, it returns
+ *         TFM_SST_ERR_ASSET_NOT_PREPARED.
+ */
+enum tfm_sst_err_t sst_object_handle(uint16_t object_uuid, uint32_t *hdl);
+
+/**
+ * \brief Creates a new object with given uuid.
+ *
+ * \param[in] object_uuid  Object UUID
+ * \param[in] size         Object size
+ *
+ * \return Returns error code specified in \ref tfm_sst_err_t
+ */
+enum tfm_sst_err_t sst_object_create(uint16_t object_uuid, uint32_t size);
+
+/**
+ * \brief Gets object's data referenced by object handle, and stores it
+ *        in the data buffer.
+ *
+ * \param[in]  object_handle  Object handler
+ * \param[out] data           Data buffer to store the object data
+ * \param[in]  offset         Offset from where the read is going to start
+ * \param[in]  size           Data buffer size
+ *
+ * \return Returns error code specified in \ref tfm_sst_err_t
+ */
+enum tfm_sst_err_t sst_object_read(uint32_t object_handle, uint8_t *data,
+                                   uint32_t offset, uint32_t size);
+/**
+ * \brief Writes data into the object referenced by object uuid.
+ *
+ * \param[in] object_handl  Object handle
+ * \param[in] data          Data buffer to write into object object
+ * \param[in] offset        Offset from where the write is going to start
+ * \param[in] size          Data buffer size
+ *
+ * \return Returns number of bytes read or a relevant error \ref tfm_sst_err_t
+ */
+enum tfm_sst_err_t sst_object_write(uint32_t object_handle, const uint8_t *data,
+                                    uint32_t offset, uint32_t size);
+/**
+ * \brief Deletes the object referenced by object handler.
+ *
+ * \param[in] object_handle  Object handler
+ *
+ * \return Returns error code specified in \ref tfm_sst_err_t
+ */
+enum tfm_sst_err_t sst_object_delete(uint32_t object_handle);
+
+/**
+ * \brief Gets the object attributes referenced by object handler.
+ *
+ * \param[in]  object_handle  Object handler
+ * \param[out] attributes     Pointer to the attributes structure to store the
+ *                            attributes values
+ *
+ * \return Returns error code specified in \ref tfm_sst_err_t
+ */
+enum tfm_sst_err_t sst_object_get_attributes(uint32_t object_handle,
+                                          struct tfm_sst_attribs_t *attributes);
+
+/**
+ * \brief Wipes secure storage system and all object data.
+ *
+ * \return Returns error code specified in \ref sst_errno_t
+ */
+enum tfm_sst_err_t sst_system_wipe_all(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SST_OBJECT_SYSTEM_H__ */
diff --git a/test/framework/secure_suites.c b/test/framework/secure_suites.c
index 144cfef..f002cd7 100644
--- a/test/framework/secure_suites.c
+++ b/test/framework/secure_suites.c
@@ -13,7 +13,7 @@
 #include "test/suites/sst/secure/sst_tests.h"
 #include "test/suites/log/secure/log_s_tests.h"
 #include "test/suites/invert/secure/invert_s_tests.h"
-#include "secure_fw/services/secure_storage/sst_core_interface.h"
+#include "secure_fw/services/secure_storage/sst_object_system.h"
 
 static struct test_suite_t test_suites[] = {
 #ifdef SERVICES_TEST_S
@@ -42,8 +42,8 @@
 static void tear_down_integ_test(void)
 {
     /* Leave the SST area clean after execute the tests */
-    sst_object_wipe_all();
-    sst_object_prepare();
+    sst_system_wipe_all();
+    sst_system_prepare();
 }
 
 void start_integ_test(void)
diff --git a/test/suites/sst/secure/s_test_helpers.c b/test/suites/sst/secure/s_test_helpers.c
index e001885..6eadca1 100755
--- a/test/suites/sst/secure/s_test_helpers.c
+++ b/test/suites/sst/secure/s_test_helpers.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  *
@@ -11,15 +11,15 @@
 #include <string.h>
 
 #include "test/framework/test_framework.h"
-#include "secure_fw/services/secure_storage/sst_core_interface.h"
+#include "secure_fw/services/secure_storage/sst_object_system.h"
 
 uint32_t prepare_test_ctx(struct test_result_t *ret)
 {
     /* Wipes secure storage area */
-    sst_object_wipe_all();
+    sst_system_wipe_all();
 
     /* Prepares secure storage area before write */
-    if (sst_object_prepare() != TFM_SST_ERR_SUCCESS) {
+    if (sst_system_prepare() != TFM_SST_ERR_SUCCESS) {
         TEST_FAIL("Wiped system should be preparable");
         return 1;
     }
diff --git a/test/suites/sst/secure/sst_sec_interface_testsuite.c b/test/suites/sst/secure/sst_sec_interface_testsuite.c
index 02902e1..d4e8f61 100644
--- a/test/suites/sst/secure/sst_sec_interface_testsuite.c
+++ b/test/suites/sst/secure/sst_sec_interface_testsuite.c
@@ -12,7 +12,7 @@
 
 #include "test/framework/helpers.h"
 #include "secure_fw/services/secure_storage/assets/sst_asset_defs.h"
-#include "secure_fw/services/secure_storage/sst_core_interface.h"
+#include "secure_fw/services/secure_storage/sst_object_system.h"
 #include "tfm_sst_veneers.h"
 #include "s_test_helpers.h"
 
@@ -1095,7 +1095,7 @@
     }
 
     /* Calls prepare again to simulate reinitialization */
-    err = sst_object_prepare();
+    err = sst_am_prepare();
     if (err != TFM_SST_ERR_SUCCESS) {
         TEST_FAIL("Saved system should have been preparable");
         return;