Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aes: move Block8 to the hazmat module #463

Merged
merged 2 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
aes: move Block8 to the hazmat module
  • Loading branch information
newpavlov committed Jan 29, 2025
commit 4417227885f12b3dcc1804ca1236efa2cc7dcfba
2 changes: 1 addition & 1 deletion aes/src/armv8/hazmat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! implementations in this crate, but instead provides raw AES-NI accelerated
//! access to the AES round function gated under the `hazmat` crate feature.

use crate::{Block, Block8};
use crate::hazmat::{Block, Block8};
use core::arch::aarch64::*;

/// AES cipher (encrypt) round function.
Expand Down
6 changes: 5 additions & 1 deletion aes/src/hazmat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
//! We do NOT recommend using it to implement any algorithm which has not
//! received extensive peer review by cryptographers.

use crate::{soft::fixslice::hazmat as soft, Block, Block8};
use crate::soft::fixslice::hazmat as soft;

pub use crate::Block;
/// Eight 128-bit AES blocks
pub type Block8 = cipher::array::Array<Block, cipher::consts::U8>;

#[cfg(all(target_arch = "aarch64", not(aes_force_soft)))]
use crate::armv8::hazmat as intrinsics;
Expand Down
4 changes: 1 addition & 3 deletions aes/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,11 @@ cfg_if! {
pub use cipher;
use cipher::{
array::Array,
consts::{U16, U8},
consts::U16,
};

/// 128-bit AES block
pub type Block = Array<u8, U16>;
/// Eight 128-bit AES blocks
pub type Block8 = Array<Block, U8>;

#[cfg(test)]
mod tests {
Expand Down
2 changes: 1 addition & 1 deletion aes/src/ni/hazmat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! access to the AES round function gated under the `hazmat` crate feature.

use super::arch::*;
use crate::{Block, Block8};
use crate::hazmat::{Block, Block8};
use cipher::array::{Array, ArraySize};

#[target_feature(enable = "sse2")]
Expand Down
2 changes: 1 addition & 1 deletion aes/src/soft/fixslice32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@ pub(crate) mod hazmat {
bitslice, inv_bitslice, inv_mix_columns_0, inv_shift_rows_1, inv_sub_bytes, mix_columns_0,
shift_rows_1, sub_bytes, sub_bytes_nots, State,
};
use crate::{Block, Block8};
use crate::hazmat::{Block, Block8};

/// XOR the `src` block into the `dst` block in-place.
fn xor_in_place(dst: &mut Block, src: &Block) {
Expand Down
2 changes: 1 addition & 1 deletion aes/src/soft/fixslice64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,7 @@ pub(crate) mod hazmat {
bitslice, inv_bitslice, inv_mix_columns_0, inv_shift_rows_1, inv_sub_bytes, mix_columns_0,
shift_rows_1, sub_bytes, sub_bytes_nots, State,
};
use crate::{Block, Block8};
use crate::hazmat::{Block, Block8};

/// XOR the `src` block into the `dst` block in-place.
fn xor_in_place(dst: &mut Block, src: &Block) {
Expand Down
2 changes: 1 addition & 1 deletion aes/tests/hazmat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// TODO(tarcieri): support for using the hazmat functions with the `soft` backend
#![cfg(feature = "hazmat")]

use aes::{Block, Block8};
use aes::hazmat::{Block, Block8};
use hex_literal::hex;

/// Round function tests vectors.
Expand Down
Loading