Skip to content

Commit

Permalink
fix: fixed build errors when only v2 is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
zonyitoo committed Nov 2, 2024
1 parent d21f894 commit ae4c20b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "shadowsocks-crypto"
version = "0.5.6"
version = "0.5.7"
authors = ["luozijun <[email protected]>", "ty <[email protected]>"]
edition = "2021"
license = "MIT"
Expand All @@ -27,7 +27,7 @@ v1-aead-extra = [
"subtle",
"ctr",
]
v2 = ["aes", "aes-gcm", "blake3", "chacha20poly1305", "bytes"]
v2 = ["aes", "aes-gcm", "blake3", "chacha20poly1305", "bytes", "cfg-if"]
v2-extra = ["v2", "chacha20poly1305/reduced-round"]

ring = ["ring-compat"]
Expand Down
4 changes: 4 additions & 0 deletions src/kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ impl CipherKind {
RC4 => Rc4::nonce_size(),
CHACHA20 => Chacha20::nonce_size(),

#[allow(unreachable_patterns)]
_ => panic!("only support Stream ciphers"),
}
}
Expand All @@ -513,7 +514,9 @@ impl CipherKind {
use self::CipherKind::*;

match *self {
#[cfg(feature = "v1-aead")]
AES_128_GCM => Aes128Gcm::tag_size(),
#[cfg(feature = "v1-aead")]
AES_256_GCM => Aes256Gcm::tag_size(),

#[cfg(feature = "v1-aead-extra")]
Expand All @@ -526,6 +529,7 @@ impl CipherKind {
#[cfg(feature = "v1-aead-extra")]
AES_256_CCM => Aes256Ccm::tag_size(),

#[cfg(feature = "v1-aead")]
CHACHA20_POLY1305 => ChaCha20Poly1305::tag_size(),

#[cfg(feature = "v1-aead-extra")]
Expand Down

0 comments on commit ae4c20b

Please sign in to comment.