diff --git a/Cargo.lock b/Cargo.lock index 2e9c3e63..80d7dc1a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -127,7 +127,7 @@ dependencies = [ "serde", "trussed", "trussed-auth", - "trussed-rsa-alloc 0.1.0 (git+https://github.com/trussed-dev/trussed-rsa-backend.git?rev=2f51478f0861ff8db19fdd5290f023ab6f4c2fb9)", + "trussed-rsa-alloc", "trussed-se050-backend", "trussed-staging", "trussed-usbip", @@ -451,17 +451,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "chacha20" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f08493fa7707effc63254c66c6ea908675912493cd67952eda23c09fae2610b1" -dependencies = [ - "cfg-if", - "cpufeatures", - "rand_core", -] - [[package]] name = "chacha20" version = "0.9.1" @@ -480,7 +469,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" dependencies = [ "aead", - "chacha20 0.9.1", + "chacha20", "cipher 0.4.4", "poly1305", "zeroize", @@ -689,7 +678,7 @@ dependencies = [ "cortex-m", "cortex-m-rtic-macros", "heapless 0.7.16", - "rtic-core 1.0.0", + "rtic-core", "rtic-monotonic", "version_check", ] @@ -703,7 +692,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "rtic-syntax 1.0.3", + "rtic-syntax", "syn 1.0.109", ] @@ -1124,7 +1113,6 @@ dependencies = [ "apps", "cargo-lock", "cfg-if", - "chacha20 0.7.3", "cortex-m", "cortex-m-rtic", "cortex-m-semihosting", @@ -1148,6 +1136,7 @@ dependencies = [ "nrf52840-hal", "nrf52840-pac", "rand", + "rand_chacha", "rand_core", "ref-swap", "rtt-target", @@ -1912,7 +1901,6 @@ dependencies = [ "generic-array 0.14.7", "littlefs2", "lpc55-pac", - "lpc55-rtic", "nb 1.1.0", "rand_core", "usb-device", @@ -1931,32 +1919,6 @@ dependencies = [ "vcell", ] -[[package]] -name = "lpc55-rtic" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4472b3ed70fa24afef24fa55fd0ebd77fbc781a4c649bb48ca6b1b9fa6b90073" -dependencies = [ - "cortex-m", - "cortex-m-rt", - "heapless 0.6.1", - "lpc55-rtic-macros", - "rtic-core 0.3.1", - "version_check", -] - -[[package]] -name = "lpc55-rtic-macros" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c4958d6458bf70ef0789830bb2ed28e9a8d95d500e7cad2b1e9bd3a3169c680" -dependencies = [ - "proc-macro2", - "quote", - "rtic-syntax 0.4.0", - "syn 1.0.109", -] - [[package]] name = "matchers" version = "0.1.0" @@ -2252,7 +2214,7 @@ dependencies = [ "subtle", "trussed", "trussed-auth", - "trussed-rsa-alloc 0.1.0 (git+https://github.com/trussed-dev/trussed-rsa-backend.git?rev=2f51478f0861ff8db19fdd5290f023ab6f4c2fb9)", + "trussed-rsa-alloc", "trussed-staging", ] @@ -2650,12 +2612,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "rtic-core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bd58a6949de8ff797a346a28d9f13f7b8f54fa61bb5e3cb0985a4efb497a5ef" - [[package]] name = "rtic-core" version = "1.0.0" @@ -2668,17 +2624,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb8b0b822d1a366470b9cea83a1d4e788392db763539dc4ba022bcc787fece82" -[[package]] -name = "rtic-syntax" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8152fcaa845720d61e6cc570548b89144c2c307f18a480bbd97e55e9f6eeff04" -dependencies = [ - "indexmap", - "proc-macro2", - "syn 1.0.109", -] - [[package]] name = "rtic-syntax" version = "1.0.3" @@ -3351,7 +3296,7 @@ dependencies = [ "cbc", "cbor-smol", "cfg-if", - "chacha20 0.9.1", + "chacha20", "chacha20poly1305", "cosey 0.3.0", "delog", @@ -3394,20 +3339,6 @@ dependencies = [ "trussed", ] -[[package]] -name = "trussed-rsa-alloc" -version = "0.1.0" -source = "git+https://github.com/Nitrokey/trussed-rsa-backend.git?rev=2088e2f8a8d706276c1559717b4c6b6d4f270253#2088e2f8a8d706276c1559717b4c6b6d4f270253" -dependencies = [ - "delog", - "heapless-bytes 0.3.0", - "num-bigint-dig", - "postcard 0.7.3", - "rsa", - "serde", - "trussed", -] - [[package]] name = "trussed-rsa-alloc" version = "0.1.0" @@ -3425,7 +3356,7 @@ dependencies = [ [[package]] name = "trussed-se050-backend" version = "0.1.0" -source = "git+https://github.com/Nitrokey/trussed-se050-backend.git?rev=cb76fbff0bae365a474b8fbb12530d127ec995a9#cb76fbff0bae365a474b8fbb12530d127ec995a9" +source = "git+https://github.com/Nitrokey/trussed-se050-backend.git?rev=1bccc1d9ec9fafb9b769e32fcfe7476b9b034506#1bccc1d9ec9fafb9b769e32fcfe7476b9b034506" dependencies = [ "cbor-smol", "crypto-bigint 0.5.5", @@ -3448,7 +3379,7 @@ dependencies = [ "sha2 0.10.8", "trussed", "trussed-auth", - "trussed-rsa-alloc 0.1.0 (git+https://github.com/Nitrokey/trussed-rsa-backend.git?rev=2088e2f8a8d706276c1559717b4c6b6d4f270253)", + "trussed-rsa-alloc", "trussed-staging", ] @@ -3798,7 +3729,7 @@ dependencies = [ "serde-indexed", "serde_bytes", "trussed", - "trussed-rsa-alloc 0.1.0 (git+https://github.com/trussed-dev/trussed-rsa-backend.git?rev=2f51478f0861ff8db19fdd5290f023ab6f4c2fb9)", + "trussed-rsa-alloc", "trussed-staging", ] diff --git a/Cargo.toml b/Cargo.toml index dbee0a25..a8aa1b2c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,7 @@ trussed-staging = { git = "https://github.com/Nitrokey/trussed-staging.git", tag trussed-auth = { git = "https://github.com/trussed-dev/trussed-auth", rev = "4b8191f248c26cb074cdac887c7f3f48f9c449a4" } trussed-rsa-alloc = { git = "https://github.com/trussed-dev/trussed-rsa-backend.git", rev = "2f51478f0861ff8db19fdd5290f023ab6f4c2fb9" } trussed-usbip = { git = "https://github.com/Nitrokey/pc-usbip-runner.git", tag = "v0.0.1-nitrokey.3" } -trussed-se050-backend = { git = "https://github.com/Nitrokey/trussed-se050-backend.git", rev = "cb76fbff0bae365a474b8fbb12530d127ec995a9" } +trussed-se050-backend = { git = "https://github.com/Nitrokey/trussed-se050-backend.git", rev = "1bccc1d9ec9fafb9b769e32fcfe7476b9b034506" } [profile.release] codegen-units = 1 diff --git a/runners/embedded/Cargo.toml b/runners/embedded/Cargo.toml index 034a21dc..4838d671 100644 --- a/runners/embedded/Cargo.toml +++ b/runners/embedded/Cargo.toml @@ -20,6 +20,7 @@ embedded-hal = "0.2.3" embedded-time = "0.12" generic-array = "0.14" nfc-device = { path = "../../components/nfc-device" } +rand_chacha = { version = "0.3.1", default-features = false, optional = true } rand_core = "0.6" rtt-target = { version = "0.3", features = ["cortex-m"], optional = true } spi-memory = "0.2.0" @@ -47,13 +48,12 @@ usbd-ccid = "0.2" usbd-ctaphid = "0.1" ### NRF52 specific dependencies -chacha20 = { version = "0.7", default-features = false, features = ["rng"], optional = true } nrf52840-hal = { version = "0.15.1", optional = true } nrf52840-pac = { version = "0.11", optional = true } ### LPC55 specific dependencies cortex-m-semihosting = { version = "0.3.5", optional = true } -lpc55-hal = { version = "0.3", features = ["littlefs", "rtic-peripherals"], optional = true } +lpc55-hal = { version = "0.3", features = ["littlefs"], optional = true } lpc55-pac = { version = "0.4", optional = true } fm11nc08 = { path = "../../components/fm11nc08", optional = true } nb = "1" @@ -99,8 +99,8 @@ board-nk3am = ["soc-nrf52840", "extflash_spi"] board-nk3xn = ["soc-lpc55"] -soc-nrf52840 = ["nrf52840-hal", "nrf52840-pac", "chacha20", "se05x?/nrf"] -soc-lpc55 = ["lpc55-hal", "lpc55-pac", "fm11nc08", "systick-monotonic", "se05x?/lpc55", "chacha20"] +soc-nrf52840 = ["nrf52840-hal", "nrf52840-pac", "rand_chacha", "se05x?/nrf"] +soc-lpc55 = ["lpc55-hal", "lpc55-pac", "fm11nc08", "systick-monotonic", "se05x?/lpc55", "rand_chacha"] se050 = ["dep:se05x", "apps/se050"] diff --git a/runners/embedded/src/bin/app-nrf.rs b/runners/embedded/src/bin/app-nrf.rs index 14a1dc1d..05162424 100644 --- a/runners/embedded/src/bin/app-nrf.rs +++ b/runners/embedded/src/bin/app-nrf.rs @@ -186,7 +186,7 @@ mod app { #[cfg(not(feature = "se050"))] use rand::{Rng as _, SeedableRng}; #[cfg(not(feature = "se050"))] - let chacha_rng = chacha20::ChaCha8Rng::from_seed(dev_rng.gen()); + let chacha_rng = rand_chacha::ChaCha8Rng::from_seed(dev_rng.gen()); #[cfg(feature = "board-nk3am")] let ui = ERL::soc::board::init_ui( diff --git a/runners/embedded/src/lib.rs b/runners/embedded/src/lib.rs index 67d88805..b7557bb2 100644 --- a/runners/embedded/src/lib.rs +++ b/runners/embedded/src/lib.rs @@ -298,9 +298,9 @@ pub fn init_se050< delay: D, dev_rng: &mut R, init_status: &mut InitStatus, -) -> (se05x::se05x::Se05X, chacha20::ChaCha8Rng) { - use chacha20::ChaCha8Rng; +) -> (se05x::se05x::Se05X, rand_chacha::ChaCha8Rng) { use rand::{Rng as _, SeedableRng}; + use rand_chacha::ChaCha8Rng; use se05x::se05x::commands::GetRandom; let seed: [u8; 32] = dev_rng.gen(); diff --git a/runners/embedded/src/soc_lpc55/init.rs b/runners/embedded/src/soc_lpc55/init.rs index 54a0d197..ff8d6306 100644 --- a/runners/embedded/src/soc_lpc55/init.rs +++ b/runners/embedded/src/soc_lpc55/init.rs @@ -32,6 +32,7 @@ use interchange::Channel; use lpc55_hal as hal; #[cfg(feature = "log-info")] use lpc55_hal::drivers::timer::Elapsed as _; +use rand_chacha::ChaCha8Rng; use trussed::{platform::UserInterface, service::Service, types::Location}; use utils::OptionalStorage; @@ -729,10 +730,10 @@ impl Stage5 { ); (chacha_rng, Some(se050)) } else { - (chacha20::ChaCha8Rng::from_seed(dev_rng.gen()), None) + (ChaCha8Rng::from_seed(dev_rng.gen()), None) }; #[cfg(not(feature = "se050"))] - let res = (chacha20::ChaCha8Rng::from_seed(dev_rng.gen()),); + let res = (ChaCha8Rng::from_seed(dev_rng.gen()),); res }; diff --git a/runners/embedded/src/soc_lpc55/types.rs b/runners/embedded/src/soc_lpc55/types.rs index 6d486045..ebea4676 100644 --- a/runners/embedded/src/soc_lpc55/types.rs +++ b/runners/embedded/src/soc_lpc55/types.rs @@ -84,7 +84,7 @@ impl crate::types::Soc for Soc { type ExternalFlashStorage = OptionalStorage>; type UsbBus = lpc55_hal::drivers::UsbBus; type NfcDevice = super::nfc::NfcChip; - type Rng = chacha20::ChaCha8Rng; + type Rng = rand_chacha::ChaCha8Rng; type TrussedUI = UserInterface; type Reboot = Lpc55Reboot; type UUID = [u8; 16]; diff --git a/runners/embedded/src/soc_nrf52840/types.rs b/runners/embedded/src/soc_nrf52840/types.rs index a83e4c4c..612f16c9 100644 --- a/runners/embedded/src/soc_nrf52840/types.rs +++ b/runners/embedded/src/soc_nrf52840/types.rs @@ -52,7 +52,7 @@ impl crate::types::Soc for Soc { type ExternalFlashStorage = ExternalStorage; type UsbBus = Usbd>; type NfcDevice = DummyNfc; - type Rng = chacha20::ChaCha8Rng; + type Rng = rand_chacha::ChaCha8Rng; type TrussedUI = super::board::TrussedUI; type Reboot = self::Reboot; type UUID = [u8; 16];