Skip to content

chore(deps): upgrade RustCrypto stack to latest versions - #25

Merged
zonyitoo merged 2 commits into
mainfrom
chore/upgrade-dependencies
Aug 26, 2026
Merged

zonyitoo merged 2 commits into
mainfrom
chore/upgrade-dependencies

Conversation

@zonyitoo

@zonyitoo zonyitoo commented May 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Upgrade all cryptography dependencies to their latest versions and migrate the codebase to the new RustCrypto 0.11 ecosystem APIs. All RustCrypto crates are now pinned to their stable releases: this PR initially used the 0.11-era release candidates, and the bump to the stable publishes landed via #26 (thanks @linus-mullvad!). The stable releases contain no API changes compared to the RCs.

Dependency updates

Crate Old New
aes-gcm 0.10 0.11
aes-gcm-siv 0.11 0.12
ccm 0.5 0.6
chacha20poly1305 0.10 0.11
aead 0.5 0.6
aes 0.8 0.9
chacha20 0.9 0.10
ctr 0.9 0.10
camellia 0.1 0.2
sm4 0.5 0.6
ghash 0.5 0.6
subtle 2.5 2.6
bytes 1.3 1.11
blake3 1.3 1.8

The whole AEAD stack is moved together: the former stable 0.10 line still pins aes 0.8 and ghash 0.5, which would conflict with the upgraded block/universal-hash crates, so the unified 0.11/0.12/0.6 generation keeps dependency resolution clean.

API migration

  • Replace aead::generic_array with aead::array (hybrid-array)
  • Replace AeadInPlace with AeadInOut — encrypt_inout_detached / decrypt_inout_detached now take an InOutBuf
  • Update the SM4-GCM custom AeadCore impl: drop CiphertextOverhead, add the new TAG_POSITION associated constant
  • Replace deprecated Array::from_slice / from_mut_slice with TryFrom
  • Rename cipher::{BlockEncrypt, BlockDecrypt} imports to their BlockCipher{Encrypt,Decrypt} counterparts
  • Import Unsigned from typenum (cipher::typenum / aead::array::typenum) since the re-export at cipher::Unsigned was removed
  • Use cipher::Iv for ChaCha20 nonce (chacha20::Nonce is no longer re-exported)

Also bumps rust-version to 1.85 to match the MSRV of the new RustCrypto generation.

Verification

Verified against the stable releases (both locally and in CI):

  • cargo build --features "v1-stream v1-aead-extra v2-extra" — 0 errors, 0 warnings
  • cargo test --features "v1-stream v1-aead-extra v2-extra" — 25/25 passing
  • cargo test --features "v1-stream v1-aead-extra v2-extra aws-lc" — 25/25 passing
  • cargo clippy and build/test jobs green across ubuntu/windows/macos

Note

The pre-existing ring feature remains broken (the ring branch in aes_gcm.rs and chacha20_poly1305.rs declares helper traits but never exposes the Aes128Gcm / Aes256Gcm / ChaCha20Poly1305 structs). This bug existed before this PR and is unrelated to the dependency upgrade.

Upgrade all cryptography dependencies to their latest versions and
migrate the codebase to the new RustCrypto 0.11 ecosystem APIs.

Dependency updates:
- aes-gcm 0.10 -> 0.11.0-rc.3
- aes-gcm-siv 0.11 -> 0.12.0-rc.3
- ccm 0.5 -> 0.6.0-rc.3
- chacha20poly1305 0.10 -> 0.11.0-rc.3
- aead 0.5 -> 0.6.0-rc.10
- aes 0.8 -> 0.9
- chacha20 0.9 -> 0.10
- ctr 0.9 -> 0.10
- camellia 0.1 -> 0.2
- sm4 0.5 -> 0.6
- ghash 0.5 -> 0.6
- subtle 2.5 -> 2.6
- bytes 1.3 -> 1.11
- blake3 1.3 -> 1.8

The AEAD crates remain on their 0.11 rc releases because the stable
0.10 line still pins aes 0.8 and ghash 0.5, which would conflict with
the upgraded block/universal-hash stack.

API migration:
- Replace aead::generic_array with aead::array (hybrid-array)
- Replace AeadInPlace with AeadInOut (encrypt_inout_detached /
  decrypt_inout_detached take InOutBuf)
- Update AeadCore impl for SM4-GCM: drop CiphertextOverhead, add
  TAG_POSITION constant
- Replace deprecated Array::from_slice / from_mut_slice with TryFrom
- Rename cipher::{BlockEncrypt, BlockDecrypt} imports to their
  BlockCipher{Encrypt,Decrypt} counterparts
- Import Unsigned from typenum (cipher::typenum / aead::array::typenum)
- Use cipher::Iv for chacha20 nonce (Nonce is no longer re-exported)

Also bump rust-version to 1.85 to match the MSRV of the new
RustCrypto crates.
@faern

faern commented Jun 4, 2026

Copy link
Copy Markdown

What is left to do on this PR or what is blocking it? Asking to see if there is anything I can help with, because I would love a release of shadowsocks with aws-lc support.

@linus-mullvad

Copy link
Copy Markdown
Contributor

aes-gcm, chacha20poly1305 and aead have now reached their stable (non-RC) state. However, aes-gcm-siv and ccm seem to still only exist as RC releases for the versions you are trying to upgrade to. I filed an issue asking for their release, if they are ready: RustCrypto/AEADs#859. If they don't seem to be ready very soon, could we maybe get a shadowsocks release without this RustCrypto stack upgrade?

@linus-mullvad

Copy link
Copy Markdown
Contributor

This PR seem unblocked now! The RustCrypto project has released everything we need as stable. You can now bump all the release candidates to their stable versions. To help out I submitted that as a separate PR, but if you feel that's excessive then feel free to close it and just do the remaining upgrade here yourself. #26

aes-gcm 0.11, aes-gcm-siv 0.12, ccm 0.6, chacha20poly1305 0.11 and
aead 0.6 are now published as stable, so drop the release candidate
pins. No API changes between the rc.3 releases and stable.
@zonyitoo
zonyitoo merged commit 956072a into main Aug 26, 2026
12 checks passed
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.

3 participants