Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 1 | /* |
Marc Moreno Berengue | 675b6e9 | 2018-06-14 17:31:01 +0100 | [diff] [blame] | 2 | * Copyright (c) 2017-2018, Arm Limited. All rights reserved. |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 3 | * |
| 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 Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 14 | enum tfm_sst_err_t tfm_sst_svc_create(uint32_t asset_uuid) |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 15 | { |
| 16 | uint32_t app_id; |
| 17 | |
| 18 | app_id = tfm_sst_get_cur_id(); |
| 19 | |
| 20 | return tfm_sst_veneer_create(app_id, asset_uuid); |
| 21 | } |
| 22 | |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 23 | enum tfm_sst_err_t tfm_sst_svc_get_info(uint32_t asset_uuid, |
Marc Moreno Berengue | 675b6e9 | 2018-06-14 17:31:01 +0100 | [diff] [blame] | 24 | struct tfm_sst_asset_info_t *info) |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 25 | { |
| 26 | uint32_t app_id; |
| 27 | |
| 28 | app_id = tfm_sst_get_cur_id(); |
| 29 | |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 30 | return tfm_sst_veneer_get_info(app_id, asset_uuid, info); |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 31 | } |
| 32 | |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 33 | enum tfm_sst_err_t tfm_sst_svc_get_attributes(uint32_t asset_uuid, |
Marc Moreno Berengue | 51af951 | 2018-06-14 18:28:14 +0100 | [diff] [blame] | 34 | struct tfm_sst_asset_attrs_t *attrs) |
| 35 | { |
| 36 | uint32_t app_id; |
| 37 | |
| 38 | app_id = tfm_sst_get_cur_id(); |
| 39 | |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 40 | return tfm_sst_veneer_get_attributes(app_id, asset_uuid, attrs); |
Marc Moreno Berengue | 51af951 | 2018-06-14 18:28:14 +0100 | [diff] [blame] | 41 | } |
| 42 | |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 43 | enum tfm_sst_err_t tfm_sst_svc_set_attributes(uint32_t asset_uuid, |
Marc Moreno Berengue | 51af951 | 2018-06-14 18:28:14 +0100 | [diff] [blame] | 44 | const struct tfm_sst_asset_attrs_t *attrs) |
| 45 | { |
| 46 | uint32_t app_id; |
| 47 | |
| 48 | app_id = tfm_sst_get_cur_id(); |
| 49 | |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 50 | return tfm_sst_veneer_set_attributes(app_id, asset_uuid, attrs); |
Marc Moreno Berengue | 51af951 | 2018-06-14 18:28:14 +0100 | [diff] [blame] | 51 | } |
| 52 | |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 53 | enum tfm_sst_err_t tfm_sst_svc_read(uint32_t asset_uuid, |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 54 | struct tfm_sst_buf_t* data) |
| 55 | { |
| 56 | uint32_t app_id; |
| 57 | |
| 58 | app_id = tfm_sst_get_cur_id(); |
| 59 | |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 60 | return tfm_sst_veneer_read(app_id, asset_uuid, data); |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 61 | } |
| 62 | |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 63 | enum tfm_sst_err_t tfm_sst_svc_write(uint32_t asset_uuid, |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 64 | struct tfm_sst_buf_t* data) |
| 65 | { |
| 66 | uint32_t app_id; |
| 67 | |
| 68 | app_id = tfm_sst_get_cur_id(); |
| 69 | |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 70 | return tfm_sst_veneer_write(app_id, asset_uuid, data); |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 71 | } |
| 72 | |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 73 | enum tfm_sst_err_t tfm_sst_svc_delete(uint32_t asset_uuid) |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 74 | { |
| 75 | uint32_t app_id; |
| 76 | |
| 77 | app_id = tfm_sst_get_cur_id(); |
| 78 | |
Marc Moreno Berengue | 4258e54 | 2018-06-18 13:55:59 +0100 | [diff] [blame^] | 79 | return tfm_sst_veneer_delete(app_id, asset_uuid); |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 80 | } |