Skip to content

Commit

Permalink
cleanup, bump version to 1.2.0. the allow(unused) is due to avx512f-v…
Browse files Browse the repository at this point in the history
…aes targets - in that case that is never used
  • Loading branch information
sayantn committed May 19, 2024
1 parent ac6b2d1 commit bc6c2d6
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aes_crypto"
version = "1.1.0"
version = "1.2.0"
authors = ["Sayantan Chakraborty <[email protected]>"]
edition = "2021"
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
This is a pure-Rust platform-agnostic [AES](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.197-upd1.pdf) library, that
is focused on reusability and optimal performance.

This library guarantees the best performance on the `target_cpu` (if correctly specified). This currently has 5
This library guarantees the best performance on the `target_cpu` (if correctly specified). This currently has 6
implementations, among which it automatically decides the best (most performant) using Cargo's `target_feature` flags.

# The implementations and their requirements are:
Expand Down
8 changes: 4 additions & 4 deletions src/aes_riscv32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ pub struct AesBlock(u32, u32, u32, u32);
macro_rules! _asm {
($instruction:expr, $idx:literal, $rsd:ident, $rs:expr) => {
asm!(
concat!($instruction, "i {},{},{},", $idx),
lateout(reg) $rsd,
in(reg) $rsd,
in(reg) $rs,
concat!($instruction, "i {rd},{rs1},{rs2},", $idx),
rd = lateout(reg) $rsd,
rs1 = in(reg) $rsd,
rs2 = in(reg) $rs,
options(pure, nomem, nostack)
)
};
Expand Down
32 changes: 16 additions & 16 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ fn try_from_slice<const N: usize, T: From<[u8; N]>>(value: &[u8]) -> Result<T, u
}
}

#[allow(unused)]
#[inline(always)]
const fn array_from_slice<const N: usize>(value: &[u8], offset: usize) -> [u8; N] {
debug_assert!(value.len() - offset >= N);
Expand Down Expand Up @@ -491,21 +492,20 @@ fn enc_round_keys<const N: usize>(dec_round_keys: &[AesBlock; N]) -> [AesBlock;
}

cfg_if! {
if #[cfg(any(
all(
any(
target_arch = "aarch64",
target_arch = "arm64ec",
all(feature = "nightly", target_arch = "arm", target_feature = "v8")
),
target_feature = "aes",
), all(
feature = "nightly",
target_arch = "riscv32",
target_feature = "zkne",
target_feature = "zknd"
)
))] {
if #[cfg(any(
all(
any(
target_arch = "aarch64",
target_arch = "arm64ec",
all(feature = "nightly", target_arch = "arm", target_feature = "v8")
),
target_feature = "aes",
), all(
feature = "nightly",
target_arch = "riscv32",
target_feature = "zkne",
target_feature = "zknd"
)))] {
macro_rules! aes_intr {
($($name:ident),*) => {$(
impl $name {
Expand Down Expand Up @@ -558,7 +558,7 @@ if #[cfg(any(
acc.pre_dec_last($round_keys[$max - 1].into()) ^ $round_keys[$max].into()
}};
}
}else{
} else {
macro_rules! impl_aes {
(enc: $round_keys: expr, $plaintext: expr, $max:literal) => {{
let mut acc = $plaintext ^ $round_keys[0].into();
Expand Down

0 comments on commit bc6c2d6

Please sign in to comment.