-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into jonas/platform-abstraction
- Loading branch information
Showing
23 changed files
with
797 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,47 @@ | ||
# libcrux-iot | ||
An IoT friendly, formally verified, crypto library based on libcrux | ||
An IoT friendly, formally verified, crypto library based on libcrux. | ||
|
||
The `libcrux-nrf*/nucleo-l4r5zi` crates are based on the app template found at [https://github.com/knurling-rs/app-template]. | ||
|
||
## Dependencies | ||
|
||
#### 1. `flip-link`: | ||
|
||
```console | ||
$ cargo install flip-link | ||
``` | ||
|
||
#### 2. Install the target resp. toolchain | ||
|
||
You need the following target toolchains installed, by board: | ||
|
||
| Board | Target toolchain | | ||
|---------------|-----------------------------| | ||
| nRF52810 | `thumbv7em-none-eabi` | | ||
| nRF52832 | `thumbv7em-none-eabihf` | | ||
| nRF52840 | `thumbv7em-none-eabihf` | | ||
| nRF52340 | `thumbv8m.main-none-eabihf` | | ||
| nucleo-L4R5ZI | `thumbv7em-none-eabihf` | | ||
|
||
#### 3. `probe-rs`: | ||
|
||
``` console | ||
$ # make sure to install v0.2.0 or later | ||
$ cargo install probe-rs --features cli | ||
``` | ||
|
||
## Running Benchmarks | ||
|
||
With the device attached, run | ||
```console | ||
$ cargo rrb mlkem | ||
``` | ||
for a crude benchmark of ML-KEM 1024 and | ||
|
||
```console | ||
$ cargo rrb mldsa | ||
``` | ||
for a crude benchmark of ML-DSA 87. | ||
|
||
Other parameter sets are available behind `mldsa44/65` and | ||
`mlkem512/768` features. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[target.'cfg(all(target_arch = "arm", target_os = "none"))'] | ||
runner = ["probe-rs", "run", "--chip", "nRF52810_xxAA", "--log-format", "{s}"] | ||
|
||
|
||
rustflags = [ | ||
"-C", "linker=flip-link", | ||
"-C", "link-arg=-Tlink.x", | ||
"-C", "link-arg=-Tdefmt.x", | ||
# This is needed if your flash or ram addresses are not aligned to 0x10000 in memory.x | ||
# See https://github.com/rust-embedded/cortex-m-quickstart/pull/95 | ||
"-C", "link-arg=--nmagic", | ||
] | ||
|
||
[build] | ||
# TODO(3) Adjust the compilation target. | ||
# (`thumbv6m-*` is compatible with all ARM Cortex-M chips but using the right | ||
# target improves performance) | ||
# target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+ | ||
# target = "thumbv7m-none-eabi" # Cortex-M3 | ||
target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU) | ||
# target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU) | ||
|
||
[alias] | ||
rb = "run --bin" | ||
rrb = "run --release --bin" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#![no_main] | ||
#![no_std] | ||
#![cfg(feature = "mldsa87")] | ||
|
||
use libcrux_ml_dsa::ml_dsa_87 as mldsa; | ||
use libcrux_nrf52810 as board; // global logger + panicking-behavior + memory layout | ||
|
||
#[cortex_m_rt::entry] | ||
fn main() -> ! { | ||
let randomness_gen = [1u8; 32]; | ||
let _keypair = mldsa::generate_key_pair(randomness_gen); | ||
|
||
board::exit() | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[target.'cfg(all(target_arch = "arm", target_os = "none"))'] | ||
# runner = "probe-rs run --chip nRF52840_xxAA" | ||
runner = ["probe-rs", "run", "--chip", "nRF52832_xxAA", "--allow-erase-all", "--log-format", "{s}"] | ||
|
||
|
||
rustflags = [ | ||
"-C", "linker=flip-link", | ||
"-C", "link-arg=-Tlink.x", | ||
"-C", "link-arg=-Tdefmt.x", | ||
# This is needed if your flash or ram addresses are not aligned to 0x10000 in memory.x | ||
# See https://github.com/rust-embedded/cortex-m-quickstart/pull/95 | ||
"-C", "link-arg=--nmagic", | ||
] | ||
|
||
[build] | ||
# TODO(3) Adjust the compilation target. | ||
# (`thumbv6m-*` is compatible with all ARM Cortex-M chips but using the right | ||
# target improves performance) | ||
# target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+ | ||
# target = "thumbv7m-none-eabi" # Cortex-M3 | ||
# target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU) | ||
target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU) | ||
|
||
[alias] | ||
rb = "run --bin" | ||
rrb = "run --release --bin" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[target.'cfg(all(target_arch = "arm", target_os = "none"))'] | ||
# runner = "probe-rs run --chip nRF52840_xxAA" | ||
runner = ["probe-rs", "run", "--chip", "nRF5340_xxAA", "--allow-erase-all", "--log-format", "{s}"] | ||
|
||
|
||
rustflags = [ | ||
"-C", "linker=flip-link", | ||
"-C", "link-arg=-Tlink.x", | ||
"-C", "link-arg=-Tdefmt.x", | ||
# This is needed if your flash or ram addresses are not aligned to 0x10000 in memory.x | ||
# See https://github.com/rust-embedded/cortex-m-quickstart/pull/95 | ||
"-C", "link-arg=--nmagic", | ||
] | ||
|
||
[build] | ||
# TODO(3) Adjust the compilation target. | ||
# (`thumbv6m-*` is compatible with all ARM Cortex-M chips but using the right | ||
# target improves performance) | ||
# target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+ | ||
# target = "thumbv7m-none-eabi" # Cortex-M3 | ||
# target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU) | ||
# target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU) | ||
target = "thumbv8m.main-none-eabihf" | ||
|
||
[alias] | ||
rb = "run --bin" | ||
rrb = "run --release --bin" | ||
|
||
[env] | ||
DEFMT_LOG = "trace" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.