From c13eefc8703dcf195422d231f6a9a7dc53bc0edb Mon Sep 17 00:00:00 2001 From: Justin Smith Date: Fri, 24 May 2024 10:06:38 -0400 Subject: [PATCH] Satisfy clippy --- aws-lc-rs/src/aead/tls.rs | 4 ++-- aws-lc-rs/src/cipher.rs | 9 ++++----- aws-lc-rs/src/cipher/streaming.rs | 12 +++--------- aws-lc-rs/src/key_wrap.rs | 8 ++++---- 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/aws-lc-rs/src/aead/tls.rs b/aws-lc-rs/src/aead/tls.rs index 4aca2ea401d..9331bdf1694 100644 --- a/aws-lc-rs/src/aead/tls.rs +++ b/aws-lc-rs/src/aead/tls.rs @@ -46,7 +46,7 @@ impl TlsRecordSealingKey { /// /// # Errors /// * `Unspecified`: Returned if the length of `key_bytes` does not match the chosen algorithm, - /// or if an unsupported algorithm is provided. + /// or if an unsupported algorithm is provided. pub fn new( algorithm: &'static Algorithm, protocol: TlsProtocolId, @@ -191,7 +191,7 @@ impl TlsRecordOpeningKey { /// /// # Errors /// * `Unspecified`: Returned if the length of `key_bytes` does not match the chosen algorithm, - /// or if an unsupported algorithm is provided. + /// or if an unsupported algorithm is provided. pub fn new( algorithm: &'static Algorithm, protocol: TlsProtocolId, diff --git a/aws-lc-rs/src/cipher.rs b/aws-lc-rs/src/cipher.rs index 83e7d01c58a..425c44bf1c2 100644 --- a/aws-lc-rs/src/cipher.rs +++ b/aws-lc-rs/src/cipher.rs @@ -410,8 +410,7 @@ impl UnboundCipherKey { /// /// # Errors /// - /// * [`Unspecified`] if `key_bytes.len()` does not match the - /// length required by `algorithm`. + /// * [`Unspecified`] if `key_bytes.len()` does not match the length required by `algorithm`. pub fn new(algorithm: &'static Algorithm, key_bytes: &[u8]) -> Result { let key_bytes = Buffer::new(key_bytes.to_vec()); Ok(UnboundCipherKey { @@ -488,7 +487,7 @@ impl EncryptingKey { /// /// # Errors /// * [`Unspecified`]: Returned if cipher mode requires input to be a multiple of the block length, - /// and `in_out.len()` is not. Otherwise, returned if encryption fails. + /// and `in_out.len()` is not. Otherwise, returned if encryption fails. pub fn encrypt(&self, in_out: &mut [u8]) -> Result { let context = self.algorithm.new_encryption_context(self.mode)?; self.less_safe_encrypt(in_out, context) @@ -501,7 +500,7 @@ impl EncryptingKey { /// /// # Errors /// * [`Unspecified`]: Returned if cipher mode requires input to be a multiple of the block length, - /// and `in_out.len()` is not. Otherwise returned if encryption fails. + /// and `in_out.len()` is not. Otherwise returned if encryption fails. pub fn less_safe_encrypt( &self, in_out: &mut [u8], @@ -575,7 +574,7 @@ impl DecryptingKey { /// /// # Errors /// * [`Unspecified`]: Returned if cipher mode requires input to be a multiple of the block length, - /// and `in_out.len()` is not. Also returned if decryption fails. + /// and `in_out.len()` is not. Also returned if decryption fails. pub fn decrypt<'in_out>( &self, in_out: &'in_out mut [u8], diff --git a/aws-lc-rs/src/cipher/streaming.rs b/aws-lc-rs/src/cipher/streaming.rs index d1d4e180346..90e5e478604 100644 --- a/aws-lc-rs/src/cipher/streaming.rs +++ b/aws-lc-rs/src/cipher/streaming.rs @@ -390,9 +390,7 @@ mod tests { let mut buffer_update = encrypt_key .update(&plaintext, &mut ciphertext_buff) .unwrap(); - let (decrypt_ctx, _) = encrypt_key - .finish(&mut buffer_update.remainder_mut()) - .unwrap(); + let (decrypt_ctx, _) = encrypt_key.finish(buffer_update.remainder_mut()).unwrap(); let unbound_key2 = UnboundCipherKey::new(cipher_alg, &key).unwrap(); let mut decrypt_key = @@ -402,9 +400,7 @@ mod tests { let mut buffer_update = decrypt_key .update(&ciphertext_buff, &mut plaintext_buff) .unwrap(); - let _ = decrypt_key - .finish(&mut buffer_update.remainder_mut()) - .unwrap(); + let _ = decrypt_key.finish(buffer_update.remainder_mut()).unwrap(); assert_eq!(&plaintext_buff, &plaintext); } @@ -444,9 +440,7 @@ mod tests { let mut buffer_update = decrypt_key .update(&ciphertext_buff[0..ciphertext_len], &mut plaintext_buff) .unwrap(); - let _ = decrypt_key - .finish(&mut buffer_update.remainder_mut()) - .unwrap(); + let _ = decrypt_key.finish(buffer_update.remainder_mut()).unwrap(); assert_eq!(&plaintext_buff[0..plaintext_len], &plaintext); } diff --git a/aws-lc-rs/src/key_wrap.rs b/aws-lc-rs/src/key_wrap.rs index bcda7e634bc..fa968e37812 100644 --- a/aws-lc-rs/src/key_wrap.rs +++ b/aws-lc-rs/src/key_wrap.rs @@ -205,7 +205,7 @@ impl KeyWrap for KeyEncryptionKey { /// /// # Errors /// * [`Unspecified`]: An error occurred either due to `output` being insufficiently sized, `input` exceeding - /// the allowed input size, or for other unspecified reasons. + /// the allowed input size, or for other unspecified reasons. fn wrap<'output>( self, plaintext: &[u8], @@ -259,7 +259,7 @@ impl KeyWrap for KeyEncryptionKey { /// /// # Errors /// * [`Unspecified`]: An error occurred either due to `output` being insufficiently sized, `input` exceeding - /// the allowed input size, or for other unspecified reasons. + /// the allowed input size, or for other unspecified reasons. fn unwrap<'output>( self, ciphertext: &[u8], @@ -318,7 +318,7 @@ impl KeyWrapPadded for KeyEncryptionKey { /// /// # Errors /// * [`Unspecified`]: An error occurred either due to `output` being insufficiently sized, `input` exceeding - /// the allowed input size, or for other unspecified reasons. + /// the allowed input size, or for other unspecified reasons. fn wrap_with_padding<'output>( self, plaintext: &[u8], @@ -364,7 +364,7 @@ impl KeyWrapPadded for KeyEncryptionKey { /// /// # Errors /// * [`Unspecified`]: An error occurred either due to `output` being insufficiently sized, `input` exceeding - /// the allowed input size, or for other unspecified reasons. + /// the allowed input size, or for other unspecified reasons. fn unwrap_with_padding<'output>( self, ciphertext: &[u8],