blob: 8277169c532d3c00bac89d637d034bd3b47351d4 [file] [log] [blame]
Ashutosh Singhf4d88672017-11-29 13:35:43 +00001/*
Marc Moreno Berengue675b6e92018-06-14 17:31:01 +01002 * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
Ashutosh Singhf4d88672017-11-29 13:35:43 +00003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8#include <string.h>
9#include "tfm_ns_svc.h"
10#include "tfm_sst_veneers.h"
11#include "tfm_id_mngr.h"
12
13/* SVC function implementations */
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010014enum tfm_sst_err_t tfm_sst_svc_create(uint32_t asset_uuid,
15 const struct tfm_sst_token_t *s_token)
Ashutosh Singhf4d88672017-11-29 13:35:43 +000016{
17 uint32_t app_id;
18
19 app_id = tfm_sst_get_cur_id();
20
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010021 return tfm_sst_veneer_create(app_id, asset_uuid, s_token);
Ashutosh Singhf4d88672017-11-29 13:35:43 +000022}
23
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010024enum tfm_sst_err_t tfm_sst_svc_get_info(uint32_t asset_uuid,
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010025 const struct tfm_sst_token_t *s_token,
Marc Moreno Berengue675b6e92018-06-14 17:31:01 +010026 struct tfm_sst_asset_info_t *info)
Ashutosh Singhf4d88672017-11-29 13:35:43 +000027{
28 uint32_t app_id;
29
30 app_id = tfm_sst_get_cur_id();
31
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010032 return tfm_sst_veneer_get_info(app_id, asset_uuid, s_token, info);
Ashutosh Singhf4d88672017-11-29 13:35:43 +000033}
34
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010035enum tfm_sst_err_t tfm_sst_svc_get_attributes(uint32_t asset_uuid,
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010036 const struct tfm_sst_token_t *s_token,
37 struct tfm_sst_asset_attrs_t *attrs)
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010038{
39 uint32_t app_id;
40
41 app_id = tfm_sst_get_cur_id();
42
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010043 return tfm_sst_veneer_get_attributes(app_id, asset_uuid, s_token, attrs);
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010044}
45
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010046enum tfm_sst_err_t tfm_sst_svc_set_attributes(uint32_t asset_uuid,
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010047 const struct tfm_sst_token_t *s_token,
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010048 const struct tfm_sst_asset_attrs_t *attrs)
49{
50 uint32_t app_id;
51
52 app_id = tfm_sst_get_cur_id();
53
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010054 return tfm_sst_veneer_set_attributes(app_id, asset_uuid, s_token, attrs);
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010055}
56
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010057enum tfm_sst_err_t tfm_sst_svc_read(uint32_t asset_uuid,
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010058 const struct tfm_sst_token_t *s_token,
Ashutosh Singhf4d88672017-11-29 13:35:43 +000059 struct tfm_sst_buf_t* data)
60{
61 uint32_t app_id;
62
63 app_id = tfm_sst_get_cur_id();
64
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010065 return tfm_sst_veneer_read(app_id, asset_uuid, s_token, data);
Ashutosh Singhf4d88672017-11-29 13:35:43 +000066}
67
Marc Moreno Berengue4258e542018-06-18 13:55:59 +010068enum tfm_sst_err_t tfm_sst_svc_write(uint32_t asset_uuid,
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010069 const struct tfm_sst_token_t *s_token,
Ashutosh Singhf4d88672017-11-29 13:35:43 +000070 struct tfm_sst_buf_t* data)
71{
72 uint32_t app_id;
73
74 app_id = tfm_sst_get_cur_id();
75
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010076 return tfm_sst_veneer_write(app_id, asset_uuid, s_token, data);
Ashutosh Singhf4d88672017-11-29 13:35:43 +000077}
78
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010079enum tfm_sst_err_t tfm_sst_svc_delete(uint32_t asset_uuid,
80 const struct tfm_sst_token_t *s_token)
Ashutosh Singhf4d88672017-11-29 13:35:43 +000081{
82 uint32_t app_id;
83
84 app_id = tfm_sst_get_cur_id();
85
Marc Moreno Berengue10d0d362018-06-18 14:15:56 +010086 return tfm_sst_veneer_delete(app_id, asset_uuid, s_token);
Ashutosh Singhf4d88672017-11-29 13:35:43 +000087}