4 releases (2 breaking)

0.3.0 Aug 7, 2022
0.2.0 Aug 6, 2022
0.1.1 Aug 1, 2022
0.1.0 Jul 30, 2022

#1642 in Embedded development

Download history 17/week @ 2024-01-12 14/week @ 2024-01-19 19/week @ 2024-01-26 25/week @ 2024-02-02 21/week @ 2024-02-09 41/week @ 2024-02-16 41/week @ 2024-02-23 35/week @ 2024-03-01 37/week @ 2024-03-08 28/week @ 2024-03-15 23/week @ 2024-03-22 35/week @ 2024-03-29 27/week @ 2024-04-05 31/week @ 2024-04-12 27/week @ 2024-04-19 15/week @ 2024-04-26

106 downloads per month
Used in 2 crates (via w5500-tls)

MIT license

75KB
2.5K SLoC

GNU Style Assembly 1.5K SLoC // 0.0% comments Rust 698 SLoC // 0.1% comments

P256-CM4

CI crates.io docs

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.

Limitations

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.

Comparisons

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

Maintainers Notes

Testing

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

ASM Generation

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

No runtime deps