From 0d78b5dcd06d48f7cee14d89701ed9c5bc440854 Mon Sep 17 00:00:00 2001 From: lubeilin <1791778603@qq.com> Date: Sat, 2 Sep 2023 12:51:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=91=98=E8=A6=81=E5=8F=AF?= =?UTF-8?q?=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cipher/aes_gcm_cipher.rs | 4 ++-- src/cipher/ring_aes_gcm_cipher.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cipher/aes_gcm_cipher.rs b/src/cipher/aes_gcm_cipher.rs index 2de496c..3802948 100644 --- a/src/cipher/aes_gcm_cipher.rs +++ b/src/cipher/aes_gcm_cipher.rs @@ -44,7 +44,7 @@ impl Aes256GcmCipher { nonce_raw[11] = net_packet.source_ttl(); let nonce: &GenericArray = Nonce::from_slice(&nonce_raw); - let mut secret_body = SecretBody::new(net_packet.payload_mut())?; + let mut secret_body = SecretBody::new(net_packet.payload_mut(), true)?; let tag = secret_body.tag(); let finger = self .finger @@ -86,7 +86,7 @@ impl Aes256GcmCipher { nonce_raw[11] = net_packet.source_ttl(); let nonce: &GenericArray = Nonce::from_slice(&nonce_raw); net_packet.set_data_len(net_packet.data_len() + ENCRYPTION_RESERVED)?; - let mut secret_body = SecretBody::new(net_packet.payload_mut())?; + let mut secret_body = SecretBody::new(net_packet.payload_mut(), true)?; secret_body.set_random(rand::thread_rng().next_u32()); return match self .cipher diff --git a/src/cipher/ring_aes_gcm_cipher.rs b/src/cipher/ring_aes_gcm_cipher.rs index 283f94b..f72392a 100644 --- a/src/cipher/ring_aes_gcm_cipher.rs +++ b/src/cipher/ring_aes_gcm_cipher.rs @@ -63,7 +63,7 @@ impl Aes256GcmCipher { nonce_raw[10] = net_packet.is_gateway() as u8; nonce_raw[11] = net_packet.source_ttl(); let nonce = aead::Nonce::assume_unique_for_key(nonce_raw); - let mut secret_body = SecretBody::new(net_packet.payload_mut())?; + let mut secret_body = SecretBody::new(net_packet.payload_mut(), true)?; let tag = secret_body.tag(); let finger = self .finger @@ -107,7 +107,7 @@ impl Aes256GcmCipher { let nonce = aead::Nonce::assume_unique_for_key(nonce_raw); let data_len = net_packet.data_len() + ENCRYPTION_RESERVED; net_packet.set_data_len(data_len)?; - let mut secret_body = SecretBody::new(net_packet.payload_mut())?; + let mut secret_body = SecretBody::new(net_packet.payload_mut(), true)?; secret_body.set_random(rand::thread_rng().next_u32()); let rs = match &self.cipher {