Skip to content

Commit c2f7ddb

Browse files
[NXP][crypto] Enable rw61x secure OpKey storage/usage (project-chip#40692)
* [NXP][crypto] Enable rw61x secure OpKey storage/usage Signed-off-by: Martin Girardot <martin.girardot@nxp.com> * [NXP] update nxp matter support Signed-off-by: Martin Girardot <martin.girardot@nxp.com> * fix PR comments Signed-off-by: Martin Girardot <martin.girardot@nxp.com> * Restyled by whitespace * Restyled by clang-format * Restyled by gn * [NXP] Fix mcxw71 gn build issue when using --check arg Signed-off-by: Martin Girardot <martin.girardot@nxp.com> * [NXP] fix PR comment Signed-off-by: Martin Girardot <martin.girardot@nxp.com> --------- Signed-off-by: Martin Girardot <martin.girardot@nxp.com> Co-authored-by: Restyled.io <commits@restyled.io>
1 parent b31081d commit c2f7ddb

File tree

18 files changed

+586
-173
lines changed

18 files changed

+586
-173
lines changed

config/nxp/chip-cmake-freertos/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ config NETWORK_LAYER_BLE
240240

241241
config OPERATIONAL_KEYSTORE
242242
bool "Use custom implementation of operational keystore"
243-
default y if CHIP_NXP_PLATFORM_MCXW71 || CHIP_NXP_PLATFORM_MCXW72
243+
default y if CHIP_NXP_PLATFORM_MCXW71 || CHIP_NXP_PLATFORM_MCXW72 || CHIP_NXP_PLATFORM_RW61X
244244
default y if CHIP_SE05X
245245
help
246246
"Use custom implementation of operational keystore"

examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ rt_executable("all_cluster_app") {
152152
"${common_example_dir}/device_callbacks/include",
153153
"${common_example_dir}/app_task/include",
154154
"${common_example_dir}/factory_data/include",
155+
"${common_example_dir}/operational_keystore/include",
155156
]
156157

157158
sources += [
@@ -161,6 +162,7 @@ rt_executable("all_cluster_app") {
161162
"${common_example_dir}/device_manager/source/CHIPDeviceManager.cpp",
162163
"${common_example_dir}/icd/source/ICDUtil.cpp",
163164
"${common_example_dir}/matter_button/source/ButtonRegistrationEmpty.cpp",
165+
"${common_example_dir}/operational_keystore/source/OperationalKeystoreS50.cpp",
164166
]
165167

166168
deps = [
@@ -171,6 +173,9 @@ rt_executable("all_cluster_app") {
171173
"${chip_root}/src/setup_payload:onboarding-codes-utils",
172174
]
173175

176+
# Operational key secure storage
177+
defines += [ "CONFIG_OPERATIONAL_KEYSTORE=1" ]
178+
174179
sources += [
175180
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
176181
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp",

examples/laundry-washer-app/nxp/rt/rw61x/BUILD.gn

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ rt_executable("laundry-washer") {
174174
"${common_example_dir}/device_callbacks/include",
175175
"${common_example_dir}/app_task/include",
176176
"${common_example_dir}/factory_data/include",
177+
"${common_example_dir}/operational_keystore/include",
177178
]
178179

179180
sources += [
@@ -183,6 +184,7 @@ rt_executable("laundry-washer") {
183184
"${common_example_dir}/device_manager/source/CHIPDeviceManager.cpp",
184185
"${common_example_dir}/icd/source/ICDUtil.cpp",
185186
"${common_example_dir}/matter_button/source/ButtonRegistrationEmpty.cpp",
187+
"${common_example_dir}/operational_keystore/source/OperationalKeystoreS50.cpp",
186188
]
187189

188190
deps = [
@@ -192,6 +194,9 @@ rt_executable("laundry-washer") {
192194
"${chip_root}/src/setup_payload:onboarding-codes-utils",
193195
]
194196

197+
# Operational key secure storage
198+
defines += [ "CONFIG_OPERATIONAL_KEYSTORE=1" ]
199+
195200
sources += [
196201
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
197202
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/laundry-washer-controls-delegate-impl.cpp",

examples/platform/nxp/common/Kconfig

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,13 @@ if CHIP_APP_OPERATIONAL_KEYSTORE
187187
choice CHIP_APP_OPERATIONAL_KEYSTORE_SELECTION
188188
prompt "Select Operation Keystore Implementation"
189189
default CHIP_APP_OPERATIONAL_KEYSTORE_SE05X if CHIP_SE05X
190-
default CHIP_APP_OPERATIONAL_KEYSTORE_S200
190+
default CHIP_APP_OPERATIONAL_KEYSTORE_S200 if CHIP_NXP_PLATFORM_MCXW71 || CHIP_NXP_PLATFORM_MCXW72
191+
default CHIP_APP_OPERATIONAL_KEYSTORE_S50 if CHIP_NXP_PLATFORM_RW61X
192+
193+
config CHIP_APP_OPERATIONAL_KEYSTORE_S50
194+
bool "Operation Keystore S50"
195+
help
196+
Enable application Operational keystore S50 implementation.
191197

192198
config CHIP_APP_OPERATIONAL_KEYSTORE_S200
193199
bool "Operation Keystore S200"
@@ -205,6 +211,12 @@ if CHIP_APP_OPERATIONAL_KEYSTORE
205211
Enable application Operational keystore SE05X implementation.
206212

207213
endchoice # CHIP_APP_OPERATIONAL_KEYSTORE_SELECTION
214+
215+
config PRIVATE_ECC_KEY_BLOB_SIZE
216+
int "Operational private ECC key blob size"
217+
default 120 if CHIP_APP_OPERATIONAL_KEYSTORE_S200
218+
default 48 if CHIP_APP_OPERATIONAL_KEYSTORE_S50
219+
208220
endif # CHIP_APP_OPERATIONAL_KEYSTORE
209221

210222
config CHIP_APP_OTA_REQUESTOR

examples/platform/nxp/common/app_common.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,12 @@ if (CONFIG_CHIP_APP_OPERATIONAL_KEYSTORE)
216216
target_include_directories(app PRIVATE
217217
${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/operational_keystore/include
218218
)
219-
if (CONFIG_CHIP_APP_OPERATIONAL_KEYSTORE_S200)
219+
220+
if (CONFIG_CHIP_APP_OPERATIONAL_KEYSTORE_S50)
221+
target_sources(app PRIVATE
222+
${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/operational_keystore/source/OperationalKeystoreS50.cpp
223+
)
224+
elseif (CONFIG_CHIP_APP_OPERATIONAL_KEYSTORE_S200)
220225
target_sources(app PRIVATE
221226
${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/operational_keystore/source/OperationalKeystoreS200.cpp
222227
)

examples/platform/nxp/common/operational_keystore/source/OperationalKeystoreS200.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717

1818
#include "OperationalKeystore.h"
19-
#include <platform/nxp/common/crypto/PersistentStorageOpKeystoreS200.h>
19+
#include <platform/nxp/common/crypto/S200/PersistentStorageOpKeystoreS200.h>
2020

2121
static chip::PersistentStorageOpKeystoreS200 sInstance;
2222

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright (c) 2024 Project CHIP Authors
3+
* All rights reserved.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#include "OperationalKeystore.h"
19+
#include <platform/nxp/common/crypto/S50/PersistentStorageOpKeystoreS50.h>
20+
21+
static chip::PersistentStorageOpKeystoreS50 sInstance;
22+
23+
chip::Crypto::OperationalKeystore * chip::NXP::App::OperationalKeystore::GetInstance()
24+
{
25+
return &sInstance;
26+
}
27+
28+
CHIP_ERROR chip::NXP::App::OperationalKeystore::Init(PersistentStorageDelegate * delegate)
29+
{
30+
VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INTERNAL);
31+
return sInstance.Init(delegate);
32+
}

examples/thermostat/nxp/rt/rw61x/BUILD.gn

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ rt_executable("thermostat") {
194194
"${common_example_dir}/device_callbacks/include",
195195
"${common_example_dir}/app_task/include",
196196
"${common_example_dir}/factory_data/include",
197+
"${common_example_dir}/operational_keystore/include",
197198
]
198199

199200
sources += [
@@ -203,6 +204,7 @@ rt_executable("thermostat") {
203204
"${common_example_dir}/device_manager/source/CHIPDeviceManager.cpp",
204205
"${common_example_dir}/icd/source/ICDUtil.cpp",
205206
"${common_example_dir}/matter_button/source/ButtonRegistrationEmpty.cpp",
207+
"${common_example_dir}/operational_keystore/source/OperationalKeystoreS50.cpp",
206208
]
207209

208210
deps = [
@@ -212,6 +214,9 @@ rt_executable("thermostat") {
212214
"${chip_root}/src/setup_payload:onboarding-codes-utils",
213215
]
214216

217+
# Operational key secure storage
218+
defines += [ "CONFIG_OPERATIONAL_KEYSTORE=1" ]
219+
215220
if (nxp_enable_matter_cli) {
216221
defines += [ "ENABLE_CHIP_SHELL" ]
217222
deps += [

0 commit comments

Comments
 (0)