Crates.io | p256-cm4 |
lib.rs | p256-cm4 |
version | 0.3.0 |
source | src |
created_at | 2022-07-30 17:02:37.091233 |
updated_at | 2022-08-07 17:38:56.409413 |
description | P256-Cortex-M4 re-written in rust |
homepage | |
repository | https://github.com/newAM/p256-cm4 |
max_upload_size | |
id | 635636 |
size | 74,611 |
A (mostly) rust re-implementation of Emill/P256-Cortex-M4.
Rust 1.59.0 stabilized the global_asm macro which allows for this to be compiled without any additional tooling. No build.rs
script or external assembler required.
This is not yet complete, it lacks interoperability with other targets (via RustCrypto traits or compile-time switches). See ycrypto/p256-cortex-m4 for an interoperable solution.
This lacks the configurability of the original source because rust features are less powerful than C pre-processor macros. Use ycrypto/p256-cortex-m4-sys if you require configurability.
As measured on a STM32WLE5.
Implementation | Signing Cycles (appx) | Verify Cycles (appx) | Flash Size (appx) |
---|---|---|---|
Hardware PKA | 5,211,859 | 10,516,860 | 1,582 B |
RustCrypto | 7,856,436 | 14,303,277 | 49 kiB |
p256-cm4 |
442,754 | 1,225,746 | 10 kiB |
Install probe-run.
Adjust .cargo/config.toml
, memory.x
, testsuite/Cargo.toml
, and the clock setup for your target.
DEFMT_LOG=trace cargo test -p testsuite
Send the GCC ASM from Emill/P256-Cortex-M4 through the pre-processor.
arm-none-eabi-gcc -O0 -ffunction-sections -fdata-sections -g -fno-omit-frame-pointer -mthumb -march=armv7e-m -Wall -Wextra -std=c11 -march=armv7e-m -c P256-Cortex-M4/p256-cortex-m4-asm-gcc.S -E > asm.s