Skip to content

aesni -> 2018 edition #56

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

Closed
wants to merge 2 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: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ matrix:
rust: nightly

- env: NAME="aes+aesni test"
rust: 1.27.0
rust: 1.31.0
script: ./test_aes.sh
- env: NAME="aes+aesni test"
rust: stable
Expand All @@ -39,7 +39,7 @@ matrix:
- rust: nightly

install:
- cargo install cross || true
- cargo install cross || true

script:
- cross test --verbose --all --release --target $TARGET
Expand Down
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[workspace]
members = [
"aes/aes",
"aes/aes-soft",
"aes/aesni",
"blowfish",
"block-modes",
"cast5",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ cryptographic and security reviews.

### Minimum Supported Rust Version
All crates in this repository support Rust 1.22 or higher. (except `aesni` and
`aes` crates, which require Rust 1.27) In future minimum supported Rust version
`aes` crates, which require Rust 1.31) In future minimum supported Rust version
can be changed, but it will be done with the minor version bump.

## Usage
Expand Down
2 changes: 0 additions & 2 deletions aes/aes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,3 @@ aesni = { version = "0.6", default-features = false }

[dev-dependencies]
block-cipher-trait = { version = "0.6", features = ["dev"] }

[workspace]
3 changes: 1 addition & 2 deletions aes/aesni/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ documentation = "https://docs.rs/aesni"
repository = "https://github.com/RustCrypto/block-ciphers"
keywords = ["crypto", "aes", "rijndael", "block-cipher"]
categories = ["cryptography", "no-std"]
edition = "2018"

[dependencies]
block-cipher-trait = "0.6"
Expand All @@ -23,8 +24,6 @@ default = ["ctr"]
ctr = ["stream-cipher"]
nocheck = []

[workspace]

[package.metadata.docs.rs]
rustc-args = ["-C", "target-feature=+aes,+ssse3"]
rustdoc-args = ["-C", "target-feature=+aes,+ssse3"]
2 changes: 1 addition & 1 deletion aes/aesni/benches/aes128.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#![no_std]
#![cfg(any(target_arch = "x86_64", target_arch = "x86"))]
#![feature(test)]
extern crate aesni;
extern crate test;
use aesni;

use aesni::Aes128;
use aesni::block_cipher_trait::BlockCipher;
Expand Down
3 changes: 1 addition & 2 deletions aes/aesni/benches/aes128_ctr.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![cfg(feature = "ctr")]
#![feature(test)]
#[macro_use] extern crate stream_cipher;
extern crate aesni;
use stream_cipher::bench_sync;

bench_sync!(aesni::Aes128Ctr);
2 changes: 1 addition & 1 deletion aes/aesni/benches/aes192.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#![no_std]
#![cfg(any(target_arch = "x86_64", target_arch = "x86"))]
#![feature(test)]
extern crate aesni;
extern crate test;
use aesni;

use aesni::Aes192;
use aesni::block_cipher_trait::BlockCipher;
Expand Down
3 changes: 1 addition & 2 deletions aes/aesni/benches/aes192_ctr.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![cfg(feature = "ctr")]
#![feature(test)]
#[macro_use] extern crate stream_cipher;
extern crate aesni;
use stream_cipher::bench_sync;

bench_sync!(aesni::Aes192Ctr);
2 changes: 1 addition & 1 deletion aes/aesni/benches/aes256.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#![no_std]
#![cfg(any(target_arch = "x86_64", target_arch = "x86"))]
#![feature(test)]
extern crate aesni;
extern crate test;
use aesni;

use aesni::Aes256;
use aesni::block_cipher_trait::BlockCipher;
Expand Down
3 changes: 1 addition & 2 deletions aes/aesni/benches/aes256_ctr.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![cfg(feature = "ctr")]
#![feature(test)]
#[macro_use] extern crate stream_cipher;
extern crate aesni;
use stream_cipher::bench_sync;

bench_sync!(aesni::Aes256Ctr);
4 changes: 2 additions & 2 deletions aes/aesni/src/aes128/expand.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use arch::*;

use core::mem;

use crate::arch::*;

