diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 581b1b2a..5a23e60f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,8 +13,8 @@ jobs: all: strategy: matrix: - # 1.83 is an arbitrary minimum, tested to notice when it bumps - rust_version: [stable, nightly, 1.83] + # 1.85 is an arbitrary minimum, tested to notice when it bumps + rust_version: [stable, nightly, 1.85] runs-on: ubuntu-latest env: RUSTUP_TOOLCHAIN: ${{ matrix.rust_version }} diff --git a/src/namelist.rs b/src/namelist.rs index a793b246..c9bc90b4 100644 --- a/src/namelist.rs +++ b/src/namelist.rs @@ -24,7 +24,7 @@ use sshwire::{BinString, SSHDecode, SSHEncode, SSHSink, SSHSource, WireResult}; /// Max count of LocalNames entries /// -/// Current max is for kex, [mlkem, curve25519, curve25519@libssh, ext-info, strictkex, kexguess2] +/// Current max is for kex: (mlkem, curve25519, curve25519@libssh, ext-info, strictkex, kexguess2) pub const MAX_LOCAL_NAMES: usize = 6; static EMPTY_LOCALNAMES: LocalNames = LocalNames::new(); diff --git a/src/sshwire.rs b/src/sshwire.rs index bfd698ab..1733ee5d 100644 --- a/src/sshwire.rs +++ b/src/sshwire.rs @@ -486,6 +486,12 @@ impl SSHEncode for u32 { } } +impl SSHEncode for u64 { + fn enc(&self, s: &mut dyn SSHSink) -> WireResult<()> { + s.push(&self.to_be_bytes()) + } +} + // no length prefix impl SSHEncode for &[u8] { fn enc(&self, s: &mut dyn SSHSink) -> WireResult<()> { @@ -555,6 +561,16 @@ impl<'de> SSHDecode<'de> for u32 { } } +impl<'de> SSHDecode<'de> for u64 { + fn dec(s: &mut S) -> WireResult + where + S: SSHSource<'de>, + { + let t = s.take(core::mem::size_of::())?; + Ok(u64::from_be_bytes(t.try_into().unwrap())) + } +} + /// Decodes a SSH name string. Must be ASCII /// without control characters. RFC4251 section 6. pub fn try_as_ascii(t: &[u8]) -> WireResult<&AsciiStr> {