Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 50 additions & 8 deletions Cargo.lock

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

9 changes: 6 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ log = "0.4"

heapless = "0.9"

ssh-key = { version = "0.7.0-rc.12", default-features = false }
ssh-key = { version = "0.7.0-rc.13", default-features = false }
sha2 = { version = "0.11", default-features = false }
hmac = "0.13"
subtle = { version = "2.6", default-features = false }
Expand Down Expand Up @@ -87,7 +87,8 @@ subtle.workspace = true
ed25519-dalek = { version = "3.0", default-features = false, features = ["zeroize", "rand_core", "hazmat"] }
x25519-dalek = { version = "3.0", default-features = false, features = ["zeroize"] }
ml-kem = { version = "0.3.2", default-features = false, features = ["zeroize"], optional = true }
rsa = { version = "0.10", default-features = false, optional = true, features = ["pkcs1v15"] }
ml-dsa = { version = "0.1.2", default-features = false, features = ["rand_core", "zeroize"], optional = true }
rsa ={ version = "0.10", default-features = false, optional = true, features = ["pkcs1v15"] }
ssh-key = { workspace = true, optional = true }

embedded-io = { workspace = true, optional = true }
Expand All @@ -106,9 +107,11 @@ mlkem = ["dep:ml-kem"]
_ecdsa = ["dep:ecdsa", "ssh-key?/ecdsa"]
# ecdsa-sha2-nistp256
ecdsa256 = ["_ecdsa", "dep:p256", "ssh-key?/p256"]
# ssh-mldsa44-ed25519
mldsa = ["dep:ml-dsa", "ssh-key?/mldsa44-ed25519"]

# allows conversion to/from OpenSSH key formats
openssh-key = ["ssh-key"]
openssh-key = ["ssh-key", "ssh-key/sha2"]
# implements embedded_io::Error for sunset::Error
embedded-io = ["dep:embedded-io"]
# Arbitrary for fuzzing. std is required for derive(Arbitrary)
Expand Down
16 changes: 12 additions & 4 deletions src/kex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ const fixed_options_hostsig: &[&str] = &[
SSH_NAME_ED25519,
#[cfg(feature = "rsa")]
SSH_NAME_RSA_SHA256,
// Least preferred, as in OpenSSH 10.6
#[cfg(feature = "mldsa")]
SSH_NAME_MLDSA44_ED25519,
];

const fixed_options_cipher: &[&str] = &[SSH_NAME_CHAPOLY, SSH_NAME_AES256_CTR];
Expand Down Expand Up @@ -704,11 +707,16 @@ impl Kex<Server> {

// Not inherently server-only, but no client use yet in sunset.
pub fn send_ext_info(&self, s: &mut TrafSend) -> Result<()> {
if cfg!(feature = "rsa") {
const SERVER_SIG_ALGS: &[&str] = &[
#[cfg(feature = "rsa")]
SSH_NAME_RSA_SHA256,
SSH_NAME_ED25519,
#[cfg(feature = "mldsa")]
SSH_NAME_MLDSA44_ED25519,
];
if cfg!(any(feature = "rsa", feature = "mldsa")) {
// OK unwrap: namelist has capacity
let algs = ([SSH_NAME_RSA_SHA256, SSH_NAME_ED25519].as_slice())
.try_into()
.unwrap();
let algs = SERVER_SIG_ALGS.try_into().unwrap();
let ext =
packets::ExtInfo { server_sig_algs: Some(NameList::Local(&algs)) };
s.send(ext)?;
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ mod conn;
mod encrypt;
mod ident;
mod kex;
#[cfg(feature = "mldsa")]
mod mldsa;
mod random;
mod sign;
mod test;
Expand Down
Loading