mirror of
https://github.com/Cateners/tiny_computer.git
synced 2026-05-20 16:35:47 +08:00
Update code to v1.0.14 (10)
This commit is contained in:
234
android/extern/wolfssl/IDE/STM32Cube/README.md
vendored
Normal file
234
android/extern/wolfssl/IDE/STM32Cube/README.md
vendored
Normal file
@@ -0,0 +1,234 @@
|
||||
# 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
|
||||
|
||||
You need both the STM32 IDE and the STM32 initialization code generator (STM32CubeMX) tools. The STM32CubeMX tool is used to setup a project which is used by the IDE to make any required code level changes and program / debug the STM32.
|
||||
|
||||
* STM32CubeIDE: Integrated Development Environment for STM32 [https://www.st.com/en/development-tools/stm32cubeide.html](https://www.st.com/en/development-tools/stm32cubeide.html)
|
||||
* STM32CubeMX: STM32Cube initialization code generator [https://www.st.com/en/development-tools/stm32cubemx.html](https://www.st.com/en/development-tools/stm32cubemx.html)
|
||||
|
||||
## STM32 Cube Pack
|
||||
|
||||
### STM32 Cube Pack Installation
|
||||
|
||||
1. Download [wolfSSL Cube Pack](https://www.wolfssl.com/files/ide/I-CUBE-wolfSSL.pack)
|
||||
2. Run the “STM32CubeMX” tool.
|
||||
3. Under “Manage software installations” pane on the right, click “INSTALL/REMOVE” button. This can be also found by clicking "Help" -> "Managed embedded software packages"
|
||||
4. From Local and choose “I-CUBE-wolfSSL.pack”.
|
||||
5. Accept the GPLv2 license. Contact wolfSSL at sales@wolfssl.com for a commercial license and support/maintenance.
|
||||
|
||||
### STM32 Cube Pack Usage
|
||||
|
||||
1. Create or open a Cube Project based on your hardware. See the sections below for creating a project and finding the example projects.
|
||||
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” for the fastest option.
|
||||
6. Hit the "Generate Code" button
|
||||
7. Open the project in STM32CubeIDE
|
||||
8. The Benchmark example uses float. To enable go to "Project Properties" -> "C/C++ Build" -> "Settings" -> "Tool Settings" -> "MCU Settings" -> Check "Use float with printf".
|
||||
9. To enable printf make the `main.c` changes below in the [STM32 Printf](#stm32-printf) section.
|
||||
|
||||
### STM32 Cube Pack Examples
|
||||
|
||||
In the `I-CUBE-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.
|
||||
|
||||
### Creating your own STM32CubeMX configuration
|
||||
|
||||
If none of the examples fit your STM32 type then you can create your own in STM32CubeMX by doing the following:
|
||||
|
||||
1. Create a project with the correct STM32 model.
|
||||
2. Click on the "Software Packs" drop down near the top and choose "Select Components".
|
||||
3. Expand the "wolfSSL" pack twice and check all the components. Then exit this menu.
|
||||
4. Under "System Core" select "SYS" and changed the "Timebase Source" to TIM1.
|
||||
5. Under "Timers" select "RTC" and make sure this is enabled.
|
||||
6. Under "Connectivity" enable whichever UART/USART you have a serial I/O connected to.
|
||||
7. Under "Middleware" select "FREERTOS" and change the interface to "CMSIS_V2".
|
||||
1. Increase the "TOTAL_HEAP_SIZE", preferably to 120000 but on smaller chips such as the F107 you may only be able to increase this to 40000.
|
||||
2. Enable "USE_MALLOC_FAILED_HOOK".
|
||||
3. Change "CHECK_FOR_STACK_OVERFLOW" to "Option2".
|
||||
4. Under "Tasks and Queues" select Add for a new task.
|
||||
5. Set the "Task Name" to "wolfCrypt".
|
||||
6. Set the "Stack Size" to 8960 or as high as you can close to that. The "Heap Usage" will show an error if this is too high.
|
||||
7. Set the "Entry Function" to "wolfCryptDemo".
|
||||
8. Set the "Code Generation Option" to "As external".
|
||||
8. In "Software Packs" select "wolfSSL" and change any options as required.
|
||||
9. Go to "Clock Configuration" and set the "HCLK" as high as the tool will let you.
|
||||
10. In "Project Manager" select the "STM32CubeIDE" toolchain.
|
||||
|
||||
When you get to the IDE make sure you edit `wolfSSL.I-CUBE-wolfSSL_conf.h` to set the `HAL_CONSOLE_UART` to the correct one for your configuration.
|
||||
|
||||
## Configuration
|
||||
|
||||
The settings for the wolfSSL CubeMX pack are in the generated `wolfSSL.I-CUBE-wolfSSL_conf.h` file. An example of a generated file can be found at `examples/configs/user_settings_stm32.h`.
|
||||
|
||||
The template used for generation is `IDE/STM32Cube/default_conf.ftl`, which is stored in the pack here: `STM32Cube/Repository/Packs/wolfSSL/wolfSSL/[Version]/CubeMX/templates/default_conf.ftl`.
|
||||
|
||||
If the default settings for the Cube GUI are insufficient you can customize the build using one of these methods to prevent the changes from being overwritten when generating the code:
|
||||
|
||||
* Copy the `wolfSSL.I-CUBE-wolfSSL_conf.h` to `Core/Inc` and rename to `user_settings.h`. Then add the preprocessor macro `WOLFSSL_USER_SETTINGS` to your project. This will use the `user_settings.h` instead of the generated configuration.
|
||||
|
||||
OR
|
||||
|
||||
* Edit the source template file used for Cube pack generation here: `STM32Cube/Repository/Packs/wolfSSL/wolfSSL/[Version]/CubeMX/templates/default_conf.ftl`.
|
||||
|
||||
|
||||
The section for "Hardware platform" may need to be adjusted depending on your processor and board:
|
||||
|
||||
* To enable STM32F1 support define `WOLFSSL_STM32F1`.
|
||||
* 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`.
|
||||
|
||||
With STM32 Cube HAL v2 some AES GCM hardware has a limitation for the AAD header, which must be a multiple of 4 bytes. If your HAL does not support `CRYP_HEADERWIDTHUNIT_BYTE` then consider adding `STM32_AESGCM_PARTIAL` if you are getting AES GCM authentication failures. This bug existed in v1.16.0 or later.
|
||||
|
||||
The STM32F7 v1.17.0 pack has a bug in the AES GCM code for handling of additional authentication data when not a multiple of 4 bytes. To patch see `stm32f7xx_hal_cryp.c` -> `CRYP_GCMCCM_SetHeaderPhase`:
|
||||
|
||||
```diff
|
||||
diff --git a/stm32f7xx_hal_cryp.c b/stm32f7xx_hal_cryp.c
|
||||
index 2ae42d0..9666f26 100644
|
||||
--- a/stm32f7xx_hal_cryp.c
|
||||
+++ b/stm32f7xx_hal_cryp.c
|
||||
@@ -5600,7 +5600,6 @@ static HAL_StatusTypeDef CRYP_GCMCCM_SetHeaderPhase(CRYP_HandleTypeDef *hcryp, u
|
||||
uint32_t size_in_bytes;
|
||||
uint32_t tmp;
|
||||
uint32_t mask[12] = {0x0U, 0xFF000000U, 0xFFFF0000U, 0xFFFFFF00U, /* 32-bit data type */
|
||||
- 0x0U, 0x0000FF00U, 0x0000FFFFU, 0xFF00FFFFU, /* 16-bit data type */
|
||||
0x0U, 0x000000FFU, 0x0000FFFFU, 0x00FFFFFFU}; /* 8-bit data type */
|
||||
|
||||
/***************************** Header phase for GCM/GMAC or CCM *********************************/
|
||||
@@ -5842,7 +5841,7 @@ static HAL_StatusTypeDef CRYP_GCMCCM_SetHeaderPhase(CRYP_HandleTypeDef *hcryp, u
|
||||
{
|
||||
/* Enter last bytes, padded with zeroes */
|
||||
tmp = *(uint32_t *)(hcryp->Init.Header + hcryp->CrypHeaderCount);
|
||||
- tmp &= mask[(hcryp->Init.DataType * 2U) + (size_in_bytes % 4U)];
|
||||
+ tmp &= mask[(hcryp->Init.HeaderWidthUnit * 4U) + (size_in_bytes % 4U)];
|
||||
hcryp->Instance->DINR = tmp;
|
||||
loopcounter++;
|
||||
/* Pad the data with zeros to have a complete block */
|
||||
```
|
||||
|
||||
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. This uses both a TLS client and server to test a TLS connection locally for each enabled TLS cipher suite.
|
||||
|
||||
## Example `IDE/STM32Cube/wolfssl_example.c` Output
|
||||
|
||||
```
|
||||
....MENU
|
||||
|
||||
.t. WolfCrypt Test
|
||||
.b. WolfCrypt Benchmark
|
||||
.l. WolfSSL TLS Bench
|
||||
.e. Show Cipher List
|
||||
.s. Run TLS 1.3 Server over UART
|
||||
.c. Run TLS 1.3 Client over UART
|
||||
|
||||
Please select one of the above options:
|
||||
```
|
||||
|
||||
### Example for TLS v1.3 over UART
|
||||
|
||||
A tutorial for setting this up can be found here: https://www.youtube.com/watch?v=OK6MKXYiVBY
|
||||
|
||||
The TLS v1.3 client/server examples over UART are paired with these host-side applications:
|
||||
* https://github.com/wolfSSL/wolfssl-examples/blob/master/tls/client-tls-uart.c
|
||||
* https://github.com/wolfSSL/wolfssl-examples/blob/master/tls/server-tls-uart.c
|
||||
|
||||
To use this example you will need to use the STM32Cube interface to enable an additional USART and enable DMA for the RX with defaults. Enabling DMA for the USART requires adding the USART RX DMA in the STM32Cube tool. Under Connectivity click on your TLS USART# and goto DMA Settings and "Add" one for USART#_RX with default options.
|
||||
|
||||
Then set the TLS_UART macro to the correct `huart#` instance. This USART will be used as a TLS transport.
|
||||
|
||||
```c
|
||||
#define TLS_UART huart2
|
||||
```
|
||||
|
||||
To disable the TLS UART example you can define `NO_TLS_UART_TEST`.
|
||||
|
||||
## Benchmarks
|
||||
|
||||
See [STM32_Benchmarks.md](STM32_Benchmarks.md).
|
||||
|
||||
Note: 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 Printf
|
||||
|
||||
In main.c make the following changes:
|
||||
|
||||
This section needs to go below the `UART_HandleTypeDef` line, otherwise `wolfssl/wolfcrypt/settings.h` will error.
|
||||
|
||||
```c
|
||||
/* Retargets the C library printf function to the USART. */
|
||||
#include <stdio.h>
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
#ifdef __GNUC__
|
||||
int __io_putchar(int ch)
|
||||
#else
|
||||
int fputc(int ch, FILE *f)
|
||||
#endif
|
||||
{
|
||||
HAL_UART_Transmit(&HAL_CONSOLE_UART, (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
|
||||
```
|
||||
|
||||
In the `main()` function make the follow `setvbuf()` additions after `HAL_Init()`.
|
||||
|
||||
```c
|
||||
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);
|
||||
|
||||
```
|
||||
|
||||
## Support
|
||||
|
||||
For questions please email [support@wolfssl.com](mailto:support@wolfssl.com)
|
||||
710
android/extern/wolfssl/IDE/STM32Cube/STM32_Benchmarks.md
vendored
Normal file
710
android/extern/wolfssl/IDE/STM32Cube/STM32_Benchmarks.md
vendored
Normal file
@@ -0,0 +1,710 @@
|
||||
# STM Benchmarks
|
||||
|
||||
* [STM32H753ZI](#stm32h753zi)
|
||||
* [STM32WB55](#stm32wb55)
|
||||
* [STM32F437](#stm32f437)
|
||||
* [STM32L4A6Z](#stm32l4a6z)
|
||||
* [STM32L562E](#stm32l562e)
|
||||
* [STM32F777](#stm32f777)
|
||||
* [STM32U585](#stm32u585)
|
||||
|
||||
## 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
|
||||
```
|
||||
|
||||
## STM32U585
|
||||
|
||||
Supports RNG, AES CBC/GCM and SHA-1,SHA-2 acceleration.
|
||||
|
||||
Board: B-U585I-IOT02A
|
||||
CPU: Cortex-M33 at 160 MHz
|
||||
IDE: STM32CubeIDE
|
||||
RTOS: FreeRTOS
|
||||
|
||||
### STM32U585 (STM Symmetric AES/SHA acceleration, STM PKA PKA w/Fast Math)
|
||||
|
||||
This test uses `WOLFSSL_SMALL_STACK_CACHE`, which slightly improves the DRBG RNG performance.
|
||||
|
||||
Only the ECC sign and verify are currently being accelerated by PKA.
|
||||
|
||||
```
|
||||
------------------------------------------------------------------------------
|
||||
wolfSSL version 5.3.1
|
||||
------------------------------------------------------------------------------
|
||||
Running wolfCrypt Benchmarks...
|
||||
wolfCrypt Benchmark (block bytes 1024, min 1.0 sec each)
|
||||
RNG 575 KB took 1.039 seconds, 553.417 KB/s
|
||||
AES-128-CBC-enc 6 MB took 1.000 seconds, 6.274 MB/s
|
||||
AES-128-CBC-dec 6 MB took 1.000 seconds, 6.128 MB/s
|
||||
AES-256-CBC-enc 6 MB took 1.000 seconds, 6.274 MB/s
|
||||
AES-256-CBC-dec 6 MB took 1.000 seconds, 6.152 MB/s
|
||||
AES-128-GCM-enc 6 MB took 1.000 seconds, 5.640 MB/s
|
||||
AES-128-GCM-dec 6 MB took 1.000 seconds, 5.566 MB/s
|
||||
AES-256-GCM-enc 6 MB took 1.000 seconds, 5.615 MB/s
|
||||
AES-256-GCM-dec 6 MB took 1.000 seconds, 5.542 MB/s
|
||||
GMAC Small 11 MB took 1.000 seconds, 11.499 MB/s
|
||||
CHACHA 4 MB took 1.000 seconds, 3.882 MB/s
|
||||
CHA-POLY 2 MB took 1.008 seconds, 2.470 MB/s
|
||||
3DES 200 KB took 1.071 seconds, 186.741 KB/s
|
||||
MD5 6 MB took 1.000 seconds, 6.299 MB/s
|
||||
POLY1305 10 MB took 1.000 seconds, 10.449 MB/s
|
||||
SHA 6 MB took 1.000 seconds, 6.299 MB/s
|
||||
SHA-256 6 MB took 1.000 seconds, 6.250 MB/s
|
||||
HMAC-MD5 6 MB took 1.000 seconds, 6.177 MB/s
|
||||
HMAC-SHA 6 MB took 1.000 seconds, 6.177 MB/s
|
||||
HMAC-SHA256 6 MB took 1.000 seconds, 6.104 MB/s
|
||||
RSA 2048 public 28 ops took 1.031 sec, avg 36.821 ms, 27.158 ops/sec
|
||||
RSA 2048 private 2 ops took 4.310 sec, avg 2155.000 ms, 0.464 ops/sec
|
||||
DH 2048 key gen 3 ops took 1.197 sec, avg 399.000 ms, 2.506 ops/sec
|
||||
DH 2048 agree 2 ops took 1.525 sec, avg 762.500 ms, 1.311 ops/sec
|
||||
ECC [ SECP256R1] 256 key gen 50 ops took 1.019 sec, avg 20.380 ms, 49.068 ops/sec
|
||||
ECDHE [ SECP256R1] 256 agree 52 ops took 1.008 sec, avg 19.385 ms, 51.587 ops/sec
|
||||
ECDSA [ SECP256R1] 256 sign 56 ops took 1.000 sec, avg 17.857 ms, 56.000 ops/sec
|
||||
ECDSA [ SECP256R1] 256 verify 56 ops took 1.008 sec, avg 18.000 ms, 55.556 ops/sec
|
||||
Benchmark complete
|
||||
Benchmark Test: Return code 0
|
||||
```
|
||||
|
||||
|
||||
### STM32U585 (STM Symmetric AES/SHA acceleration, SP Math ASM Cortex M)
|
||||
|
||||
```
|
||||
------------------------------------------------------------------------------
|
||||
wolfSSL version 5.3.1
|
||||
------------------------------------------------------------------------------
|
||||
Running wolfCrypt Benchmarks...
|
||||
wolfCrypt Benchmark (block bytes 1024, min 1.0 sec each)
|
||||
RNG 250 KB took 1.039 seconds, 240.616 KB/s
|
||||
AES-128-CBC-enc 6 MB took 1.000 seconds, 6.152 MB/s
|
||||
AES-128-CBC-dec 6 MB took 1.004 seconds, 6.031 MB/s
|
||||
AES-256-CBC-enc 6 MB took 1.000 seconds, 6.152 MB/s
|
||||
AES-256-CBC-dec 6 MB took 1.000 seconds, 6.055 MB/s
|
||||
AES-128-GCM-enc 6 MB took 1.000 seconds, 5.542 MB/s
|
||||
AES-128-GCM-dec 5 MB took 1.000 seconds, 5.493 MB/s
|
||||
AES-256-GCM-enc 6 MB took 1.000 seconds, 5.518 MB/s
|
||||
AES-256-GCM-dec 5 MB took 1.000 seconds, 5.469 MB/s
|
||||
GMAC Small 11 MB took 1.000 seconds, 11.182 MB/s
|
||||
CHACHA 3 MB took 1.004 seconds, 3.429 MB/s
|
||||
CHA-POLY 2 MB took 1.000 seconds, 2.271 MB/s
|
||||
3DES 175 KB took 1.000 seconds, 175.000 KB/s
|
||||
MD5 8 MB took 1.000 seconds, 8.008 MB/s
|
||||
POLY1305 10 MB took 1.000 seconds, 10.181 MB/s
|
||||
SHA 8 MB took 1.000 seconds, 7.983 MB/s
|
||||
SHA-256 8 MB took 1.000 seconds, 7.910 MB/s
|
||||
HMAC-MD5 8 MB took 1.000 seconds, 7.812 MB/s
|
||||
HMAC-SHA 8 MB took 1.000 seconds, 7.812 MB/s
|
||||
HMAC-SHA256 8 MB took 1.000 seconds, 7.642 MB/s
|
||||
RSA 2048 public 52 ops took 1.000 sec, avg 19.231 ms, 52.000 ops/sec
|
||||
RSA 2048 private 2 ops took 1.381 sec, avg 690.500 ms, 1.448 ops/sec
|
||||
DH 2048 key gen 4 ops took 1.263 sec, avg 315.750 ms, 3.167 ops/sec
|
||||
DH 2048 agree 4 ops took 1.262 sec, avg 315.500 ms, 3.170 ops/sec
|
||||
ECC [ SECP256R1] 256 key gen 108 ops took 1.016 sec, avg 9.407 ms, 106.299 ops/sec
|
||||
ECDHE [ SECP256R1] 256 agree 58 ops took 1.032 sec, avg 17.793 ms, 56.202 ops/sec
|
||||
ECDSA [ SECP256R1] 256 sign 64 ops took 1.027 sec, avg 16.047 ms, 62.317 ops/sec
|
||||
ECDSA [ SECP256R1] 256 verify 36 ops took 1.019 sec, avg 28.306 ms, 35.329 ops/sec
|
||||
Benchmark complete
|
||||
Benchmark Test: Return code 0
|
||||
```
|
||||
|
||||
### STM32U585 (No STM HW Crypto, SP Math C32)
|
||||
|
||||
```
|
||||
------------------------------------------------------------------------------
|
||||
wolfSSL version 5.3.1
|
||||
------------------------------------------------------------------------------
|
||||
Running wolfCrypt Benchmarks...
|
||||
wolfCrypt Benchmark (block bytes 1024, min 1.0 sec each)
|
||||
RNG 750 KB took 1.015 seconds, 738.916 KB/s
|
||||
AES-128-CBC-enc 900 KB took 1.004 seconds, 896.414 KB/s
|
||||
AES-128-CBC-dec 900 KB took 1.012 seconds, 889.328 KB/s
|
||||
AES-192-CBC-enc 775 KB took 1.004 seconds, 771.912 KB/s
|
||||
AES-192-CBC-dec 775 KB took 1.023 seconds, 757.576 KB/s
|
||||
AES-256-CBC-enc 675 KB took 1.000 seconds, 675.000 KB/s
|
||||
AES-256-CBC-dec 675 KB took 1.031 seconds, 654.704 KB/s
|
||||
AES-128-GCM-enc 50 KB took 1.035 seconds, 48.309 KB/s
|
||||
AES-128-GCM-dec 50 KB took 1.036 seconds, 48.263 KB/s
|
||||
AES-192-GCM-enc 50 KB took 1.051 seconds, 47.574 KB/s
|
||||
AES-192-GCM-dec 50 KB took 1.051 seconds, 47.574 KB/s
|
||||
AES-256-GCM-enc 50 KB took 1.067 seconds, 46.860 KB/s
|
||||
AES-256-GCM-dec 50 KB took 1.070 seconds, 46.729 KB/s
|
||||
GMAC Small 52 KB took 1.004 seconds, 51.793 KB/s
|
||||
CHACHA 4 MB took 1.000 seconds, 3.833 MB/s
|
||||
CHA-POLY 2 MB took 1.004 seconds, 2.456 MB/s
|
||||
3DES 200 KB took 1.074 seconds, 186.220 KB/s
|
||||
MD5 6 MB took 1.000 seconds, 6.274 MB/s
|
||||
POLY1305 10 MB took 1.000 seconds, 10.400 MB/s
|
||||
SHA 5 MB took 1.000 seconds, 5.225 MB/s
|
||||
SHA-256 2 MB took 1.004 seconds, 1.970 MB/s
|
||||
HMAC-MD5 6 MB took 1.000 seconds, 6.201 MB/s
|
||||
HMAC-SHA 5 MB took 1.000 seconds, 5.176 MB/s
|
||||
HMAC-SHA256 2 MB took 1.000 seconds, 1.953 MB/s
|
||||
RSA 2048 public 36 ops took 1.008 sec, avg 28.000 ms, 35.714 ops/sec
|
||||
RSA 2048 private 2 ops took 3.216 sec, avg 1608.000 ms, 0.622 ops/sec
|
||||
DH 2048 key gen 2 ops took 1.416 sec, avg 708.000 ms, 1.412 ops/sec
|
||||
DH 2048 agree 2 ops took 1.419 sec, avg 709.500 ms, 1.409 ops/sec
|
||||
ECC [ SECP256R1] 256 key gen 8 ops took 1.169 sec, avg 146.125 ms, 6.843 ops/sec
|
||||
ECDHE [ SECP256R1] 256 agree 8 ops took 1.165 sec, avg 145.625 ms, 6.867 ops/sec
|
||||
ECDSA [ SECP256R1] 256 sign 8 ops took 1.314 sec, avg 164.250 ms, 6.088 ops/sec
|
||||
ECDSA [ SECP256R1] 256 verify 4 ops took 1.196 sec, avg 299.000 ms, 3.344 ops/sec
|
||||
Benchmark complete
|
||||
Benchmark Test: Return code 0
|
||||
```
|
||||
608
android/extern/wolfssl/IDE/STM32Cube/default_conf.ftl
vendored
Normal file
608
android/extern/wolfssl/IDE/STM32Cube/default_conf.ftl
vendored
Normal file
@@ -0,0 +1,608 @@
|
||||
[#ftl]
|
||||
/**
|
||||
******************************************************************************
|
||||
* File Name : ${name}
|
||||
* Description : This file provides code for the configuration
|
||||
* of the ${name} instances.
|
||||
******************************************************************************
|
||||
[@common.optinclude name=mxTmpFolder+"/license.tmp"/][#--include License text --]
|
||||
******************************************************************************
|
||||
*/
|
||||
[#assign s = name]
|
||||
[#assign toto = s?replace(".","_")]
|
||||
[#assign toto = toto?replace("/","")]
|
||||
[#assign toto = toto?replace("-","_")]
|
||||
[#assign inclusion_protection = toto?upper_case]
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __${inclusion_protection}__
|
||||
#define __${inclusion_protection}__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
[#if includes??]
|
||||
[#list includes as include]
|
||||
#include "${include}"
|
||||
[/#list]
|
||||
[/#if]
|
||||
|
||||
[#-- SWIPdatas is a list of SWIPconfigModel --]
|
||||
[#list SWIPdatas as SWIP]
|
||||
[#-- Global variables --]
|
||||
[#if SWIP.variables??]
|
||||
[#list SWIP.variables as variable]
|
||||
extern ${variable.value} ${variable.name};
|
||||
[/#list]
|
||||
[/#if]
|
||||
|
||||
[#-- Global variables --]
|
||||
|
||||
[#assign instName = SWIP.ipName]
|
||||
[#assign fileName = SWIP.fileName]
|
||||
[#assign version = SWIP.version]
|
||||
|
||||
/**
|
||||
MiddleWare name : ${instName}
|
||||
MiddleWare fileName : ${fileName}
|
||||
MiddleWare version : ${version}
|
||||
*/
|
||||
[#if SWIP.defines??]
|
||||
[#list SWIP.defines as definition]
|
||||
/*---------- [#if definition.comments??]${definition.comments}[/#if] -----------*/
|
||||
#define ${definition.name} #t#t ${definition.value}
|
||||
[#if definition.description??]${definition.description} [/#if]
|
||||
[/#list]
|
||||
[/#if]
|
||||
|
||||
|
||||
|
||||
[/#list]
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* 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(STM32F756xx)
|
||||
#define WOLFSSL_STM32F7
|
||||
#undef NO_STM32_HASH
|
||||
#undef NO_STM32_CRYPTO
|
||||
#define STM32_HAL_V2
|
||||
#define HAL_CONSOLE_UART huart3
|
||||
#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(STM32F217xx)
|
||||
#define WOLFSSL_STM32F2
|
||||
#define HAL_CONSOLE_UART huart2
|
||||
#elif defined(STM32F107xC)
|
||||
#define WOLFSSL_STM32F1
|
||||
#define HAL_CONSOLE_UART huart4
|
||||
#define NO_STM32_RNG
|
||||
#elif defined(STM32F401xE)
|
||||
#define WOLFSSL_STM32F4
|
||||
#define HAL_CONSOLE_UART huart2
|
||||
#define NO_STM32_RNG
|
||||
#define WOLFSSL_GENSEED_FORTEST
|
||||
#elif defined(STM32G071xx)
|
||||
#define WOLFSSL_STM32G0
|
||||
#define HAL_CONSOLE_UART huart2
|
||||
#define NO_STM32_RNG
|
||||
#define WOLFSSL_GENSEED_FORTEST
|
||||
#elif defined(STM32U575xx) || defined(STM32U585xx)
|
||||
#define HAL_CONSOLE_UART huart1
|
||||
#define WOLFSSL_STM32U5
|
||||
#define STM32_HAL_V2
|
||||
#ifdef STM32U585xx
|
||||
#undef NO_STM32_HASH
|
||||
#undef NO_STM32_CRYPTO
|
||||
#define WOLFSSL_STM32_PKA
|
||||
#endif
|
||||
#else
|
||||
#warning Please define a hardware platform!
|
||||
/* This means there is not a pre-defined platform for your board/CPU */
|
||||
/* You need to define a CPU type, HW crypto and debug UART */
|
||||
/* CPU Type: WOLFSSL_STM32F1, WOLFSSL_STM32F2, WOLFSSL_STM32F4,
|
||||
WOLFSSL_STM32F7, WOLFSSL_STM32H7, WOLFSSL_STM32L4, WOLFSSL_STM32L5,
|
||||
WOLFSSL_STM32G0, WOLFSSL_STM32WB and WOLFSSL_STM32U5 */
|
||||
#define WOLFSSL_STM32F4
|
||||
|
||||
/* Debug UART used for printf */
|
||||
/* The UART interface number varies for each board/CPU */
|
||||
/* Typically this is the UART attached to the ST-Link USB CDC UART port */
|
||||
#define HAL_CONSOLE_UART huart4
|
||||
|
||||
/* Hardware Crypto - uncomment as available on hardware */
|
||||
//#define WOLFSSL_STM32_PKA
|
||||
//#define NO_STM32_RNG
|
||||
//#undef NO_STM32_HASH
|
||||
//#undef NO_STM32_CRYPTO
|
||||
//#define WOLFSSL_GENSEED_FORTEST /* if no HW RNG is available use test seed */
|
||||
//#define STM32_HAL_V2
|
||||
#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 (stack)
|
||||
* 2=Normal (heap)
|
||||
* 3=Single Precision C (only common curves/key sizes)
|
||||
* 4=Single Precision ASM Cortex-M3+
|
||||
* 5=Single Precision ASM Cortex-M0 (Generic Thumb)
|
||||
* 6=Single Precision C all small
|
||||
* 7=Single Precision C all big
|
||||
*/
|
||||
#if defined(WOLF_CONF_MATH) && WOLF_CONF_MATH == 1
|
||||
/* fast (stack) math - tfm.c */
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_TIMING_RESISTANT
|
||||
|
||||
/* Optimizations (TFM_ARM, TFM_ASM or none) */
|
||||
//#define TFM_NO_ASM
|
||||
//#define TFM_ASM
|
||||
#elif defined(WOLF_CONF_MATH) && WOLF_CONF_MATH == 2
|
||||
/* heap math - integer.c */
|
||||
#define USE_INTEGER_HEAP_MATH
|
||||
#elif defined(WOLF_CONF_MATH) && (WOLF_CONF_MATH >= 3)
|
||||
/* single precision only */
|
||||
#define WOLFSSL_SP
|
||||
#if WOLF_CONF_MATH != 7
|
||||
#define WOLFSSL_SP_SMALL /* use smaller version of code */
|
||||
#endif
|
||||
#if defined(WOLF_CONF_RSA) && WOLF_CONF_RSA == 1
|
||||
#define WOLFSSL_HAVE_SP_RSA
|
||||
#endif
|
||||
#if defined(WOLF_CONF_DH) && WOLF_CONF_DH == 1
|
||||
#define WOLFSSL_HAVE_SP_DH
|
||||
#endif
|
||||
#if defined(WOLF_CONF_ECC) && WOLF_CONF_ECC == 1
|
||||
#define WOLFSSL_HAVE_SP_ECC
|
||||
#endif
|
||||
#if WOLF_CONF_MATH == 6 || WOLF_CONF_MATH == 7
|
||||
#define WOLFSSL_SP_MATH /* disable non-standard curves / key sizes */
|
||||
#endif
|
||||
#define SP_WORD_SIZE 32
|
||||
|
||||
/* Enable to put all math on stack (no heap) */
|
||||
//#define WOLFSSL_SP_NO_MALLOC
|
||||
/* Enable for SP cache resistance (not usually enabled for embedded micros) */
|
||||
//#define WOLFSSL_SP_CACHE_RESISTANT
|
||||
|
||||
#if WOLF_CONF_MATH == 4 || WOLF_CONF_MATH == 5
|
||||
#define WOLFSSL_SP_ASM /* required if using the ASM versions */
|
||||
#if WOLF_CONF_MATH == 4
|
||||
/* ARM Cortex-M3+ */
|
||||
#define WOLFSSL_SP_ARM_CORTEX_M_ASM
|
||||
#endif
|
||||
#if WOLF_CONF_MATH == 5
|
||||
/* Generic ARM Thumb (Cortex-M0) Assembly */
|
||||
#define WOLFSSL_SP_ARM_THUMB_ASM
|
||||
#endif
|
||||
#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_KEEP_PEER_CERT) && WOLF_CONF_KEEP_PEER_CERT == 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
|
||||
#if !defined(INT_MAX)
|
||||
#include <limits.h>
|
||||
#endif
|
||||
#endif
|
||||
#if defined(WOLF_CONF_OPENSSL_EXTRA) && WOLF_CONF_OPENSSL_EXTRA >= 2
|
||||
#define OPENSSL_ALL
|
||||
#endif
|
||||
|
||||
/* TLS Session Cache */
|
||||
#if 0
|
||||
#define SMALL_SESSION_CACHE
|
||||
#else
|
||||
#define NO_SESSION_CACHE
|
||||
#endif
|
||||
|
||||
/* Post Quantum
|
||||
* Note: PQM4 is compatible with STM32. The project can be found at:
|
||||
* https://github.com/mupq/pqm4
|
||||
*/
|
||||
#if defined(WOLF_CONF_PQM4) && WOLF_CONF_PQM4 == 1
|
||||
#define HAVE_PQM4
|
||||
#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, GCM_TABLE or GCM_TABLE_4BIT */
|
||||
/* GCM_TABLE is about 4K larger and 3x faster for GHASH */
|
||||
#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 */
|
||||
#if !defined(WOLF_CONF_RNG) || WOLF_CONF_RNG == 1
|
||||
/* default is enabled */
|
||||
#define HAVE_HASHDRBG
|
||||
#else /* WOLF_CONF_RNG == 0 */
|
||||
#define WC_NO_HASHDRBG
|
||||
#define WC_NO_RNG
|
||||
#endif
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* 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_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 /* ${inclusion_protection}_H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/*****END OF FILE****/
|
||||
10
android/extern/wolfssl/IDE/STM32Cube/include.am
vendored
Normal file
10
android/extern/wolfssl/IDE/STM32Cube/include.am
vendored
Normal 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_example.h
|
||||
EXTRA_DIST+= IDE/STM32Cube/STM32_Benchmarks.md
|
||||
EXTRA_DIST+= IDE/STM32Cube/default_conf.ftl
|
||||
367
android/extern/wolfssl/IDE/STM32Cube/main.c
vendored
Normal file
367
android/extern/wolfssl/IDE/STM32Cube/main.c
vendored
Normal file
@@ -0,0 +1,367 @@
|
||||
/* main.c
|
||||
*
|
||||
* Copyright (C) 2006-2022 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"
|
||||
#include "wolfssl/wolfcrypt/settings.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(&HAL_CONSOLE_UART, (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 */
|
||||
1953
android/extern/wolfssl/IDE/STM32Cube/wolfssl_example.c
vendored
Normal file
1953
android/extern/wolfssl/IDE/STM32Cube/wolfssl_example.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
52
android/extern/wolfssl/IDE/STM32Cube/wolfssl_example.h
vendored
Normal file
52
android/extern/wolfssl/IDE/STM32Cube/wolfssl_example.h
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
/* wolfssl_example.h
|
||||
*
|
||||
* Copyright (C) 2006-2022 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_ */
|
||||
Reference in New Issue
Block a user