@@ -374,6 +374,42 @@ For `TF-M` protected storage use:
374
374
[Open IoT SDK build script](../../scripts/examples/openiotsdk_example.sh)
375
375
provides the `-K,--kvsfile` option to use the persistence options listed above.
376
376
377
+ ### Crypto backend
378
+
379
+ Open IoT SDK port supports two crypto backend implementations:
380
+
381
+ - [Mbed TLS](../guides/openiotsdk_platform_overview.md#mbed-tls) - it's the
382
+ default option
383
+ - [PSA crypto service](https://tf-m-user-guide.trustedfirmware.org/integration_guide/services/tfm_crypto_integration_guide.html)
384
+ from the
385
+ [TrustedFirmware-M (TF-M)](../guides/openiotsdk_platform_overview.md#trusted-firmware-m)
386
+ component
387
+
388
+ The CMake variable `CONFIG_CHIP_CRYPTO` controls how cryptographic operations
389
+ are implemented in Matter. It accepts two values:
390
+
391
+ - `mbedtls`: use Mbed TLS for crypto operations.
392
+ - `psa`: use
393
+ [PSA Cryptography API](https://armmbed.github.io/mbed-crypto/html/) for
394
+ crypto operations.
395
+
396
+ This variable can be set in the main application `CMakeLists.txt`:
397
+
398
+ ```
399
+ set(CONFIG_CHIP_CRYPTO <mbedtls | psa>)
400
+ ```
401
+
402
+ The variable can also be defined with CMake CLI:
403
+
404
+ ```
405
+ cmake -G <...> -DCONFIG_CHIP_CRYPTO=<mbedtls | psa> <...>
406
+ ```
407
+
408
+ > 💡 **Notes**:
409
+ >
410
+ > The `TF-M PSA crypto` option requires enabling [TF-M](#trusted-firmware-m)
411
+ > support.
412
+
377
413
## Building
378
414
379
415
You can build examples using the dedicated VSCode task or by calling directly
@@ -386,6 +422,7 @@ the build script from the command line.
386
422
- Select `Build Open IoT SDK example`
387
423
- Decide on debug mode support
388
424
- Decide on LwIP debug logs support
425
+ - Choose crypto algorithm
389
426
- Choose example name
390
427
391
428
This will call the script with the selected parameters.
@@ -568,12 +605,12 @@ telnet> close
568
605
569
606
## Specific examples
570
607
571
- ### Build lock-app example and run it in the network namespace
608
+ ### Build lock-app example with PSA crypto backend support and run it in the network namespace
572
609
573
610
**Using CLI**
574
611
575
612
```
576
- ${MATTER_ROOT}/scripts/examples/openiotsdk_example.sh lock-app
613
+ ${MATTER_ROOT}/scripts/examples/openiotsdk_example.sh -b psa lock-app
577
614
578
615
export TEST_NETWORK_NAME=OIStest
579
616
@@ -593,6 +630,7 @@ Build example:
593
630
- Select `Build Open IoT SDK example`
594
631
- Deny debug mode support `false`
595
632
- Deny LwIP debug logs support `false`
633
+ - Choose crypto algorithm `psa`
596
634
- Choose example name `lock-app`
597
635
598
636
Setup network environment:
@@ -614,12 +652,12 @@ Run example:
614
652
615
653
The example output should be seen in the terminal window.
616
654
617
- ### Build lock-app example and execute its test in the network namespace
655
+ ### Build lock-app example with mbedtls crypto backend support and execute its test in the network namespace
618
656
619
657
**Using CLI**
620
658
621
659
```
622
- ${MATTER_ROOT}/scripts/examples/openiotsdk_example.sh lock-app
660
+ ${MATTER_ROOT}/scripts/examples/openiotsdk_example.sh -b mbedtls lock-app
623
661
624
662
export TEST_NETWORK_NAME=OIStest
625
663
@@ -639,6 +677,7 @@ Build example:
639
677
- Select `Build Open IoT SDK example`
640
678
- Deny debug mode support `false`
641
679
- Deny LwIP debug logs support `false`
680
+ - Choose crypto algorithm `mbedtls`
642
681
- Choose example name `lock-app`
643
682
644
683
Setup network environment:
@@ -658,7 +697,7 @@ Test example:
658
697
- Enter network interface `OIStesttap`
659
698
- Choose example name `lock-app`
660
699
661
- ### Build lock-app example in debug mode and debug it in the network namespace using the VSCode task
700
+ ### Build lock-app example with mbedtls crypto backend support in debug mode and debug it in the network namespace using the VSCode task
662
701
663
702
Build example:
664
703
@@ -667,6 +706,7 @@ Build example:
667
706
- Select `Build Open IoT SDK example`
668
707
- Confirm debug mode support `true`
669
708
- Deny LwIP debug logs support `false`
709
+ - Choose crypto algorithm `mbedtls`
670
710
- Choose example name `lock-app`
671
711
672
712
Setup network environment:
@@ -757,7 +797,7 @@ Example:
757
797
id: build_new_example
758
798
timeout-minutes: 10
759
799
run: |
760
- scripts/examples/openiotsdk_example.sh new-example
800
+ scripts/examples/openiotsdk_example.sh -b ${{ matrix.cryptoBackend }} new-example
761
801
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
762
802
openiotsdk release new-example \
763
803
examples/new-example/openiotsdk/build/chip-openiotsdk-new-example-example.elf \
0 commit comments