From 1e726997383fa1013214364ba7daa85556e684f9 Mon Sep 17 00:00:00 2001 From: occheung Date: Thu, 15 Oct 2020 22:25:09 +0800 Subject: [PATCH] cipher: bare impl --- src/tls.rs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/tls.rs b/src/tls.rs index a4afa88..abf33e8 100644 --- a/src/tls.rs +++ b/src/tls.rs @@ -335,12 +335,31 @@ impl TlsSocket { .diffie_hellman(&server_public) .expect("Unsupported key"); let cipher = match selected_cipher { + CipherSuite::TLS_AES_128_GCM_SHA256 => { + Cipher::TLS_AES_128_GCM_SHA256( + todo!() + ) + }, CipherSuite::TLS_AES_256_GCM_SHA384 => { Cipher::TLS_AES_256_GCM_SHA384( Aes256Gcm::new(shared.as_bytes()) ) + }, + CipherSuite::TLS_CHACHA20_POLY1305_SHA256 => { + Cipher::TLS_CHACHA20_POLY1305_SHA256( + ChaCha20Poly1305::new(shared.as_bytes()) + ) + }, + CipherSuite::TLS_AES_128_CCM_SHA256 => { + Cipher::TLS_AES_128_CCM_SHA256( + todo!() + ) + }, + // CCM_8 is not supported + // TODO: Abort communication + CipherSuite::TLS_AES_128_CCM_8_SHA256 => { + todo!() } - _ => todo!() }; self.cipher.replace(Some(cipher)); }