From 3142ed7bae1f8305640fb9be27132636fd70b8c3 Mon Sep 17 00:00:00 2001 From: Benalleng Date: Thu, 10 Sep 2026 09:53:54 -0400 Subject: [PATCH 1/2] Update cargo toml editions and bump msrv to 1.85.0 By updating the editions to 2024 it allows us to utilize the more up-to-date cargo resolver features to keep msrv in check within the toml configuration itself. This change does mandate that we update the msrv to at least 1.84.0 but with rust-payjoin and the main payjoin crate already being at 1.85.0 it seems appropriate to do the same here. rustfmt takes its style edition from the crate edition, so the 2024 edition also brings the 2024 formatting rules, mostly the new import ordering. The reformat lands in this commit because the tree only passes cargo fmt --check once the edition and formatting change together. --- .clippy.toml | 2 +- Cargo.toml | 2 +- README.md | 2 +- bhttp-convert/Cargo.toml | 2 +- bhttp/Cargo.toml | 6 ++++-- bhttp/src/lib.rs | 10 +++------- bhttp/src/rw.rs | 2 +- ohttp-client-cli/Cargo.toml | 2 +- ohttp-client-cli/src/main.rs | 2 +- ohttp-client/Cargo.toml | 2 +- ohttp-server/Cargo.toml | 2 +- ohttp-server/src/main.rs | 2 +- ohttp/Cargo.toml | 4 ++-- ohttp/build.rs | 4 +++- ohttp/src/config.rs | 9 +++++---- ohttp/src/lib.rs | 2 +- ohttp/src/nss/aead.rs | 8 ++++---- ohttp/src/nss/err.rs | 4 ++-- ohttp/src/nss/hkdf.rs | 8 ++++---- ohttp/src/nss/hpke.rs | 6 +++--- ohttp/src/nss/mod.rs | 4 ++-- ohttp/src/nss/p11.rs | 10 +++++----- ohttp/src/rand.rs | 2 +- ohttp/src/rh/aead.rs | 2 +- ohttp/src/rh/hpke.rs | 7 ++++--- 25 files changed, 54 insertions(+), 52 deletions(-) diff --git a/.clippy.toml b/.clippy.toml index b3c3a24..4972822 100644 --- a/.clippy.toml +++ b/.clippy.toml @@ -1 +1 @@ -msrv = "1.63.0" +msrv = "1.85.0" diff --git a/Cargo.toml b/Cargo.toml index 0621518..9c9026e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -resolver = "2" +resolver = "3" members = [ "bhttp", "bhttp-convert", diff --git a/README.md b/README.md index 3972f29..fbdb2b5 100644 --- a/README.md +++ b/README.md @@ -138,4 +138,4 @@ install itself. ## Minnimum Supported Rust Version (MSRV) -`ohttp` and `bhttp` should compile on Rust 1.63.0. +`ohttp` and `bhttp` should compile on Rust 1.85.0. diff --git a/bhttp-convert/Cargo.toml b/bhttp-convert/Cargo.toml index 8a82101..7a18aae 100644 --- a/bhttp-convert/Cargo.toml +++ b/bhttp-convert/Cargo.toml @@ -2,7 +2,7 @@ name = "bhttp-convert" version = "0.5.3" authors = ["Martin Thomson "] -edition = "2021" +edition = "2024" [dependencies] structopt = "0.3" diff --git a/bhttp/Cargo.toml b/bhttp/Cargo.toml index 8c89536..cfd8e13 100644 --- a/bhttp/Cargo.toml +++ b/bhttp/Cargo.toml @@ -2,8 +2,8 @@ name = "bhttp" version = "0.5.3" authors = ["Martin Thomson "] -edition = "2021" -rust-version = "1.63.0" +edition = "2024" +rust-version = "1.85.0" license = "MIT OR Apache-2.0" description = "Binary HTTP messages (RFC 9292)" repository = "https://github.com/martinthomson/ohttp" @@ -21,5 +21,7 @@ write-http = [] thiserror = "1" url = {version = "2", optional = true} +yoke-derive = "=0.8.2" + [dev-dependencies] hex = "0.4" diff --git a/bhttp/src/lib.rs b/bhttp/src/lib.rs index 3c8fbde..d84b2f3 100644 --- a/bhttp/src/lib.rs +++ b/bhttp/src/lib.rs @@ -31,8 +31,8 @@ pub use err::Error; ))] use err::Res; #[cfg(feature = "read-http")] -use parse::{downcase, is_ows, read_line, split_at, COLON, SEMICOLON, SLASH, SP}; -use parse::{index_of, trim_ows, COMMA}; +use parse::{COLON, SEMICOLON, SLASH, SP, downcase, is_ows, read_line, split_at}; +use parse::{COMMA, index_of, trim_ows}; #[cfg(feature = "read-bhttp")] use rw::{read_varint, read_vec}; #[cfg(feature = "write-bhttp")] @@ -401,11 +401,7 @@ impl ControlData { #[must_use] pub fn path(&self) -> Option<&[u8]> { if let Self::Request { path, .. } = self { - if path.is_empty() { - None - } else { - Some(path) - } + if path.is_empty() { None } else { Some(path) } } else { None } diff --git a/bhttp/src/rw.rs b/bhttp/src/rw.rs index 92009ed..a761f2b 100644 --- a/bhttp/src/rw.rs +++ b/bhttp/src/rw.rs @@ -4,7 +4,7 @@ use std::{convert::TryFrom, io}; use crate::err::Res; #[cfg(feature = "read-bhttp")] -use crate::{err::Error, ReadSeek}; +use crate::{ReadSeek, err::Error}; #[cfg(feature = "write-bhttp")] #[allow(clippy::cast_possible_truncation)] diff --git a/ohttp-client-cli/Cargo.toml b/ohttp-client-cli/Cargo.toml index 2a99603..51b395f 100644 --- a/ohttp-client-cli/Cargo.toml +++ b/ohttp-client-cli/Cargo.toml @@ -2,7 +2,7 @@ name = "ohttp-client-cli" version = "0.5.3" authors = ["Martin Thomson "] -edition = "2021" +edition = "2024" [features] default = ["rust-hpke"] diff --git a/ohttp-client-cli/src/main.rs b/ohttp-client-cli/src/main.rs index 7acc0f1..204f2b4 100644 --- a/ohttp-client-cli/src/main.rs +++ b/ohttp-client-cli/src/main.rs @@ -1,7 +1,7 @@ #![deny(warnings, clippy::pedantic)] use bhttp::{Message, Mode}; -use ohttp::{init, ClientRequest}; +use ohttp::{ClientRequest, init}; use std::io::{self, BufRead, Write}; fn main() { diff --git a/ohttp-client/Cargo.toml b/ohttp-client/Cargo.toml index 75d59e0..4d5df17 100644 --- a/ohttp-client/Cargo.toml +++ b/ohttp-client/Cargo.toml @@ -2,7 +2,7 @@ name = "ohttp-client" version = "0.5.3" authors = ["Martin Thomson "] -edition = "2021" +edition = "2024" [features] default = ["rust-hpke"] diff --git a/ohttp-server/Cargo.toml b/ohttp-server/Cargo.toml index 8e4581c..3bb0eb7 100644 --- a/ohttp-server/Cargo.toml +++ b/ohttp-server/Cargo.toml @@ -2,7 +2,7 @@ name = "ohttp-server" version = "0.5.3" authors = ["Martin Thomson "] -edition = "2021" +edition = "2024" [features] default = ["rust-hpke"] diff --git a/ohttp-server/src/main.rs b/ohttp-server/src/main.rs index 7c33b20..7acbead 100644 --- a/ohttp-server/src/main.rs +++ b/ohttp-server/src/main.rs @@ -9,8 +9,8 @@ use std::{ use bhttp::{Message, Mode, StatusCode}; use ohttp::{ - hpke::{Aead, Kdf, Kem}, KeyConfig, Server as OhttpServer, SymmetricSuite, + hpke::{Aead, Kdf, Kem}, }; use structopt::StructOpt; use warp::Filter; diff --git a/ohttp/Cargo.toml b/ohttp/Cargo.toml index 73cdfed..e6de02d 100644 --- a/ohttp/Cargo.toml +++ b/ohttp/Cargo.toml @@ -2,8 +2,8 @@ name = "bitcoin-ohttp" version = "0.6.0" authors = ["Dan Gould "] -edition = "2021" -rust-version = "1.63.0" +edition = "2024" +rust-version = "1.85.0" build = "build.rs" license = "MIT OR Apache-2.0" description = "Oblivious HTTP over secp256k1 and ChaCha20Poly1305" diff --git a/ohttp/build.rs b/ohttp/build.rs index 1c01e3f..57e93df 100644 --- a/ohttp/build.rs +++ b/ohttp/build.rs @@ -473,7 +473,9 @@ mod nss { "NSS_DIR path (obtained via `env`) does not exist: {}", nss_dir.display() ); - panic!("It looks like NSS is not built. Please run `libs/verify-[platform]-environment.sh` in application-services first!"); + panic!( + "It looks like NSS is not built. Please run `libs/verify-[platform]-environment.sh` in application-services first!" + ); } let lib_dir = nss_dir.join("lib"); diff --git a/ohttp/src/config.rs b/ohttp/src/config.rs index 0e6d747..14448ad 100644 --- a/ohttp/src/config.rs +++ b/ohttp/src/config.rs @@ -1,7 +1,7 @@ use crate::{ + KeyId, err::{Error, Res}, hpke::{Aead as AeadId, Kdf, Kem}, - KeyId, }; use byteorder::{NetworkEndian, ReadBytesExt, WriteBytesExt}; use std::{ @@ -11,13 +11,13 @@ use std::{ #[cfg(feature = "nss")] use crate::nss::{ - hpke::{generate_key_pair, Config as HpkeConfig, HpkeR}, PrivateKey, PublicKey, + hpke::{Config as HpkeConfig, HpkeR, generate_key_pair}, }; #[cfg(feature = "rust-hpke")] use crate::rh::hpke::{ - derive_key_pair, generate_key_pair, Config as HpkeConfig, HpkeR, PrivateKey, PublicKey, + Config as HpkeConfig, HpkeR, PrivateKey, PublicKey, derive_key_pair, generate_key_pair, }; /// A tuple of KDF and AEAD identifiers. @@ -278,8 +278,9 @@ impl AsRef for KeyConfig { #[cfg(test)] mod test { use crate::{ + Error, KeyConfig, KeyId, SymmetricSuite, hpke::{Aead, Kdf, Kem}, - init, Error, KeyConfig, KeyId, SymmetricSuite, + init, }; use std::iter::zip; diff --git a/ohttp/src/lib.rs b/ohttp/src/lib.rs index b047c5a..b0e4bc1 100644 --- a/ohttp/src/lib.rs +++ b/ohttp/src/lib.rs @@ -313,10 +313,10 @@ impl ClientResponse { #[cfg(all(test, feature = "client", feature = "server"))] mod test { use crate::{ + ClientRequest, Error, KeyConfig, KeyId, Server, config::SymmetricSuite, err::Res, hpke::{Aead, Kdf, Kem}, - ClientRequest, Error, KeyConfig, KeyId, Server, }; use log::trace; use std::{fmt::Debug, io::ErrorKind}; diff --git a/ohttp/src/nss/aead.rs b/ohttp/src/nss/aead.rs index 18f0b66..288ae13 100644 --- a/ohttp/src/nss/aead.rs +++ b/ohttp/src/nss/aead.rs @@ -1,12 +1,12 @@ use super::{ err::secstatus_to_res, p11::{ + Item, SymKey, sys::{ - self, PK11Context, PK11_AEADOp, PK11_CreateContextBySymKey, PRBool, CKA_DECRYPT, + self, CK_ATTRIBUTE_TYPE, CK_GENERATOR_FUNCTION, CK_MECHANISM_TYPE, CKA_DECRYPT, CKA_ENCRYPT, CKA_NSS_MESSAGE, CKG_GENERATE_COUNTER_XOR, CKG_NO_GENERATE, CKM_AES_GCM, - CKM_CHACHA20_POLY1305, CK_ATTRIBUTE_TYPE, CK_GENERATOR_FUNCTION, CK_MECHANISM_TYPE, + CKM_CHACHA20_POLY1305, PK11_AEADOp, PK11_CreateContextBySymKey, PK11Context, PRBool, }, - Item, SymKey, }, }; use crate::{ @@ -195,7 +195,7 @@ impl Aead { mod test { use super::{ super::{super::hpke::Aead as AeadId, init}, - Aead, Mode, SequenceNumber, NONCE_LEN, + Aead, Mode, NONCE_LEN, SequenceNumber, }; /// Check that the first invocation of encryption matches expected values. diff --git a/ohttp/src/nss/err.rs b/ohttp/src/nss/err.rs index af85066..5c7a83d 100644 --- a/ohttp/src/nss/err.rs +++ b/ohttp/src/nss/err.rs @@ -88,8 +88,8 @@ pub fn secstatus_to_res(rv: SECStatus) -> Res<()> { #[cfg(test)] mod tests { use super::{ - super::{init, SECFailure, SECSuccess}, - secstatus_to_res, PRErrorCode, PR_SetError, + super::{SECFailure, SECSuccess, init}, + PR_SetError, PRErrorCode, secstatus_to_res, }; fn set_error_code(code: PRErrorCode) { diff --git a/ohttp/src/nss/hkdf.rs b/ohttp/src/nss/hkdf.rs index 470b1dd..6ef95e5 100644 --- a/ohttp/src/nss/hkdf.rs +++ b/ohttp/src/nss/hkdf.rs @@ -1,12 +1,12 @@ use super::{ super::hpke::{Aead, Kdf}, p11::{ + ParamItem, SymKey, sys::{ - self, CKA_DERIVE, CKF_HKDF_SALT_DATA, CKF_HKDF_SALT_NULL, CKM_AES_GCM, - CKM_CHACHA20_POLY1305, CKM_HKDF_DATA, CKM_HKDF_DERIVE, CKM_SHA256, CK_BBOOL, - CK_HKDF_PARAMS, CK_INVALID_HANDLE, CK_MECHANISM_TYPE, CK_OBJECT_HANDLE, CK_ULONG, + self, CK_BBOOL, CK_HKDF_PARAMS, CK_INVALID_HANDLE, CK_MECHANISM_TYPE, CK_OBJECT_HANDLE, + CK_ULONG, CKA_DERIVE, CKF_HKDF_SALT_DATA, CKF_HKDF_SALT_NULL, CKM_AES_GCM, + CKM_CHACHA20_POLY1305, CKM_HKDF_DATA, CKM_HKDF_DERIVE, CKM_SHA256, }, - ParamItem, SymKey, }, }; use crate::err::Res; diff --git a/ohttp/src/nss/hpke.rs b/ohttp/src/nss/hpke.rs index b7ef845..3a9034a 100644 --- a/ohttp/src/nss/hpke.rs +++ b/ohttp/src/nss/hpke.rs @@ -1,7 +1,7 @@ use super::{ super::hpke::{Aead, Kdf, Kem}, - err::{sec::SEC_ERROR_INVALID_ARGS, secstatus_to_res, Error}, - p11::{sys, Item, PrivateKey, PublicKey, Slot, SymKey}, + err::{Error, sec::SEC_ERROR_INVALID_ARGS, secstatus_to_res}, + p11::{Item, PrivateKey, PublicKey, Slot, SymKey, sys}, }; use crate::err::Res; use log::{log_enabled, trace}; @@ -292,7 +292,7 @@ pub fn generate_key_pair(kem: Kem) -> Res<(PrivateKey, PublicKey)> { #[cfg(test)] mod test { - use super::{generate_key_pair, Config, HpkeContext, HpkeR, HpkeS}; + use super::{Config, HpkeContext, HpkeR, HpkeS, generate_key_pair}; use crate::{hpke::Aead, init}; const INFO: &[u8] = b"info"; diff --git a/ohttp/src/nss/mod.rs b/ohttp/src/nss/mod.rs index 1b60c9e..626a11e 100644 --- a/ohttp/src/nss/mod.rs +++ b/ohttp/src/nss/mod.rs @@ -11,9 +11,9 @@ pub mod aead; pub mod hkdf; pub mod hpke; -pub use self::p11::{random, PrivateKey, PublicKey}; -use err::secstatus_to_res; +pub use self::p11::{PrivateKey, PublicKey, random}; pub use err::Error; +use err::secstatus_to_res; use lazy_static::lazy_static; use std::ptr::null; diff --git a/ohttp/src/nss/p11.rs b/ohttp/src/nss/p11.rs index 9bddef6..c87cbe9 100644 --- a/ohttp/src/nss/p11.rs +++ b/ohttp/src/nss/p11.rs @@ -4,7 +4,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use super::err::{secstatus_to_res, Error}; +use super::err::{Error, secstatus_to_res}; use crate::err::Res; use std::{ convert::TryFrom, @@ -28,11 +28,11 @@ pub mod sys { } use sys::{ - PK11ObjectType, PK11SlotInfo, PK11SymKey, PK11_ExtractKeyValue, PK11_FreeSlot, PK11_FreeSymKey, + CK_ATTRIBUTE_TYPE, CKA_VALUE, PK11_ExtractKeyValue, PK11_FreeSlot, PK11_FreeSymKey, PK11_GenerateRandom, PK11_GetInternalSlot, PK11_GetKeyData, PK11_ReadRawAttribute, - PK11_ReferenceSymKey, PRBool, SECITEM_FreeItem, SECItem, SECItemType, SECKEYPrivateKey, - SECKEYPublicKey, SECKEY_DestroyPrivateKey, SECKEY_DestroyPublicKey, CKA_VALUE, - CK_ATTRIBUTE_TYPE, + PK11_ReferenceSymKey, PK11ObjectType, PK11SlotInfo, PK11SymKey, PRBool, SECITEM_FreeItem, + SECItem, SECItemType, SECKEY_DestroyPrivateKey, SECKEY_DestroyPublicKey, SECKEYPrivateKey, + SECKEYPublicKey, }; macro_rules! scoped_ptr { diff --git a/ohttp/src/rand.rs b/ohttp/src/rand.rs index 381b83f..8e70938 100644 --- a/ohttp/src/rand.rs +++ b/ohttp/src/rand.rs @@ -4,7 +4,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ::rand::{thread_rng, RngCore}; +use ::rand::{RngCore, thread_rng}; #[must_use] pub fn random(size: usize) -> Vec { diff --git a/ohttp/src/rh/aead.rs b/ohttp/src/rh/aead.rs index f209086..b89c96e 100644 --- a/ohttp/src/rh/aead.rs +++ b/ohttp/src/rh/aead.rs @@ -121,7 +121,7 @@ impl Aead { mod test { use super::{ super::super::{hpke::Aead as AeadId, init}, - Aead, Mode, SequenceNumber, NONCE_LEN, + Aead, Mode, NONCE_LEN, SequenceNumber, }; /// Check that the first invocation of encryption matches expected values. diff --git a/ohttp/src/rh/hpke.rs b/ohttp/src/rh/hpke.rs index db544f4..156cbb6 100644 --- a/ohttp/src/rh/hpke.rs +++ b/ohttp/src/rh/hpke.rs @@ -1,14 +1,15 @@ use super::SymKey; use crate::{ - hpke::{Aead, Kdf, Kem}, Error, Res, + hpke::{Aead, Kdf, Kem}, }; use bitcoin_hpke::{ + Deserializable, OpModeR, OpModeS, Serializable, aead::{AeadCtxR, AeadCtxS, AeadTag, ChaCha20Poly1305}, kdf::HkdfSha256, kem::{Kem as KemTrait, SecpK256HkdfSha256}, - setup_receiver, setup_sender, Deserializable, OpModeR, OpModeS, Serializable, + setup_receiver, setup_sender, }; use ::rand::thread_rng; @@ -419,7 +420,7 @@ pub fn derive_key_pair(kem: Kem, ikm: &[u8]) -> Res<(PrivateKey, PublicKey)> { #[cfg(test)] mod test { - use super::{generate_key_pair, Config, HpkeR, HpkeS}; + use super::{Config, HpkeR, HpkeS, generate_key_pair}; use crate::{ hpke::{Aead, Kem}, init, From aa6b974c43f5b91d590300a430b800c2265ddcac Mon Sep 17 00:00:00 2001 From: Benalleng Date: Tue, 22 Sep 2026 11:01:05 -0400 Subject: [PATCH 2/2] Add msrv CI matrix with the latest update to our msrv I think it is appropriate to ensure at least at a baseline that the library passes at our msrv. --- .github/workflows/check.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index c19dc00..2f63fd1 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -10,26 +10,29 @@ env: CARGO_TERM_COLOR: always RUST_BACKTRACE: 1 -# This fork ships one configuration: the rust-hpke backend with the secp256k1 DHKEM -# from bitcoin-hpke, on stable Rust. That is what CI gates. +# This fork ships the rust-hpke backend with the secp256k1 DHKEM from bitcoin-hpke. # # Not in the matrix, on purpose: # - nss: NSS has no secp256k1 DHKEM, and the backend has not compiled since the Kem # enum was pruned to K256Sha256 (bac8f2c). Drop or delete is a separate decision. -# - an MSRV toolchain: the declared MSRV cannot resolve current transitive -# dependencies. Restore the leg when #6 is settled. jobs: check: - name: Continuous Integration (rust-hpke, stable) + name: Continuous Integration (rust-hpke) runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + rust: + - 1.85.0 # MSRV + - stable steps: - uses: actions/checkout@v4 - name: Install Rust uses: dtolnay/rust-toolchain@master with: - toolchain: stable + toolchain: ${{ matrix.rust }} components: rustfmt, clippy - name: Build