• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..10-Feb-2022-

README.mdH A D10-Feb-20225.8 KiB119104

include.amH A D10-Feb-2022216 97

main.cH A D10-Feb-20221.8 KiB6632

user_settings.hH A D10-Feb-202213.2 KiB594307

README.md

1# ARM® TrustZone® CryptoCell 310 Port
2## Overview
3ARM® TrustZone® CryptoCell 310 is a security subsystem which provides root of trust (RoT) and cryptographic services for a device.
4You can enable the wolfSSL support for ARM CryptoCell using the `#define WOLFSSL_CRYPTOCELL`, The CryptoCell APIs are distributed as part of the Nordic nRF5 SDKs [here](https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.0.0%2Fgroup__cryptocell__api.html) .
5
6## Prerequisites
71. Follow the Nordic website [here](https://www.nordicsemi.com/Software-and-Tools/Software/nRF5-SDK) to download the Nordic nRF5-SDK and software tools.
82. Install the SEGGER Embedded Studio IDE.
93. Run a simple blinky application on your Nordic nRF52840 (PCA10056) development board to confirm that your board functions as expected and the communication between your computer and the board works.
10
11## Usage
12You can start with a wolfcrypt SEGGER embedded studio (ses) example project to integrate the wolfSSL source code.
13wolfSSL supports a compile-time user configurable options in the `IDE/CRYPTOCELL/user_settings.h` file.
14
15The `IDE/CRYPTOCELL/main.c` example application provides a function to run the selected examples at compile time through the following two #defines in user_settings.h. You can define these macro options to disable the test run.
16```
17- #undef NO_CRYPT_TEST
18- #undef NO_CRYPT_BENCHMARK
19```
20
21## Supported features
22- SHA-256
23- AES CBC
24- CryptoCell 310 RNG
25- RSA sign/verify and RSA key gen (2048 bit in PKCSv1.5 padding mode)
26- RSA encrypt/decrypt
27- ECC sign/verify/shared secret
28- ECC key import/export and key gen pairs
29- Hardware RNG
30- RTC for benchmark timing source
31
32Note: All Cryptocell features are not supported. The wolfcrypt RSA API allows import and export of Private/Public keys in DER format. However, this is not possible with key pairs generated with Cryptocell because the importing/exporting Cryptocell keys has not been implemented yet.
33
34## Setup
35### Setting up Nordic SDK with wolfSSL
361. Download the wolfSSL source code or a zip file from GitHub and place it under your SDK `InstallFolder/external/` directory. You can also copy or simlink to the source.
37```
38  For example,
39
40  $cd ~/nRF5_SDK_15.2.0_9412b96/external
41  $git clone --depth=1 https://github.com/wolfSSL/wolfssl.git
42
43  Or, assuming you have already cloned the wolfSSL source code under ~/wolfssl.
44
45  $cd ~/nRF5_SDK_15.2.0_9412b96/external
46  $ln -s  ~/wolfssl wolfssl
47```
482. Copy the example project from [here](https://github.com/tmael/nRF5_SDK/tree/master/examples/crypto/nrf_cc310/wolfcrypt) into your `nRF5_SDK_15.2.0_9412b96/examples/crypto/nrf_cc310/` directory.
49```
50  $git clone https://github.com/tmael/nRF5_SDK.git
51  $cd ~/nRF5_SDK_15.2.0_9412b96/examples/crypto/nrf_cc310
52
53  $cp -rf ~/nRF5_SDK/examples/crypto/nrf_cc310/wolfcrypt .
54  OR
55  $ln -s ~/nRF5_SDK/examples/crypto/nrf_cc310/wolfcrypt wolfcrypt
56```
573. Launch the SEGGER Embedded Studio IDE
584. In the main menu, go to File >Open Solutions to open the example solution. Browse to the location containing the wolfcrypt code `/examples/crypto/nrf_cc310/wolfcrypt/pca10056/blank/ses/wolfcrypt_pca10056.emProject` and choose Open.
59
60## Building and Running
61In the main menu, go to Build > Rebuild your project, then load and run your image on your nRF52840 target platform. Review the test results on the console output.
62
63### `wolfcrypt_test()`
64wolfcrypt_test() prints a message on the target console similar to the following output:
65```
66wolfCrypt Test Started
67error    test passed!
68base64   test passed!
69asn      test passed!
70SHA      test passed!
71SHA-256  test passed!
72Hash     test passed!
73HMAC-SHA test passed!
74HMAC-SHA256 test passed!
75AES      test passed!
76RANDOM   test passed!
77RSA      test passed!
78ECC      test passed!
79ECC buffer test passed!
80logging  test passed!
81mutex    test passed!
82wolfCrypt Test Completed
83```
84### `benchmark_test()`
85benchmark_test() prints a message on the target console similar to the following output.
86```
87Benchmark Test Started
88------------------------------------------------------------------------------
89 wolfSSL version 3.15.7
90------------------------------------------------------------------------------
91wolfCrypt Benchmark (block bytes 1024, min 1.0 sec each)
92RNG                  5 MB took 1.000 seconds,    4.858 MB/s
93AES-128-CBC-enc     17 MB took 1.001 seconds,   17.341 MB/s
94AES-128-CBC-dec     17 MB took 1.000 seconds,   17.285 MB/s
95SHA                425 KB took 1.040 seconds,  408.654 KB/s
96SHA-256             26 MB took 1.000 seconds,   25.903 MB/s
97HMAC-SHA           425 KB took 1.049 seconds,  405.148 KB/s
98HMAC-SHA256         24 MB took 1.000 seconds,   23.877 MB/s
99RSA     1024 key gen         2 ops took 1.579 sec, avg 789.500 ms, 1.267 ops/sec
100RSA     2048 key gen         1 ops took 9.695 sec, avg 9695.000 ms, 0.103 ops/sec
101RSA     2048 public        328 ops took 1.001 sec, avg 3.052 ms, 327.672 ops/sec
102RSA     2048 private         4 ops took 1.713 sec, avg 428.250 ms, 2.335 ops/sec
103ECC      256 key gen        55 ops took 1.017 sec, avg 18.491 ms, 54.081 ops/sec
104ECDHE    256 agree          56 ops took 1.017 sec, avg 18.161 ms, 55.064 ops/sec
105ECDSA    256 sign           50 ops took 1.004 sec, avg 20.080 ms, 49.801 ops/sec
106ECDSA    256 verify         48 ops took 1.028 sec, avg 21.417 ms, 46.693 ops/sec
107Benchmark Test Completed
108```
109
110## References
111The test results were collected from an nRF52840 reference platform target with the following software and tool chains:
112- Nordic nRF52840 development board (PCA10056 1.0.0 2018.49 683529999).
113- nRF5_SDK_15.2.0_9412b96
114- SEGGER Embedded Studio for ARM, Release 4.12  Build 2018112601.37855 Linux x64Segger J-Link software
115- gcc-arm-none-eabi-8-2018-q4-major
116- wolfssl [latest version](https://github.com/wolfSSL/wolfssl)
117
118For more information or questions, please email [support@wolfssl.com](mailto:support@wolfssl.com)
119