App, Test: Updates for thread mode NS-S transition
- Remove the SVC call framework from the non-secure
- Update the S and NS tests to work with the new concept
- Update documentation to reflect changes
Change-Id: Iac4e1b7d11f264f1905e71a81a1d622421ea5d6d
Signed-off-by: Mate Toth-Pal <mate.toth-pal@arm.com>
diff --git a/interface/include/tfm_log_svc_handler.h b/interface/include/tfm_log_svc_handler.h
deleted file mode 100644
index 5c90c25..0000000
--- a/interface/include/tfm_log_svc_handler.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef __TFM_LOG_SVC_HANDLER_H__
-#define __TFM_LOG_SVC_HANDLER_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "tfm_log_defs.h"
-
-/**
- * \brief Retrieves the audit log (SVC function)
- *
- * \details The function reads the audit log into the buffer provided.
- * If provided buffer size is too small to fit the full log,
- * the function will read the maximum number of items in the
- * log that fit the available space in the buffer
- *
- * \param[in] size Maximum number of bytes to retrieve from the log
- * \param[in] start Index of element from where to start retrieval
- * \param[out] buffer Pointer to the buffer that will hold the log
- * \param[out] info Pointer to the \ref tfm_log_info structure
- * contained information related to the retrieved
- * portion of the log (size and number of items)
- *
- * \return Returns TFM_LOG_ERR_SUCCESS if retrieval has been completed,
- * otherwise error as specified in \ref tfm_log_err
- *
- * \note If start is equal to TFM_ALG_READ_RECENT, the function will
- * retrieve the most recent elements that fit the provided size
- */
-enum tfm_log_err tfm_log_svc_retrieve(uint32_t size,
- int32_t start,
- uint8_t *buffer,
- struct tfm_log_info *info);
-
-/**
- * \brief Gets the log information (SVC function)
- *
- * \param[out] info Pointer to the \ref tfm_log_info structure that
- * holds the current log size (both in bytes and items)
- *
- * \return Returns TFM_LOG_ERR_SUCCESS if reading has been completed,
- * otherwise error as specified in \ref tfm_log_err
- */
-enum tfm_log_err tfm_log_svc_get_info(struct tfm_log_info *info);
-
-/**
- * \brief Deletes one or more elements from the head of the log (SVC function)
- *
- * \param[in] num_items Number of elements to be deleted
- * \param[out] rem_items Pointer to the number of elements removed. This
- * value indicates the number of elements actually
- * removed from the log. In case the number of items
- * stored is less than the number of items requested
- * to remove, this value will reflect the number of
- * items effectively removed.
- *
- * \return Returns TFM_LOG_ERR_SUCCESS if removal has been completed,
- * otherwise error as specified in \ref tfm_log_err
- */
-enum tfm_log_err tfm_log_svc_delete_items(uint32_t num_items,
- uint32_t *rem_items);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TFM_LOG_SVC_HANDLER_H__ */
diff --git a/interface/include/tfm_ns_lock.h b/interface/include/tfm_ns_lock.h
index 7361aac..0c73a60 100644
--- a/interface/include/tfm_ns_lock.h
+++ b/interface/include/tfm_ns_lock.h
@@ -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
*
@@ -12,18 +12,19 @@
#endif
#include <stdint.h>
-#include "tfm_ns_svc.h"
+
+typedef int32_t (*veneer_fn) (uint32_t arg0, uint32_t arg1,
+ uint32_t arg2, uint32_t arg3);
/**
* \brief NS world, NS lock based dispatcher
*
- * \details To be called from the SVC wrapper API interface
+ * \details To be called from the wrapper API interface
*/
-uint32_t tfm_ns_lock_svc_dispatch(enum tfm_svc_num svc_num,
- uint32_t arg0,
- uint32_t arg1,
- uint32_t arg2,
- uint32_t arg3);
+
+uint32_t tfm_ns_lock_dispatch(veneer_fn fn,
+ uint32_t arg0, uint32_t arg1,
+ uint32_t arg2, uint32_t arg3);
/**
* \brief NS world, Init NS lock
diff --git a/interface/include/tfm_ns_svc.h b/interface/include/tfm_ns_svc.h
deleted file mode 100644
index a88df66..0000000
--- a/interface/include/tfm_ns_svc.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#include <stdio.h>
-#include <cmsis_compiler.h>
-
-#ifndef __TFM_NS_SVC_H__
-#define __TFM_NS_SVC_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief Include all the SVC handler headers
- */
-#include "tfm_sst_svc_handler.h"
-#include "tfm_log_svc_handler.h"
-#include "svc_core_test_ns.h"
-#include "sst_test_service_svc.h"
-
-/**
- * \brief Macro to encode an svc instruction
- *
- */
-#define SVC(code) __ASM("svc %0" : : "I" (code))
-
-/**
- * \def LIST_SVC_DISPATCHERS
- *
- * \brief This is an X macro which lists
- * the SVC interface exposed by the
- * available secure services. The
- * enumerator and corresponding
- * SVC handler function need to be
- * registered.
- *
- */
-#define LIST_SVC_DISPATCHERS \
- X(SVC_TFM_SST_CREATE, tfm_sst_svc_create) \
- X(SVC_TFM_SST_GET_INFO, tfm_sst_svc_get_info) \
- X(SVC_TFM_SST_GET_ATTRIBUTES, tfm_sst_svc_get_attributes) \
- X(SVC_TFM_SST_SET_ATTRIBUTES, tfm_sst_svc_set_attributes) \
- X(SVC_TFM_SST_READ, tfm_sst_svc_read) \
- X(SVC_TFM_SST_WRITE, tfm_sst_svc_write) \
- X(SVC_TFM_SST_DELETE, tfm_sst_svc_delete) \
- X(SVC_TFM_LOG_RETRIEVE, tfm_log_svc_retrieve) \
- X(SVC_TFM_LOG_GET_INFO, tfm_log_svc_get_info) \
- X(SVC_TFM_LOG_DELETE_ITEMS, tfm_log_svc_delete_items)
-
-/**
- * \def LIST_SVC_CORE_TEST_INTERACTIVE
- *
- * \brief This is an X macro which lists
- * the SVC interface available for
- * the CORE_TEST_INTERACTIVE. The
- * enumerator and corresponding
- * SVC handler function need to be
- * registered.
- *
- */
-#define LIST_SVC_CORE_TEST_INTERACTIVE \
- X(SVC_SECURE_DECREMENT_NS_LOCK_1, svc_secure_decrement_ns_lock_1) \
- X(SVC_SECURE_DECREMENT_NS_LOCK_2, svc_secure_decrement_ns_lock_2)
-
-/**
- * \def LIST_SVC_TFM_PARTITION_TEST_CORE
- *
- * \brief This is an X macro which lists
- * the SVC interface available for
- * the TEST_CORE partition. The
- * enumerator and corresponding
- * SVC handler function need to be
- * registered.
- *
- */
-#define LIST_SVC_TFM_PARTITION_TEST_CORE \
- X(SVC_TFM_CORE_TEST, svc_tfm_core_test) \
- X(SVC_TFM_CORE_TEST_MULTIPLE_CALLS, svc_tfm_core_test_multiple_calls)
-
-/**
- * \def LIST_SVC_TFM_PARTITION_TEST_SST
- *
- * \brief This is an X macro which lists
- * the SVC interface available for
- * TEST_SST partition. The
- * enumerator and corresponding
- * SVC handler function need to be
- * registered.
- *
- */
-#define LIST_SVC_TFM_PARTITION_TEST_SST \
- X(SVC_SST_TEST_SERVICE_SETUP, sst_test_service_svc_setup) \
- X(SVC_SST_TEST_SERVICE_DUMMY_ENCRYPT, sst_test_service_svc_dummy_encrypt) \
- X(SVC_SST_TEST_SERVICE_DUMMY_DECRYPT, sst_test_service_svc_dummy_decrypt) \
- X(SVC_SST_TEST_SERVICE_CLEAN, sst_test_service_svc_clean)
-
-/**
- * \def LIST_SVC_TFM_PARTITION_TEST_SECURE_SERVICES
- *
- * \brief This is an X macro which lists
- * the SVC interface available for
- * TEST_SECURE_SERVICES partition.
- * The enumerator and corresponding
- * SVC handler function need to be
- * registered.
- *
- */
-#define LIST_SVC_TFM_PARTITION_TEST_SECURE_SERVICES \
- X(SVC_TFM_SECURE_CLIENT_RUN_TESTS, tfm_secure_client_service_svc_run_tests)
-
-/**
- * \brief Numbers associated to each SVC available
- *
- * \details Start from 1 as 0 is reserved by RTX
- */
-enum tfm_svc_num {
- SVC_INVALID = 0,
-
-#define X(SVC_ENUM, SVC_HANDLER) SVC_ENUM,
- /* SVC API for Services */
- LIST_SVC_DISPATCHERS
-
-#if defined(CORE_TEST_INTERACTIVE)
- LIST_SVC_CORE_TEST_INTERACTIVE
-#endif /* CORE_TEST_INTERACTIVE */
-
-#if defined(TFM_PARTITION_TEST_CORE)
- LIST_SVC_TFM_PARTITION_TEST_CORE
-#endif /* TFM_PARTITION_TEST_CORE */
-
-#if defined(TFM_PARTITION_TEST_SST)
- LIST_SVC_TFM_PARTITION_TEST_SST
-#endif /* TFM_PARTITION_TEST_SST */
-
-#if defined(TFM_PARTITION_TEST_SECURE_SERVICES)
- LIST_SVC_TFM_PARTITION_TEST_SECURE_SERVICES
-#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
-
-#undef X
-
- /* add all the new entries above this line */
- SVC_TFM_MAX,
-};
-
-/* number of user SVC functions */
-#define USER_SVC_COUNT (SVC_TFM_MAX - 1)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TFM_NS_SVC_H__ */
diff --git a/interface/include/tfm_sst_svc_handler.h b/interface/include/tfm_sst_svc_handler.h
deleted file mode 100644
index 57e2734..0000000
--- a/interface/include/tfm_sst_svc_handler.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef __TFM_SST_SVC_HANDLER_H__
-#define __TFM_SST_SVC_HANDLER_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "tfm_sst_defs.h"
-
-/**
- * \brief SVC funtion to allocate space for the asset, referenced by asset
- * UUID, without setting any data in the asset.
- *
- * \param[in] asset_uuid Asset UUID \ref tfm_sst_asset_id_t
- * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
- *
- * \return Returns an PSA_SST_ERR_SUCCESS if asset is created correctly.
- * Otherwise, error code as specified in \ref psa_sst_err_t
- */
-enum psa_sst_err_t tfm_sst_svc_create(uint32_t asset_uuid,
- const struct tfm_sst_token_t *s_token);
-
-/**
- * \brief SVC funtion to get asset's information referenced by asset UUID.
- *
- * \param[in] asset_uuid Asset UUID
- * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
- * \param[out] info Pointer to store the asset's information
- * \ref psa_sst_asset_info_t
- *
- * \return Returns error code as specified in \ref psa_sst_err_t
- */
-enum psa_sst_err_t tfm_sst_svc_get_info(uint32_t asset_uuid,
- const struct tfm_sst_token_t *s_token,
- struct psa_sst_asset_info_t *info);
-/**
- * \brief SVC funtion to get asset's attributes referenced by asset UUID.
- *
- * \param[in] asset_uuid Asset UUID
- * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
- * \param[out] attrs Pointer to store the asset's attributes
- * \ref psa_sst_asset_attrs_t
- *
- * \return Returns error code as specified in \ref psa_sst_err_t
- */
-enum psa_sst_err_t tfm_sst_svc_get_attributes(uint32_t asset_uuid,
- const struct tfm_sst_token_t *s_token,
- struct psa_sst_asset_attrs_t *attrs);
-
-/**
- * \brief SVC funtion to set asset's attributes referenced by asset UUID.
- *
- * \param[in] asset_uuid Asset UUID
- * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
- * \param[in] attrs Pointer to new the asset's attributes
- * \ref psa_sst_asset_attrs_t
- *
- * \return Returns error code as specified in \ref psa_sst_err_t
- */
-enum psa_sst_err_t tfm_sst_svc_set_attributes(uint32_t asset_uuid,
- const struct tfm_sst_token_t *s_token,
- const struct psa_sst_asset_attrs_t *attrs);
-
-/**
- * \brief SVC funtion to read asset's data from asset referenced by asset UUID.
- *
- * \param[in] asset_uuid Asset UUID
- * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
- * \param[out] data Pointer to data vector \ref tfm_sst_buf_t to store
- * data, size and offset
- *
- * \return Returns error code as specified in \ref psa_sst_err_t
- */
-enum psa_sst_err_t tfm_sst_svc_read(uint32_t asset_uuid,
- const struct tfm_sst_token_t *s_token,
- struct tfm_sst_buf_t* data);
-
-/**
- * \brief SVC funtion to write data into an asset referenced by asset UUID.
- *
- * \param[in] asset_uuid Asset UUID
- * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
- * \param[in] data Pointer to data vector \ref tfm_sst_buf_t which
- * contains the data to write
- *
- * \return Returns error code as specified in \ref psa_sst_err_t
- */
-enum psa_sst_err_t tfm_sst_svc_write(uint32_t asset_uuid,
- const struct tfm_sst_token_t *s_token,
- struct tfm_sst_buf_t* data);
-
-/**
- * \brief SVC funtion to delete the asset referenced by the asset UUID.
- *
- * \param[in] asset_uuid Asset UUID
- * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
- *
- * \return Returns error code as specified in \ref psa_sst_err_t
- */
-enum psa_sst_err_t tfm_sst_svc_delete(uint32_t asset_uuid,
- const struct tfm_sst_token_t *s_token);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TFM_SST_SVC_HANDLER_H__ */
diff --git a/interface/src/tfm_log_api.c b/interface/src/tfm_log_api.c
index ae918da..c6b27e7 100644
--- a/interface/src/tfm_log_api.c
+++ b/interface/src/tfm_log_api.c
@@ -5,6 +5,7 @@
*
*/
+#include "tfm_log_veneers.h"
#include "tfm_log_defs.h"
#include "tfm_ns_lock.h"
@@ -13,28 +14,28 @@
uint8_t *buffer,
struct tfm_log_info *info)
{
- return tfm_ns_lock_svc_dispatch(SVC_TFM_LOG_RETRIEVE,
- size,
- (uint32_t)start,
- (uint32_t)buffer,
- (uint32_t)info);
+ return tfm_ns_lock_dispatch((veneer_fn)tfm_log_veneer_retrieve,
+ size,
+ (uint32_t)start,
+ (uint32_t)buffer,
+ (uint32_t)info);
}
enum tfm_log_err tfm_log_get_info(struct tfm_log_info *info)
{
- return tfm_ns_lock_svc_dispatch(SVC_TFM_LOG_GET_INFO,
- (uint32_t)info,
- 0,
- 0,
- 0);
+ return tfm_ns_lock_dispatch((veneer_fn)tfm_log_veneer_get_info,
+ (uint32_t)info,
+ 0,
+ 0,
+ 0);
}
enum tfm_log_err tfm_log_delete_items(uint32_t num_items,
uint32_t *rem_items)
{
- return tfm_ns_lock_svc_dispatch(SVC_TFM_LOG_DELETE_ITEMS,
- num_items,
- (uint32_t)rem_items,
- 0,
- 0);
+ return tfm_ns_lock_dispatch((veneer_fn)tfm_log_veneer_delete_items,
+ num_items,
+ (uint32_t)rem_items,
+ 0,
+ 0);
}
diff --git a/interface/src/tfm_log_svc_handler.c b/interface/src/tfm_log_svc_handler.c
deleted file mode 100644
index 325d6de..0000000
--- a/interface/src/tfm_log_svc_handler.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#include "tfm_ns_svc.h"
-#include "tfm_log_veneers.h"
-
-/* SVC function implementations */
-enum tfm_log_err tfm_log_svc_retrieve(uint32_t size,
- int32_t start,
- uint8_t* buffer,
- struct tfm_log_info *info)
-{
- return tfm_log_veneer_retrieve(size, start, buffer, info);
-}
-
-enum tfm_log_err tfm_log_svc_get_info(struct tfm_log_info *info)
-{
- return tfm_log_veneer_get_info(info);
-}
-
-enum tfm_log_err tfm_log_svc_delete_items(uint32_t num_items,
- uint32_t *rem_items)
-{
- return tfm_log_veneer_delete_items(num_items, rem_items);
-}
diff --git a/interface/src/tfm_ns_lock_rtx.c b/interface/src/tfm_ns_lock_rtx.c
index 5ec6638..ef6cfe0 100644
--- a/interface/src/tfm_ns_lock_rtx.c
+++ b/interface/src/tfm_ns_lock_rtx.c
@@ -11,7 +11,7 @@
#include "cmsis_os2.h"
#include "tfm_api.h"
-#include "tfm_ns_svc.h"
+#include "tfm_ns_lock.h"
/**
* \brief struct ns_lock_state type
@@ -36,86 +36,27 @@
};
/**
- * \def TFM_SVC_DISPATCH_NAME
- *
- * \brief Macro to declare a SVC dispatch function name
- */
-#define TFM_SVC_DISPATCH_NAME(SVC_ENUM) tfm_svc_dispatch_##SVC_ENUM
-
-/**
- * \def TFM_SVC_DISPATCH_FUNCTION
- *
- * \brief Macro to declare a SVC dispatch naked function body (4 bytes each)
- */
-#define TFM_SVC_DISPATCH_FUNCTION(SVC_ENUM) \
- __attribute__((naked)) \
- static uint32_t TFM_SVC_DISPATCH_NAME(SVC_ENUM)(uint32_t arg0, \
- uint32_t arg1, \
- uint32_t arg2, \
- uint32_t arg3) \
- { \
- SVC(SVC_ENUM); \
- __ASM("BX LR"); \
- }
-
-/**
- * \brief Naked functions associated to each
- * SVC in the list of X macros
- * \ref LIST_SVC_DISPATCHERS
- */
-#define X(SVC_ENUM, SVC_HANDLER) TFM_SVC_DISPATCH_FUNCTION(SVC_ENUM);
-LIST_SVC_DISPATCHERS
-#undef X
-
-/**
- * \brief Array with function pointers to the
- * naked functions. Entry 0 is treated
- * as invalid. The other entries are
- * taken automatically from the list of
- * X macros \ref LIST_SVC_DISPATCHERS
- */
-static void *tfm_svc_dispatch_functions[] = {
- (void *) NULL, /* SVC_INVALID */
-#define X(SVC_ENUM, SVC_HANDLER) (void *)TFM_SVC_DISPATCH_NAME(SVC_ENUM),
- LIST_SVC_DISPATCHERS
-#undef X
-};
-
-/**
* \brief NS world, NS lock based dispatcher
*/
-uint32_t tfm_ns_lock_svc_dispatch(enum tfm_svc_num svc_num,
- uint32_t arg0,
- uint32_t arg1,
- uint32_t arg2,
- uint32_t arg3)
+uint32_t tfm_ns_lock_dispatch(veneer_fn fn,
+ uint32_t arg0, uint32_t arg1,
+ uint32_t arg2, uint32_t arg3)
{
uint32_t result;
- uint32_t (*tfm_svc_dispatch_function_p)(uint32_t, uint32_t,
- uint32_t, uint32_t);
-
- const uint32_t num_svc_dispatchers =
- sizeof(tfm_svc_dispatch_functions)/sizeof(tfm_svc_dispatch_functions[0]);
/* Check the NS lock has been initialized */
if (ns_lock.init == false) {
return TFM_ERROR_GENERIC;
}
- /* Validate the SVC number requested */
- if ((svc_num > SVC_INVALID) && (svc_num < num_svc_dispatchers)) {
- tfm_svc_dispatch_function_p = tfm_svc_dispatch_functions[svc_num];
+ /* TFM request protected by NS lock */
+ osMutexAcquire(ns_lock.id,osWaitForever);
- /* TFM request protected by NS lock */
- osMutexAcquire(ns_lock.id,osWaitForever);
- result = (*tfm_svc_dispatch_function_p)(arg0, arg1, arg2, arg3);
- osMutexRelease(ns_lock.id);
+ result = fn(arg0, arg1, arg2, arg3);
- return result;
- }
- else {
- return TFM_ERROR_GENERIC;
- }
+ osMutexRelease(ns_lock.id);
+
+ return result;
}
/**
@@ -132,3 +73,9 @@
return TFM_ERROR_GENERIC;
}
}
+
+bool tfm_ns_lock_get_init_state()
+{
+ return ns_lock.init;
+}
+
diff --git a/interface/src/tfm_sst_api.c b/interface/src/tfm_sst_api.c
index d9947b4..8a3fec8 100644
--- a/interface/src/tfm_sst_api.c
+++ b/interface/src/tfm_sst_api.c
@@ -5,23 +5,28 @@
*
*/
+#include "tfm_sst_veneers.h"
#include "tfm_sst_defs.h"
#include "tfm_ns_lock.h"
+#include "tfm_id_mngr.h"
enum psa_sst_err_t psa_sst_create(uint32_t asset_uuid, const uint8_t *token,
uint32_t token_size)
{
struct tfm_sst_token_t s_token;
+ int32_t client_id;
/* Pack the token information in the token structure */
s_token.token = token;
s_token.token_size = token_size;
- return tfm_ns_lock_svc_dispatch(SVC_TFM_SST_CREATE,
- asset_uuid,
- (uint32_t)&s_token,
- 0,
- 0);
+ client_id = tfm_sst_get_cur_id();
+
+ return tfm_ns_lock_dispatch((veneer_fn)tfm_sst_veneer_create,
+ client_id,
+ asset_uuid,
+ (uint32_t)&s_token,
+ 0);
}
enum psa_sst_err_t psa_sst_get_info(uint32_t asset_uuid,
@@ -30,16 +35,19 @@
struct psa_sst_asset_info_t *info)
{
struct tfm_sst_token_t s_token;
+ int32_t client_id;
/* Pack the token information in the token structure */
s_token.token = token;
s_token.token_size = token_size;
- return tfm_ns_lock_svc_dispatch(SVC_TFM_SST_GET_INFO,
- asset_uuid,
- (uint32_t)&s_token,
- (uint32_t)info,
- 0);
+ client_id = tfm_sst_get_cur_id();
+
+ return tfm_ns_lock_dispatch((veneer_fn)tfm_sst_veneer_get_info,
+ client_id,
+ asset_uuid,
+ (uint32_t)&s_token,
+ (uint32_t)info);
}
enum psa_sst_err_t psa_sst_get_attributes(uint32_t asset_uuid,
@@ -48,16 +56,19 @@
struct psa_sst_asset_attrs_t *attrs)
{
struct tfm_sst_token_t s_token;
+ int32_t client_id;
/* Pack the token information in the token structure */
s_token.token = token;
s_token.token_size = token_size;
- return tfm_ns_lock_svc_dispatch(SVC_TFM_SST_GET_ATTRIBUTES,
- asset_uuid,
- (uint32_t)&s_token,
- (uint32_t)attrs,
- 0);
+ client_id = tfm_sst_get_cur_id();
+
+ return tfm_ns_lock_dispatch((veneer_fn)tfm_sst_veneer_get_attributes,
+ client_id,
+ asset_uuid,
+ (uint32_t)&s_token,
+ (uint32_t)attrs);
}
enum psa_sst_err_t psa_sst_set_attributes(uint32_t asset_uuid,
@@ -66,16 +77,19 @@
const struct psa_sst_asset_attrs_t *attrs)
{
struct tfm_sst_token_t s_token;
+ int32_t client_id;
/* Pack the token information in the token structure */
s_token.token = token;
s_token.token_size = token_size;
- return tfm_ns_lock_svc_dispatch(SVC_TFM_SST_SET_ATTRIBUTES,
- asset_uuid,
- (uint32_t)&s_token,
- (uint32_t)attrs,
- 0);
+ client_id = tfm_sst_get_cur_id();
+
+ return tfm_ns_lock_dispatch((veneer_fn)tfm_sst_veneer_set_attributes,
+ client_id,
+ asset_uuid,
+ (uint32_t)&s_token,
+ (uint32_t)attrs);
}
enum psa_sst_err_t psa_sst_read(uint32_t asset_uuid,
@@ -87,6 +101,7 @@
{
struct tfm_sst_token_t s_token;
struct tfm_sst_buf_t s_data;
+ int32_t client_id;
/* Pack the token information in the token structure */
s_token.token = token;
@@ -97,11 +112,13 @@
s_data.offset = offset;
s_data.data = data;
- return tfm_ns_lock_svc_dispatch(SVC_TFM_SST_READ,
- asset_uuid,
- (uint32_t)&s_token,
- (uint32_t)&s_data,
- 0);
+ client_id = tfm_sst_get_cur_id();
+
+ return tfm_ns_lock_dispatch((veneer_fn)tfm_sst_veneer_read,
+ client_id,
+ asset_uuid,
+ (uint32_t)&s_token,
+ (uint32_t)&s_data);
}
enum psa_sst_err_t psa_sst_write(uint32_t asset_uuid,
@@ -113,6 +130,7 @@
{
struct tfm_sst_token_t s_token;
struct tfm_sst_buf_t s_data;
+ int32_t client_id;
/* Pack the token information in the token structure */
s_token.token = token;
@@ -123,11 +141,13 @@
s_data.offset = offset;
s_data.data = (uint8_t *)data;
- return tfm_ns_lock_svc_dispatch(SVC_TFM_SST_WRITE,
- asset_uuid,
- (uint32_t)&s_token,
- (uint32_t)&s_data,
- 0);
+ client_id = tfm_sst_get_cur_id();
+
+ return tfm_ns_lock_dispatch((veneer_fn)tfm_sst_veneer_write,
+ client_id,
+ asset_uuid,
+ (uint32_t)&s_token,
+ (uint32_t)&s_data);
}
enum psa_sst_err_t psa_sst_delete(uint32_t asset_uuid,
@@ -135,14 +155,17 @@
uint32_t token_size)
{
struct tfm_sst_token_t s_token;
+ int32_t client_id;
/* Pack the token information in the token structure */
s_token.token = token;
s_token.token_size = token_size;
- return tfm_ns_lock_svc_dispatch(SVC_TFM_SST_DELETE,
- asset_uuid,
- (uint32_t)&s_token,
- 0,
- 0);
+ client_id = tfm_sst_get_cur_id();
+
+ return tfm_ns_lock_dispatch((veneer_fn)tfm_sst_veneer_delete,
+ client_id,
+ asset_uuid,
+ (uint32_t)&s_token,
+ 0);
}
diff --git a/interface/src/tfm_sst_svc_handler.c b/interface/src/tfm_sst_svc_handler.c
deleted file mode 100644
index 3fbd3ad..0000000
--- a/interface/src/tfm_sst_svc_handler.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#include <string.h>
-#include "tfm_ns_svc.h"
-#include "tfm_sst_veneers.h"
-#include "tfm_id_mngr.h"
-
-/* SVC function implementations */
-enum psa_sst_err_t tfm_sst_svc_create(uint32_t asset_uuid,
- const struct tfm_sst_token_t *s_token)
-{
- int32_t client_id;
-
- client_id = tfm_sst_get_cur_id();
-
- return tfm_sst_veneer_create(client_id, asset_uuid, s_token);
-}
-
-enum psa_sst_err_t tfm_sst_svc_get_info(uint32_t asset_uuid,
- const struct tfm_sst_token_t *s_token,
- struct psa_sst_asset_info_t *info)
-{
- int32_t client_id;
-
- client_id = tfm_sst_get_cur_id();
-
- return tfm_sst_veneer_get_info(client_id, asset_uuid, s_token, info);
-}
-
-enum psa_sst_err_t tfm_sst_svc_get_attributes(uint32_t asset_uuid,
- const struct tfm_sst_token_t *s_token,
- struct psa_sst_asset_attrs_t *attrs)
-{
- int32_t client_id;
-
- client_id = tfm_sst_get_cur_id();
-
- return tfm_sst_veneer_get_attributes(client_id, asset_uuid,
- s_token, attrs);
-}
-
-enum psa_sst_err_t tfm_sst_svc_set_attributes(uint32_t asset_uuid,
- const struct tfm_sst_token_t *s_token,
- const struct psa_sst_asset_attrs_t *attrs)
-{
- int32_t client_id;
-
- client_id = tfm_sst_get_cur_id();
-
- return tfm_sst_veneer_set_attributes(client_id, asset_uuid,
- s_token, attrs);
-}
-
-enum psa_sst_err_t tfm_sst_svc_read(uint32_t asset_uuid,
- const struct tfm_sst_token_t *s_token,
- struct tfm_sst_buf_t* data)
-{
- int32_t client_id;
-
- client_id = tfm_sst_get_cur_id();
-
- return tfm_sst_veneer_read(client_id, asset_uuid, s_token, data);
-}
-
-enum psa_sst_err_t tfm_sst_svc_write(uint32_t asset_uuid,
- const struct tfm_sst_token_t *s_token,
- struct tfm_sst_buf_t* data)
-{
- int32_t client_id;
-
- client_id = tfm_sst_get_cur_id();
-
- return tfm_sst_veneer_write(client_id, asset_uuid, s_token, data);
-}
-
-enum psa_sst_err_t tfm_sst_svc_delete(uint32_t asset_uuid,
- const struct tfm_sst_token_t *s_token)
-{
- int32_t client_id;
-
- client_id = tfm_sst_get_cur_id();
-
- return tfm_sst_veneer_delete(client_id, asset_uuid, s_token);
-}