From 93e07239319d21469a454d1eb6c26ddc80167c1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Mon, 18 Nov 2024 05:26:47 +0300 Subject: [PATCH] Rename b2b methods --- aead/src/dyn_aead.rs | 12 ++++++------ aead/src/lib.rs | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/aead/src/dyn_aead.rs b/aead/src/dyn_aead.rs index 4813710b..a18d38ed 100644 --- a/aead/src/dyn_aead.rs +++ b/aead/src/dyn_aead.rs @@ -39,7 +39,7 @@ pub trait DynAead: sealed::Sealed { buffer: &'out mut [u8], ) -> Result<&'out mut [u8]>; - fn postfix_encrypt_b2b<'out>( + fn postfix_encrypt_to_buf<'out>( &self, nonce: &[u8], associated_data: &[u8], @@ -47,7 +47,7 @@ pub trait DynAead: sealed::Sealed { buffer: &'out mut [u8], ) -> Result<&'out mut [u8]>; - fn postfix_decrypt_b2b<'out>( + fn postfix_decrypt_to_buf<'out>( &self, nonce: &[u8], associated_data: &[u8], @@ -116,7 +116,7 @@ impl DynAead for T { Aead::postfix_decrypt_inplace(self, nonce, associated_data, buffer) } - fn postfix_encrypt_b2b<'out>( + fn postfix_encrypt_to_buf<'out>( &self, nonce: &[u8], associated_data: &[u8], @@ -124,10 +124,10 @@ impl DynAead for T { buffer: &'out mut [u8], ) -> Result<&'out mut [u8]> { let nonce = nonce.try_into().map_err(|_| Error)?; - Aead::postfix_encrypt_b2b(self, nonce, associated_data, plaintext, buffer) + Aead::postfix_encrypt_to_buf(self, nonce, associated_data, plaintext, buffer) } - fn postfix_decrypt_b2b<'out>( + fn postfix_decrypt_to_buf<'out>( &self, nonce: &[u8], associated_data: &[u8], @@ -135,7 +135,7 @@ impl DynAead for T { buffer: &'out mut [u8], ) -> Result<&'out mut [u8]> { let nonce = nonce.try_into().map_err(|_| Error)?; - Aead::postfix_decrypt_b2b(self, nonce, associated_data, ciphertext, buffer) + Aead::postfix_decrypt_to_buf(self, nonce, associated_data, ciphertext, buffer) } #[cfg(feature = "alloc")] diff --git a/aead/src/lib.rs b/aead/src/lib.rs index ffb41dd5..f91161c8 100644 --- a/aead/src/lib.rs +++ b/aead/src/lib.rs @@ -132,7 +132,7 @@ pub trait Aead { /// Encrypt the data buffer-to-buffer, returning the authentication tag. #[inline] - fn detached_encrypt_b2b( + fn detached_encrypt_to_buf( &self, nonce: &Nonce, associated_data: &[u8], @@ -146,7 +146,7 @@ pub trait Aead { /// Encrypt the data buffer-to-buffer, returning an error in the event the provided /// authentication tag does not match the given ciphertext. #[inline] - fn detached_decrypt_b2b( + fn detached_decrypt_to_buf( &self, nonce: &Nonce, associated_data: &[u8], @@ -228,7 +228,7 @@ pub trait Aead { } #[inline] - fn postfix_encrypt_b2b<'out>( + fn postfix_encrypt_to_buf<'out>( &self, nonce: &Nonce, associated_data: &[u8], @@ -248,7 +248,7 @@ pub trait Aead { /// Encrypt the data buffer-to-buffer, returning an error in the event the provided /// authentication tag does not match the given ciphertext. #[inline] - fn postfix_decrypt_b2b<'out>( + fn postfix_decrypt_to_buf<'out>( &self, nonce: &Nonce, associated_data: &[u8], @@ -363,7 +363,7 @@ pub trait Aead { } else { res.as_mut().split_at_mut(tag_len) }; - let tag = self.detached_encrypt_b2b(nonce, aad, pt, ct_dst)?; + let tag = self.detached_encrypt_to_buf(nonce, aad, pt, ct_dst)?; tag_dst.copy_from_slice(&tag); Ok(res) } @@ -384,7 +384,7 @@ pub trait Aead { ct_tag.split_at(tag_len) }; let tag = tag.try_into().expect("tag has correct length"); - self.detached_decrypt_b2b(nonce, aad, ct, pt_dst.as_mut(), tag)?; + self.detached_decrypt_to_buf(nonce, aad, ct, pt_dst.as_mut(), tag)?; Ok(pt_dst) }