blob: 52e41b39b26a9df3f0639dd2f529d4f7d0262617 [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,
Ashutosh Singhf4d88672017-11-29 13:35:43 +000050 TFM_SST_ERR_STORAGE_SYSTEM_FULL,
51 TFM_SST_ERR_SYSTEM_ERROR,
52 /* Following entry is only to ensure the error code of int size */
53 TFM_SST_ERR_FORCE_INT_SIZE = INT_MAX
54};
55
Marc Moreno Berengue675b6e92018-06-14 17:31:01 +010056/*!
Marc Moreno Berengue675b6e92018-06-14 17:31:01 +010057 * \struct tfm_sst_buf_t
58 *
59 * \brief Structure to store data information to read/write from/to asset.
60 *
61 */
Ashutosh Singhf4d88672017-11-29 13:35:43 +000062struct tfm_sst_buf_t {
Marc Moreno Berengue675b6e92018-06-14 17:31:01 +010063 uint8_t *data; /*!< Address of input/output data */
Ashutosh Singhf4d88672017-11-29 13:35:43 +000064 uint32_t size; /*!< Size of input/output data */
65 uint32_t offset; /*!< Offset within asset */
66};
67
Ashutosh Singhf4d88672017-11-29 13:35:43 +000068#ifdef __cplusplus
69}
70#endif
71
72#endif /* __TFM_SST_DEFS_H__ */