Skip to content

Commit bd3ec19

Browse files
authored
Merge pull request #344 from Patater/box-id-api-doc
Update Box ID API documentation
2 parents 669eda9 + e1dbceb commit bd3ec19

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

docs/api/API.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,13 @@ A box identity identifies a security domain uniquely and globally.
210210

211211
The box identity API can be used to determine the source box of an inbound secure gateway call. This can be useful for implementing complex authorization logic between mutually distrustful security domains.
212212

213-
uVisor provides the ability to retrieve the box ID of the current box (`uvisor_box_id_self`), or of the box that most recently called the current box through a secure gateway (`uvisor_box_id_caller`).
213+
uVisor provides the ability to retrieve the box ID of the current box (`uvisor_box_id_self`), or of the box that called the current box through an RPC gateway via the `box_id_caller` parameter of `rpc_fncall_waitfor`.
214214

215215
The box ID number is not constant and can change between reboots. But, the box ID number can be used as a token to retrieve a constant string identifier, known as the box namespace.
216216

217217
A box namespace is a static, box-specific string, that can help identify which box has which ID at run-time. In the future, the box namespace will be guaranteed to be globally unique.
218218

219-
A full example using this API is available at [example-uvisor-box-id](https://github.com/ARMmbed/example-uvisor-box-id).
219+
A full example using this API is available at [mbed-os-example-uvisor-number-store](https://github.com/ARMmbed/mbed-os-example-uvisor-number-store).
220220

221221
```C
222222
int uvisor_box_id_self(void)
@@ -236,20 +236,22 @@ int uvisor_box_id_self(void)
236236
---
237237
238238
```C
239-
int uvisor_box_id_caller(void)
239+
int rpc_fncall_waitfor(const TFN_Ptr fn_ptr_array[], size_t fn_count, int * box_id_caller, uint32_t timeout_ms)
240240
```
241241

242242
<table>
243243
<tr>
244244
<td>Description</td>
245-
<td colspan="2">Get the ID of the box that is calling the current box through the most recent secure gateway</td>
245+
<td colspan="2">Handle incoming RPC, setting the parameter `box_id_caller` to the caller box ID.</td>
246246
</tr>
247247
<tr>
248-
<td>Return value</td>
249-
<td colspan="2">The ID of the caller box, or -1 if there is no secure gateway calling box</td>
248+
<td>`box_id_caller` value</td>
249+
<td colspan="2">After a call, `box_id_caller` is set to the box ID of the calling box (the source box of the RPC). This is set before the RPC is dispatched, so that the RPC target function can read from this location to determine the calling box ID. This parameter is optional.</td>
250250
</tr>
251251
</table>
252252

253+
> When deciding which memory to provide for `rpc_fncall_waitfor` to use when writing `box_id_caller`, strongly prefer thread local storage when multiple threads in a box can handle incoming RPC.
254+
253255
---
254256

255257
```C

0 commit comments

Comments
 (0)