Commit | Line | Data |
---|---|---|
cd9434cc T |
1 | /* |
2 | * Copyright (c) 2013-2015 TRUSTONIC LIMITED | |
3 | * All rights reserved. | |
4 | * | |
5 | * Redistribution and use in source and binary forms, with or without | |
6 | * modification, are permitted provided that the following conditions are met: | |
7 | * | |
8 | * 1. Redistributions of source code must retain the above copyright notice, | |
9 | * this list of conditions and the following disclaimer. | |
10 | * | |
11 | * 2. Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | |
14 | * | |
15 | * 3. Neither the name of the TRUSTONIC LIMITED nor the names of its | |
16 | * contributors may be used to endorse or promote products derived from | |
17 | * this software without specific prior written permission. | |
18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR | |
23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
26 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
27 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
28 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
29 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | |
31 | ||
32 | /** | |
33 | * @file drSecureFS_Api.h | |
34 | * @brief Contains TCI definitions shared with FSD2 daemon and SPT2 TA | |
35 | * | |
36 | */ | |
37 | ||
38 | #ifndef __DRSFSAPI_H__ | |
39 | #define __DRSFSAPI_H__ | |
40 | ||
41 | #include "service_delegation_protocol.h" | |
42 | ||
43 | ||
44 | /* | |
45 | * Driver ID. This is managed by Trustonic | |
46 | */ | |
47 | #define DRV_STH2_ID 0x0104 | |
48 | ||
49 | /** | |
50 | * Driver UUID. Update accordingly after reserving UUID | |
51 | */ | |
52 | #define DRV_SFS_UUID { { 0x07, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20 } } | |
53 | ||
54 | /* | |
55 | * TCI definitions, relayed by SPT2 TA from FSD2 daemon | |
56 | */ | |
57 | #define EXCHANGE_BUFFER_INSTRUCTIONS_NB 1000 | |
58 | ||
59 | /** | |
60 | * This type indicates the state of the daemon | |
61 | */ | |
62 | typedef enum { | |
63 | STH2_DAEMON_LISTENING = 0, | |
64 | STH2_DAEMON_PROCESSING = 1, | |
65 | } STH2_daemon_state; | |
66 | ||
67 | /** | |
68 | * TCI message data. | |
69 | */ | |
70 | typedef struct { | |
71 | /* indicates that the secure driver has sent instructions to the normal world daemon. | |
72 | * This variable is updated in the following ways: | |
73 | * - Initially set to LISTENING by the daemon before it connects to the secure driver. | |
74 | * - The secure driver switches the state from LISTENING to PROCESSING when it wants the daemon to process instructions. | |
75 | * - The daemon switches the state from PROCESSING to LISTENING when it has finished processing the instructions. | |
76 | */ | |
77 | STH2_daemon_state nDaemonState; | |
78 | /* sector size | |
79 | * set initially by the secure world. | |
80 | * In TF: `g_nSectorSize`. | |
81 | */ | |
82 | uint32_t nSectorSize; | |
83 | ||
84 | /* workspace length | |
85 | * set initially by the daemon. | |
86 | * In TF: calculated from the exchange buffer size. | |
87 | */ | |
88 | uint32_t nWorkspaceLength; | |
89 | /* administrative data | |
90 | * written by the normal world. | |
91 | * In TF: `g_pExchangeBuffer->sAdministrativeData`. | |
92 | */ | |
93 | DELEGATION_ADMINISTRATIVE_DATA sAdministrativeData; | |
94 | /* number of instructions to be executed by the daemon. | |
95 | * Set by the secure world for each command. | |
96 | * In TF: the output `size` of `params[1]` | |
97 | */ | |
98 | uint32_t nInstructionsBufferSize; | |
99 | /* instruction list | |
100 | * set by the secure world. | |
101 | * In TF: `g_pExchangeBuffer->sInstructions`. | |
102 | */ | |
103 | uint32_t sInstructions[EXCHANGE_BUFFER_INSTRUCTIONS_NB]; | |
104 | /* sectors content, set by either side depending on the instruction. | |
105 | * The workspace size is hard-coded based on the maximum sector size (4096). | |
106 | * In TF: `g_pExchangeBuffer->sWorkspace' | |
107 | */ | |
108 | uint8_t sWorkspace[]; | |
109 | } STH2_delegation_exchange_buffer_t; | |
110 | ||
111 | ||
112 | #endif // __DRSFSAPI_H__ |