[修改] 增加freeRTOS

1. 版本FreeRTOSv202212.01,命名为kernel;
This commit is contained in:
2023-05-06 16:43:01 +00:00
commit a345df017b
20944 changed files with 11094377 additions and 0 deletions

View File

@ -0,0 +1,92 @@
# wolfSSL STM32 Example for STM32 Cube IDE
This example includes:
* wolfCrypt test
* wolfCrypt benchmark
* wolfSSL TLS client/server test using in-memory transfers
These examples use the Cube HAL for STM32.
## Requirements
* STM32CubeIDE: Integrated Development Environment for STM32 [https://www.st.com/en/development-tools/stm32cubeide.html](https://www.st.com/en/development-tools/stm32cubeide.html)
## Configuration
The settings for the wolfSTM32 project are located in `<wolfssl-root>/IDE/STM32Cube/wolfSSL.wolfSSL_conf.h`. The section for "Hardware platform" may need to be adjusted depending on your processor and board:
* To enable STM32F2 support define `WOLFSSL_STM32F2`.
* To enable STM32F4 support define `WOLFSSL_STM32F4`.
* To enable STM32F7 support define `WOLFSSL_STM32F7`.
* To enable STM32L4 support define `WOLFSSL_STM32L4`.
* To enable STM32L5 support define `WOLFSSL_STM32L5`.
* To enable STM32H7 support define `WOLFSSL_STM32H7`.
* To enable STM32WB support define `WOLFSSL_STM32WB`.
To use the STM32 Cube HAL support make sure `WOLFSSL_STM32_CUBEMX` is defined.
The L5 and WB55 support ECC PKA acceleration, which is enabled with `WOLFSSL_STM32_PKA`.
To disable hardware crypto acceleration you can define:
* `NO_STM32_HASH`
* `NO_STM32_CRYPTO`
To enable the latest Cube HAL support please define `STM32_HAL_V2`.
If you'd like to use the older Standard Peripheral library undefine `WOLFSSL_STM32_CUBEMX`.
If you are using FreeRTOS make sure your `FreeRTOSConfig.h` has its `configTOTAL_HEAP_SIZE` increased.
The TLS client/server benchmark example requires about 76 KB for allocated tasks (with stack) and peak heap.
## STM32 Cube Pack
### STM32 Cube Pack Installation
1. Download [wolfSSL Cube Pack](https://www.wolfssl.com/files/ide/I-CUBE-WOLFSSL-WOLFSSL.pack)
2. Run the “STM32CubeMX” tool.
3. Under “Manage software installations” click “INSTALL/REMOVE” button.
4. From Local and choose “I-CUBE-WOLFSSL-WOLFSSL.pack”.
### STM32 Cube Pack Usage
1. Create or open a Cube Project based on your hardware.
2. Under “Software Packs” choose “Select Components”.
3. Find and check all components for the wolfSSL.wolfSSL packs (wolfSSL / Core, wolfCrypt / Core and wolfCrypt / Test). Close
4. Under the “Software Packs” section click on “wolfSSL.wolfSSL” and configure the parameters.
5. For Cortex-M recommend “Math Configuration” -> “Single Precision Cortex-M Math”
6. Generate Code
7. The Benchmark example uses float. To enable go to "Project Properties" -> "C/C++ Build" -> "Settings" -> "Tool Settings" -> "MCU Settings" -> Check "Use float with printf".
### STM32 Cube Pack Examples
In the `I-CUBE-WOLFSSL-WOLFSSL.pack` pack there are pre-assembled example projects available.
After installing the pack you can find these example projects in `STM32Cube/Repository/Packs/wolfSSL/wolfSSL/[Version]/Projects`.
To use an example:
1. Open STM32CubeIDE
2. Choose "Import" -> "Import an Existing STM32CubeMX Configuration File (.ioc)".
3. Browse to find the .ioc in `STM32Cube/Repository/Packs/wolfSSL/wolfSSL/[Version]/Projects` and click finish.
## Example `IDE/STM32Cube/wolfssl_example.c` Output
```
....MENU
.t. WolfCrypt Test
.b. WolfCrypt Benchmark
.l. WolfSSL TLS Bench
.e. Show Cipher List
Please select one of the above options:
```
## Benchmarks
See [STM32_Benchmarks.md](STM32_Benchmarks.md).
## Support
For questions please email [support@wolfssl.com](mailto:support@wolfssl.com)

View File

@ -0,0 +1,564 @@
# STM Benchmarks
## STM32H753ZI
Supports RNG, AES CBC/GCM and SHA-2 acceleration.
Note: HW RNG on for all tests
Board: NUCLEO-H753ZI
CPU: Cortex-M7 at 480 MHz
IDE: STM32CubeIDE
RTOS: FreeRTOS
### STM32H753ZI (STM Crypto/Hash Acceleration, -Os, SP-ASM Cortex-M)
```
------------------------------------------------------------------------------
wolfSSL version 4.4.1
------------------------------------------------------------------------------
wolfCrypt Benchmark (block bytes 1024, min 1.0 sec each)
RNG 875 KB took 1.019 seconds, 858.685 KB/s
AES-128-CBC-enc 10 MB took 1.000 seconds, 10.400 MB/s
AES-128-CBC-dec 10 MB took 1.000 seconds, 10.327 MB/s
AES-192-CBC-enc 10 MB took 1.000 seconds, 10.425 MB/s
AES-192-CBC-dec 10 MB took 1.000 seconds, 10.278 MB/s
AES-256-CBC-enc 10 MB took 1.000 seconds, 10.376 MB/s
AES-256-CBC-dec 10 MB took 1.000 seconds, 10.278 MB/s
AES-128-GCM-enc 9 MB took 1.000 seconds, 8.789 MB/s
AES-128-GCM-dec 9 MB took 1.000 seconds, 8.716 MB/s
AES-192-GCM-enc 9 MB took 1.000 seconds, 8.740 MB/s
AES-192-GCM-dec 9 MB took 1.000 seconds, 8.691 MB/s
AES-256-GCM-enc 9 MB took 1.000 seconds, 8.765 MB/s
AES-256-GCM-dec 9 MB took 1.000 seconds, 8.691 MB/s
CHACHA 4 MB took 1.000 seconds, 4.443 MB/s
CHA-POLY 3 MB took 1.004 seconds, 3.040 MB/s
POLY1305 13 MB took 1.000 seconds, 12.671 MB/s
SHA-256 9 MB took 1.000 seconds, 8.691 MB/s
HMAC-SHA256 8 MB took 1.000 seconds, 8.496 MB/s
RSA 2048 public 82 ops took 1.019 sec, avg 12.427 ms, 80.471 ops/sec
RSA 2048 private 4 ops took 1.749 sec, avg 437.250 ms, 2.287 ops/sec
DH 2048 key gen 5 ops took 1.000 sec, avg 200.000 ms, 5.000 ops/sec
DH 2048 agree 6 ops took 1.200 sec, avg 200.000 ms, 5.000 ops/sec
ECC 256 key gen 121 ops took 1.000 sec, avg 8.264 ms, 121.000 ops/sec
ECDHE 256 agree 56 ops took 1.016 sec, avg 18.143 ms, 55.118 ops/sec
ECDSA 256 sign 78 ops took 1.007 sec, avg 12.910 ms, 77.458 ops/sec
ECDSA 256 verify 36 ops took 1.004 sec, avg 27.889 ms, 35.857 ops/sec
Benchmark complete
Benchmark Test: Return code 0
```
### STM32H753ZI (No HW Crypto, -Os, FastMath)
```
------------------------------------------------------------------------------
wolfSSL version 4.4.1
------------------------------------------------------------------------------
wolfCrypt Benchmark (block bytes 1024, min 1.0 sec each)
RNG 1 MB took 1.015 seconds, 1.010 MB/s
AES-128-CBC-enc 1 MB took 1.012 seconds, 1.399 MB/s
AES-128-CBC-dec 1 MB took 1.000 seconds, 1.318 MB/s
AES-192-CBC-enc 1 MB took 1.019 seconds, 1.198 MB/s
AES-192-CBC-dec 1 MB took 1.012 seconds, 1.134 MB/s
AES-256-CBC-enc 1 MB took 1.000 seconds, 1.050 MB/s
AES-256-CBC-dec 1 MB took 1.012 seconds, 0.989 MB/s
AES-128-GCM-enc 75 KB took 1.125 seconds, 66.667 KB/s
AES-128-GCM-dec 75 KB took 1.125 seconds, 66.667 KB/s
AES-192-GCM-enc 75 KB took 1.149 seconds, 65.274 KB/s
AES-192-GCM-dec 75 KB took 1.149 seconds, 65.274 KB/s
AES-256-GCM-enc 75 KB took 1.161 seconds, 64.599 KB/s
AES-256-GCM-dec 75 KB took 1.165 seconds, 64.378 KB/s
CHACHA 5 MB took 1.000 seconds, 4.858 MB/s
CHA-POLY 3 MB took 1.003 seconds, 3.140 MB/s
POLY1305 13 MB took 1.000 seconds, 12.671 MB/s
SHA-256 3 MB took 1.004 seconds, 2.845 MB/s
HMAC-SHA256 3 MB took 1.004 seconds, 2.821 MB/s
RSA 2048 public 38 ops took 1.012 sec, avg 26.632 ms, 37.549 ops/sec
RSA 2048 private 2 ops took 3.267 sec, avg 1633.500 ms, 0.612 ops/sec
DH 2048 key gen 4 ops took 1.184 sec, avg 296.000 ms, 3.378 ops/sec
DH 2048 agree 2 ops took 1.259 sec, avg 629.500 ms, 1.589 ops/sec
ECC 256 key gen 4 ops took 1.070 sec, avg 267.500 ms, 3.738 ops/sec
ECDHE 256 agree 4 ops took 1.070 sec, avg 267.500 ms, 3.738 ops/sec
ECDSA 256 sign 4 ops took 1.082 sec, avg 270.500 ms, 3.697 ops/sec
ECDSA 256 verify 6 ops took 1.016 sec, avg 169.333 ms, 5.906 ops/sec
Benchmark complete
Benchmark Test: Return code 0
```
## STM32WB55
Supports RNG, ECC P-256, AES-CBC and SHA-256 acceleration.
Note: SP math beats PKA HW. HW RNG on for all tests
Board: P-NUCLEO-WB55 (MB1355C-02)
CPU: Cortex-M4 at 64 MHz
IDE: STM32CubeIDE
RTOS: FreeRTOS
### STM32WB55 (STM AES-CBC/Hash Acceleration, -Os, SP-ASM Cortex-M)
```
------------------------------------------------------------------------------
wolfSSL version 4.4.1
------------------------------------------------------------------------------
wolfCrypt Benchmark (block bytes 1024, min 1.0 sec each)
RNG 375 KB took 1.008 seconds, 372.024 KB/s
AES-128-CBC-enc 4 MB took 1.000 seconds, 3.882 MB/s
AES-128-CBC-dec 4 MB took 1.000 seconds, 3.955 MB/s
AES-256-CBC-enc 4 MB took 1.004 seconds, 3.550 MB/s
AES-256-CBC-dec 4 MB took 1.004 seconds, 3.599 MB/s
AES-128-GCM-enc 50 KB took 1.800 seconds, 27.778 KB/s
AES-128-GCM-dec 50 KB took 1.804 seconds, 27.716 KB/s
AES-256-GCM-enc 50 KB took 1.828 seconds, 27.352 KB/s
AES-256-GCM-dec 50 KB took 1.831 seconds, 27.307 KB/s
CHACHA 2 MB took 1.008 seconds, 1.574 MB/s
CHA-POLY 1 MB took 1.004 seconds, 1.046 MB/s
POLY1305 5 MB took 1.000 seconds, 4.663 MB/s
SHA-256 1000 KB took 1.015 seconds, 985.222 KB/s
HMAC-SHA256 975 KB took 1.000 seconds, 975.000 KB/s
RSA 2048 public 28 ops took 1.016 sec, avg 36.286 ms, 27.559 ops/sec
RSA 2048 private 2 ops took 2.522 sec, avg 1261.000 ms, 0.793 ops/sec
DH 2048 key gen 2 ops took 1.184 sec, avg 592.000 ms, 1.689 ops/sec
DH 2048 agree 2 ops took 1.181 sec, avg 590.500 ms, 1.693 ops/sec
ECC 256 key gen 37 ops took 1.008 sec, avg 27.243 ms, 36.706 ops/sec
ECDHE 256 agree 18 ops took 1.071 sec, avg 59.500 ms, 16.807 ops/sec
ECDSA 256 sign 14 ops took 1.130 sec, avg 80.714 ms, 12.389 ops/sec
ECDSA 256 verify 8 ops took 1.305 sec, avg 163.125 ms, 6.130 ops/sec
Benchmark complete
Benchmark Test: Return code 0
```
### STM32WB55 (STM PKA only, -Os, FastMath)
```
------------------------------------------------------------------------------
wolfSSL version 4.4.1
------------------------------------------------------------------------------
wolfCrypt Benchmark (block bytes 1024, min 1.0 sec each)
RNG 375 KB took 1.008 seconds, 372.024 KB/s
AES-128-CBC-enc 600 KB took 1.020 seconds, 588.235 KB/s
AES-128-CBC-dec 575 KB took 1.007 seconds, 571.003 KB/s
AES-192-CBC-enc 525 KB took 1.043 seconds, 503.356 KB/s
AES-192-CBC-dec 500 KB took 1.028 seconds, 486.381 KB/s
AES-256-CBC-enc 450 KB took 1.027 seconds, 438.169 KB/s
AES-256-CBC-dec 425 KB took 1.000 seconds, 425.000 KB/s
AES-128-GCM-enc 50 KB took 1.819 seconds, 27.488 KB/s
AES-128-GCM-dec 50 KB took 1.820 seconds, 27.473 KB/s
AES-192-GCM-enc 50 KB took 1.855 seconds, 26.954 KB/s
AES-192-GCM-dec 50 KB took 1.851 seconds, 27.012 KB/s
AES-256-GCM-enc 50 KB took 1.874 seconds, 26.681 KB/s
AES-256-GCM-dec 50 KB took 1.875 seconds, 26.667 KB/s
CHACHA 2 MB took 1.004 seconds, 1.581 MB/s
CHA-POLY 1 MB took 1.000 seconds, 1.050 MB/s
POLY1305 5 MB took 1.000 seconds, 4.663 MB/s
SHA-256 1000 KB took 1.016 seconds, 984.252 KB/s
HMAC-SHA256 1000 KB took 1.024 seconds, 976.562 KB/s
RSA 2048 public 14 ops took 1.121 sec, avg 80.071 ms, 12.489 ops/sec
RSA 2048 private 2 ops took 9.428 sec, avg 4714.000 ms, 0.212 ops/sec
DH 2048 key gen 2 ops took 1.807 sec, avg 903.500 ms, 1.107 ops/sec
DH 2048 agree 2 ops took 3.643 sec, avg 1821.500 ms, 0.549 ops/sec
ECC 256 key gen 9 ops took 1.024 sec, avg 113.778 ms, 8.789 ops/sec
ECDHE 256 agree 10 ops took 1.129 sec, avg 112.900 ms, 8.857 ops/sec
ECDSA 256 sign 14 ops took 1.157 sec, avg 82.643 ms, 12.100 ops/sec
ECDSA 256 verify 8 ops took 1.282 sec, avg 160.250 ms, 6.240 ops/sec
Benchmark complete
Benchmark Test: Return code 0
```
### STM32WB55 (No HW Crypto, -Os, FastMath)
```
------------------------------------------------------------------------------
wolfSSL version 4.4.1
------------------------------------------------------------------------------
wolfCrypt Benchmark (block bytes 1024, min 1.0 sec each)
RNG 375 KB took 1.004 seconds, 373.506 KB/s
AES-128-CBC-enc 600 KB took 1.024 seconds, 585.937 KB/s
AES-128-CBC-dec 575 KB took 1.008 seconds, 570.437 KB/s
AES-192-CBC-enc 525 KB took 1.047 seconds, 501.433 KB/s
AES-192-CBC-dec 500 KB took 1.028 seconds, 486.381 KB/s
AES-256-CBC-enc 450 KB took 1.028 seconds, 437.743 KB/s
AES-256-CBC-dec 450 KB took 1.055 seconds, 426.540 KB/s
AES-128-GCM-enc 50 KB took 1.816 seconds, 27.533 KB/s
AES-128-GCM-dec 50 KB took 1.820 seconds, 27.473 KB/s
AES-192-GCM-enc 50 KB took 1.851 seconds, 27.012 KB/s
AES-192-GCM-dec 50 KB took 1.851 seconds, 27.012 KB/s
AES-256-GCM-enc 50 KB took 1.875 seconds, 26.667 KB/s
AES-256-GCM-dec 50 KB took 1.874 seconds, 26.681 KB/s
CHACHA 2 MB took 1.004 seconds, 1.581 MB/s
CHA-POLY 1 MB took 1.012 seconds, 1.061 MB/s
POLY1305 5 MB took 1.004 seconds, 4.693 MB/s
SHA-256 1000 KB took 1.016 seconds, 984.252 KB/s
HMAC-SHA256 1000 KB took 1.023 seconds, 977.517 KB/s
RSA 2048 public 14 ops took 1.141 sec, avg 81.500 ms, 12.270 ops/sec
RSA 2048 private 2 ops took 9.498 sec, avg 4749.000 ms, 0.211 ops/sec
DH 2048 key gen 2 ops took 1.839 sec, avg 919.500 ms, 1.088 ops/sec
DH 2048 agree 2 ops took 3.674 sec, avg 1837.000 ms, 0.544 ops/sec
ECC 256 key gen 1 ops took 1.130 sec, avg 1130.000 ms, 0.885 ops/sec
ECDHE 256 agree 2 ops took 2.251 sec, avg 1125.500 ms, 0.888 ops/sec
ECDSA 256 sign 2 ops took 2.275 sec, avg 1137.500 ms, 0.879 ops/sec
ECDSA 256 verify 2 ops took 1.490 sec, avg 745.000 ms, 1.342 ops/sec
Benchmark complete
Benchmark Test: Return code 0
```
## STM32F437
Supports RNG, AES-CBC/GCM and SHA-256 acceleration.
Note: HW RNG on for all tests
Board: STM32F437I-EVAL
CPU: Cortex-M4 at 160 MHz
IDE: STM32CubeIDE
RTOS: FreeRTOS
### STM32F437 (STM Crypto/Hash Acceleration, -Os, SP-ASM Cortex-M)
```
------------------------------------------------------------------------------
wolfSSL version 4.4.1
------------------------------------------------------------------------------
wolfCrypt Benchmark (block bytes 1024, min 1.0 sec each)
RNG 500 KB took 1.000 seconds, 500.000 KB/s
AES-128-CBC-enc 9 MB took 1.000 seconds, 8.716 MB/s
AES-128-CBC-dec 9 MB took 1.004 seconds, 8.681 MB/s
AES-192-CBC-enc 9 MB took 1.000 seconds, 8.740 MB/s
AES-192-CBC-dec 9 MB took 1.000 seconds, 8.667 MB/s
AES-256-CBC-enc 9 MB took 1.000 seconds, 8.740 MB/s
AES-256-CBC-dec 9 MB took 1.004 seconds, 8.681 MB/s
AES-128-GCM-enc 8 MB took 1.000 seconds, 7.837 MB/s
AES-128-GCM-dec 8 MB took 1.000 seconds, 7.812 MB/s
AES-192-GCM-enc 8 MB took 1.000 seconds, 7.812 MB/s
AES-192-GCM-dec 8 MB took 1.000 seconds, 7.788 MB/s
AES-256-GCM-enc 8 MB took 1.000 seconds, 7.837 MB/s
AES-256-GCM-dec 8 MB took 1.000 seconds, 7.764 MB/s
CHACHA 4 MB took 1.000 seconds, 4.150 MB/s
CHA-POLY 3 MB took 1.004 seconds, 2.821 MB/s
POLY1305 13 MB took 1.000 seconds, 12.646 MB/s
SHA-256 7 MB took 1.000 seconds, 7.446 MB/s
HMAC-SHA256 7 MB took 1.000 seconds, 7.251 MB/s
RSA 2048 public 74 ops took 1.000 sec, avg 13.514 ms, 74.000 ops/sec
RSA 2048 private 4 ops took 1.933 sec, avg 483.250 ms, 2.069 ops/sec
DH 2048 key gen 5 ops took 1.075 sec, avg 215.000 ms, 4.651 ops/sec
DH 2048 agree 6 ops took 1.282 sec, avg 213.667 ms, 4.680 ops/sec
ECC 256 key gen 123 ops took 1.004 sec, avg 8.163 ms, 122.510 ops/sec
ECDHE 256 agree 58 ops took 1.019 sec, avg 17.569 ms, 56.919 ops/sec
ECDSA 256 sign 82 ops took 1.016 sec, avg 12.390 ms, 80.709 ops/sec
ECDSA 256 verify 38 ops took 1.015 sec, avg 26.711 ms, 37.438 ops/sec
Benchmark complete
Benchmark Test: Return code 0
```
### STM32F437 (No HW Crypto, -Os, FastMath)
```
------------------------------------------------------------------------------
wolfSSL version 4.4.1
------------------------------------------------------------------------------
wolfCrypt Benchmark (block bytes 1024, min 1.0 sec each)
RNG 1 MB took 1.024 seconds, 0.978 MB/s
AES-128-CBC-enc 1 MB took 1.012 seconds, 1.303 MB/s
AES-128-CBC-dec 1 MB took 1.004 seconds, 1.264 MB/s
AES-192-CBC-enc 1 MB took 1.012 seconds, 1.110 MB/s
AES-192-CBC-dec 1 MB took 1.016 seconds, 1.081 MB/s
AES-256-CBC-enc 1000 KB took 1.011 seconds, 989.120 KB/s
AES-256-CBC-dec 975 KB took 1.008 seconds, 967.262 KB/s
AES-128-GCM-enc 75 KB took 1.024 seconds, 73.242 KB/s
AES-128-GCM-dec 75 KB took 1.024 seconds, 73.242 KB/s
AES-192-GCM-enc 75 KB took 1.043 seconds, 71.908 KB/s
AES-192-GCM-dec 75 KB took 1.047 seconds, 71.633 KB/s
AES-256-GCM-enc 75 KB took 1.059 seconds, 70.822 KB/s
AES-256-GCM-dec 75 KB took 1.058 seconds, 70.888 KB/s
CHACHA 4 MB took 1.004 seconds, 4.158 MB/s
CHA-POLY 3 MB took 1.004 seconds, 2.821 MB/s
POLY1305 13 MB took 1.000 seconds, 12.598 MB/s
SHA-256 3 MB took 1.004 seconds, 2.602 MB/s
HMAC-SHA256 3 MB took 1.000 seconds, 2.588 MB/s
RSA 2048 public 34 ops took 1.039 sec, avg 30.559 ms, 32.724 ops/sec
RSA 2048 private 2 ops took 3.635 sec, avg 1817.500 ms, 0.550 ops/sec
DH 2048 key gen 3 ops took 1.039 sec, avg 346.333 ms, 2.887 ops/sec
DH 2048 agree 2 ops took 1.416 sec, avg 708.000 ms, 1.412 ops/sec
ECC 256 key gen 3 ops took 1.248 sec, avg 416.000 ms, 2.404 ops/sec
ECDHE 256 agree 4 ops took 1.662 sec, avg 415.500 ms, 2.407 ops/sec
ECDSA 256 sign 4 ops took 1.691 sec, avg 422.750 ms, 2.365 ops/sec
ECDSA 256 verify 4 ops took 1.091 sec, avg 272.750 ms, 3.666 ops/sec
Benchmark complete
Benchmark Test: Return code 0
```
## STM32L4A6Z
Supports RNG, AES-CBC/GCM and SHA-256 acceleration.
Note: HW RNG on for all tests
Board: NUCLEO-L4A6ZG
CPU: Cortex-M4 at 80 MHz
IDE: STM32CubeIDE
RTOS: FreeRTOS
### STM32L4A6Z (STM Crypto/Hash Acceleration, -Os, SP-ASM Cortex-M)
```
------------------------------------------------------------------------------
wolfSSL version 4.4.1
------------------------------------------------------------------------------
wolfCrypt Benchmark (block bytes 1024, min 1.0 sec each)
RNG 250 KB took 1.083 seconds, 230.840 KB/s
AES-128-CBC-enc 4 MB took 1.000 seconds, 4.175 MB/s
AES-128-CBC-dec 3 MB took 1.000 seconds, 3.442 MB/s
AES-256-CBC-enc 3 MB took 1.000 seconds, 3.247 MB/s
AES-256-CBC-dec 3 MB took 1.008 seconds, 2.664 MB/s
AES-128-GCM-enc 4 MB took 1.000 seconds, 3.589 MB/s
AES-128-GCM-dec 4 MB took 1.004 seconds, 3.575 MB/s
AES-256-GCM-enc 3 MB took 1.004 seconds, 2.869 MB/s
AES-256-GCM-dec 3 MB took 1.000 seconds, 2.856 MB/s
CHACHA 2 MB took 1.008 seconds, 2.010 MB/s
CHA-POLY 1 MB took 1.004 seconds, 1.337 MB/s
POLY1305 6 MB took 1.000 seconds, 6.030 MB/s
SHA-256 4 MB took 1.004 seconds, 3.623 MB/s
HMAC-SHA256 4 MB took 1.000 seconds, 3.540 MB/s
RSA 2048 public 36 ops took 1.020 sec, avg 28.333 ms, 35.294 ops/sec
RSA 2048 private 2 ops took 2.031 sec, avg 1015.500 ms, 0.985 ops/sec
DH 2048 key gen 3 ops took 1.353 sec, avg 451.000 ms, 2.217 ops/sec
DH 2048 agree 4 ops took 1.804 sec, avg 451.000 ms, 2.217 ops/sec
ECC 256 key gen 33 ops took 1.011 sec, avg 30.636 ms, 32.641 ops/sec
ECDHE 256 agree 16 ops took 1.078 sec, avg 67.375 ms, 14.842 ops/sec
ECDSA 256 sign 24 ops took 1.012 sec, avg 42.167 ms, 23.715 ops/sec
ECDSA 256 verify 12 ops took 1.165 sec, avg 97.083 ms, 10.300 ops/sec
Benchmark complete
Benchmark Test: Return code 0
```
### STM32L4A6Z (No HW Crypto, -Os, FastMath)
```
------------------------------------------------------------------------------
wolfSSL version 4.4.1
------------------------------------------------------------------------------
wolfCrypt Benchmark (block bytes 1024, min 1.0 sec each)
RNG 450 KB took 1.048 seconds, 429.389 KB/s
AES-128-CBC-enc 625 KB took 1.008 seconds, 620.040 KB/s
AES-128-CBC-dec 675 KB took 1.008 seconds, 669.643 KB/s
AES-192-CBC-enc 550 KB took 1.023 seconds, 537.634 KB/s
AES-192-CBC-dec 575 KB took 1.012 seconds, 568.182 KB/s
AES-256-CBC-enc 475 KB took 1.004 seconds, 473.108 KB/s
AES-256-CBC-dec 500 KB took 1.008 seconds, 496.032 KB/s
AES-128-GCM-enc 50 KB took 1.440 seconds, 34.722 KB/s
AES-128-GCM-dec 50 KB took 1.435 seconds, 34.843 KB/s
AES-192-GCM-enc 50 KB took 1.466 seconds, 34.106 KB/s
AES-192-GCM-dec 50 KB took 1.463 seconds, 34.176 KB/s
AES-256-GCM-enc 50 KB took 1.482 seconds, 33.738 KB/s
AES-256-GCM-dec 50 KB took 1.478 seconds, 33.829 KB/s
CHACHA 2 MB took 1.008 seconds, 2.010 MB/s
CHA-POLY 1 MB took 1.008 seconds, 1.332 MB/s
POLY1305 6 MB took 1.000 seconds, 6.006 MB/s
SHA-256 1 MB took 1.000 seconds, 1.123 MB/s
HMAC-SHA256 1 MB took 1.008 seconds, 1.114 MB/s
RSA 2048 public 16 ops took 1.028 sec, avg 64.250 ms, 15.564 ops/sec
RSA 2048 private 2 ops took 7.491 sec, avg 3745.500 ms, 0.267 ops/sec
DH 2048 key gen 2 ops took 1.440 sec, avg 720.000 ms, 1.389 ops/sec
DH 2048 agree 2 ops took 2.882 sec, avg 1441.000 ms, 0.694 ops/sec
ECC 256 key gen 2 ops took 1.918 sec, avg 959.000 ms, 1.043 ops/sec
ECDHE 256 agree 2 ops took 1.914 sec, avg 957.000 ms, 1.045 ops/sec
ECDSA 256 sign 2 ops took 1.941 sec, avg 970.500 ms, 1.030 ops/sec
ECDSA 256 verify 2 ops took 1.294 sec, avg 647.000 ms, 1.546 ops/sec
Benchmark complete
Benchmark Test: Return code 0
```
## STM32L562E
Supports RNG, AES-CBC/GCM and SHA-256 acceleration.
Note: HW RNG on for all tests
Board: STM32L562E-DK
CPU: Cortex-M33 at 110 MHz
IDE: STM32CubeIDE
RTOS: FreeRTOS
### STM32L562E (STM AES-CBC/Hash Acceleration, -Os, SP-ASM Cortex-M)
```
------------------------------------------------------------------------------
wolfSSL version 4.4.1
------------------------------------------------------------------------------
wolfCrypt Benchmark (block bytes 1024, min 1.0 sec each)
RNG 150 KB took 1.105 seconds, 135.747 KB/s
AES-128-CBC-enc 4 MB took 1.000 seconds, 4.468 MB/s
AES-128-CBC-dec 4 MB took 1.000 seconds, 4.297 MB/s
AES-256-CBC-enc 4 MB took 1.000 seconds, 3.857 MB/s
AES-256-CBC-dec 4 MB took 1.004 seconds, 3.745 MB/s
AES-128-GCM-enc 4 MB took 1.000 seconds, 3.662 MB/s
AES-128-GCM-dec 4 MB took 1.004 seconds, 3.648 MB/s
AES-256-GCM-enc 3 MB took 1.004 seconds, 3.258 MB/s
AES-256-GCM-dec 3 MB took 1.000 seconds, 3.247 MB/s
CHACHA 1 MB took 1.008 seconds, 1.138 MB/s
CHA-POLY 825 KB took 1.023 seconds, 806.452 KB/s
POLY1305 4 MB took 1.000 seconds, 3.711 MB/s
SHA-256 2 MB took 1.000 seconds, 1.855 MB/s
HMAC-SHA256 2 MB took 1.008 seconds, 1.817 MB/s
RSA 2048 public 20 ops took 1.106 sec, avg 55.300 ms, 18.083 ops/sec
RSA 2048 private 2 ops took 3.804 sec, avg 1902.000 ms, 0.526 ops/sec
DH 2048 key gen 2 ops took 1.772 sec, avg 886.000 ms, 1.129 ops/sec
DH 2048 agree 2 ops took 1.773 sec, avg 886.500 ms, 1.128 ops/sec
ECC 256 key gen 36 ops took 1.011 sec, avg 28.083 ms, 35.608 ops/sec
ECDHE 256 agree 18 ops took 1.086 sec, avg 60.333 ms, 16.575 ops/sec
ECDSA 256 sign 22 ops took 1.004 sec, avg 45.636 ms, 21.912 ops/sec
ECDSA 256 verify 12 ops took 1.133 sec, avg 94.417 ms, 10.591 ops/sec
Benchmark complete
Benchmark Test: Return code 0
```
### STM32L562E (STM PKA ECC/AES-CBC/Hash Acceleration, -Os, SP-ASM Cortex-M)
```
------------------------------------------------------------------------------
wolfSSL version 4.4.1
------------------------------------------------------------------------------
wolfCrypt Benchmark (block bytes 1024, min 1.0 sec each)
RNG 150 KB took 1.105 seconds, 135.747 KB/s
AES-128-CBC-enc 4 MB took 1.000 seconds, 4.468 MB/s
AES-128-CBC-dec 4 MB took 1.000 seconds, 4.297 MB/s
AES-256-CBC-enc 4 MB took 1.000 seconds, 3.857 MB/s
AES-256-CBC-dec 4 MB took 1.004 seconds, 3.745 MB/s
AES-128-GCM-enc 4 MB took 1.000 seconds, 3.662 MB/s
AES-128-GCM-dec 4 MB took 1.004 seconds, 3.648 MB/s
AES-256-GCM-enc 3 MB took 1.004 seconds, 3.258 MB/s
AES-256-GCM-dec 3 MB took 1.000 seconds, 3.247 MB/s
CHACHA 1 MB took 1.008 seconds, 1.138 MB/s
CHA-POLY 825 KB took 1.023 seconds, 806.452 KB/s
POLY1305 4 MB took 1.000 seconds, 3.711 MB/s
SHA-256 2 MB took 1.000 seconds, 1.855 MB/s
HMAC-SHA256 2 MB took 1.008 seconds, 1.817 MB/s
RSA 2048 public 20 ops took 1.106 sec, avg 55.300 ms, 18.083 ops/sec
RSA 2048 private 2 ops took 3.804 sec, avg 1902.000 ms, 0.526 ops/sec
DH 2048 key gen 2 ops took 1.772 sec, avg 886.000 ms, 1.129 ops/sec
DH 2048 agree 2 ops took 1.773 sec, avg 886.500 ms, 1.128 ops/sec
ECC 256 key gen 11 ops took 1.067 sec, avg 97.000 ms, 10.309 ops/sec
ECDHE 256 agree 12 ops took 1.130 sec, avg 94.167 ms, 10.619 ops/sec
ECDSA 256 sign 22 ops took 1.071 sec, avg 48.682 ms, 20.542 ops/sec
ECDSA 256 verify 12 ops took 1.125 sec, avg 93.750 ms, 10.667 ops/sec
Benchmark complete
Benchmark Test: Return code 0
```
### STM32L562E (No HW Crypto, -Os, FastMath)
```
------------------------------------------------------------------------------
wolfSSL version 4.4.1
------------------------------------------------------------------------------
wolfCrypt Benchmark (block bytes 1024, min 1.0 sec each)
RNG 75 KB took 1.274 seconds, 58.870 KB/s
AES-128-CBC-enc 475 KB took 1.036 seconds, 458.494 KB/s
AES-128-CBC-dec 450 KB took 1.007 seconds, 446.872 KB/s
AES-192-CBC-enc 400 KB took 1.024 seconds, 390.625 KB/s
AES-192-CBC-dec 400 KB took 1.047 seconds, 382.044 KB/s
AES-256-CBC-enc 350 KB took 1.023 seconds, 342.131 KB/s
AES-256-CBC-dec 350 KB took 1.051 seconds, 333.016 KB/s
AES-128-GCM-enc 25 KB took 1.310 seconds, 19.084 KB/s
AES-128-GCM-dec 25 KB took 1.306 seconds, 19.142 KB/s
AES-192-GCM-enc 25 KB took 1.330 seconds, 18.797 KB/s
AES-192-GCM-dec 25 KB took 1.329 seconds, 18.811 KB/s
AES-256-GCM-enc 25 KB took 1.341 seconds, 18.643 KB/s
AES-256-GCM-dec 25 KB took 1.345 seconds, 18.587 KB/s
CHACHA 1 MB took 1.012 seconds, 1.230 MB/s
CHA-POLY 850 KB took 1.000 seconds, 850.000 KB/s
POLY1305 4 MB took 1.004 seconds, 3.672 MB/s
SHA-256 750 KB took 1.020 seconds, 735.294 KB/s
HMAC-SHA256 750 KB took 1.031 seconds, 727.449 KB/s
RSA 2048 public 10 ops took 1.086 sec, avg 108.600 ms, 9.208 ops/sec
RSA 2048 private 2 ops took 12.894 sec, avg 6447.000 ms, 0.155 ops/sec
DH 2048 key gen 1 ops took 1.200 sec, avg 1200.000 ms, 0.833 ops/sec
DH 2048 agree 2 ops took 4.867 sec, avg 2433.500 ms, 0.411 ops/sec
ECC 256 key gen 1 ops took 1.514 sec, avg 1514.000 ms, 0.661 ops/sec
ECDHE 256 agree 2 ops took 3.028 sec, avg 1514.000 ms, 0.661 ops/sec
ECDSA 256 sign 2 ops took 3.066 sec, avg 1533.000 ms, 0.652 ops/sec
ECDSA 256 verify 2 ops took 1.973 sec, avg 986.500 ms, 1.014 ops/sec
Benchmark complete
Benchmark Test: Return code 0
```
## STM32F777
Supports RNG, AES-CBC/GCM and SHA-256 acceleration.
Note: HW RNG on for all tests
Board: Custom STM32F777
CPU: Cortex-M7 at 216 MHz
IDE: STM32CubeIDE
RTOS: FreeRTOS
### STM32F777 (STM AES-CBC/Hash Acceleration, -Os, SP-ASM Cortex-M)
```
------------------------------------------------------------------------------
wolfSSL version 4.4.1
------------------------------------------------------------------------------
wolfCrypt Benchmark (block bytes 1024, min 1.0 sec each)
RNG 525 KB took 1.012 seconds, 518.775 KB/s
AES-128-CBC-enc 8 MB took 1.000 seconds, 8.350 MB/s
AES-128-CBC-dec 8 MB took 1.000 seconds, 8.203 MB/s
AES-192-CBC-enc 8 MB took 1.000 seconds, 8.325 MB/s
AES-192-CBC-dec 8 MB took 1.000 seconds, 8.179 MB/s
AES-256-CBC-enc 8 MB took 1.000 seconds, 8.325 MB/s
AES-256-CBC-dec 8 MB took 1.000 seconds, 8.154 MB/s
AES-128-GCM-enc 6 MB took 1.000 seconds, 6.494 MB/s
AES-128-GCM-dec 6 MB took 1.000 seconds, 6.494 MB/s
AES-192-GCM-enc 6 MB took 1.000 seconds, 6.470 MB/s
AES-192-GCM-dec 6 MB took 1.000 seconds, 6.494 MB/s
AES-256-GCM-enc 6 MB took 1.000 seconds, 6.494 MB/s
AES-256-GCM-dec 6 MB took 1.000 seconds, 6.494 MB/s
CHACHA 4 MB took 1.004 seconds, 4.182 MB/s
CHA-POLY 3 MB took 1.004 seconds, 2.505 MB/s
POLY1305 9 MB took 1.000 seconds, 9.204 MB/s
SHA-256 3 MB took 1.000 seconds, 3.467 MB/s
HMAC-SHA256 3 MB took 1.004 seconds, 3.404 MB/s
RSA 2048 public 54 ops took 1.028 sec, avg 19.037 ms, 52.529 ops/sec
RSA 2048 private 2 ops took 1.262 sec, avg 631.000 ms, 1.585 ops/sec
DH 2048 key gen 4 ops took 1.220 sec, avg 305.000 ms, 3.279 ops/sec
DH 2048 agree 4 ops took 1.215 sec, avg 303.750 ms, 3.292 ops/sec
ECC 256 key gen 130 ops took 1.000 sec, avg 7.692 ms, 130.000 ops/sec
ECDHE 256 agree 60 ops took 1.003 sec, avg 16.717 ms, 59.821 ops/sec
ECDSA 256 sign 70 ops took 1.024 sec, avg 14.629 ms, 68.359 ops/sec
ECDSA 256 verify 36 ops took 1.015 sec, avg 28.194 ms, 35.468 ops/sec
Benchmark complete
Benchmark Test: Return code 0
```
### STM32F777 (No HW Crypto, -Os, FastMath)
```
------------------------------------------------------------------------------
wolfSSL version 4.4.1
------------------------------------------------------------------------------
wolfCrypt Benchmark (block bytes 1024, min 1.0 sec each)
RNG 700 KB took 1.016 seconds, 688.976 KB/s
AES-128-CBC-enc 1 MB took 1.019 seconds, 1.006 MB/s
AES-128-CBC-dec 950 KB took 1.000 seconds, 950.000 KB/s
AES-192-CBC-enc 900 KB took 1.016 seconds, 885.827 KB/s
AES-192-CBC-dec 825 KB took 1.011 seconds, 816.024 KB/s
AES-256-CBC-enc 800 KB took 1.028 seconds, 778.210 KB/s
AES-256-CBC-dec 725 KB took 1.008 seconds, 719.246 KB/s
AES-128-GCM-enc 50 KB took 1.223 seconds, 40.883 KB/s
AES-128-GCM-dec 50 KB took 1.220 seconds, 40.984 KB/s
AES-192-GCM-enc 50 KB took 1.251 seconds, 39.968 KB/s
AES-192-GCM-dec 50 KB took 1.247 seconds, 40.096 KB/s
AES-256-GCM-enc 50 KB took 1.267 seconds, 39.463 KB/s
AES-256-GCM-dec 50 KB took 1.263 seconds, 39.588 KB/s
CHACHA 4 MB took 1.000 seconds, 4.175 MB/s
CHA-POLY 2 MB took 1.000 seconds, 2.417 MB/s
POLY1305 10 MB took 1.000 seconds, 10.132 MB/s
SHA-256 2 MB took 1.000 seconds, 1.782 MB/s
HMAC-SHA256 2 MB took 1.004 seconds, 1.775 MB/s
RSA 2048 public 22 ops took 1.067 sec, avg 48.500 ms, 20.619 ops/sec
RSA 2048 private 2 ops took 5.549 sec, avg 2774.500 ms, 0.360 ops/sec
DH 2048 key gen 3 ops took 1.483 sec, avg 494.333 ms, 2.023 ops/sec
DH 2048 agree 2 ops took 1.866 sec, avg 933.000 ms, 1.072 ops/sec
ECC 256 key gen 1 ops took 1.090 sec, avg 1090.000 ms, 0.917 ops/sec
ECDHE 256 agree 2 ops took 2.180 sec, avg 1090.000 ms, 0.917 ops/sec
ECDSA 256 sign 2 ops took 2.208 sec, avg 1104.000 ms, 0.906 ops/sec
ECDSA 256 verify 2 ops took 1.463 sec, avg 731.500 ms, 1.367 ops/sec
Benchmark complete
Benchmark Test: Return code 0
```

View File

@ -0,0 +1,10 @@
# vim:ft=automake
# included from Top Level Makefile.am
# All paths should be given relative to the root
EXTRA_DIST+= IDE/STM32Cube/README.md
EXTRA_DIST+= IDE/STM32Cube/main.c
EXTRA_DIST+= IDE/STM32Cube/wolfssl_example.c
EXTRA_DIST+= IDE/STM32Cube/wolfSSL.wolfSSL_conf.h
EXTRA_DIST+= IDE/STM32Cube/wolfssl_example.h
EXTRA_DIST+= IDE/STM32Cube/STM32_Benchmarks.md

View File

@ -0,0 +1,366 @@
/* main.c
*
* Copyright (C) 2006-2020 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
/* Example for main.c with STM32Cube/wolfssl_example.c */
#if 0 /* EXAMPLE main.c */
/* Includes ------------------------------------------------------------------*/
#include "wolfssl_example.h"
/* Private variables ---------------------------------------------------------*/
CRYP_HandleTypeDef hcryp;
__ALIGN_BEGIN static const uint32_t pKeyCRYP[6] __ALIGN_END = {
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000};
HASH_HandleTypeDef hhash;
RNG_HandleTypeDef hrng;
RTC_HandleTypeDef hrtc;
UART_HandleTypeDef huart4;
/* Definitions for defaultTask */
#ifndef SINGLE_THREADED
#ifdef CMSIS_OS2_H_
osThreadId_t defaultTaskHandle;
const osThreadAttr_t wolfCryptDemo_attributes = {
.name = "wolfCryptDemo",
.priority = (osPriority_t) osPriorityNormal,
.stack_size = WOLF_EXAMPLES_STACK
};
#else
osThreadId defaultTaskHandle;
#endif
#endif
/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_CRYP_Init(void);
static void MX_HASH_Init(void);
static void MX_RNG_Init(void);
static void MX_UART4_Init(void);
static void MX_RTC_Init(void);
/* Retargets the C library printf function to the USART. */
#include <stdio.h>
#ifdef __GNUC__
int __io_putchar(int ch)
#else
int fputc(int ch, FILE *f)
#endif
{
HAL_UART_Transmit(&huart4, (uint8_t *)&ch, 1, 0xFFFF);
return ch;
}
#ifdef __GNUC__
int _write(int file,char *ptr, int len)
{
int DataIdx;
for (DataIdx= 0; DataIdx< len; DataIdx++) {
__io_putchar(*ptr++);
}
return len;
}
#endif
int main(void)
{
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Turn off buffers, so I/O occurs immediately */
setvbuf(stdin, NULL, _IONBF, 0);
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_CRYP_Init();
MX_HASH_Init();
MX_RNG_Init();
MX_UART4_Init();
MX_RTC_Init();
MX_SPI1_Init();
MX_UART4_Init();
#ifdef SINGLE_THREADED
wolfCryptDemo(NULL);
#else
/* Init scheduler */
osKernelInitialize();
/* Create the thread(s) */
/* definition and creation of defaultTask */
#ifdef CMSIS_OS2_H_
defaultTaskHandle = osThreadNew(wolfCryptDemo, NULL, &wolfCryptDemo_attributes);
#else
osThreadDef(defaultTask, wolfCryptDemo, osPriorityNormal, 0, WOLF_EXAMPLES_STACK);
defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL);
#endif
/* Start scheduler */
osKernelStart();
/* We should never get here as control is now taken by the scheduler */
/* Infinite loop */
while (1) {}
#endif /* SINGLE_THREADED */
}
/** System Clock Configuration
*/
static void SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
/** Configure the main internal regulator output voltage
*/
__HAL_RCC_PWR_CLK_ENABLE();
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
/** Initializes the CPU, AHB and APB busses clocks
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_LSI;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
RCC_OscInitStruct.PLL.PLLM = 8;
RCC_OscInitStruct.PLL.PLLN = 160;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 7;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
Error_Handler();
}
/** Initializes the CPU, AHB and APB busses clocks
*/
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) {
Error_Handler();
}
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSI;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
Error_Handler();
}
}
/**
* @brief CRYP Initialization Function
* @param None
* @retval None
*/
static void MX_CRYP_Init(void)
{
hcryp.Instance = CRYP;
hcryp.Init.DataType = CRYP_DATATYPE_32B;
hcryp.Init.pKey = (uint32_t *)pKeyCRYP;
hcryp.Init.Algorithm = CRYP_TDES_ECB;
hcryp.Init.DataWidthUnit = CRYP_DATAWIDTHUNIT_WORD;
if (HAL_CRYP_Init(&hcryp) != HAL_OK) {
Error_Handler();
}
}
/**
* @brief HASH Initialization Function
* @param None
* @retval None
*/
static void MX_HASH_Init(void)
{
hhash.Init.DataType = HASH_DATATYPE_32B;
if (HAL_HASH_Init(&hhash) != HAL_OK) {
Error_Handler();
}
}
/**
* @brief RNG Initialization Function
* @param None
* @retval None
*/
static void MX_RNG_Init(void)
{
hrng.Instance = RNG;
if (HAL_RNG_Init(&hrng) != HAL_OK) {
Error_Handler();
}
}
/**
* @brief RTC Initialization Function
* @param None
* @retval None
*/
static void MX_RTC_Init(void)
{
RTC_TimeTypeDef sTime = {0};
RTC_DateTypeDef sDate = {0};
/* Initialize RTC Only */
hrtc.Instance = RTC;
hrtc.Init.HourFormat = RTC_HOURFORMAT_24;
hrtc.Init.AsynchPrediv = 127;
hrtc.Init.SynchPrediv = 255;
hrtc.Init.OutPut = RTC_OUTPUT_DISABLE;
hrtc.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;
hrtc.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;
if (HAL_RTC_Init(&hrtc) != HAL_OK) {
Error_Handler();
}
/* Initialize RTC and set the Time and Date */
sTime.Hours = 0x0;
sTime.Minutes = 0x0;
sTime.Seconds = 0x0;
sTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE;
sTime.StoreOperation = RTC_STOREOPERATION_RESET;
if (HAL_RTC_SetTime(&hrtc, &sTime, RTC_FORMAT_BCD) != HAL_OK) {
Error_Handler();
}
sDate.WeekDay = RTC_WEEKDAY_MONDAY;
sDate.Month = RTC_MONTH_JANUARY;
sDate.Date = 0x1;
sDate.Year = 0x0;
if (HAL_RTC_SetDate(&hrtc, &sDate, RTC_FORMAT_BCD) != HAL_OK) {
Error_Handler();
}
}
/**
* @brief UART4 Initialization Function
* @param None
* @retval None
*/
static void MX_UART4_Init(void)
{
huart4.Instance = UART4;
huart4.Init.BaudRate = 115200;
huart4.Init.WordLength = UART_WORDLENGTH_8B;
huart4.Init.StopBits = UART_STOPBITS_1;
huart4.Init.Parity = UART_PARITY_NONE;
huart4.Init.Mode = UART_MODE_TX_RX;
huart4.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart4.Init.OverSampling = UART_OVERSAMPLING_16;
if (HAL_UART_Init(&huart4) != HAL_OK) {
Error_Handler();
}
}
/**
* @brief GPIO Initialization Function
* @param None
* @retval None
*/
static void MX_GPIO_Init(void)
{
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOC_CLK_ENABLE();
}
/**
* @brief Period elapsed callback in non blocking mode
* @note This function is called when TIM1 interrupt took place, inside
* HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment
* a global variable "uwTick" used as application time base.
* @param htim : TIM handle
* @retval None
*/
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
if (htim->Instance == TIM1) {
HAL_IncTick();
}
}
/**
* @brief This function is executed in case of error occurrence.
* @retval None
*/
void Error_Handler(void)
{
/* User can add his own implementation to report the HAL error return state */
while(1)
{
}
}
#ifdef USE_FULL_ASSERT
/**
* @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* @param file: pointer to the source file name
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(uint8_t *file, uint32_t line)
{
/* User can add his own implementation to report the file name and line number,
tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
}
#endif /* USE_FULL_ASSERT */
#if 0
/* Working _sbrk example for .ld based libC malloc/free */
/* Replace this with one in Core/Src/sysmem.c */
/* Symbols defined in the linker script */
extern uint8_t _end;
extern uint8_t _estack;
extern uint32_t _Min_Stack_Size;
void* _sbrk(ptrdiff_t incr)
{
static uint8_t* __sbrk_heap_end = NULL;
const uint32_t stack_limit = (uint32_t)&_estack - (uint32_t)&_Min_Stack_Size;
const uint8_t* max_heap = (uint8_t *)stack_limit;
uint8_t* prev_heap_end;
/* Initialize heap end at first call */
if (__sbrk_heap_end == NULL) {
__sbrk_heap_end = &_end;
}
/* Protect heap from growing into the reserved MSP stack */
if (__sbrk_heap_end + incr > max_heap) {
errno = ENOMEM;
return (void *)-1;
}
prev_heap_end = __sbrk_heap_end;
__sbrk_heap_end += incr;
return (void*)prev_heap_end;
}
#endif
#endif /* EXAMPLE main.c */

