blob: 1fac2ad1863f4a90aa2626fe3aced3892ed206f6 [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"
Marc Moreno Berengue51af9512018-06-14 18:28:14 +010018#include "tfm_sst_asset_defs.h"
19#include "tfm_sst_asset_macros.h"
Ashutosh Singhf4d88672017-11-29 13:35:43 +000020
21/* FIXME: the secure APP ID should not be share with the non-secure code
22 * as it is revealing information about secure code implementation.
23 */
24#define S_APP_ID 0xF0000000
25
26/* FIXME:
27 * Very descriptive error codes can leak implementation
28 * information to caller and may allow exploitation
29 * of implementation weaknesses by malicious actors.
30 * Potential approaches-
31 * a. Just return generic error for any kind of failure
32 *
33 * OR
34 *
35 * b. Non-secure callers get the generic failure, the
36 * secure side callers get a bit more detailed error
37 * codes.
38 */
39
40/* The return value is shared with the TFM service status value. The SST return
41 * codes shouldn't overlap with predefined TFM status values.
42 */
Mate Toth-Pal7de74b52018-02-23 15:46:47 +010043#define TFM_SST_ERR_OFFSET (TFM_PARTITION_SPECIFIC_ERROR_MIN)
Ashutosh Singhf4d88672017-11-29 13:35:43 +000044
45enum tfm_sst_err_t {
46 TFM_SST_ERR_SUCCESS = 0,
47 TFM_SST_ERR_ASSET_NOT_PREPARED = TFM_SST_ERR_OFFSET,
48 TFM_SST_ERR_ASSET_NOT_FOUND,
49 TFM_SST_ERR_PARAM_ERROR,
50 TFM_SST_ERR_INVALID_HANDLE,
51 TFM_SST_ERR_STORAGE_SYSTEM_FULL,
52 TFM_SST_ERR_SYSTEM_ERROR,
53 /* Following entry is only to ensure the error code of int size */
54 TFM_SST_ERR_FORCE_INT_SIZE = INT_MAX
55};
56
Marc Moreno Berengue675b6e92018-06-14 17:31:01 +010057/*!
Marc Moreno Berengue675b6e92018-06-14 17:31:01 +010058 * \struct tfm_sst_buf_t
59 *
60 * \brief Structure to store data information to read/write from/to asset.
61 *
62 */
Ashutosh Singhf4d88672017-11-29 13:35:43 +000063struct tfm_sst_buf_t {
Marc Moreno Berengue675b6e92018-06-14 17:31:01 +010064 uint8_t *data; /*!< Address of input/output data */
Ashutosh Singhf4d88672017-11-29 13:35:43 +000065 uint32_t size; /*!< Size of input/output data */
66 uint32_t offset; /*!< Offset within asset */
67};
68
Ashutosh Singhf4d88672017-11-29 13:35:43 +000069#ifdef __cplusplus
70}
71#endif
72
73#endif /* __TFM_SST_DEFS_H__ */