macro_rules! expand_round {
($enc_keys:expr, $dec_keys:expr, $pos:expr, $round:expr) => {
let mut t1 = _mm_load_si128($enc_keys.as_ptr().offset($pos - 1));
Expand Down
9 changes: 5 additions & 4 deletions aes/aesni/src/aes128/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use core::mem;

use opaque_debug::impl_opaque_debug;
use block_cipher_trait::generic_array::GenericArray;
use block_cipher_trait::generic_array::typenum::{U16, U8};
use block_cipher_trait::BlockCipher;
use arch::*;

use core::mem;
use utils::{Block128, Block128x8};
use crate::arch::*;
use crate::utils::{Block128, Block128x8};

mod expand;
#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion aes/aesni/src/aes128/test_expand.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::expand::expand;
use utils::check;
use crate::utils::check;

#[test]
fn test() {
Expand Down
4 changes: 2 additions & 2 deletions aes/aesni/src/aes192/expand.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use arch::*;

use core::{mem, ptr};

use crate::arch::*;

macro_rules! expand_round {
($t1:expr, $t3:expr, $round:expr) => {{
let mut t1 = $t1;
Expand Down
9 changes: 5 additions & 4 deletions aes/aesni/src/aes192/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use core::mem;

use opaque_debug::impl_opaque_debug;
use block_cipher_trait::generic_array::GenericArray;
use block_cipher_trait::generic_array::typenum::{U16, U24, U8};
use block_cipher_trait::BlockCipher;
use arch::*;

use core::mem;
use utils::{Block128, Block128x8};
use crate::arch::*;
use crate::utils::{Block128, Block128x8};

mod expand;
#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion aes/aesni/src/aes192/test_expand.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::expand::expand;
use utils::check;
use crate::utils::check;

#[test]
fn test() {
Expand Down
12 changes: 6 additions & 6 deletions aes/aesni/src/aes256/expand.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use arch::*;

use core::mem;

use crate::arch::*;

macro_rules! expand_round {
($enc_keys:expr, $dec_keys:expr, $pos:expr, $round:expr) => {
let mut t1 = _mm_load_si128($enc_keys.as_ptr().offset($pos - 2));;
let mut t1 = _mm_load_si128($enc_keys.as_ptr().offset($pos - 2));
let mut t2;
let mut t3 = _mm_load_si128($enc_keys.as_ptr().offset($pos - 1));;
let mut t3 = _mm_load_si128($enc_keys.as_ptr().offset($pos - 1));
let mut t4;

t2 = _mm_aeskeygenassist_si128(t3, $round);
Expand Down Expand Up @@ -41,9 +41,9 @@ macro_rules! expand_round {

macro_rules! expand_round_last {
($enc_keys:expr, $dec_keys:expr, $pos:expr, $round:expr) => {
let mut t1 = _mm_load_si128($enc_keys.as_ptr().offset($pos - 2));;
let mut t1 = _mm_load_si128($enc_keys.as_ptr().offset($pos - 2));
let mut t2;
let t3 = _mm_load_si128($enc_keys.as_ptr().offset($pos - 1));;
let t3 = _mm_load_si128($enc_keys.as_ptr().offset($pos - 1));
let mut t4;

t2 = _mm_aeskeygenassist_si128(t3, $round);
Expand Down
9 changes: 5 additions & 4 deletions aes/aesni/src/aes256/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use core::mem;

use opaque_debug::impl_opaque_debug;
use block_cipher_trait::generic_array::GenericArray;
use block_cipher_trait::generic_array::typenum::{U16, U32, U8};
use block_cipher_trait::BlockCipher;
use arch::*;

use core::mem;
use utils::{Block128, Block128x8};
use crate::arch::*;
use crate::utils::{Block128, Block128x8};

mod expand;
#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion aes/aesni/src/aes256/test_expand.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::expand::expand;
use utils::check;
use crate::utils::check;

#[test]
fn test() {
Expand Down
5 changes: 3 additions & 2 deletions aes/aesni/src/ctr.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
use core::{mem, cmp};
use arch::*;

use super::{Aes128, Aes192, Aes256};
use block_cipher_trait::BlockCipher;
use block_cipher_trait::generic_array::GenericArray;
use block_cipher_trait::generic_array::typenum::U16;
use stream_cipher::{
SyncStreamCipher, SyncStreamCipherSeek, NewStreamCipher, LoopError,
};
use opaque_debug::impl_opaque_debug;
use super::{Aes128, Aes192, Aes256};
use crate::arch::*;

const BLOCK_SIZE: usize = 16;
const PAR_BLOCKS: usize = 8;
Expand Down
6 changes: 3 additions & 3 deletions aes/aesni/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@
//! - [Intel AES-NI whitepaper](https://software.intel.com/sites/default/files/article/165683/aes-wp-2012-09-22-v01.pdf)
//! - [Use of the AES Instruction Set](https://www.cosic.esat.kuleuven.be/ecrypt/AESday/slides/Use_of_the_AES_Instruction_Set.pdf)
#![no_std]
pub extern crate block_cipher_trait;
#[macro_use] extern crate opaque_debug;
pub use block_cipher_trait;
#[cfg(feature = "ctr")]
pub extern crate stream_cipher;
pub use stream_cipher;

#[cfg(not(feature = "nocheck"))]
mod target_checks;
#[macro_use]
Expand Down
Loading