SST: Use get caller client ID API in SST
This change modifies SST service to use
tfm_core_get_caller_client_id(...), provided by the TF-M core, instead
of use the client ID provided by the dummy ID manager via the SST APIs.
The details of this change are:
- Remove client_id from the veneer API of SST (except for the read
operation, as referenced read is still possible)
- Remove the dummy ID manager
- Add documentation on how to integrate this new method to a NS
application
- Change Asset management to work with non-hardcoded secure
client ID
Change-Id: Ic97ea7aa5840d7e212adc009fa39c1c505440965
Signed-off-by: Mate Toth-Pal <mate.toth-pal@arm.com>
diff --git a/interface/src/tfm_sst_api.c b/interface/src/tfm_sst_api.c
index 8a3fec8..317032c 100644
--- a/interface/src/tfm_sst_api.c
+++ b/interface/src/tfm_sst_api.c
@@ -8,25 +8,25 @@
#include "tfm_sst_veneers.h"
#include "tfm_sst_defs.h"
#include "tfm_ns_lock.h"
-#include "tfm_id_mngr.h"
+
+/* This define uses the TF-M invalid client ID to specify a direct client read,
+ * as that it can not be used to identify a client.
+ */
+#define SST_DIRECT_CLIENT_READ TFM_INVALID_CLIENT_ID
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;
- 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);
+ 0, 0);
}
enum psa_sst_err_t psa_sst_get_info(uint32_t asset_uuid,
@@ -35,19 +35,16 @@
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;
- 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);
+ (uint32_t)info,
+ 0);
}
enum psa_sst_err_t psa_sst_get_attributes(uint32_t asset_uuid,
@@ -56,19 +53,16 @@
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;
- 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);
+ (uint32_t)attrs,
+ 0);
}
enum psa_sst_err_t psa_sst_set_attributes(uint32_t asset_uuid,
@@ -77,19 +71,16 @@
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;
- 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);
+ (uint32_t)attrs,
+ 0);
}
enum psa_sst_err_t psa_sst_read(uint32_t asset_uuid,
@@ -101,7 +92,6 @@
{
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;
@@ -112,10 +102,8 @@
s_data.offset = offset;
s_data.data = data;
- client_id = tfm_sst_get_cur_id();
-
return tfm_ns_lock_dispatch((veneer_fn)tfm_sst_veneer_read,
- client_id,
+ SST_DIRECT_CLIENT_READ,
asset_uuid,
(uint32_t)&s_token,
(uint32_t)&s_data);
@@ -130,7 +118,6 @@
{
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;
@@ -141,13 +128,11 @@
s_data.offset = offset;
s_data.data = (uint8_t *)data;
- 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);
+ (uint32_t)&s_data,
+ 0);
}
enum psa_sst_err_t psa_sst_delete(uint32_t asset_uuid,
@@ -155,17 +140,13 @@
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;
- 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);
+ 0, 0);
}