blob: 75e2a16cb4be84c11aca0f05b8cea22f2d5948f0 [file] [log] [blame]
Ashutosh Singhf4d88672017-11-29 13:35:43 +00001/*
2 * Copyright (c) 2017, Arm Limited. All rights reserved.
3 *
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 */
41#define TFM_SST_ERR_OFFSET (TFM_SERVICE_SPECIFIC_ERROR_MIN)
42
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
55struct tfm_sst_attribs_t {
56 uint32_t size_current; /*!< The current size of the asset */
57 uint32_t size_max; /*!< The maximum size of the asset in bytes */
58};
59
60/* Structure to store data information to read/write from/to asset */
61struct tfm_sst_buf_t {
62 uint8_t* data; /*!< Address of input/output data */
63 uint32_t size; /*!< Size of input/output data */
64 uint32_t offset; /*!< Offset within asset */
65};
66
67#ifdef __cplusplus
68}
69#endif
70
71#endif /* __TFM_SST_DEFS_H__ */