From 7cc44151d5efebde5d6df7f2d0df81c6233bf5a1 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Tue, 10 Oct 2023 21:06:31 -0700 Subject: [PATCH] Remove use of `ring::endian` from `aead::chacha20_poly1305_openssh`. This is a step towards removing `ArrayEncoding::as_byte_array()`. --- src/aead/chacha20_poly1305_openssh.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/aead/chacha20_poly1305_openssh.rs b/src/aead/chacha20_poly1305_openssh.rs index 585914b14d..b8aa999fbc 100644 --- a/src/aead/chacha20_poly1305_openssh.rs +++ b/src/aead/chacha20_poly1305_openssh.rs @@ -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 { @@ -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.