Skip to content

Commit

Permalink
Add software-crypto-hmac-sha256 to Nordic (#746)
Browse files Browse the repository at this point in the history
  • Loading branch information
ia0 authored Feb 17, 2025
1 parent 004b265 commit 2c8a347
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 7 deletions.
1 change: 1 addition & 0 deletions crates/board/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

### Patch

- Enable `api-crypto-sha{256,384}` when `api-crypto-hmac-sha{256,384}` is enabled
- Update dependencies

## 0.8.0
Expand Down
12 changes: 10 additions & 2 deletions crates/board/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,16 @@ software-crypto-aes256-gcm = [
"dep:aes-gcm",
"internal-software-crypto-aead",
]
software-crypto-hmac-sha256 = ["api-crypto-hmac-sha256", "internal-software-crypto-hmac"]
software-crypto-hmac-sha384 = ["api-crypto-hmac-sha384", "internal-software-crypto-hmac"]
software-crypto-hmac-sha256 = [
"api-crypto-hmac-sha256",
"api-crypto-sha256",
"internal-software-crypto-hmac",
]
software-crypto-hmac-sha384 = [
"api-crypto-hmac-sha384",
"api-crypto-sha384",
"internal-software-crypto-hmac",
]
software-crypto-p256 = [
"api-crypto-p256",
"dep:p256",
Expand Down
1 change: 1 addition & 0 deletions crates/runner-nordic/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion crates/runner-nordic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ usb-ctap = ["_usb", "dep:usbd-hid", "wasefire-scheduler/board-api-usb-ctap"]
usb-serial = ["_usb", "dep:usbd-serial", "wasefire-scheduler/board-api-usb-serial"]
# Software crypto features.
software-crypto-aes256-gcm = ["wasefire-scheduler/software-crypto-aes256-gcm"]
software-crypto-hmac-sha256 = [
"software-crypto-sha256",
"wasefire-scheduler/software-crypto-hmac-sha256",
]
software-crypto-p256 = ["software-crypto-sha256", "wasefire-scheduler/software-crypto-p256"]
software-crypto-sha256 = ["wasefire-scheduler/software-crypto-sha256"]
# Exactly one is enabled by xtask.
Expand All @@ -91,7 +95,13 @@ release = ["dep:panic-abort"]
native = ["wasefire-scheduler/native"]
wasm = ["dep:wasefire-interpreter", "wasefire-scheduler/wasm"]
# Internal features.
_software-crypto = ["software-crypto-aes256-gcm", "software-crypto-p256", "software-crypto-sha256"]
_full = ["_software-crypto", "radio-ble", "usb-ctap", "usb-serial"]
_software-crypto = [
"software-crypto-aes256-gcm",
"software-crypto-hmac-sha256",
"software-crypto-p256",
"software-crypto-sha256",
]
_usb = []

[lints]
Expand Down
2 changes: 2 additions & 0 deletions crates/runner-nordic/src/board/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ impl crypto::Api for Impl {
type Aes128Ccm = ccm::Impl;
#[cfg(feature = "software-crypto-aes256-gcm")]
type Aes256Gcm = crypto::SoftwareAes256Gcm;
#[cfg(feature = "software-crypto-hmac-sha256")]
type HmacSha256 = crypto::SoftwareHmacSha256<Self>;
#[cfg(feature = "software-crypto-p256")]
type P256 = crypto::SoftwareP256<Impl>;
#[cfg(feature = "software-crypto-sha256")]
Expand Down
10 changes: 6 additions & 4 deletions crates/runner-nordic/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ set -e

ensure_applet

for feature in $(package_features); do
case $feature in _*|debug|release|native|wasm) continue ;; esac
x cargo clippy --bin=runner-nordic --target=thumbv7em-none-eabi --features=wasm,debug,$feature
done

test_helper

cargo check --bin=runner-nordic --target=thumbv7em-none-eabi --features=wasm,debug,_full
cargo check --bin=runner-nordic --target=thumbv7em-none-eabi --features=wasm,debug
cargo check --bin=runner-nordic --target=thumbv7em-none-eabi --features=wasm,debug,radio-ble
cargo check --bin=runner-nordic --target=thumbv7em-none-eabi --features=wasm,debug,usb-ctap
cargo check --bin=runner-nordic --target=thumbv7em-none-eabi --features=wasm,debug,usb-serial
cargo check --bin=runner-nordic --target=thumbv7em-none-eabi --features=wasm,debug,_software-crypto
DEFMT_LOG=trace cargo check --bin=runner-nordic --target=thumbv7em-none-eabi --features=wasm,debug
cargo check --bin=runner-nordic --target=thumbv7em-none-eabi --features=wasm,release
cargo check --bin=runner-nordic --target=thumbv7em-none-eabi --features=native,release

0 comments on commit 2c8a347

Please sign in to comment.