Skip to content

ssh-encoding v0.4.0 - #668

Open
tarcieri wants to merge 1 commit into
masterfrom
ssh-encoding/v0.4.0
Open

tarcieri wants to merge 1 commit into
masterfrom
ssh-encoding/v0.4.0

Conversation

@tarcieri

@tarcieri tarcieri commented Dec 5, 2026 •

Copy link
Copy Markdown
Member

Added

  • Decoder<R> for bounded, nested decoding without allocation. Use read_nested for a known length or read_prefixed for an SSH length prefix (#618)
  • Mpint::is_zero and equality comparisons for Mpint without the ctutils feature (#622)
  • MpintRef for encoding a borrowed magnitude, Decoder::read_mpint_bytes for decoding into caller-provided storage, and a Writer impl for &mut [u8] (#656)
  • Decoder::from_bytes, from_base64, and from_pem. The base64 and pem features expose Base64Decoder and PemDecoder aliases. Use pem_label() to inspect the PEM label or pem::PemReader to access the reader directly (#663)
  • With the derive feature, use #[ssh(error = crate::Error)] to select a derived Decode::Error (#665)

Changed

  • Raise the minimum supported Rust version from 1.85 to 1.87 (#610)
  • Limit Mpint magnitudes to 16384 bits (2048 bytes) (#615)
  • Decode::decode now takes &mut Decoder<impl Reader>. Call nested reads and completion checks on the decoder. After a read or nested decode fails, subsequent reads return Error::Failed (#618)
  • Mpint::from_bytes and as_bytes now use unsigned big-endian magnitudes. Decoding rejects negative wire values and accepts redundant leading zeros within the wire-size limit. Encoding produces canonical SSH integers. Use TryFrom to convert a Uint to an Mpint and From for the reverse conversion (#622)
  • Report buffer reservation failures as Error::Alloc when decoding owned values or encoding into a Vec<u8> (#627)
  • Decoder::new and Reader::into_decoder are fallible and reject decoded binary input larger than 128 MiB, including when reading Base64 or PEM (#628)
  • Decode any SSH uint32 representable as a usize, lifting the previous 0xfffff cap (#637)
  • Accept SSH algorithm and method labels up to 64 bytes, up from 48 (#639)
  • Limit decoding to 64 active nested scopes and return Error::NestingDepth at the next level (#641)
  • The derives now reject previously ignored #[ssh(...)] attributes on enum variants (#644)
  • Custom Reader implementations must implement Clone. Each clone starts at the same position and advances independently, allowing a decoder to reread the original bytes (#659)
  • Update the optional ssh-derive dependency to v0.4 (#667)

Removed

  • Mpint::from_positive_bytes, as_positive_bytes, and is_positive. Use from_bytes and as_bytes for unsigned magnitudes and is_zero to test for zero (#622)
  • Reader::read_byten. Use Decoder::read_string_bytes for a length-prefixed SSH string or decode [u8; N] for a fixed-width byte array (#647)

Fixed

  • Slice readers now return Error::TrailingData when a length-prefixed field is only partly consumed (8cbd2a0)
  • Order Mpint values numerically with ctutils enabled and preserve canonical zero after zeroization (#622)
  • Count four bytes for #[repr(usize)] enum tags in derived Encode::encoded_len, and allow fields named writer. Derived decoders now match discriminant expressions by value (#643)
  • Correct the Vec<String> documentation to describe an SSH string containing a sequence of length-prefixed strings (#646)

Security

  • Require ctutils v0.4.8 when that optional dependency is enabled, picking up upstream constant-time fixes for mask generation and comparisons (#610, RUSTSEC-2026-0385)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant