From 1c165511ee881e5750252101ff602184735638b4 Mon Sep 17 00:00:00 2001 From: Matt Johnston Date: Tue, 1 Dec 2026 22:13:19 +0800 Subject: [PATCH 1/7] Limit channel adjust to u32 Exceeding this would be unlikely. --- src/channel.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/channel.rs b/src/channel.rs index f9c27c59..0457d9e1 100644 --- a/src/channel.rs +++ b/src/channel.rs @@ -1138,14 +1138,14 @@ impl Channel { /// Send a window adjust packet if required. fn check_send_window_adjust(&mut self, s: &mut TrafSend) { if self.pending_adjust > self.full_window / 2 { - let adjust = self.pending_adjust as u32; + let adjust = self.pending_adjust.max(u32::MAX as usize) as u32; let Some(sdir) = self.send.as_mut() else { return; }; let num = sdir.num; let p = packets::ChannelWindowAdjust { num, adjust }; match s.send(p) { - Ok(()) => self.pending_adjust = 0, + Ok(()) => self.pending_adjust -= adjust as usize, Err(Error::BusySend { .. }) => { // Do nothing, the adjustment will be sent later. } From 9d687c7fc992fad3c9ff99b025f9487b62b162b1 Mon Sep 17 00:00:00 2001 From: Matt Johnston Date: Tue, 1 Dec 2026 22:15:29 +0800 Subject: [PATCH 2/7] Improve some docs --- Cargo.toml | 4 ++-- README.md | 13 +++++-------- async/Cargo.toml | 5 +++-- sftp/Cargo.toml | 2 +- src/packets.rs | 6 +++--- src/sshnames.rs | 24 +++++++++++++----------- src/sshwire.rs | 2 +- stdasync/Cargo.toml | 4 +++- 8 files changed, 31 insertions(+), 29 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index caa3446e..3a8b8375 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,11 +2,11 @@ name = "sunset" version = "0.6.0" edition = "2024" +license = "0BSD" description = "A SSH library suitable for embedded and larger programs" repository = "https://github.com/mkj/sunset" categories = ["network-programming", "embedded", "no-std"] -license = "0BSD" -keywords = ["ssh"] +keywords = ["ssh", "ssh-client", "ssh-server"] rust-version = "1.95" [workspace] diff --git a/README.md b/README.md index e07d82d0..b4eee7d2 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ suggest something! non-async API, runs with `no_std` and no alloc. - [`sunset-async`](async) - async SSH client and server library, also - `no_std` no-alloc. This is async-executor agnostic (using Embassy for mutexes, but works on std too). + `no_std` no-alloc. This is async-executor agnostic (uses embassy-sync mutexes, but works on std too). - [`demo`](demo) has demos with Embassy executor for wifi on a Raspberry Pi [Pico W](demo/picow) or a @@ -35,15 +35,12 @@ Working: - Client and server - Shell or command connection - Password and public key authentication -- ed25519 signatures -- curve25519 key exchange -- chacha20-poly1305, aes256-ctr ciphers -- hmac-sha256 integrity -- rsa (`std`-only unless someone writes a `no_std` crate) -- ecdsa256 +- ed25519, ecdsa256, and rsa signatures (rsa requires alloc) +- curve25519 and hybrid mlkem key exchange +- chacha20-poly1305 and aes256-ctr - `~.` client escape sequences -- Post quantum hybrid key exchange (mlkem) - SFTP server +- standalone commandline client `sunsetc` Desirable: diff --git a/async/Cargo.toml b/async/Cargo.toml index d2fe1359..c68613c1 100644 --- a/async/Cargo.toml +++ b/async/Cargo.toml @@ -2,10 +2,11 @@ name = "sunset-async" version = "0.6.0" edition = "2024" -repository = "https://github.com/mkj/sunset" -categories = ["network-programming", "embedded", "no-std"] license = "0BSD" description = "Async for Sunset SSH" +repository = "https://github.com/mkj/sunset" +categories = ["network-programming", "embedded", "no-std"] +keywords = ["ssh", "ssh-client", "ssh-server", "sunset", "no-std"] [dependencies] embassy-sync.workspace = true diff --git a/sftp/Cargo.toml b/sftp/Cargo.toml index d746eeab..beacaf71 100644 --- a/sftp/Cargo.toml +++ b/sftp/Cargo.toml @@ -5,7 +5,7 @@ edition = "2024" license = "0BSD" repository = "https://github.com/mkj/sunset" categories = ["network-programming", "embedded", "no-std", "filesystem"] -keywords = ["sftp"] +keywords = ["ssh", "sftp", "sftp-server", "sunset"] description = "SFTP for Sunset SSH" [features] diff --git a/src/packets.rs b/src/packets.rs index 8c4815b4..99586440 100644 --- a/src/packets.rs +++ b/src/packets.rs @@ -1094,10 +1094,10 @@ impl<'a> From<$SpecificPacketType> for Packet<'a> { pub enum Category { /// Allowed at any time. - /// TODO: may need to limit some of these during KEX. All, - /// After kexinit, before newkeys complete (other packets are not allowed during - /// that time). + /// After kexinit, before newkeys complete. + /// + /// Other packets are not allowed during that time. Kex, /// Post-kex Auth, diff --git a/src/sshnames.rs b/src/sshnames.rs index 4dd004ab..03eb0677 100644 --- a/src/sshnames.rs +++ b/src/sshnames.rs @@ -10,16 +10,17 @@ pub const SSH_PORT: u16 = 22; /// [RFC8731](https://tools.ietf.org/html/rfc8731) pub const SSH_NAME_CURVE25519: &str = "curve25519-sha256"; -/// An older alias prior to standardisation. Eventually could be removed +/// An older alias prior to standardisation. Eventually could be removed. pub const SSH_NAME_CURVE25519_LIBSSH: &str = "curve25519-sha256@libssh.org"; -/// [draft-ietf-sshm-mlkem-hybrid-kex](https://datatracker.ietf.org/doc/html/draft-ietf-sshm-mlkem-hybrid-kex) +/// [draft-ietf-sshm-mlkem-hybrid-kex](https://tools.ietf.org/html/rfc10042) pub const SSH_NAME_MLKEM_X25519: &str = "mlkem768x25519-sha256"; /// [RFC8308](https://tools.ietf.org/html/rfc8308) Extension Negotiation pub const SSH_NAME_EXT_INFO_S: &str = "ext-info-s"; /// [RFC8308](https://tools.ietf.org/html/rfc8308) Extension Negotiation pub const SSH_NAME_EXT_INFO_C: &str = "ext-info-c"; -/// Implemented by Dropbear to improve first_kex_packet_follows, described -/// [https://mailarchive.ietf.org/arch/msg/secsh/3n6lNzDHmsGsIQSqhmHHwigIbuo/](https://mailarchive.ietf.org/arch/msg/secsh/3n6lNzDHmsGsIQSqhmHHwigIbuo/) +/// Implemented by Dropbear to improve first_kex_packet_follows +/// +/// Described [https://mailarchive.ietf.org/arch/msg/secsh/3n6lNzDHmsGsIQSqhmHHwigIbuo/](https://mailarchive.ietf.org/arch/msg/secsh/3n6lNzDHmsGsIQSqhmHHwigIbuo/) pub const SSH_NAME_KEXGUESS2: &str = "kexguess2@matt.ucc.asn.au"; /// OpenSSH [PROTOCOL](https://cvsweb.openbsd.org/checkout/src/usr.bin/ssh/PROTOCOL?rev=HEAD) pub const SSH_NAME_STRICT_KEX_S: &str = "kex-strict-s-v00@openssh.com"; @@ -30,9 +31,11 @@ pub const SSH_NAME_STRICT_KEX_C: &str = "kex-strict-c-v00@openssh.com"; pub const SSH_NAME_ED25519: &str = "ssh-ed25519"; /// [RFC8332](https://tools.ietf.org/html/rfc8332) pub const SSH_NAME_RSA_SHA256: &str = "rsa-sha2-256"; -/// [RFC4253](https://tools.ietf.org/html/rfc4253). Deprecated for signatures but is a valid key type. +/// [RFC4253](https://tools.ietf.org/html/rfc4253) RSA key type. +/// +/// Signature format `ssh-rsa` using SHA1 is deprecated and not supported by Sunset. pub const SSH_NAME_RSA: &str = "ssh-rsa"; -/// [RFC5656](https://tools.ietf.org/html/rfc5656). +/// [RFC5656](https://tools.ietf.org/html/rfc5656) pub const SSH_NAME_ECDSA256: &str = "ecdsa-sha2-nistp256"; /// [RFC4344](https://tools.ietf.org/html/rfc4344) @@ -40,8 +43,9 @@ pub const SSH_NAME_AES256_CTR: &str = "aes256-ctr"; /// [draft-ietf-sshm-chacha20-poly1305](https://datatracker.ietf.org/doc/draft-ietf-sshm-chacha20-poly1305/) pub const SSH_NAME_CHAPOLY: &str = "chacha20-poly1305@openssh.com"; /// OpenSSH [PROTOCOL](https://cvsweb.openbsd.org/checkout/src/usr.bin/ssh/PROTOCOL?rev=HEAD) -/// (No-one directly uses `AEAD_AES_256_GCM` [RFC5647](https://tools.ietf.org/html/rfc5647) from the NSA, it fails to define MAC negotiation -/// sensibly and has incongruous naming style) +/// +/// No-one directly uses `AEAD_AES_256_GCM` [RFC5647](https://tools.ietf.org/html/rfc5647) from the NSA, it fails to define MAC negotiation +/// sensibly and has incongruous naming style. pub const SSH_NAME_AES256_GCM: &str = "aes256-gcm@openssh.com"; /// [RFC6668](https://tools.ietf.org/html/rfc6668) @@ -81,9 +85,7 @@ pub enum ChanFail { SSH_OPEN_RESOURCE_SHORTAGE = 4, } -/// Reason codes for `SSH_MSG_DISCONNECT` -/// -/// [RFC4253](https://tools.ietf.org/html/rfc4253#section-11.1) +/// [RFC4253](https://tools.ietf.org/html/rfc4253#section-11.1) Reason codes for `SSH_MSG_DISCONNECT` #[allow(non_camel_case_types)] #[derive(Debug, PartialEq, Eq, Copy, Clone, Hash)] pub enum DisconnectReason { diff --git a/src/sshwire.rs b/src/sshwire.rs index 7289b716..15c20c56 100644 --- a/src/sshwire.rs +++ b/src/sshwire.rs @@ -492,7 +492,7 @@ impl<'de, B: SSHDecode<'de>> SSHDecode<'de> for Blob { let inner = SSHDecode::dec(s)?; let rem2 = s.remaining(); - // Sanity check the length matched + // Check the length matched let used_len = rem1 - rem2; if used_len != len { if s.ctx().seen_unknown { diff --git a/stdasync/Cargo.toml b/stdasync/Cargo.toml index b8dd95e5..adfaca73 100644 --- a/stdasync/Cargo.toml +++ b/stdasync/Cargo.toml @@ -2,9 +2,11 @@ name = "sunset-stdasync" version = "0.6.0" edition = "2024" -repository = "https://github.com/mkj/sunset" license = "0BSD" description = "Sunset SSH for larger systems" +repository = "https://github.com/mkj/sunset" +categories = ["network-programming"] +keywords = ["ssh", "ssh-client", "ssh-agent", "sunset"] [dependencies] sunset = { workspace = true, features = ["std", "openssh-key"] } From 3de51ab9f6c8d372c240caa84efeda7265dbfe94 Mon Sep 17 00:00:00 2001 From: Matt Johnston Date: Tue, 1 Dec 2026 22:15:54 +0800 Subject: [PATCH 3/7] Use .position() rather than .enumerate() --- src/channel.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/channel.rs b/src/channel.rs index 0457d9e1..25d19987 100644 --- a/src/channel.rs +++ b/src/channel.rs @@ -146,10 +146,8 @@ impl Channels { fn unused_chan(&self) -> Result { self.ch .iter() - .enumerate() - .find_map(|(i, ch)| { - if ch.as_ref().is_none() { Some(ChanNum(i as u32)) } else { None } - }) + .position(|ch| ch.is_none()) + .map(|ch| ChanNum(ch as u32)) .ok_or(Error::NoChannels) } From 37007e27f82c804ff3589346cf4185015b55b8b7 Mon Sep 17 00:00:00 2001 From: Matt Johnston Date: Tue, 1 Dec 2026 22:17:59 +0800 Subject: [PATCH 4/7] Remove sunset build.rs The version string can be created directly. --- build.rs | 4 ---- src/ident.rs | 4 +++- 2 files changed, 3 insertions(+), 5 deletions(-) delete mode 100644 build.rs diff --git a/build.rs b/build.rs deleted file mode 100644 index 735361f6..00000000 --- a/build.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - let sunset_ssh_ident = format!("SSH-2.0-Sunset-{}", env!("CARGO_PKG_VERSION")); - println!("cargo::rustc-env=SUNSET_SSH_IDENT={sunset_ssh_ident}"); -} diff --git a/src/ident.rs b/src/ident.rs index 15075d03..3be91026 100644 --- a/src/ident.rs +++ b/src/ident.rs @@ -1,7 +1,9 @@ use crate::error::{self, Error, Result}; // From build.rs, "SSH-2.0-Sunset-{crate_vers}" -pub(crate) const OUR_VERSION: &[u8] = env!("SUNSET_SSH_IDENT").as_bytes(); +// let sunset_ssh_ident = format!( +pub(crate) const OUR_VERSION: &[u8] = + concat!("SSH-2.0-Sunset-", env!("CARGO_PKG_VERSION")).as_bytes(); pub(crate) const SSH_PREFIX: &[u8] = b"SSH-2.0-"; // RFC4253 4.2 says max length 255 incl CR LF. From 05d1aa7e3d5d95f9c1a1f243d67c56292392af08 Mon Sep 17 00:00:00 2001 From: Matt Johnston Date: Tue, 1 Dec 2026 21:56:49 +0800 Subject: [PATCH 5/7] Implement common traits for various public types --- src/channel.rs | 6 +++--- src/packets.rs | 6 +++--- src/sign.rs | 1 + src/sshwire.rs | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/channel.rs b/src/channel.rs index 25d19987..556b9124 100644 --- a/src/channel.rs +++ b/src/channel.rs @@ -659,13 +659,13 @@ impl From<&ChannelOpenType<'_>> for ChanType { } } -#[derive(Debug)] +#[derive(Debug, Hash, Eq, PartialEq, Clone)] pub struct ModePair { pub opcode: u8, pub arg: u32, } -#[derive(Debug)] +#[derive(Debug, Hash, Eq, PartialEq, Clone)] pub struct Pty { pub term: String, pub cols: u32, @@ -1185,7 +1185,7 @@ impl core::fmt::Display for ChanNum { } /// Channel data type, normal or stderr -#[derive(Debug, PartialEq, Copy, Clone)] +#[derive(Debug, PartialEq, Copy, Clone, Eq)] pub enum ChanData { /// `SSH_MSG_CHANNEL_DATA` Normal, diff --git a/src/packets.rs b/src/packets.rs index 99586440..3bdd0e91 100644 --- a/src/packets.rs +++ b/src/packets.rs @@ -861,7 +861,7 @@ pub struct Subsystem<'a> { /// The contents of a `"pty-req"` request. /// /// Note that most function arguments use [`channel::Pty`] rather than this struct. -#[derive(Debug, SSHEncode, SSHDecode, Clone)] +#[derive(Debug, SSHEncode, SSHDecode, Clone, Eq, PartialEq, Hash)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] pub struct PtyReq<'a> { pub term: TextString<'a>, @@ -872,7 +872,7 @@ pub struct PtyReq<'a> { pub modes: BinString<'a>, } -#[derive(Debug, Clone, SSHEncode, SSHDecode)] +#[derive(Debug, Clone, SSHEncode, SSHDecode, Eq, PartialEq, Hash)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] pub struct WinChange { pub cols: u32, @@ -966,7 +966,7 @@ macro_rules! messagetypes { ) => { -#[derive(Debug)] +#[derive(Debug, Hash, Ord, PartialEq, Eq, PartialOrd, Clone, Copy)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] #[repr(u8)] #[allow(non_camel_case_types)] diff --git a/src/sign.rs b/src/sign.rs index 6dad1126..ede47ea4 100644 --- a/src/sign.rs +++ b/src/sign.rs @@ -265,6 +265,7 @@ impl SigType { } } +#[derive(Debug, Clone)] pub enum OwnedSig { // just store raw bytes here. Ed25519([u8; 64]), diff --git a/src/sshwire.rs b/src/sshwire.rs index 15c20c56..119a55d1 100644 --- a/src/sshwire.rs +++ b/src/sshwire.rs @@ -442,7 +442,7 @@ impl<'de> SSHDecode<'de> for TextString<'de> { } /// A wrapper for a `u32` length prefixed data structure `B`, such as a public key blob -#[derive(PartialEq, Clone)] +#[derive(PartialEq, Clone, Eq, Hash, PartialOrd, Ord)] pub struct Blob(pub B); #[cfg(feature = "arbitrary")] From 87b52e761a99131f9a904eec26780201d331b77d Mon Sep 17 00:00:00 2001 From: Matt Johnston Date: Tue, 1 Dec 2026 21:57:34 +0800 Subject: [PATCH 6/7] Re-export ssh-key --- src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index ee1f0a48..ec88c7b9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -88,3 +88,10 @@ pub use p256; #[cfg(feature = "rsa")] pub use rsa; + +/// `ssh-key` crate re-export +/// +/// This dependent crate rc version is not part of the stable API +/// of Sunset, it will update to the released version when ready. +#[cfg(feature = "openssh-key")] +pub use ssh_key; From 714ac5a8e098fb92e2162d121671ed57e816a965 Mon Sep 17 00:00:00 2001 From: Matt Johnston Date: Tue, 1 Dec 2026 23:43:40 +0800 Subject: [PATCH 7/7] Update some dependencies --- Cargo.lock | 186 +++++++++++++++++++------------------- Cargo.toml | 2 +- demo/sftp/std/Cargo.toml | 2 +- demo/sftp/std/src/main.rs | 5 +- demo/std/Cargo.toml | 2 +- demo/std/src/main.rs | 5 +- 6 files changed, 98 insertions(+), 104 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a72b77a7..1d3f00be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,9 +14,9 @@ dependencies = [ [[package]] name = "aes" -version = "0.9.1" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1fc76eaeac4c9164506c466d4ffdd8ec9d0c5bf57ee97177c4d8eceb3a0e138" +checksum = "fc0fc36d7440d015b45468ba08a21e80e056ebbd014c611c6298bb7503e04bd1" dependencies = [ "cipher 0.5.2", "cpubits", @@ -165,7 +165,7 @@ dependencies = [ "argh_shared", "proc-macro2", "quote", - "syn", + "syn 2.0.117", ] [[package]] @@ -388,8 +388,8 @@ dependencies = [ "critical-section", "embassy-rp", "log", - "rand 0.10.1", - "rand_chacha 0.10.0", + "rand", + "rand_chacha", "sha2 0.10.9", ] @@ -409,17 +409,6 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" -[[package]] -name = "chacha20" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" -dependencies = [ - "cfg-if", - "cipher 0.4.4", - "cpufeatures 0.2.17", -] - [[package]] name = "chacha20" version = "0.10.1" @@ -440,7 +429,6 @@ checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" dependencies = [ "crypto-common 0.1.7", "inout 0.1.4", - "zeroize", ] [[package]] @@ -519,35 +507,48 @@ dependencies = [ [[package]] name = "cortex-m" -version = "0.7.7" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9" +checksum = "408ca8c6d703a196b73219fdb68fd8914d4fda90c34e2bd6859d4842f761bd5f" dependencies = [ "bare-metal", "bitfield 0.13.2", + "cortex-m-macros", "critical-section", "embedded-hal 0.2.7", + "embedded-hal 1.0.0", "volatile-register", ] +[[package]] +name = "cortex-m-macros" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d1922be58519ad40368fc4ca595a2cefa51a7abf947be3b0c90586dc7dbd0e2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + [[package]] name = "cortex-m-rt" -version = "0.7.5" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "801d4dec46b34c299ccf6b036717ae0fce602faa4f4fe816d9013b9a7c9f5ba6" +checksum = "f1f0f27b7ecbb9fad6702c8764d11d0b7245437de1575e34e39b2af95382f096" dependencies = [ "cortex-m-rt-macros", ] [[package]] name = "cortex-m-rt-macros" -version = "0.7.5" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472" +checksum = "05cf9e0f899304705b85fda7b178fc383f2529ec2479693248b600e530d2327a" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 3.0.10", ] [[package]] @@ -691,7 +692,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.117", ] [[package]] @@ -747,7 +748,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn", + "syn 2.0.117", ] [[package]] @@ -758,7 +759,7 @@ checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ "darling_core", "quote", - "syn", + "syn 2.0.117", ] [[package]] @@ -794,7 +795,7 @@ checksum = "30542c1ad912e0e3d22a1935c290e12e8a29d704a420177a31faad4a601a0800" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.117", ] [[package]] @@ -816,7 +817,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version 0.4.1", - "syn", + "syn 2.0.117", "unicode-xid", ] @@ -971,7 +972,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn", + "syn 2.0.117", ] [[package]] @@ -1459,7 +1460,7 @@ checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.117", ] [[package]] @@ -1516,17 +1517,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "getrandom" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - [[package]] name = "getrandom" version = "0.4.3" @@ -1745,7 +1735,7 @@ checksum = "782d32378dddf207193ac91cefb848ad41abb58195c95168e1291227a0832b47" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.117", ] [[package]] @@ -1950,23 +1940,24 @@ dependencies = [ [[package]] name = "ml-kem" -version = "0.3.2" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e15f3e5b957493873e396a66914e83e616b6afe335cdef7efe5c6e1216aba66" +checksum = "84ca78b66f46050d49fa21693ae8adab2081d8101b65d8067316b6b70b64a0d1" dependencies = [ "hybrid-array", "kem", "module-lattice", "rand_core 0.10.1", - "sha3 0.11.0", + "sha3 0.12.0", + "shake", "zeroize", ] [[package]] name = "module-lattice" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c61b87c9683ab7cb1c6871d261ad5479b6b10ceb52c4352aaca3b5d35a8febe" +checksum = "c4a1e412c8ee83a1c678f427806219c49c96b2511b9f07497514f0e43fb26155" dependencies = [ "ctutils", "hybrid-array", @@ -2062,7 +2053,7 @@ checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.117", ] [[package]] @@ -2207,7 +2198,7 @@ checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.117", ] [[package]] @@ -2267,7 +2258,7 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn", + "syn 2.0.117", ] [[package]] @@ -2395,7 +2386,7 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn", + "syn 2.0.117", ] [[package]] @@ -2422,17 +2413,6 @@ version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" -[[package]] -name = "rand" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a" -dependencies = [ - "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", -] - [[package]] name = "rand" version = "0.10.1" @@ -2442,16 +2422,6 @@ dependencies = [ "rand_core 0.10.1", ] -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.4", -] - [[package]] name = "rand_chacha" version = "0.10.0" @@ -2467,9 +2437,6 @@ name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.17", -] [[package]] name = "rand_core" @@ -2728,7 +2695,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.117", ] [[package]] @@ -2781,12 +2748,24 @@ dependencies = [ [[package]] name = "sha3" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be176f1a57ce4e3d31c1a166222d9768de5954f811601fb7ca06fc8203905ce1" +checksum = "bc9bad02c26382724b2d2692c6f179285e4b54eeecd7968f52a50059c3c11759" dependencies = [ "digest 0.11.3", "keccak 0.2.0", + "sponge-cursor", +] + +[[package]] +name = "shake" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09057cb2149ad4cbd2da1e26b351f9a4c354219421229c69c3063e6f61947c4a" +dependencies = [ + "digest 0.11.3", + "keccak 0.2.0", + "sponge-cursor", ] [[package]] @@ -2902,7 +2881,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn", + "syn 2.0.117", ] [[package]] @@ -2924,6 +2903,12 @@ dependencies = [ "proc-canonicalize", ] +[[package]] +name = "sponge-cursor" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a0219bd7d979d58245a4f41f695e1ac9f8befdffadd7f61f1bae9e39abc6620" + [[package]] name = "ssh-cipher" version = "0.3.0" @@ -2933,7 +2918,7 @@ dependencies = [ "aead", "aes", "aes-gcm", - "chacha20 0.10.1", + "chacha20", "cipher 0.5.2", "des", "poly1305", @@ -3040,14 +3025,14 @@ dependencies = [ "anyhow", "arbitrary", "ascii", - "chacha20 0.9.1", + "chacha20", "cipher 0.5.2", "ctr", "digest 0.11.3", "ecdsa", "ed25519-dalek", "embedded-io 0.7.1", - "getrandom 0.4.3", + "getrandom", "heapless 0.9.3", "hmac", "log", @@ -3093,7 +3078,7 @@ dependencies = [ "embassy-sync", "embassy-time", "embedded-io-async 0.7.0", - "getrandom 0.4.3", + "getrandom", "heapless 0.9.3", "hmac", "log", @@ -3129,7 +3114,7 @@ dependencies = [ "embedded-hal-bus", "embedded-io-async 0.7.0", "embedded-storage-async", - "getrandom 0.4.3", + "getrandom", "heapless 0.9.3", "log", "portable-atomic", @@ -3154,9 +3139,9 @@ dependencies = [ "embassy-sync", "embassy-time", "env_logger", + "getrandom", "heapless 0.9.3", "log", - "rand 0.8.6", "strict-path", "sunset", "sunset-async", @@ -3178,10 +3163,10 @@ dependencies = [ "embassy-time", "embedded-io-async 0.7.0", "env_logger", + "getrandom", "heapless 0.9.3", "libc", "log", - "rand 0.8.6", "sunset", "sunset-async", "sunset-demo-common", @@ -3258,6 +3243,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "term" version = "1.2.1" @@ -3343,7 +3339,7 @@ checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.117", ] [[package]] @@ -3365,7 +3361,7 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.117", ] [[package]] @@ -3494,7 +3490,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn", + "syn 2.0.117", "usbd-hid-descriptors", ] @@ -3591,7 +3587,7 @@ dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn", + "syn 2.0.117", "wasm-bindgen-shared", ] @@ -3777,14 +3773,14 @@ checksum = "0b631b19d36a892ab55420c92dbc83ccd79274f25be714855d3074aa71cab639" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.117", ] [[package]] name = "zeroize" -version = "1.9.0" +version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" +checksum = "85ccff8a4805aba1eaa4cd4afcd49f7557dd2cf5fd79ffc37f8959466effc5aa" dependencies = [ "zeroize_derive", ] @@ -3797,5 +3793,5 @@ checksum = "3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.117", ] diff --git a/Cargo.toml b/Cargo.toml index 3a8b8375..6b1ac606 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -76,7 +76,7 @@ rand_core.workspace = true ctr = { version = "0.10", features = ["zeroize"] } aes = { version = "0.9", features = ["zeroize"] } -chacha20 = { version = "0.9", features = ["zeroize"] } +chacha20 = { version = "0.10", features = ["zeroize"] } sha2.workspace = true hmac.workspace = true poly1305 = "0.9" diff --git a/demo/sftp/std/Cargo.toml b/demo/sftp/std/Cargo.toml index 5cc80345..0c8ed90f 100644 --- a/demo/sftp/std/Cargo.toml +++ b/demo/sftp/std/Cargo.toml @@ -37,6 +37,6 @@ env_logger = { version = "0.11", default-features = false, features = [ heapless.workspace = true -rand = { version = "0.8", features = ["getrandom"] } +getrandom.workspace = true strict-path = "0.2" diff --git a/demo/sftp/std/src/main.rs b/demo/sftp/std/src/main.rs index ea229f39..8e221a50 100644 --- a/demo/sftp/std/src/main.rs +++ b/demo/sftp/std/src/main.rs @@ -11,8 +11,7 @@ use crate::demosftpserver::DemoSftpServer; use embassy_executor::Spawner; use embassy_net::{Stack, StackResources, StaticConfigV4}; -use rand::RngCore; -use rand::rngs::OsRng; +use getrandom::rand_core::TryRng; use embassy_futures::select::select; use embassy_net_tuntap::TunTapDevice; @@ -65,7 +64,7 @@ async fn main_task(spawner: Spawner) { // Init network device let net_device = TunTapDevice::new(opt_tap0).unwrap(); - let seed = OsRng.next_u64(); + let seed = getrandom::SysRng.try_next_u64().unwrap(); // Init network stack let res = Box::leak(Box::new(StackResources::::new())); diff --git a/demo/std/Cargo.toml b/demo/std/Cargo.toml index acb5482a..41905f6d 100644 --- a/demo/std/Cargo.toml +++ b/demo/std/Cargo.toml @@ -34,4 +34,4 @@ async-io = "2.6" critical-section = "1.1" -rand = { version = "0.8", default-features = false, features = ["getrandom"] } \ No newline at end of file +getrandom.workspace = true diff --git a/demo/std/src/main.rs b/demo/std/src/main.rs index 13b9c15d..7c064649 100644 --- a/demo/std/src/main.rs +++ b/demo/std/src/main.rs @@ -4,8 +4,7 @@ use log::{debug, error, info, log, trace, warn}; use embassy_executor::Spawner; use embassy_net::{Stack, StackResources, StaticConfigV4}; -use rand::RngCore; -use rand::rngs::OsRng; +use getrandom::rand_core::TryRng; use demo_common::menu::Runner as MenuRunner; use embassy_futures::select::select; @@ -63,7 +62,7 @@ async fn main_task(spawner: Spawner) { // Init network device let net_device = TunTapDevice::new(opt_tap0).unwrap(); - let seed = OsRng.next_u64(); + let seed = getrandom::SysRng.try_next_u64().unwrap(); // Init network stack let res = Box::leak(Box::new(StackResources::::new()));