From 8a6d6f4dbeb056f6e5f51e8adbb40dca4bbeeffd Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Tue, 10 Oct 2023 18:36:19 -0700 Subject: [PATCH] GCM: Remove use of `Into<[BigEndian; 2]>`. Take a step towards removing the `u64` functionality from `Block`. --- src/aead/gcm.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/aead/gcm.rs b/src/aead/gcm.rs index c7ceedc84..c114582b5 100644 --- a/src/aead/gcm.rs +++ b/src/aead/gcm.rs @@ -16,7 +16,7 @@ use super::{ block::{Block, BLOCK_LEN}, Aad, }; -use crate::cpu; +use crate::{cpu, polyfill::ChunksFixed}; use core::ops::BitXorAssign; #[cfg(not(target_arch = "aarch64"))] @@ -30,7 +30,8 @@ pub struct Key { impl Key { pub(super) fn new(h_be: Block, cpu_features: cpu::Features) -> Self { - let h: [u64; 2] = h_be.into(); + let h_be: &[[u8; 8]; 2] = h_be.as_ref().chunks_fixed(); + let h: [u64; 2] = h_be.map(u64::from_be_bytes); let mut key = Self { h_table: HTable {