Skip to content

Commit 16f27db

Browse files
57300nordicjm
authored andcommitted
nrf_security: IronSide SE support for PSA ITS API
Allow IronSide SE to export the `psa_its_*` API over IPC. This makes it so that the Internal Trusted Storage can be used to store not only keys (via the PSA Crypto API) but other sensitive assets too. Once again, the serialization code is reused from TF-M, which leverages the IronSide SE implementation of `psa_call()` that was initially added to support the PSA Crypto API. The only change to `psa_call()` is that the `type` argument is no longer ignored. It has to be sent over IPC, because it identifies the ITS API. Signed-off-by: Grzegorz Swiderski <[email protected]>
1 parent d390702 commit 16f27db

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

include/tfm/ironside/se/ipc_service.h

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,22 @@ enum {
1818
IRONSIDE_SE_IPC_INDEX_OUT_VEC,
1919
IRONSIDE_SE_IPC_INDEX_OUT_LEN,
2020
IRONSIDE_SE_IPC_INDEX_STATUS,
21+
IRONSIDE_SE_IPC_INDEX_TYPE,
2122
/* The last enum value is reserved for the size of the IPC buffer */
2223
IRONSIDE_SE_IPC_DATA_LEN
2324
};
2425

25-
/* IronSide call identifiers with implicit versions.
26-
*
27-
* With the initial "version 0", the service ABI is allowed to break until the
28-
* first public release of IronSide SE.
29-
*/
30-
#define IRONSIDE_CALL_ID_PSA_CRYPTO_V0 0
26+
/* IronSide call identifiers with implicit versions */
27+
#define IRONSIDE_CALL_ID_PSA_V1 0
3128

32-
/* We are adding the source files for the TF-M crypto partition to the build.
29+
/* We are adding the source files for the TF-M Crypto partition
30+
* and the TF-M Internal Trusted Storage partition to the build.
3331
*
34-
* The crypto partition will include the file psa_manifest/sid.h and
35-
* expect the below three symbols to be there.
32+
* These partitions will include the file psa_manifest/sid.h and
33+
* expect the below triplets of symbols to be there.
3634
*
3735
* In a TF-M build, the TF-M build system will generate
38-
* psa_manifest/sid.h based on each partitions manifest.
36+
* psa_manifest/sid.h based on each partition's manifest.
3937
*
4038
* See https://trustedfirmware-m.readthedocs.io/
4139
* en/latest/integration_guide/services/tfm_secure_partition_addition.html
@@ -46,4 +44,8 @@ enum {
4644
#define TFM_CRYPTO_VERSION (1U)
4745
#define TFM_CRYPTO_HANDLE (0x40000100U)
4846

47+
#define TFM_INTERNAL_TRUSTED_STORAGE_SERVICE_SID (0x00000070U)
48+
#define TFM_INTERNAL_TRUSTED_STORAGE_SERVICE_VERSION (1U)
49+
#define TFM_INTERNAL_TRUSTED_STORAGE_SERVICE_HANDLE (0x40000102U)
50+
4951
#endif /* __SDFW_PSA_IPC_SERVICE_H__ */

subsys/nrf_security/src/ssf_secdom/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66

77
zephyr_library()
88
zephyr_library_sources(
9-
# ironside_psa_ns_api.c provides psa_call. psa_call is invoked by
10-
# serialized functions from tfm_crypto_api.c and sends a message
11-
# over IPC.
9+
# ironside_psa_ns_api.c provides psa_call, which sends a message over IPC.
10+
# psa_call is invoked by serialized functions from tfm_crypto_api.c and tfm_its_api.c.
1211
${CMAKE_CURRENT_LIST_DIR}/ironside_se_psa_ns_api.c
1312
# tfm_crypto_api.c provides and serializes the PSA Crypto API.
1413
${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/interface/src/tfm_crypto_api.c
14+
# tfm_its_api.c provides and serializes the PSA Internal Trusted Storage API.
15+
${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/interface/src/tfm_its_api.c
1516
)
1617

1718
zephyr_library_include_directories(

subsys/nrf_security/src/ssf_secdom/ironside_se_psa_ns_api.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,16 @@ static psa_status_t psa_call_buffered_and_flushed(psa_handle_t handle, int32_t t
3030
const psa_invec *in_vec, size_t in_len,
3131
psa_outvec *out_vec, size_t out_len)
3232
{
33-
/* We have no need for this at this time */
34-
ARG_UNUSED(type);
35-
3633
struct ironside_call_buf *const buf = ironside_call_alloc();
3734

38-
buf->id = IRONSIDE_CALL_ID_PSA_CRYPTO_V0;
35+
buf->id = IRONSIDE_CALL_ID_PSA_V1;
3936

40-
buf->args[IRONSIDE_SE_IPC_INDEX_HANDLE] =
41-
handle; /* i.e. TFM_CRYPTO_HANDLE defined to 0x40000100U */
37+
buf->args[IRONSIDE_SE_IPC_INDEX_HANDLE] = handle;
4238
buf->args[IRONSIDE_SE_IPC_INDEX_IN_VEC] = (uint32_t)in_vec;
4339
buf->args[IRONSIDE_SE_IPC_INDEX_IN_LEN] = in_len;
4440
buf->args[IRONSIDE_SE_IPC_INDEX_OUT_VEC] = (uint32_t)out_vec;
4541
buf->args[IRONSIDE_SE_IPC_INDEX_OUT_LEN] = out_len;
42+
buf->args[IRONSIDE_SE_IPC_INDEX_TYPE] = type;
4643

4744
ironside_call_dispatch(buf);
4845

0 commit comments

Comments
 (0)