Skip to content

Commit

Permalink
Remove use of ring::endian from aead::chacha20_poly1305_openssh.
Browse files Browse the repository at this point in the history
This is a step towards removing `ArrayEncoding::as_byte_array()`.
  • Loading branch information
briansmith committed Oct 11, 2023
1 parent 19c0d1e commit 7cc4415
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/aead/chacha20_poly1305_openssh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use super::{
polyfill::ChunksFixed,
Nonce, Tag,
};
use crate::{constant_time, endian::*, error};
use crate::{constant_time, error};

/// A key for sealing packets.
pub struct SealingKey {
Expand Down Expand Up @@ -161,12 +161,9 @@ impl Key {
}

fn make_counter(sequence_number: u32) -> Counter {
let nonce = [
BigEndian::ZERO,
BigEndian::ZERO,
BigEndian::from(sequence_number),
];
Counter::zero(Nonce::assume_unique_for_key(*(nonce.as_byte_array())))
let [s0, s1, s2, s3] = sequence_number.to_be_bytes();
let nonce = [0, 0, 0, 0, 0, 0, 0, 0, s0, s1, s2, s3];
Counter::zero(Nonce::assume_unique_for_key(nonce))
}

/// The length of key.
Expand Down

0 comments on commit 7cc4415

Please sign in to comment.