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

ParBlocksSizeUser impls #317

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions aes/src/armv8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ macro_rules! define_aes_impl {
}
}

impl ParBlocksSizeUser for $name {
type ParBlocksSize = U8;
}

impl fmt::Debug for $name {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
f.write_str(concat!(stringify!($name), " { .. }"))
Expand Down
4 changes: 4 additions & 0 deletions aes/src/ni.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ macro_rules! define_aes_impl {
}
}

impl ParBlocksSizeUser for $name {
type ParBlocksSize = U8;
}

impl fmt::Debug for $name {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
f.write_str(concat!(stringify!($name), " { .. }"))
Expand Down
4 changes: 4 additions & 0 deletions aes/src/soft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ macro_rules! define_aes_impl {
}
}

impl ParBlocksSizeUser for $name {
type ParBlocksSize = FixsliceBlocks;
}

impl From<$name_enc> for $name {
#[inline]
fn from(enc: $name_enc) -> $name {
Expand Down
8 changes: 6 additions & 2 deletions kuznyechik/src/soft/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{BlockSize, Key, KeySize};
use cipher::{
AlgorithmName, BlockCipher, BlockClosure, BlockDecrypt, BlockEncrypt, BlockSizeUser, KeyInit,
KeySizeUser,
consts::U1, AlgorithmName, BlockCipher, BlockClosure, BlockDecrypt, BlockEncrypt,
BlockSizeUser, KeyInit, KeySizeUser, ParBlocksSizeUser,
};
use core::fmt;

Expand Down Expand Up @@ -65,6 +65,10 @@ impl BlockDecrypt for Kuznyechik {
}
}

impl ParBlocksSizeUser for Kuznyechik {
type ParBlocksSize = U1;
}

impl fmt::Debug for Kuznyechik {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
f.write_str("Kuznyechik { ... }")
Expand Down
2 changes: 1 addition & 1 deletion kuznyechik/src/sse2/backends.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use core::arch::x86_64::*;

pub(super) type RoundKeys = [__m128i; 10];

type ParBlocksSize = U4;
pub(crate) type ParBlocksSize = U4;

#[rustfmt::skip]
macro_rules! unroll_par {
Expand Down
6 changes: 5 additions & 1 deletion kuznyechik/src/sse2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use crate::{BlockSize, Key, KeySize};
use cipher::{
AlgorithmName, BlockCipher, BlockClosure, BlockDecrypt, BlockEncrypt, BlockSizeUser, KeyInit,
KeySizeUser,
KeySizeUser, ParBlocksSizeUser,
};
use core::fmt;

Expand Down Expand Up @@ -72,6 +72,10 @@ impl BlockDecrypt for Kuznyechik {
}
}

impl ParBlocksSizeUser for Kuznyechik {
type ParBlocksSize = backends::ParBlocksSize;
}

impl fmt::Debug for Kuznyechik {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
f.write_str("Kuznyechik { ... }")
Expand Down