Skip to content

Commit

Permalink
Satisfy clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed May 24, 2024
1 parent 05e253e commit b5ff9ac
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 20 deletions.
4 changes: 2 additions & 2 deletions aws-lc-rs/src/aead/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
9 changes: 4 additions & 5 deletions aws-lc-rs/src/cipher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self, Unspecified> {
let key_bytes = Buffer::new(key_bytes.to_vec());
Ok(UnboundCipherKey {
Expand Down Expand Up @@ -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<DecryptionContext, Unspecified> {
let context = self.algorithm.new_encryption_context(self.mode)?;
self.less_safe_encrypt(in_out, context)
Expand All @@ -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],
Expand Down Expand Up @@ -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],
Expand Down
12 changes: 3 additions & 9 deletions aws-lc-rs/src/cipher/streaming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,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 =
Expand All @@ -394,9 +392,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);
}
Expand Down Expand Up @@ -436,9 +432,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);
}
Expand Down
8 changes: 4 additions & 4 deletions aws-lc-rs/src/key_wrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ impl KeyWrap for KeyEncryptionKey<AesBlockCipher> {
///
/// # 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],
Expand Down Expand Up @@ -259,7 +259,7 @@ impl KeyWrap for KeyEncryptionKey<AesBlockCipher> {
///
/// # 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],
Expand Down Expand Up @@ -318,7 +318,7 @@ impl KeyWrapPadded for KeyEncryptionKey<AesBlockCipher> {
///
/// # 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],
Expand Down Expand Up @@ -364,7 +364,7 @@ impl KeyWrapPadded for KeyEncryptionKey<AesBlockCipher> {
///
/// # 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],
Expand Down

0 comments on commit b5ff9ac

Please sign in to comment.