Commit bf071e5
Hernan Gatta
libteec: implement OCALL support during function invocation
OCALLs allow a TA to invoke functions on their CA with parameters, if
desired.
The flow begins when a CA calls TEEC_InvokeFunction. If the TEE context was
initialized with the OCALL setting, libteec includes an additional
parameter, the OCALL parameter, in the function invocation IOCTL. The
presence of the OCALL parameter lets the kernel driver know that an OCALL
may result from the invocation.
If an OCALL does arrive from the TA, the OCALL parameter includes
information about the OCALL, including the ID of the function that libteec
must handle. These are: allocate shared memory, free shared memory, and
invoke a function on the CA.
If either of the first two functions arrive at libteec, the library handles
these on behalf of the CA, allocating and freeing shared memory as
necessary.
When the third function arrives, libteec processes the OCALL's parameters.
These will have temporarily replaced the parameters of the original
function invocation. Additionally, the 'func' element of the IOCTL
parameters will have been modified to carry the command ID that the TA
requests that the CA execute on its behalf.
The library passes this ID along with the parameters and arbitrary data
pointers configured via the settings API to the CA-provided OCALL handler.
After the handler is finished processing the request, libteec performs
minor post-processing on the parameters and calls back into the driver to
let it know that the OCALL has been handled.
It is possible for a TA to invoke multiple OCALLs in the same originating
function invocation.
Signed-off-by: Hernan Gatta <hegatta@microsoft.com>1 parent dacd6a3 commit bf071e5
File tree
3 files changed
+370
-11
lines changed- libteec
- include/linux
- src
- public
3 files changed
+370
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
168 | 169 | | |
169 | 170 | | |
170 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
171 | 175 | | |
172 | 176 | | |
173 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
174 | 180 | | |
175 | 181 | | |
176 | 182 | | |
| |||
244 | 250 | | |
245 | 251 | | |
246 | 252 | | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
247 | 280 | | |
248 | 281 | | |
249 | 282 | | |
| |||
0 commit comments