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:

  1. Run the “STM32CubeMX” tool.
  2. Under “Manage software installations” click “INSTALL/REMOVE” button.
  3. From Local and choose “I-CUBE-wolfSSL.pack”.

To create a Cube project with wolfSSL:

  1. Create or open an STM32Cube 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 basic parameters.
  5. For Cortex-M recommend “Math Configuration” -> “Single Precision Cortex-M Math”
  6. 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

STM32 Bench Comparison

AlgorithmSoftware (MB/s), Normal Math LibraryHardware Accelerated (MB/s)
AES1.229.52
ARC44.574.57
DES0.668.00
3DES0.257.09
MD58.4022.22
SHA3.5821.28
SHA-2561.451.45

STM32F777 Cortex-M7 at 216 MHz

Symmetric AlgorithmSoftware (MB/s)Accelerated (MB/s)
AES-CBC-1281.0068.350
AES-GCM-1280.0416.494
SHA-2561.7823.467
Asymmetric AlgorithmSoftware (ops/sec)Accelerated (ops/sec)
SP Math Cortex-M
RSA 2048 public20.61952.529
RSA 2048 private0.3601.585
DH 2048 key gen2.0233.279
DH 2048 agree1.0723.292
ECC 256 key gen0.917130.000
ECDHE 256 agree0.91759.821
ECDSA 256 sign0.90668.359
ECDSA 256 verify1.36735.468

STM32L562E Cortex-M33 at 110 MHz

Symmetric AlgorithmSoftware (MB/s)Accelerated (MB/s)
AES-CBC-1280.1214.468
AES-GCM-1280.0083.662
SHA-2560.1361.855
Asymmetric AlgorithmSoftware (ops/sec)Accelerated (ops/sec)
SP Math Cortex-M
Accelerated (ops/sec)
ST PKA ECC
RSA 2048 public9.20818.08318.083
RSA 2048 private0.1550.5260.526
DH 2048 key gen0.8331.1291.129
DH 2048 agree0.4111.1281.128
ECC 256 key gen0.66135.60810.309
ECDHE 256 agree0.66116.57510.619
ECDSA 256 sign0.65221.91220.542
ECDSA 256 verify1.01410.59110.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.

References