View File

@ -0,0 +1,554 @@
/* wolfSSL.wolfSSL_conf.h
*
* Copyright (C) 2006-2020 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
/* STM32 Cube Configuration File
* Included automatically when USE_HAL_DRIVER is defined
* (and not WOLFSSL_USER_SETTINGS or HAVE_CONF_H).
*/
#ifndef __WOLFSSL_WOLFSSL_CONF_H__
#define __WOLFSSL_WOLFSSL_CONF_H__
#ifdef __cplusplus
extern "C" {
#endif
/*---------- Debug Support -----------*/
#define WOLF_CONF_DEBUG 0
/*---------- wolfCrypt Only -----------*/
#define WOLF_CONF_WOLFCRYPT_ONLY 0
/*---------- TLS v1.3 -----------*/
#define WOLF_CONF_TLS13 1
/*---------- TLS v1.2 -----------*/
#define WOLF_CONF_TLS12 1
/*---------- DTLS Support -----------*/
#define WOLF_CONF_DTLS 0
/*---------- Math Configuration -----------*/
#define WOLF_CONF_MATH 4
/*---------- RTOS -----------*/
#define WOLF_CONF_RTOS 2
/*---------- RSA Support -----------*/
#define WOLF_CONF_RSA 1
/*---------- ECC Support -----------*/
#define WOLF_CONF_ECC 1
/*---------- DH (DiffieHellman) Support -----------*/
#define WOLF_CONF_DH 1
/*---------- AES GCM Support -----------*/
#define WOLF_CONF_AESGCM 1
/*---------- AES CBC Support -----------*/
#define WOLF_CONF_AESCBC 0
/*---------- ChaCha20 / Poly1305 Support -----------*/
#define WOLF_CONF_CHAPOLY 1
/*---------- Ed25519 / Curve25519 Support -----------*/
#define WOLF_CONF_EDCURVE25519 0
/*---------- MD5 Support -----------*/
#define WOLF_CONF_MD5 0
/*---------- SHA1 Support -----------*/
#define WOLF_CONF_SHA1 0
/*---------- SHA2-224 Support -----------*/
#define WOLF_CONF_SHA2_224 0
/*---------- SHA2-256 Support -----------*/
#define WOLF_CONF_SHA2_256 1
/*---------- SHA2-384 Support -----------*/
#define WOLF_CONF_SHA2_384 0
/*---------- SHA2-512 Support -----------*/
#define WOLF_CONF_SHA2_512 0
/*---------- SHA3 Support -----------*/
#define WOLF_CONF_SHA3 0
/*---------- Pre-Shared-Key Support -----------*/
#define WOLF_CONF_PSK 0
/*---------- Pwd Based Key Derivation Support -----------*/
#define WOLF_CONF_PWDBASED 0
/*---------- Keep Peer Cert Support -----------*/
#define WOLF_CONF_KEEP_PEER_CERT 0
/*---------- Base64 Encode Support -----------*/
#define WOLF_CONF_BASE64_ENCODE 0
/*---------- OpenSSL Extra Support -----------*/
#define WOLF_CONF_OPENSSL_EXTRA 0
/*---------- wolfCrypt test/benchmark -----------*/
#define WOLF_CONF_TEST 1
/* ------------------------------------------------------------------------- */
/* Hardware platform */
/* ------------------------------------------------------------------------- */
#define NO_STM32_HASH
#define NO_STM32_CRYPTO
#if defined(STM32WB55xx)
#define WOLFSSL_STM32WB
#define WOLFSSL_STM32_PKA
#undef NO_STM32_CRYPTO
#define HAL_CONSOLE_UART huart1
#elif defined(STM32F407xx)
#define WOLFSSL_STM32F4
#define HAL_CONSOLE_UART huart2
#elif defined(STM32F437xx)
#define WOLFSSL_STM32F4
#undef NO_STM32_HASH
#undef NO_STM32_CRYPTO
#define STM32_HAL_V2
#define HAL_CONSOLE_UART huart4
#elif defined(STM32F777xx)
#define WOLFSSL_STM32F7
#undef NO_STM32_HASH
#undef NO_STM32_CRYPTO
#define STM32_HAL_V2
#define HAL_CONSOLE_UART huart2
#elif defined(STM32H753xx)
#define WOLFSSL_STM32H7
#undef NO_STM32_HASH
#undef NO_STM32_CRYPTO
#define HAL_CONSOLE_UART huart3
#elif defined(STM32L4A6xx)
#define WOLFSSL_STM32L4
#undef NO_STM32_HASH
#undef NO_STM32_CRYPTO
#define HAL_CONSOLE_UART hlpuart1
#elif defined(STM32L475xx)
#define WOLFSSL_STM32L4
#define HAL_CONSOLE_UART huart1
#elif defined(STM32L562xx)
#define WOLFSSL_STM32L5
#define WOLFSSL_STM32_PKA
#undef NO_STM32_HASH
#undef NO_STM32_CRYPTO
#define HAL_CONSOLE_UART huart1
#elif defined(STM32L552xx)
#define WOLFSSL_STM32L5
#undef NO_STM32_HASH
#define HAL_CONSOLE_UART hlpuart1
#elif defined(STM32F207xx)
#define WOLFSSL_STM32F2
#define HAL_CONSOLE_UART huart3
#elif defined(STM32F107xC)
#define WOLFSSL_STM32F1
#define HAL_CONSOLE_UART huart4
#define NO_STM32_RNG
#else
#warning Please define a hardware platform!
#define WOLFSSL_STM32F4 /* default */
#define HAL_CONSOLE_UART huart4
#endif
/* ------------------------------------------------------------------------- */
/* Platform */
/* ------------------------------------------------------------------------- */
#define SIZEOF_LONG_LONG 8
#define WOLFSSL_GENERAL_ALIGNMENT 4
#define WOLFSSL_STM32_CUBEMX
#define WOLFSSL_SMALL_STACK
#define WOLFSSL_USER_IO
#define WOLFSSL_NO_SOCK
#define WOLFSSL_IGNORE_FILE_WARN
/* ------------------------------------------------------------------------- */
/* Operating System */
/* ------------------------------------------------------------------------- */
#if defined(WOLF_CONF_RTOS) && WOLF_CONF_RTOS == 2
#define FREERTOS
#else
#define SINGLE_THREADED
#endif
/* ------------------------------------------------------------------------- */
/* Math Configuration */
/* ------------------------------------------------------------------------- */
/* 1=Fast, 2=Normal, 3=SP C, 4=SP Cortex-M */
#if defined(WOLF_CONF_MATH) && WOLF_CONF_MATH != 2
/* fast (stack) math */
#define USE_FAST_MATH
#define TFM_TIMING_RESISTANT
/* Optimizations (TFM_ARM, TFM_ASM or none) */
//#define TFM_NO_ASM
//#define TFM_ASM
#endif
#if defined(WOLF_CONF_MATH) && (WOLF_CONF_MATH == 3 || WOLF_CONF_MATH == 4)
/* single precision only */
#define WOLFSSL_SP
#define WOLFSSL_SP_SMALL /* use smaller version of code */
#define WOLFSSL_HAVE_SP_RSA
#define WOLFSSL_HAVE_SP_DH
#define WOLFSSL_HAVE_SP_ECC
#define WOLFSSL_SP_MATH
#define SP_WORD_SIZE 32
//#define WOLFSSL_SP_NO_MALLOC
//#define WOLFSSL_SP_CACHE_RESISTANT
/* single precision Cortex-M only */
#if WOLF_CONF_MATH == 4
#define WOLFSSL_SP_ASM /* required if using the ASM versions */
#define WOLFSSL_SP_ARM_CORTEX_M_ASM
#endif
#endif
/* ------------------------------------------------------------------------- */
/* Enable Features */
/* ------------------------------------------------------------------------- */
/* Required for TLS */
#define HAVE_TLS_EXTENSIONS
#define HAVE_SUPPORTED_CURVES
#define HAVE_ENCRYPT_THEN_MAC
#define HAVE_EXTENDED_MASTER
#if defined(WOLF_CONF_TLS13) && WOLF_CONF_TLS13 == 1
#define WOLFSSL_TLS13
#define HAVE_HKDF
#endif
#if defined(WOLF_CONF_DTLS) && WOLF_CONF_DTLS == 1
#define WOLFSSL_DTLS
#endif
#if defined(WOLF_CONF_PSK) && WOLF_CONF_PSK == 0
#define NO_PSK
#endif
#if defined(WOLF_CONF_PWDBASED) && WOLF_CONF_PWDBASED == 0
#define NO_PWDBASED
#endif
#if defined(WOLF_CONF_KEEPPEERCERT) && WOLF_CONF_KEEPPEERCERT == 1
#define KEEP_PEER_CERT
#endif
#if defined(WOLF_CONF_BASE64_ENCODE) && WOLF_CONF_BASE64_ENCODE == 1
#define WOLFSSL_BASE64_ENCODE
#endif
#if defined(WOLF_CONF_OPENSSL_EXTRA) && WOLF_CONF_OPENSSL_EXTRA == 1
#define OPENSSL_EXTRA
#endif
/* TLS Session Cache */
#if 0
#define SMALL_SESSION_CACHE
#else
#define NO_SESSION_CACHE
#endif
/* ------------------------------------------------------------------------- */
/* Crypto */
/* ------------------------------------------------------------------------- */
/* RSA */
#undef NO_RSA
#if defined(WOLF_CONF_RSA) && WOLF_CONF_RSA == 1
#ifdef USE_FAST_MATH
/* Maximum math bits (Max RSA key bits * 2) */
#undef FP_MAX_BITS
#define FP_MAX_BITS 4096
#endif
/* half as much memory but twice as slow */
#undef RSA_LOW_MEM
//#define RSA_LOW_MEM
/* Enables blinding mode, to prevent timing attacks */
#undef WC_RSA_BLINDING
#define WC_RSA_BLINDING
/* RSA PSS Support (required for TLS v1.3) */
#ifdef WOLFSSL_TLS13
#define WC_RSA_PSS
#endif
#else
#define NO_RSA
#endif
/* ECC */
#undef HAVE_ECC
#if defined(WOLF_CONF_ECC) && WOLF_CONF_ECC == 1
#define HAVE_ECC
/* Manually define enabled curves */
#define ECC_USER_CURVES
//#define HAVE_ECC192
//#define HAVE_ECC224
#undef NO_ECC256
//#define HAVE_ECC384
//#define HAVE_ECC521
/* Fixed point cache (speeds repeated operations against same private key) */
#undef FP_ECC
//#define FP_ECC
#ifdef FP_ECC
/* Bits / Entries */
#undef FP_ENTRIES
#define FP_ENTRIES 2
#undef FP_LUT
#define FP_LUT 4
#endif
/* Optional ECC calculation method */
/* Note: doubles heap usage, but slightly faster */
#undef ECC_SHAMIR
#define ECC_SHAMIR
/* Reduces heap usage, but slower */
#define ECC_TIMING_RESISTANT
/* Compressed ECC key support */
//#define HAVE_COMP_KEY
#ifdef USE_FAST_MATH
#ifdef NO_RSA
/* Custom fastmath size if not using RSA */
/* MAX = ROUND32(ECC BITS) * 2 */
#define FP_MAX_BITS (256 * 2)
#else
#define ALT_ECC_SIZE
#endif
/* Enable TFM optimizations for ECC */
//#define TFM_ECC192
//#define TFM_ECC224
//#define TFM_ECC256
//#define TFM_ECC384
//#define TFM_ECC521
#endif
#endif
/* DH */
#undef NO_DH
#if defined(WOLF_CONF_DH) && WOLF_CONF_DH == 1
#define HAVE_DH /* freeRTOS settings.h requires this */
#define HAVE_FFDHE_2048
#define HAVE_DH_DEFAULT_PARAMS
#else
#define NO_DH
#endif
/* AES */
#if defined(WOLF_CONF_AESGCM) && WOLF_CONF_AESGCM == 1
#define HAVE_AESGCM
/* GCM Method: GCM_SMALL, GCM_WORD32 or GCM_TABLE */
/* GCM_TABLE is about 4K larger and 3x faster */
#define GCM_SMALL
#define HAVE_AES_DECRYPT
#endif
#if defined(WOLF_CONF_AESCBC) && WOLF_CONF_AESCBC == 1
#define HAVE_AES_CBC
#define HAVE_AES_DECRYPT
#endif
/* Other possible AES modes */
//#define WOLFSSL_AES_COUNTER
//#define HAVE_AESCCM
//#define WOLFSSL_AES_XTS
//#define WOLFSSL_AES_DIRECT
//#define HAVE_AES_ECB
//#define HAVE_AES_KEYWRAP
//#define AES_MAX_KEY_SIZE 256
/* ChaCha20 / Poly1305 */
#undef HAVE_CHACHA
#undef HAVE_POLY1305
#if defined(WOLF_CONF_CHAPOLY) && WOLF_CONF_CHAPOLY == 1
#define HAVE_CHACHA
#define HAVE_POLY1305
/* Needed for Poly1305 */
#undef HAVE_ONE_TIME_AUTH
#define HAVE_ONE_TIME_AUTH
#endif
/* Ed25519 / Curve25519 */
#undef HAVE_CURVE25519
#undef HAVE_ED25519
#if defined(WOLF_CONF_EDCURVE25519) && WOLF_CONF_EDCURVE25519 == 1
#define HAVE_CURVE25519
#define HAVE_ED25519
/* Optionally use small math (less flash usage, but much slower) */
#define CURVED25519_SMALL
#endif
/* ------------------------------------------------------------------------- */
/* Hashing */
/* ------------------------------------------------------------------------- */
/* Sha1 */
#undef NO_SHA
#if defined(WOLF_CONF_SHA1) && WOLF_CONF_SHA1 == 1
/* 1k smaller, but 25% slower */
//#define USE_SLOW_SHA
#else
#define NO_SHA
#endif
/* Sha2-256 */
#undef NO_SHA256
#if defined(WOLF_CONF_SHA2_256) && WOLF_CONF_SHA2_256 == 1
/* not unrolled - ~2k smaller and ~25% slower */
//#define USE_SLOW_SHA256
//#define WOLFSSL_SHAKE256
/* Sha2-224 */
#if defined(WOLF_CONF_SHA2_224) && WOLF_CONF_SHA2_224 == 1
#define WOLFSSL_SHA224
#endif
#else
#define NO_SHA256
#endif
/* Sha2-512 */
#undef WOLFSSL_SHA512
#if defined(WOLF_CONF_SHA2_512) && WOLF_CONF_SHA2_512 == 1
/* over twice as small, but 50% slower */
//#define USE_SLOW_SHA512
#define WOLFSSL_SHA512
#define HAVE_SHA512 /* freeRTOS settings.h requires this */
#endif
/* Sha2-384 */
#undef WOLFSSL_SHA384
#if defined(WOLF_CONF_SHA2_384) && WOLF_CONF_SHA2_384 == 1
#define WOLFSSL_SHA384
#endif
/* Sha3 */
#undef WOLFSSL_SHA3
#if defined(WOLF_CONF_SHA3) && WOLF_CONF_SHA3 == 1
#define WOLFSSL_SHA3
#endif
/* MD5 */
#if defined(WOLF_CONF_MD5) && WOLF_CONF_MD5 == 1
/* enabled */
#else
#define NO_MD5
#endif
/* ------------------------------------------------------------------------- */
/* Benchmark / Test */
/* ------------------------------------------------------------------------- */
/* Use reduced benchmark / test sizes */
#define BENCH_EMBEDDED
#define USE_CERT_BUFFERS_2048
#define USE_CERT_BUFFERS_256
/* ------------------------------------------------------------------------- */
/* Debugging */
/* ------------------------------------------------------------------------- */
#if defined(WOLF_CONF_DEBUG) && WOLF_CONF_DEBUG == 1
#define DEBUG_WOLFSSL
/* Use this to measure / print heap usage */
#if 0
#define USE_WOLFSSL_MEMORY
#define WOLFSSL_TRACK_MEMORY
#define WOLFSSL_DEBUG_MEMORY
#define WOLFSSL_DEBUG_MEMORY_PRINT
#endif
#else
//#define NO_WOLFSSL_MEMORY
//#define NO_ERROR_STRINGS
#endif
/* ------------------------------------------------------------------------- */
/* Port */
/* ------------------------------------------------------------------------- */
/* Override Current Time */
/* Allows custom "custom_time()" function to be used for benchmark */
#define WOLFSSL_USER_CURRTIME
/* ------------------------------------------------------------------------- */
/* RNG */
/* ------------------------------------------------------------------------- */
#define NO_OLD_RNGNAME /* conflicts with STM RNG macro */
#define HAVE_HASHDRBG
/* ------------------------------------------------------------------------- */
/* Disable Features */
/* ------------------------------------------------------------------------- */
#if defined(WOLF_CONF_TLS12) && WOLF_CONF_TLS12 == 0
#define WOLFSSL_NO_TLS12
#endif
#if defined(WOLF_CONF_WOLFCRYPT_ONLY) && WOLF_CONF_WOLFCRYPT_ONLY == 1
#define WOLFCRYPT_ONLY
#endif
//#define NO_WOLFSSL_SERVER
//#define NO_WOLFSSL_CLIENT
#if defined(WOLF_CONF_TEST) && WOLF_CONF_TEST == 0
#define NO_CRYPT_TEST
#define NO_CRYPT_BENCHMARK
#endif
#define NO_FILESYSTEM
#define NO_WRITEV
#define NO_MAIN_DRIVER
#define NO_DEV_RANDOM
#define NO_OLD_TLS
#define WOLFSSL_NO_CLIENT_AUTH /* disable client auth for Ed25519/Ed448 */
#define NO_DSA
#define NO_RC4
#define NO_HC128
#define NO_RABBIT
#define NO_MD4
#define NO_DES3
/* In-lining of misc.c functions */
/* If defined, must include wolfcrypt/src/misc.c in build */
/* Slower, but about 1k smaller */
//#define NO_INLINE
/* Base16 / Base64 encoding */
//#define NO_CODING
/* bypass certificate date checking, due to lack of properly configured RTC source */
#ifndef HAL_RTC_MODULE_ENABLED
#define NO_ASN_TIME
#endif
#ifdef __cplusplus
}
#endif
#endif /*__WOLFSSL_WOLFSSL_CONF_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,52 @@
/* wolfssl_example.h
*
* Copyright (C) 2006-2020 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
#ifndef WOLFSSL_EXAMPLE_H_
#define WOLFSSL_EXAMPLE_H_
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifndef WOLFSSL_USER_SETTINGS
#include <wolfssl/options.h>
#endif
#include <wolfssl/wolfcrypt/settings.h>
#include <wolfssl/ssl.h>
#include <wolfssl/wolfcrypt/error-crypt.h>
#include <wolfcrypt/test/test.h>
#include <wolfcrypt/benchmark/benchmark.h>
#ifndef SINGLE_THREADED
#include <cmsis_os.h>
#endif
#ifndef WOLF_EXAMPLES_STACK
#define WOLF_EXAMPLES_STACK (30*1024)
#endif
#ifdef CMSIS_OS2_H_
void wolfCryptDemo(void* argument);
#else
void wolfCryptDemo(void const * argument);
#endif
#endif /* WOLFSSL_EXAMPLE_H_ */