ocrypto is a tiny crypto library for 32-bit microcontrollers. It is partially written in portable C code, and partially in assembly code. The assembly part speeds up some cryptographic operations even beyond the speed-up from our algorithmic improvements. The desired variant of the assembly code is chosen as a build option, and is available for the most common microcontroller cores:
Instruction Set Architecture | Processor Cores (Examples) |
ARMv6 | ARM1176 (e.g., as on Raspberry Pi Zero) |
ARMv6-M | Cortex-M0/M0+ (e.g., as on Raspberry Pi RP2040) |
ARMv7-M | Cortex-M3 |
ARMv7E-M (with/without FPU) | Cortex-M4/M7 (e.g., as on Nordic Semiconductor nRF52840) |
ARMv8-M Baseline | Cortex-M23 (e.g., as on Renesas RA0E1) |
ARMv8-M Mainline (with/without FPU, with/without DSP) | Cortex-M33/M55/M85 (e.g., as on Raspberry Pi RP2350) |
ARMv7-A, ARMv8-A | Cortex-A7/A53/72 (e.g., as on Raspberry Pi 3/4 Model B with a 32-bit OS) |
RISC-V (RV32IM, using Zbb/Zbc/Zbkb/Zbkc where available) | Renesas core (e.g., as on R9A02G021), Hazard 3 core (e.g., as on Raspberry Pi RP2350) |
For maximum portability, the C code in ocrypto conforms to the C89 standard. Supported compilers/assemblers are GCC, and for Cortex-M additionally Keil and IAR. The GCC assembly files also work with LLVM/clang.
A generic reference implementation in pure C code is also available, which works with any 32-bit or 64-bit core with a suitable C compiler. It provides only algorithmic optimizations, no device-specific optimizations.
If you need optimized support for 64-bit cores, older ARM cores, Synopsys ARCv2 cores, or MIPS cores, please contact us.