Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugeny committed Dec 2, 2023
1 parent d0908de commit 9589623
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions russh/src/cipher/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ impl<C: StreamCipher + KeySizeUser + IvSizeUser> super::OpeningKey for OpeningKe
return Err(Error::PacketAuth);
}
}

#[allow(clippy::indexing_slicing)]
Ok(&ciphertext_in_plaintext_out[PACKET_LENGTH_LEN..])
}
}
Expand Down
7 changes: 5 additions & 2 deletions russh/src/cipher/gcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ pub struct SealingKey {

fn inc_nonce(nonce: &mut GenericArray<u8, NonceSize>) {
let mut carry = 1;
#[allow(clippy::indexing_slicing)] // length checked
for i in (0..nonce.len()).rev() {
let n = nonce[i] as u16 + carry;
nonce[i] = n as u8;
Expand All @@ -107,7 +108,7 @@ impl super::OpeningKey for OpeningKey {

fn open<'a>(
&mut self,
sequence_number: u32,
_sequence_number: u32,
ciphertext_in_plaintext_out: &'a mut [u8],
tag: &[u8],
) -> Result<&'a [u8], Error> {
Expand Down Expand Up @@ -136,6 +137,8 @@ impl super::OpeningKey for OpeningKey {
.map_err(|_| Error::DecryptionError)?;

inc_nonce(&mut self.nonce);

#[allow(clippy::indexing_slicing)]
Ok(&ciphertext_in_plaintext_out[super::PACKET_LENGTH_LEN..])
}
}
Expand Down Expand Up @@ -166,7 +169,7 @@ impl super::SealingKey for SealingKey {

fn seal(
&mut self,
sequence_number: u32,
_sequence_number: u32,
plaintext_in_ciphertext_out: &mut [u8],
tag: &mut [u8],
) {
Expand Down

0 comments on commit 9589623

Please sign in to comment.