Skip to content

Commit 993ecee

Browse files
Add Aes128Ccm support for QUIC and update dependencies in Cargo.toml
1 parent 81e24eb commit 993ecee

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

src/quic.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ use typenum::Unsigned;
99

1010
use crate::aead::{DecryptBufferAdapter, EncryptBufferAdapter};
1111

12+
#[cfg(feature = "aes-ccm")]
13+
use crate::aead::aes::Aes128Ccm;
1214
#[cfg(feature = "aes-gcm")]
1315
use crate::aead::aes::{Aes128Gcm, Aes256Gcm};
1416
#[cfg(feature = "chacha20")]
@@ -48,6 +50,16 @@ impl HasHeaderKey for Aes256Gcm {
4850
}
4951
}
5052

53+
#[cfg(feature = "aes-ccm")]
54+
impl HasHeaderKey for Aes128Ccm {
55+
fn new(key: AeadKey) -> Result<HeaderProtectionKey, Error> {
56+
Ok(HeaderProtectionKey::Aes128Ecb(
57+
aes::Aes128::new_from_slice(key.as_ref())
58+
.map_err(|_| Error::General("Invalid AES-128-GCM key".into()))?,
59+
))
60+
}
61+
}
62+
5163
#[cfg(feature = "chacha20poly1305")]
5264
impl HasHeaderKey for ChaCha20Poly1305 {
5365
fn new(key: AeadKey) -> Result<HeaderProtectionKey, Error> {

src/tls13/suites/aes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ tls13_cipher_suite!(
4444
hash::SHA256,
4545
HkdfUsingHmac(hmac::SHA256),
4646
AES_128_CCM,
47-
None // TODO: add QUIC support
47+
feature_eval_expr!([feature = "quic"], Some(&crate::quic::QuicCrypto::<Aes128Ccm>::DEFAULT), else None)
4848
);
4949

5050
#[cfg(all(feature = "ccm", feature = "hash-sha256"))]

validation/quic-test/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ rust-version = "1.88.0"
88

99
[dependencies]
1010
rustls-rustcrypto = { path = "../..", default-features = false, features = [
11-
"aead-chacha20poly1305",
12-
"aead-aes-gcm",
11+
"aead-full",
1312
"der",
1413
"fast",
1514
"kx-p256",

0 commit comments

Comments
 (0)