Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 1 | /* |
Mate Toth-Pal | 7de74b5 | 2018-02-23 15:46:47 +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 | #ifndef __TFM_SST_DEFS_H__ |
| 9 | #define __TFM_SST_DEFS_H__ |
| 10 | |
| 11 | #ifdef __cplusplus |
| 12 | extern "C" { |
| 13 | #endif |
| 14 | |
| 15 | #include <inttypes.h> |
| 16 | #include <limits.h> |
| 17 | #include "tfm_api.h" |
Marc Moreno Berengue | 51af951 | 2018-06-14 18:28:14 +0100 | [diff] [blame] | 18 | #include "tfm_sst_asset_defs.h" |
| 19 | #include "tfm_sst_asset_macros.h" |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 20 | |
| 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-Pal | 7de74b5 | 2018-02-23 15:46:47 +0100 | [diff] [blame] | 43 | #define TFM_SST_ERR_OFFSET (TFM_PARTITION_SPECIFIC_ERROR_MIN) |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 44 | |
| 45 | enum 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 Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 50 | 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 Berengue | 675b6e9 | 2018-06-14 17:31:01 +0100 | [diff] [blame] | 56 | /*! |
Marc Moreno Berengue | 675b6e9 | 2018-06-14 17:31:01 +0100 | [diff] [blame] | 57 | * \struct tfm_sst_buf_t |
| 58 | * |
| 59 | * \brief Structure to store data information to read/write from/to asset. |
| 60 | * |
| 61 | */ |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 62 | struct tfm_sst_buf_t { |
Marc Moreno Berengue | 675b6e9 | 2018-06-14 17:31:01 +0100 | [diff] [blame] | 63 | uint8_t *data; /*!< Address of input/output data */ |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 64 | uint32_t size; /*!< Size of input/output data */ |
| 65 | uint32_t offset; /*!< Offset within asset */ |
| 66 | }; |
| 67 | |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 68 | #ifdef __cplusplus |
| 69 | } |
| 70 | #endif |
| 71 | |
| 72 | #endif /* __TFM_SST_DEFS_H__ */ |