WOLFSSL STM32 SUPPORT
The wolfSSL embedded SSL/TLS library has support for several of the STM32 microcontrollers and for the hardware-based cryptography and random number generator offered by them as well. wolfSSL supports both the STM32 Standard Peripheral Library as well as the STM32Cube HAL (Hardware Abstraction Layer). wolfSSL also maintains and makes available an STM32Cube Expansion Package for wolfSSL to make it easy for users to pull wolfSSL directly into STM32CubeMX and STM32CubeIDE projects.
The wolfSSL and wolfCrypt library support the following ST microcontrollers:
- STM32F-Series: STM32F1, STM32F2, STM32F4, STM32F7
- STM32L-Series: STM32L4, STM32L5
- STM32H-Series: STM32H7
- STM32WB-Series: STM32WB55
- STM32G-Series: STM32G0
wolfSSL STM32Cube Package Bundle
The STMCubeIDE and STM32CubeMX tools enable quick adoption of the wolfSSL library using a software expansion for STM32Cube, enhanced for STM32 Toolset, which can be downloaded here:
https://www.wolfssl.com/files/ide/I-CUBE-wolfSSL.pack
To install the package:
- Run the “STM32CubeMX” tool.
- Under “Manage software installations” click “INSTALL/REMOVE” button.
- From Local and choose “I-CUBE-wolfSSL.pack”.
To create a Cube project with wolfSSL:
- Create or open an STM32Cube Project based on your hardware.
- Under “Software Packs” choose “Select Components”.
- Find and check all components for the wolfSSL.wolfSSL packs (wolfSSL / Core, wolfCrypt / Core and wolfCrypt / Test). Close
- Under the “Software Packs” section click on “wolfSSL.wolfSSL” and configure the basic parameters.
- For Cortex-M recommend “Math Configuration” -> “Single Precision Cortex-M Math”
- Generate Code
For more information on the package see:
https://github.com/wolfSSL/wolfssl/tree/master/IDE/STM32Cube
Building wolfSSL with STM32F2 Support
To enable STM32F2 hardware cryptography and RNG support, define STM32F2_CRYPTO and STM32F2_RNG when building wolfSSL. To see a list of defines used to build wolfSSL on the STM3221G-EVAL board with Keil MDK-ARM, reference the WOLFSSL_STM32F2 define in <wolfssl_root>/wolfssl/wolfcrypt/settings.h.
Please contact wolfSSL with any questions about using the wolfSSL lightweight SSL/TLS library with the STM32.
Building wolfSSL with STM32CubeMX HAL
wolfSSL has created STM32CubeMX example for wolfSSL using System Workbench for STM32. This example can be downloaded from the following link. Please see the README included in the download for details.
STM32 Hardware Crypto Support and Benchmarks
For STM32 Microcontrollers that have hardware crypto acceleration wolfSSL fully supports it.
- RNG Hardware:
- All of the STM32’s support hardware based RNG.
- PKA Hardware Acceleration for ECC:
- STM32WB55 and STM32L562.
- AES ECB/CBC/GCM:
- STM32F437, STM32H753, STM32F777, STM32H753, STM32L4A6, STM32WB55
- SHA256:
- STM32F437, STM32F777, STM32H753, STM32L4A6, STM32L552
STM32Fxx Standard Peripheral Library Support
Supported cryptographic algorithms accelerated in hardware through the STM32Fxx Standard Peripheral Library include AES (CBC, CTR), DES (ECB, CBC), 3DES, MD5, and SHA1. For details regarding the STM32 cryptography and hash processors, please see the STM32Fxx Standard Peripheral Library user manual:
http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/USER_MANUAL/DM00023896.pdf
STM32Cube with HAL Support
Supported cryptographic algorithms accelerated in hardware through the STM32CubeMX HAL include RNG, AES, SHA-1, 3DES, and MD5 as noted above. For details regarding STM32CubeMX please see the following STMicroelectronics webpage:
http://www.st.com/en/development-tools/stm32cubemx.html
Using wolfSSL with the STM32, applications can see substantial speed improvements when using the hardware crypto versus using wolfSSL’s standard software cryptography implementation. The following benchmarks were gathered from the wolfCrypt benchmark application (located in <wolfssl_root>/wolfcrypt/benchmark/benchmark.c) running on the STM3221G-EVAL board (STM32F2) using the STM32F2 Standard Peripheral Library and FreeRTOS.
STM32 Benchmarks
A full list of STM32 benchmarks can be found here:
https://github.com/wolfSSL/wolfssl/tree/master/IDE/STM32Cube/STM32_Benchmarks.md
STM3221G-EVAL board (STM32F2) using the STM32F2 Standard Peripheral Library and FreeRTOS
Algorithm | Software (MB/s), Normal Math Library | Hardware Accelerated (MB/s) |
---|---|---|
AES | 1.22 | 9.52 |
ARC4 | 4.57 | 4.57 |
DES | 0.66 | 8.00 |
3DES | 0.25 | 7.09 |
MD5 | 8.40 | 22.22 |
SHA | 3.58 | 21.28 |
SHA-256 | 1.45 | 1.45 |
STM32F777 Cortex-M7 at 216 MHz
Symmetric Algorithm | Software (MB/s) | Accelerated (MB/s) |
---|---|---|
AES-CBC-128 | 1.006 | 8.350 |
AES-GCM-128 | 0.041 | 6.494 |
SHA-256 | 1.782 | 3.467 |
Asymmetric Algorithm | Software (ops/sec) | Accelerated (ops/sec) SP Math Cortex-M |
---|---|---|
RSA 2048 public | 20.619 | 52.529 |
RSA 2048 private | 0.360 | 1.585 |
DH 2048 key gen | 2.023 | 3.279 |
DH 2048 agree | 1.072 | 3.292 |
ECC 256 key gen | 0.917 | 130.000 |
ECDHE 256 agree | 0.917 | 59.821 |
ECDSA 256 sign | 0.906 | 68.359 |
ECDSA 256 verify | 1.367 | 35.468 |
STM32L562E Cortex-M33 at 110 MHz
Symmetric Algorithm | Software (MB/s) | Accelerated (MB/s) |
---|---|---|
AES-CBC-128 | 0.121 | 4.468 |
AES-GCM-128 | 0.008 | 3.662 |
SHA-256 | 0.136 | 1.855 |
Asymmetric Algorithm | Software (ops/sec) | Accelerated (ops/sec) SP Math Cortex-M | Accelerated (ops/sec) ST PKA ECC |
---|---|---|---|
RSA 2048 public | 9.208 | 18.083 | 18.083 |
RSA 2048 private | 0.155 | 0.526 | 0.526 |
DH 2048 key gen | 0.833 | 1.129 | 1.129 |
DH 2048 agree | 0.411 | 1.128 | 1.128 |
ECC 256 key gen | 0.661 | 35.608 | 10.309 |
ECDHE 256 agree | 0.661 | 16.575 | 10.619 |
ECDSA 256 sign | 0.652 | 21.912 | 20.542 |
ECDSA 256 verify | 1.014 | 10.591 | 10.667 |
About ST
STMicroelectronics is a global leader in the semiconductor market serving customers across the spectrum of sense and power and automotive products and embedded processing solutions. From energy management and savings to trust and data security, from healthcare and wellness to smart consumer devices, in the home, car and office, at work and at play, ST is found everywhere microelectronics make a positive and innovative contribution to people’s life. By getting more from technology to get more from life, ST stands for life.augmented.