From 10a9432c45e62464e5a395710df397df34ab00fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Mon, 15 Jun 2026 03:29:13 +0300 Subject: [PATCH 1/6] chacha20: apply `unreachable_pub` lint --- chacha20/Cargo.toml | 1 + chacha20/src/chacha.rs | 2 +- chacha20/src/lib.rs | 8 +++++--- chacha20/src/xchacha.rs | 6 +++--- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/chacha20/Cargo.toml b/chacha20/Cargo.toml index 76a0a7a7..2d9d6f55 100644 --- a/chacha20/Cargo.toml +++ b/chacha20/Cargo.toml @@ -45,6 +45,7 @@ missing_debug_implementations = "warn" missing_docs = "warn" trivial_casts = "warn" trivial_numeric_casts = "warn" +unreachable_pub = "warn" unused_lifetimes = "warn" unused_qualifications = "warn" diff --git a/chacha20/src/chacha.rs b/chacha20/src/chacha.rs index 1105f1a7..b9b9eaff 100644 --- a/chacha20/src/chacha.rs +++ b/chacha20/src/chacha.rs @@ -1,4 +1,4 @@ -pub use cipher::{ +use cipher::{ IvSizeUser, KeyIvInit, KeySizeUser, StreamCipherCoreWrapper, array::Array, consts::{U12, U32, U64}, diff --git a/chacha20/src/lib.rs b/chacha20/src/lib.rs index bb867e5f..06fcba88 100644 --- a/chacha20/src/lib.rs +++ b/chacha20/src/lib.rs @@ -19,17 +19,19 @@ mod rng; mod xchacha; #[cfg(feature = "cipher")] -pub use chacha::{ChaCha8, ChaCha12, ChaCha20, Key, KeyIvInit}; +pub use chacha::{ChaCha8, ChaCha12, ChaCha20, Key, Nonce}; #[cfg(feature = "cipher")] pub use cipher; +#[cfg(feature = "cipher")] +pub use cipher::KeyIvInit; #[cfg(feature = "legacy")] -pub use legacy::{ChaCha20Legacy, LegacyNonce}; +pub use legacy::{ChaCha20Legacy, ChaCha20LegacyCore, LegacyNonce}; #[cfg(feature = "rng")] pub use rand_core; #[cfg(feature = "rng")] pub use rng::{ChaCha8Rng, ChaCha12Rng, ChaCha20Rng, Seed, SerializedRngState}; #[cfg(feature = "xchacha")] -pub use xchacha::{XChaCha8, XChaCha12, XChaCha20, XNonce, hchacha}; +pub use xchacha::{XChaCha8, XChaCha12, XChaCha20, XKey, XNonce, hchacha}; use cfg_if::cfg_if; use core::{fmt, marker::PhantomData}; diff --git a/chacha20/src/xchacha.rs b/chacha20/src/xchacha.rs index 66e236bf..a377d8c2 100644 --- a/chacha20/src/xchacha.rs +++ b/chacha20/src/xchacha.rs @@ -14,7 +14,7 @@ use cipher::{ use zeroize::ZeroizeOnDrop; /// Key type used by all ChaCha variants. -pub type Key = Array; +pub type XKey = Array; /// Nonce type used by XChaCha variants. pub type XNonce = Array; @@ -57,7 +57,7 @@ impl BlockSizeUser for XChaChaCore { } impl KeyIvInit for XChaChaCore { - fn new(key: &Key, iv: &XNonce) -> Self { + fn new(key: &XKey, iv: &XNonce) -> Self { #[allow(clippy::unwrap_used)] let subkey = hchacha::(key, iv[..16].as_ref().try_into().unwrap()); @@ -113,7 +113,7 @@ impl ZeroizeOnDrop for XChaChaCore {} /// /// #[must_use] -pub fn hchacha(key: &Key, input: &Array) -> Array { +pub fn hchacha(key: &XKey, input: &Array) -> Array { let mut state = [0u32; STATE_WORDS]; state[..4].copy_from_slice(&CONSTANTS); From 641070935c51e80fdb204b6b3f19b8d1f977d2a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Mon, 15 Jun 2026 03:34:20 +0300 Subject: [PATCH 2/6] remove Xkey --- chacha20/src/legacy.rs | 4 +--- chacha20/src/lib.rs | 2 +- chacha20/src/xchacha.rs | 9 +++------ 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/chacha20/src/legacy.rs b/chacha20/src/legacy.rs index 9ec0d94a..3f6de311 100644 --- a/chacha20/src/legacy.rs +++ b/chacha20/src/legacy.rs @@ -1,7 +1,6 @@ //! Legacy version of ChaCha20 with a 64-bit nonce -use crate::chacha::Key; -use crate::{ChaChaCore, R20}; +use crate::{ChaChaCore, Key, R20, variants::Legacy}; use cipher::{ IvSizeUser, KeyIvInit, KeySizeUser, StreamCipherCoreWrapper, array::Array, @@ -10,7 +9,6 @@ use cipher::{ /// Nonce type used by [`ChaCha20Legacy`]. pub type LegacyNonce = Array; -use crate::variants::Legacy; /// The ChaCha20 stream cipher (legacy "djb" construction with 64-bit nonce). pub type ChaCha20Legacy = StreamCipherCoreWrapper; diff --git a/chacha20/src/lib.rs b/chacha20/src/lib.rs index 06fcba88..dbf726cb 100644 --- a/chacha20/src/lib.rs +++ b/chacha20/src/lib.rs @@ -31,7 +31,7 @@ pub use rand_core; #[cfg(feature = "rng")] pub use rng::{ChaCha8Rng, ChaCha12Rng, ChaCha20Rng, Seed, SerializedRngState}; #[cfg(feature = "xchacha")] -pub use xchacha::{XChaCha8, XChaCha12, XChaCha20, XKey, XNonce, hchacha}; +pub use xchacha::{XChaCha8, XChaCha12, XChaCha20, XNonce, hchacha}; use cfg_if::cfg_if; use core::{fmt, marker::PhantomData}; diff --git a/chacha20/src/xchacha.rs b/chacha20/src/xchacha.rs index a377d8c2..6f8b05d1 100644 --- a/chacha20/src/xchacha.rs +++ b/chacha20/src/xchacha.rs @@ -1,7 +1,7 @@ //! XChaCha is an extended nonce variant of ChaCha use crate::{ - CONSTANTS, ChaChaCore, R8, R12, R20, Rounds, STATE_WORDS, quarter_round, variants::Ietf, + CONSTANTS, ChaChaCore, Key, R8, R12, R20, Rounds, STATE_WORDS, quarter_round, variants::Ietf, }; use cipher::{ BlockSizeUser, IvSizeUser, KeyIvInit, KeySizeUser, StreamCipherClosure, StreamCipherCore, @@ -13,9 +13,6 @@ use cipher::{ #[cfg(feature = "zeroize")] use zeroize::ZeroizeOnDrop; -/// Key type used by all ChaCha variants. -pub type XKey = Array; - /// Nonce type used by XChaCha variants. pub type XNonce = Array; @@ -57,7 +54,7 @@ impl BlockSizeUser for XChaChaCore { } impl KeyIvInit for XChaChaCore { - fn new(key: &XKey, iv: &XNonce) -> Self { + fn new(key: &Key, iv: &XNonce) -> Self { #[allow(clippy::unwrap_used)] let subkey = hchacha::(key, iv[..16].as_ref().try_into().unwrap()); @@ -113,7 +110,7 @@ impl ZeroizeOnDrop for XChaChaCore {} /// /// #[must_use] -pub fn hchacha(key: &XKey, input: &Array) -> Array { +pub fn hchacha(key: &Key, input: &Array) -> Array { let mut state = [0u32; STATE_WORDS]; state[..4].copy_from_slice(&CONSTANTS); From 391ac6d2508f47e1bd864ada1a826f9fb9be0096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Mon, 15 Jun 2026 03:35:25 +0300 Subject: [PATCH 3/6] Update changelog --- chacha20/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/chacha20/CHANGELOG.md b/chacha20/CHANGELOG.md index 32c5df8a..66ce3da3 100644 --- a/chacha20/CHANGELOG.md +++ b/chacha20/CHANGELOG.md @@ -5,6 +5,12 @@ 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.10.1 (UNRELEASED) +### Added +- `ChaCha20LegacyCore` type and `Nonce` type alias ([#570]) + +[#570]: https://github.com/RustCrypto/stream-ciphers/pull/570 + ## 0.10.0 (2026-02-07) ### Added - `rand_core` v0.10 support ([#333], [#513]) From 87c5c34c4e370fb9d66159dfa0a1e4ff062effd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Mon, 15 Jun 2026 03:45:34 +0300 Subject: [PATCH 4/6] Update Intel SDE version --- .github/workflows/chacha20.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/chacha20.yml b/.github/workflows/chacha20.yml index 20c4d2de..03fee92a 100644 --- a/.github/workflows/chacha20.yml +++ b/.github/workflows/chacha20.yml @@ -17,8 +17,8 @@ env: CARGO_INCREMENTAL: 0 RUSTFLAGS: "-Dwarnings" # NOTE: The mirror number changes with each version so keep these in sync - SDE_FULL_VERSION_MIRROR: "859732" - SDE_FULL_VERSION: "9.58.0-2025-06-16" + SDE_FULL_VERSION_MIRROR: "915934" + SDE_FULL_VERSION: "10.8.0-2026-03-15" jobs: build: From 3ec2f9b3086e499a4bcb25851cdebffa283befca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Mon, 15 Jun 2026 03:54:32 +0300 Subject: [PATCH 5/6] disable `avx512` CI job --- .github/workflows/chacha20.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/chacha20.yml b/.github/workflows/chacha20.yml index 03fee92a..e44369c7 100644 --- a/.github/workflows/chacha20.yml +++ b/.github/workflows/chacha20.yml @@ -17,8 +17,8 @@ env: CARGO_INCREMENTAL: 0 RUSTFLAGS: "-Dwarnings" # NOTE: The mirror number changes with each version so keep these in sync - SDE_FULL_VERSION_MIRROR: "915934" - SDE_FULL_VERSION: "10.8.0-2026-03-15" + SDE_FULL_VERSION_MIRROR: "859732" + SDE_FULL_VERSION: "9.58.0-2025-06-16" jobs: build: @@ -90,6 +90,9 @@ jobs: CARGO_INCREMENTAL: 0 RUSTFLAGS: ${{ matrix.RUSTFLAGS }} steps: + # It looks like Intel blocks `curl` downloads, so the job is disabled + # until a fix is found + - if: false - uses: actions/checkout@v6 - name: Install Intel SDE run: | From 491d79146dcbf726fb8b3cd843f11c2a3bef5f2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Mon, 15 Jun 2026 03:56:52 +0300 Subject: [PATCH 6/6] fix CI --- .github/workflows/chacha20.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/chacha20.yml b/.github/workflows/chacha20.yml index e44369c7..27e8051f 100644 --- a/.github/workflows/chacha20.yml +++ b/.github/workflows/chacha20.yml @@ -79,6 +79,9 @@ jobs: # Tests for the AVX-512 backend avx512: + # It looks like Intel blocks `curl` downloads, so the job is disabled + # until a fix is found + if: false runs-on: ubuntu-latest strategy: matrix: @@ -90,9 +93,6 @@ jobs: CARGO_INCREMENTAL: 0 RUSTFLAGS: ${{ matrix.RUSTFLAGS }} steps: - # It looks like Intel blocks `curl` downloads, so the job is disabled - # until a fix is found - - if: false - uses: actions/checkout@v6 - name: Install Intel SDE run: |