Skip to content

Commit ae4c20b

Browse files
committed
fix: fixed build errors when only v2 is enabled
1 parent d21f894 commit ae4c20b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "shadowsocks-crypto"
3-
version = "0.5.6"
3+
version = "0.5.7"
44
authors = ["luozijun <luozijun.assistant@gmail.com>", "ty <zonyitoo@gmail.com>"]
55
edition = "2021"
66
license = "MIT"
@@ -27,7 +27,7 @@ v1-aead-extra = [
2727
"subtle",
2828
"ctr",
2929
]
30-
v2 = ["aes", "aes-gcm", "blake3", "chacha20poly1305", "bytes"]
30+
v2 = ["aes", "aes-gcm", "blake3", "chacha20poly1305", "bytes", "cfg-if"]
3131
v2-extra = ["v2", "chacha20poly1305/reduced-round"]
3232

3333
ring = ["ring-compat"]

src/kind.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ impl CipherKind {
503503
RC4 => Rc4::nonce_size(),
504504
CHACHA20 => Chacha20::nonce_size(),
505505

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

515516
match *self {
517+
#[cfg(feature = "v1-aead")]
516518
AES_128_GCM => Aes128Gcm::tag_size(),
519+
#[cfg(feature = "v1-aead")]
517520
AES_256_GCM => Aes256Gcm::tag_size(),
518521

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

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

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

0 commit comments

Comments
 (0)