quic: name fields of ring::quic::KeyBuilder

This commit is contained in:
Dirkjan Ochtman 2023-12-19 12:08:54 +01:00
parent 5cd41a3d4f
commit 0591cb13a3
3 changed files with 31 additions and 31 deletions

View File

@ -30,10 +30,10 @@ pub(crate) static TLS13_CHACHA20_POLY1305_SHA256_INTERNAL: &Tls13CipherSuite = &
},
hkdf_provider: &RingHkdf(hkdf::HKDF_SHA256, hmac::HMAC_SHA256),
aead_alg: &Chacha20Poly1305Aead(AeadAlgorithm(&aead::CHACHA20_POLY1305)),
quic: Some(&super::quic::KeyBuilder(
&aead::CHACHA20_POLY1305,
&aead::quic::CHACHA20,
)),
quic: Some(&super::quic::KeyBuilder {
packet_alg: &aead::CHACHA20_POLY1305,
header_alg: &aead::quic::CHACHA20,
}),
};
/// The TLS1.3 ciphersuite TLS_AES_256_GCM_SHA384
@ -47,10 +47,10 @@ pub static TLS13_AES_256_GCM_SHA384: SupportedCipherSuite =
},
hkdf_provider: &RingHkdf(hkdf::HKDF_SHA384, hmac::HMAC_SHA384),
aead_alg: &Aes256GcmAead(AeadAlgorithm(&aead::AES_256_GCM)),
quic: Some(&super::quic::KeyBuilder(
&aead::AES_256_GCM,
&aead::quic::AES_256,
)),
quic: Some(&super::quic::KeyBuilder {
packet_alg: &aead::AES_256_GCM,
header_alg: &aead::quic::AES_256,
}),
});
/// The TLS1.3 ciphersuite TLS_AES_128_GCM_SHA256
@ -66,10 +66,10 @@ pub(crate) static TLS13_AES_128_GCM_SHA256_INTERNAL: &Tls13CipherSuite = &Tls13C
},
hkdf_provider: &RingHkdf(hkdf::HKDF_SHA256, hmac::HMAC_SHA256),
aead_alg: &Aes128GcmAead(AeadAlgorithm(&aead::AES_128_GCM)),
quic: Some(&super::quic::KeyBuilder(
&aead::AES_128_GCM,
&aead::quic::AES_128,
)),
quic: Some(&super::quic::KeyBuilder {
packet_alg: &aead::AES_128_GCM,
header_alg: &aead::quic::AES_128,
}),
};
struct Chacha20Poly1305Aead(AeadAlgorithm);

View File

@ -160,22 +160,22 @@ impl quic::PacketKey for PacketKey {
}
}
pub(crate) struct KeyBuilder(
pub(crate) &'static aead::Algorithm,
pub(crate) &'static aead::quic::Algorithm,
);
pub(crate) struct KeyBuilder {
pub(crate) packet_alg: &'static aead::Algorithm,
pub(crate) header_alg: &'static aead::quic::Algorithm,
}
impl crate::quic::Algorithm for KeyBuilder {
fn packet_key(&self, key: AeadKey, iv: Iv) -> Box<dyn quic::PacketKey> {
Box::new(super::quic::PacketKey::new(key, iv, self.0))
Box::new(super::quic::PacketKey::new(key, iv, self.packet_alg))
}
fn header_protection_key(&self, key: AeadKey) -> Box<dyn quic::HeaderProtectionKey> {
Box::new(super::quic::HeaderProtectionKey::new(key, self.1))
Box::new(super::quic::HeaderProtectionKey::new(key, self.header_alg))
}
fn aead_key_len(&self) -> usize {
self.0.key_len()
self.packet_alg.key_len()
}
}

View File

@ -30,10 +30,10 @@ pub(crate) static TLS13_CHACHA20_POLY1305_SHA256_INTERNAL: &Tls13CipherSuite = &
},
hkdf_provider: &RingHkdf(hkdf::HKDF_SHA256, hmac::HMAC_SHA256),
aead_alg: &Chacha20Poly1305Aead(AeadAlgorithm(&aead::CHACHA20_POLY1305)),
quic: Some(&super::quic::KeyBuilder(
&aead::CHACHA20_POLY1305,
&aead::quic::CHACHA20,
)),
quic: Some(&super::quic::KeyBuilder {
packet_alg: &aead::CHACHA20_POLY1305,
header_alg: &aead::quic::CHACHA20,
}),
};
/// The TLS1.3 ciphersuite TLS_AES_256_GCM_SHA384
@ -47,10 +47,10 @@ pub static TLS13_AES_256_GCM_SHA384: SupportedCipherSuite =
},
hkdf_provider: &RingHkdf(hkdf::HKDF_SHA384, hmac::HMAC_SHA384),
aead_alg: &Aes256GcmAead(AeadAlgorithm(&aead::AES_256_GCM)),
quic: Some(&super::quic::KeyBuilder(
&aead::AES_256_GCM,
&aead::quic::AES_256,
)),
quic: Some(&super::quic::KeyBuilder {
packet_alg: &aead::AES_256_GCM,
header_alg: &aead::quic::AES_256,
}),
});
/// The TLS1.3 ciphersuite TLS_AES_128_GCM_SHA256
@ -66,10 +66,10 @@ pub(crate) static TLS13_AES_128_GCM_SHA256_INTERNAL: &Tls13CipherSuite = &Tls13C
},
hkdf_provider: &RingHkdf(hkdf::HKDF_SHA256, hmac::HMAC_SHA256),
aead_alg: &Aes128GcmAead(AeadAlgorithm(&aead::AES_128_GCM)),
quic: Some(&super::quic::KeyBuilder(
&aead::AES_128_GCM,
&aead::quic::AES_128,
)),
quic: Some(&super::quic::KeyBuilder {
packet_alg: &aead::AES_128_GCM,
header_alg: &aead::quic::AES_128,
}),
};
struct Chacha20Poly1305Aead(AeadAlgorithm);