Skip to content

Commit 9b48510

Browse files
committed
[crypto] PSA API: Enable native ITS File and RAM implementations
1 parent 3157d55 commit 9b48510

File tree

21 files changed

+131
-24
lines changed

21 files changed

+131
-24
lines changed

etc/cmake/options.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ ot_int_option(OT_RCP_TX_WAIT_TIME_SECS OPENTHREAD_SPINEL_CONFIG_RCP_TX_WAIT_TIME
342342
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
343343

344344
if(NOT OT_EXTERNAL_MBEDTLS)
345-
set(OT_MBEDTLS mbedtls)
345+
set(OT_MBEDTLS mbedtls mbedcrypto)
346346
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS=1")
347347
else()
348348
set(OT_MBEDTLS ${OT_EXTERNAL_MBEDTLS})

examples/apps/cli/ftd.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ target_link_libraries(ot-cli-ftd PRIVATE
4141
openthread-cli-ftd
4242
${OT_PLATFORM_LIB_FTD}
4343
openthread-ftd
44-
${OT_PLATFORM_LIB_FTD}
4544
openthread-cli-ftd
4645
${OT_MBEDTLS}
46+
${OT_PLATFORM_LIB_FTD}
4747
ot-config-ftd
4848
ot-config
4949
)

examples/apps/cli/mtd.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ target_link_libraries(ot-cli-mtd PRIVATE
4141
openthread-cli-mtd
4242
${OT_PLATFORM_LIB_MTD}
4343
openthread-mtd
44-
${OT_PLATFORM_LIB_MTD}
4544
openthread-cli-mtd
4645
${OT_MBEDTLS}
46+
${OT_PLATFORM_LIB_MTD}
4747
ot-config-mtd
4848
ot-config
4949
)

examples/apps/ncp/ftd.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ target_link_libraries(ot-ncp-ftd PRIVATE
4141
openthread-ncp-ftd
4242
${OT_PLATFORM_LIB_FTD}
4343
openthread-ftd
44-
${OT_PLATFORM_LIB_FTD}
4544
openthread-ncp-ftd
4645
${OT_MBEDTLS}
46+
${OT_PLATFORM_LIB_FTD}
4747
ot-config-ftd
4848
ot-config
4949
)

examples/apps/ncp/mtd.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ target_link_libraries(ot-ncp-mtd PRIVATE
4141
openthread-ncp-mtd
4242
${OT_PLATFORM_LIB_MTD}
4343
openthread-mtd
44-
${OT_PLATFORM_LIB_MTD}
4544
openthread-ncp-mtd
4645
${OT_MBEDTLS}
46+
${OT_PLATFORM_LIB_MTD}
4747
ot-config-mtd
4848
ot-config
4949
)

examples/platforms/simulation/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,10 @@ endif()
103103

104104
target_link_libraries(openthread-simulation PRIVATE
105105
openthread-platform
106+
mbedtls
107+
openthread-native-its-file
106108
ot-simulation-config
107109
ot-config
108-
mbedtls
109110
)
110111

111112
target_compile_options(openthread-simulation PRIVATE

examples/platforms/simulation/openthread-core-simulation-config.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@
3939
#define OPENTHREAD_RADIO 0
4040
#endif
4141

42-
#if !OPENTHREAD_RADIO
43-
4442
#ifndef OPENTHREAD_CONFIG_CRYPTO_LIB
4543
#define OPENTHREAD_CONFIG_CRYPTO_LIB OPENTHREAD_CONFIG_CRYPTO_LIB_PSA
4644
#endif
@@ -49,8 +47,6 @@
4947
#define OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE 1
5048
#endif
5149

52-
#endif
53-
5450
#ifndef OPENTHREAD_CONFIG_PLATFORM_INFO
5551
#define OPENTHREAD_CONFIG_PLATFORM_INFO "SIMULATION"
5652
#endif

examples/platforms/simulation/system.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ extern otRadioCaps gRadioCaps;
6161

6262
static volatile bool gTerminate = false;
6363

64+
#if OPENTHREAD_PSA_CRYPTO_NATIVE_ITS_FILE
65+
static char sNativeItsFileNamePrefix[256];
66+
extern const char *gItsFileNamePrefix;
67+
#endif
68+
6469
static void handleSignal(int aSignal)
6570
{
6671
OT_UNUSED_VARIABLE(aSignal);
@@ -193,6 +198,12 @@ void otSysInit(int aArgCount, char *aArgVector[])
193198
signal(SIGTERM, &handleSignal);
194199
signal(SIGHUP, &handleSignal);
195200

201+
#if OPENTHREAD_PSA_CRYPTO_NATIVE_ITS_FILE
202+
snprintf(sNativeItsFileNamePrefix, sizeof(sNativeItsFileNamePrefix), "%s/%s_%d_",
203+
OPENTHREAD_CONFIG_POSIX_SETTINGS_PATH, getenv("PORT_OFFSET") ? getenv("PORT_OFFSET") : "0", gNodeId);
204+
gItsFileNamePrefix = sNativeItsFileNamePrefix;
205+
#endif
206+
196207
platformLoggingInit(basename(aArgVector[0]));
197208
platformAlarmInit(speedUpFactor);
198209
platformRadioInit();

examples/platforms/simulation/virtual_time/platform-sim.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ static volatile bool gTerminate = false;
6060
int gArgumentsCount = 0;
6161
char **gArguments = NULL;
6262

63+
#if OPENTHREAD_PSA_CRYPTO_NATIVE_ITS_FILE
64+
static char sNativeItsFileNamePrefix[256];
65+
extern const char *gItsFileNamePrefix;
66+
#endif
67+
6368
uint64_t sNow = 0; // microseconds
6469
int sSockFd;
6570
uint16_t sPortBase = 9000;
@@ -222,6 +227,12 @@ void otSysInit(int argc, char *argv[])
222227
DieNow(OT_EXIT_FAILURE);
223228
}
224229

230+
#if OPENTHREAD_PSA_CRYPTO_NATIVE_ITS_FILE
231+
snprintf(sNativeItsFileNamePrefix, sizeof(sNativeItsFileNamePrefix), "%s/%s_%d_",
232+
OPENTHREAD_CONFIG_POSIX_SETTINGS_PATH, getenv("PORT_OFFSET") ? getenv("PORT_OFFSET") : "0", gNodeId);
233+
gItsFileNamePrefix = sNativeItsFileNamePrefix;
234+
#endif
235+
225236
socket_init();
226237

227238
platformAlarmInit(1);

src/core/mac/link_raw.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ LinkRaw::LinkRaw(Instance &aInstance)
5858
, mSubMac(aInstance.Get<SubMac>())
5959
#endif
6060
{
61+
otPlatCryptoInit();
62+
6163
Init();
6264
}
6365

0 commit comments

Comments
 (0)