blob: 83ac62d4a527b16ae84963f671dbcf946201ea84 [file] [log] [blame]
Ashutosh Singhf4d88672017-11-29 13:35:43 +00001/*
Mate Toth-Pal7de74b52018-02-23 15:46:47 +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#ifndef __TFM_SST_DEFS_H__
9#define __TFM_SST_DEFS_H__
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15#include <inttypes.h>
16#include <limits.h>
17#include "tfm_api.h"
18
19/* FIXME: the secure APP ID should not be share with the non-secure code
20 * as it is revealing information about secure code implementation.
21 */
22#define S_APP_ID 0xF0000000
23
24/* FIXME:
25 * Very descriptive error codes can leak implementation
26 * information to caller and may allow exploitation
27 * of implementation weaknesses by malicious actors.
28 * Potential approaches-
29 * a. Just return generic error for any kind of failure
30 *
31 * OR
32 *
33 * b. Non-secure callers get the generic failure, the
34 * secure side callers get a bit more detailed error
35 * codes.
36 */
37
38/* The return value is shared with the TFM service status value. The SST return
39 * codes shouldn't overlap with predefined TFM status values.
40 */
Mate Toth-Pal7de74b52018-02-23 15:46:47 +010041#define TFM_SST_ERR_OFFSET (TFM_PARTITION_SPECIFIC_ERROR_MIN)
Ashutosh Singhf4d88672017-11-29 13:35:43 +000042
43enum tfm_sst_err_t {
44 TFM_SST_ERR_SUCCESS = 0,
45 TFM_SST_ERR_ASSET_NOT_PREPARED = TFM_SST_ERR_OFFSET,
46 TFM_SST_ERR_ASSET_NOT_FOUND,
47 TFM_SST_ERR_PARAM_ERROR,
48 TFM_SST_ERR_INVALID_HANDLE,
49 TFM_SST_ERR_STORAGE_SYSTEM_FULL,
50 TFM_SST_ERR_SYSTEM_ERROR,
51 /* Following entry is only to ensure the error code of int size */
52 TFM_SST_ERR_FORCE_INT_SIZE = INT_MAX
53};
54
Marc Moreno Berengue675b6e92018-06-14 17:31:01 +010055/*!
56 * \struct tfm_sst_asset_info_t
57 *
58 * \brief Structure to store the asset information concerning the content
59 * information.
60 *
61 */
62struct tfm_sst_asset_info_t {
63 uint32_t size_current; /*!< The current size of the asset data */
64 uint32_t size_max; /*!< The maximum size of the asset data in bytes */
Ashutosh Singhf4d88672017-11-29 13:35:43 +000065};
66
Marc Moreno Berengue675b6e92018-06-14 17:31:01 +010067/*!
68 * \struct tfm_sst_buf_t
69 *
70 * \brief Structure to store data information to read/write from/to asset.
71 *
72 */
Ashutosh Singhf4d88672017-11-29 13:35:43 +000073struct tfm_sst_buf_t {
Marc Moreno Berengue675b6e92018-06-14 17:31:01 +010074 uint8_t *data; /*!< Address of input/output data */
Ashutosh Singhf4d88672017-11-29 13:35:43 +000075 uint32_t size; /*!< Size of input/output data */
76 uint32_t offset; /*!< Offset within asset */
77};
78
Marc Moreno Berengue675b6e92018-06-14 17:31:01 +010079#define TFM_SST_ASSET_INFO_SIZE sizeof(struct tfm_sst_asset_info_t)
80
Ashutosh Singhf4d88672017-11-29 13:35:43 +000081#ifdef __cplusplus
82}
83#endif
84
85#endif /* __TFM_SST_DEFS_H__ */