This page explains how to use the STM32 cryptographic firmware library software expansion for STM32Cube package once you've downloaded it.
1. Package Structure & Contents
After uncompressing the package, you'll have this usual folder structure: File:ADD AN IMAGE OF THE FOLDER CONTENTS
- ...\Drivers\STM32xx_HAL_Drivers
- Help on HAL/LL drivers
- HAL release notes
- HAL and LL drivers source files
- ...\Drivers\BSP
- BSP drivers for all supported boards
- Drivers for all the external components used on the supported boards
- ...\Drivers\CMSIS
- CMSIS files that define peripherals register declaration, bit definition and address mapping
- CMSIS files that define peripherals register declaration, bit definition and address mapping
- ...\Middlewares
- Middleware libraries
- Middleware release notes
- Middleware libraries
- ...\Projects
- STM32CubeProjectsList.html, an exhaustive list of all applications supported for each board
- Then organized by board / feature, a set of applications demonstrating various cryptographic algorithms provided for several compatible IDEs.
The Cryptographic Library middleware folder in details:
- ...\Middlewares\ST\STM32_Cryptographic\include
- Cryptographic library header files
- ...\Middlewares\ST\STM32_Cryptographic\interface
- Low layer template files to implement in your project to use the Cryptographic Library
- ...\Middlewares\ST\STM32_Cryptographic\lib
- Cryptographic libraries to link into your project
- ...\Middlewares\ST\STM32_Cryptographic\legacy_v3
- Legacy Cryptographic library migration helpers (for more details: refer to Migration_from_previous_Cryptographic_Library_version)
- ...\Middlewares\ST\STM32_Cryptographic\CMOX.chm
- The complete Cryptographic Library API documentation
2. Creating a project that embeds the Cryptographic Library
2.1. Select a library
Add the library corresponding to your needs to your project.
Example: choose libSTM32Cryptographic_CM33.a to build a project for a Arm® Cortex®-M33 based STM32 SoC.
2.2. Include path
Add the path to the include folder to your project settings.
2.3. Interface files
- Copy the cmox_low_level_template.c file from the interface folder to your project specific source folder, renaming it into “cmox_low_level.c”.
- Add this copied file to your project.
- Tune this file by including the right STM32 HAL driver header instead of the comment:
/* #include "stm32<series>xx_hal.h" */
2.4. Implement your application
Everything is ready, you can now write your own application calling the cryptographic library services.
3. Link time configuration mechanism
The CMOX library incorporates several implementations of the same service for different levels of performance and size.
The implementation to use is selected in the service configuration (through the Init/config API), keeping it in the generated executable.