diff --git a/Cargo.lock b/Cargo.lock index 01e0f338..3dd2f3c8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -860,7 +860,7 @@ dependencies = [ [[package]] name = "ssh-encoding" -version = "0.4.0-rc.2" +version = "0.4.0" dependencies = [ "base64ct", "bytes", diff --git a/ssh-cipher/Cargo.toml b/ssh-cipher/Cargo.toml index ec221552..4b2eb34d 100644 --- a/ssh-cipher/Cargo.toml +++ b/ssh-cipher/Cargo.toml @@ -27,7 +27,7 @@ aes-gcm = { version = "0.11", optional = true, default-features = false, feature ctutils = { version = "0.4.8", optional = true, default-features = false } chacha20 = { version = "0.10", optional = true, default-features = false, features = ["cipher", "legacy"] } des = { version = "0.9", optional = true, default-features = false } -encoding = { package = "ssh-encoding", version = "0.4.0-rc.2", optional = true } +encoding = { package = "ssh-encoding", version = "0.4", optional = true } poly1305 = { version = "0.9", optional = true, default-features = false } zeroize = { version = "1", optional = true, default-features = false } diff --git a/ssh-encoding/CHANGELOG.md b/ssh-encoding/CHANGELOG.md index cb731004..7bb85e26 100644 --- a/ssh-encoding/CHANGELOG.md +++ b/ssh-encoding/CHANGELOG.md @@ -4,6 +4,82 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.4.0 (2026-12-04) +### Added +- `Decoder` 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`. 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` ([#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` 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]) + +[#610]: https://github.com/RustCrypto/SSH/pull/610 +[#615]: https://github.com/RustCrypto/SSH/pull/615 +[#618]: https://github.com/RustCrypto/SSH/pull/618 +[#622]: https://github.com/RustCrypto/SSH/pull/622 +[#627]: https://github.com/RustCrypto/SSH/pull/627 +[#628]: https://github.com/RustCrypto/SSH/pull/628 +[#637]: https://github.com/RustCrypto/SSH/pull/637 +[#639]: https://github.com/RustCrypto/SSH/pull/639 +[#641]: https://github.com/RustCrypto/SSH/pull/641 +[#643]: https://github.com/RustCrypto/SSH/pull/643 +[#644]: https://github.com/RustCrypto/SSH/pull/644 +[#646]: https://github.com/RustCrypto/SSH/pull/646 +[#647]: https://github.com/RustCrypto/SSH/pull/647 +[#656]: https://github.com/RustCrypto/SSH/pull/656 +[#659]: https://github.com/RustCrypto/SSH/pull/659 +[#663]: https://github.com/RustCrypto/SSH/pull/663 +[#665]: https://github.com/RustCrypto/SSH/pull/665 +[#667]: https://github.com/RustCrypto/SSH/pull/667 +[8cbd2a0]: https://github.com/RustCrypto/SSH/commit/8cbd2a001fff63aead2e3c83c8dbd95dce5a5e95 +[RUSTSEC-2026-0385]: https://rustsec.org/advisories/RUSTSEC-2026-0385.html + ## 0.3.0 (2026-05-25) ### Added - `boolean` encode/decode support ([#214]) diff --git a/ssh-encoding/Cargo.toml b/ssh-encoding/Cargo.toml index 9336681a..a5a7db53 100644 --- a/ssh-encoding/Cargo.toml +++ b/ssh-encoding/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ssh-encoding" -version = "0.4.0-rc.2" +version = "0.4.0" description = "Pure Rust implementation of SSH data type decoders/encoders as described in RFC4251" authors = ["RustCrypto Developers"] license = "Apache-2.0 OR MIT" diff --git a/ssh-key/Cargo.toml b/ssh-key/Cargo.toml index 5f55bde2..17fc5d8e 100644 --- a/ssh-key/Cargo.toml +++ b/ssh-key/Cargo.toml @@ -19,7 +19,7 @@ rust-version = "1.87" [dependencies.encoding] package = "ssh-encoding" -version = "0.4.0-rc.2" +version = "0.4" features = ["base64", "derive", "digest", "pem", "ctutils", "zeroize"] [dependencies] diff --git a/ssh-protocol/Cargo.toml b/ssh-protocol/Cargo.toml index 2c248746..9216e989 100644 --- a/ssh-protocol/Cargo.toml +++ b/ssh-protocol/Cargo.toml @@ -17,7 +17,7 @@ rust-version = "1.87" [dependencies] cipher = { package = "ssh-cipher", version = "0.4.0-rc.0", default-features = false } -encoding = { package = "ssh-encoding", version = "0.4.0-rc.2", default-features = false } +encoding = { package = "ssh-encoding", version = "0.4", default-features = false } key = { package = "ssh-key", version = "0.7.0-rc.13", default-features = false } [features]