Skip to content

Commit

Permalink
chacha20_poly1305_openssh: Reformat seal_in_place (NFC).
Browse files Browse the repository at this point in the history
  • Loading branch information
briansmith committed Jan 16, 2025
1 parent 525d577 commit b5f73c0
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/aead/chacha20_poly1305_openssh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,15 @@ impl SealingKey {
let mut counter = make_counter(sequence_number);
let poly_key = derive_poly1305_key(&self.key.k_2, counter.increment());

{
let (len_in_out, data_and_padding_in_out) =
plaintext_in_ciphertext_out.split_at_mut(PACKET_LENGTH_LEN);

self.key
.k_1
.encrypt_in_place(make_counter(sequence_number), len_in_out);
self.key
.k_2
.encrypt_in_place(counter, data_and_padding_in_out);
}
let (len_in_out, data_and_padding_in_out) =
plaintext_in_ciphertext_out.split_at_mut(PACKET_LENGTH_LEN);

self.key
.k_1
.encrypt_in_place(make_counter(sequence_number), len_in_out);
self.key
.k_2
.encrypt_in_place(counter, data_and_padding_in_out);

let Tag(tag) = poly1305::sign(poly_key, plaintext_in_ciphertext_out, cpu_features);
*tag_out = tag;
Expand Down

0 comments on commit b5f73c0

Please sign in to comment.