Skip to content

Commit

Permalink
chacha20_poly1305_openssh: Rename confusing variable (NFC).
Browse files Browse the repository at this point in the history
`open_in_place` takes ciphertext in and outputs plaintext, and it
already has a local variable with a name to that effect. It is very
confusing to then have a variable named `plaintext_in_ciphertext_out`
in this function. Probably it was copy-pasta from `seal_in_place`.
  • Loading branch information
briansmith committed Jan 16, 2025
1 parent f2116eb commit 6aec280
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/aead/chacha20_poly1305_openssh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,11 @@ impl OpeningKey {
verify(poly_key, ciphertext_in_plaintext_out, tag)?;

// Won't panic because the length was checked above.
let plaintext_in_ciphertext_out = &mut ciphertext_in_plaintext_out[PACKET_LENGTH_LEN..];
let after_packet_length = &mut ciphertext_in_plaintext_out[PACKET_LENGTH_LEN..];

self.key
.k_2
.encrypt_in_place(counter, plaintext_in_ciphertext_out);
self.key.k_2.encrypt_in_place(counter, after_packet_length);

Ok(plaintext_in_ciphertext_out)
Ok(after_packet_length)
}
}

Expand Down

0 comments on commit 6aec280

Please sign in to comment.