Skip to content

Commit 5d395e3

Browse files
Integrate Tinycrypt ECC operations (project-chip#19270)
* Add NXPmicro/mbedtls submodule Signed-off-by: Andrei Menzopol <andrei.menzopol@nxp.com> * Integrate TinyCrypt library * Add changes for ECC operations * Add changes for spake2+ * Add build changes * Add build changes for external mbedtls lib * Update lighting-app README Signed-off-by: Andrei Menzopol <andrei.menzopol@nxp.com> * Restyled by clang-format * Restyled by gn * Restyled by prettier-markdown * Resolve conversations * add platforms for external mbedtls submodule * reduce nesting in conditional compilation * update wordlist Signed-off-by: Andrei Menzopol <andrei.menzopol@nxp.com> * Fix wordlist and readme Signed-off-by: Andrei Menzopol <andrei.menzopol@nxp.com> * Resolve comments * check before setting the rng function * added comment for point compression * clear ecc key structure * clear spake2+ context on error * discard TinyCrypt NewCertificateSigningRequest changes Signed-off-by: Andrei Menzopol <andrei.menzopol@nxp.com> * Restyled by clang-format Co-authored-by: Restyled.io <commits@restyled.io>
1 parent a93bd93 commit 5d395e3

File tree

10 files changed

+431
-27
lines changed

10 files changed

+431
-27
lines changed

.github/.wordlist.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,6 @@ IlluminanceMeasurement
626626
IM
627627
imager
628628
imagetool
629-
ImageURI
630629
imageUri
631630
img
632631
Impl
@@ -1278,6 +1277,7 @@ timedInteractionTimeoutMs
12781277
TimeFormatLocalization
12791278
timeoutMs
12801279
TimeSynchronization
1280+
tinycrypt
12811281
Tizen
12821282
TKIP
12831283
tlsr

.gitmodules

+5
Original file line numberDiff line numberDiff line change
@@ -246,3 +246,8 @@
246246
url = https://github.com/bouffalolab/bl_iot_sdk_matter.git
247247
branch = bl602_release
248248
platforms = bl602
249+
[submodule "third_party/nxp/libs/mbedtls/repo"]
250+
path = third_party/nxp/libs/mbedtls/repo
251+
url = https://github.com/NXPmicro/mbedtls.git
252+
branch = tinycrypt-mbedtls-2.28
253+
platforms = k32w0

build_overrides/mbedtls.gni

+1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@
1515
declare_args() {
1616
# Root directory for mbedTLS.
1717
mbedtls_root = "//third_party/mbedtls"
18+
mbedtls_repo = "//third_party/mbedtls"
1819
}

examples/build_overrides/mbedtls.gni

+1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@
1515
declare_args() {
1616
# Root directory for mbedTLS.
1717
mbedtls_root = "//third_party/connectedhomeip/third_party/mbedtls"
18+
mbedtls_repo = "//third_party/connectedhomeip/third_party/mbedtls"
1819
}

examples/lighting-app/nxp/k32w/k32w0/README.md

+33-8
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,16 @@ network.
2727
- [Detokenizer script](#detokenizer)
2828
- [Notes](#detokenizer-notes)
2929
- [Known issues](#detokenizer-known-issues)
30-
- [OTA](#ota) - [Writing the SSBL](#ssbl) - [Writing the PSECT](#psect) -
31-
[Writing the application](#appwrite) - [OTA Testing](#otatesting) -
32-
[Known issues](#otaissues)
30+
- [Tinycrypt ECC operations](#tinycrypt)
31+
- [Building steps](#tinycrypt-building-steps)
32+
- [OTA](#ota)
33+
34+
- [Writing the SSBL](#ssbl)
35+
- [Writing the PSECT](#psect)
36+
- [Writing the application](#appwrite)
37+
- [OTA Testing](#otatesting)
38+
- [Known issues](#otaissues)
39+
3340
</hr>
3441

3542
<a name="intro"></a>
@@ -182,18 +189,17 @@ user@ubuntu:~/Desktop/git/connectedhomeip$ export NXP_K32W061_SDK_ROOT=/home/use
182189
user@ubuntu:~/Desktop/git/connectedhomeip$ ./third_party/nxp/k32w0_sdk/sdk_fixes/patch_k32w_sdk.sh
183190
user@ubuntu:~/Desktop/git/connectedhomeip$ source ./scripts/activate.sh
184191
user@ubuntu:~/Desktop/git/connectedhomeip$ cd examples/lighting-app/nxp/k32w/k32w0
185-
user@ubuntu:~/Desktop/git/connectedhomeip/examples/lighting-app/nxp/k32w/k32w0$ gn gen out/debug --args="k32w0_sdk_root=\"${NXP_K32W061_SDK_ROOT}\" chip_with_OM15082=1 chip_with_ot_cli=0 is_debug=false chip_crypto=\"mbedtls\" chip_with_se05x=0"
192+
user@ubuntu:~/Desktop/git/connectedhomeip/examples/lighting-app/nxp/k32w/k32w0$ gn gen out/debug --args="k32w0_sdk_root=\"${NXP_K32W061_SDK_ROOT}\" chip_with_OM15082=1 chip_with_ot_cli=0 is_debug=false chip_crypto=\"mbedtls\" chip_with_se05x=0 mbedtls_use_tinycrypt=true chip_pw_tokenizer_logging=true mbedtls_repo=\"//third_party/connectedhomeip/third_party/nxp/libs/mbedtls\""
186193
user@ubuntu:~/Desktop/git/connectedhomeip/examples/lighting-app/nxp/k32w/k32w0$ ninja -C out/debug
187194
user@ubuntu:~/Desktop/git/connectedhomeip/examples/lighting-app/nxp/k32w/k32w0$ $NXP_K32W061_SDK_ROOT/tools/imagetool/sign_images.sh out/debug/
188195
```
189196

190197
- with Secure element
191198
Exactly the same steps as above but set chip_with_se05x=1 in the gn command
192-
and add arguments chip_pw_tokenizer_logging=true chip_enable_ota_requestor=false
199+
and add argument chip_enable_ota_requestor=false
193200

194-
Note that options chip_pw_tokenizer_logging=true and
195-
chip_enable_ota_requestor=false are required for building with Secure Element.
196-
These can be changed if building without Secure Element
201+
Note that option chip_enable_ota_requestor=false are required for building with
202+
Secure Element. These can be changed if building without Secure Element
197203

198204
Note that "patch_k32w_sdk.sh" script must be run for patching the K32W061 SDK
199205
2.6.4.
@@ -299,6 +305,25 @@ If run, closed and rerun with the serial option on the same serial port, the
299305
detokenization script will get stuck and not show any logs. The solution is to
300306
unplug and plug the board and then rerun the script.
301307

308+
<a name="tinycrypt"></a>
309+
310+
## Tinycrypt ECC operations
311+
312+
<a name="tinycrypt-building-steps"></a>
313+
314+
### Building steps
315+
316+
Note: This solution is temporary.
317+
318+
In order to use the tinycrypt ecc operations, use the following build arguments:
319+
320+
- Build without Secure element (_chip_with_se05x=0_), with tinycrypt enabled
321+
(_mbedtls_use_tinycrypt=true_) and with the `NXPmicro/mbedtls` library
322+
(_mbedtls_repo=`\"//third_party/connectedhomeip/third_party/nxp/libs/mbedtls\"`_).
323+
324+
To disable tinycrypt ecc operations, simply build without
325+
_mbedtls_use_tinycrypt=true_ and without _mbedtls_repo_.
326+
302327
<a name="ota"></a>
303328

304329
## OTA

0 commit comments

Comments
 (0)