Skip to content

Commit f2f37ec

Browse files
committed
aes: remove force-soft feature
It's breaking cross-based builds. See: #208 (comment)
1 parent d8587e8 commit f2f37ec

File tree

8 files changed

+155
-204
lines changed

8 files changed

+155
-204
lines changed

.github/workflows/aes.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ jobs:
3939
- run: cargo build --release --target ${{ matrix.target }}
4040
- run: cargo build --release --target ${{ matrix.target }} --features compact
4141
- run: cargo build --release --target ${{ matrix.target }} --features ctr
42-
- run: cargo build --release --target ${{ matrix.target }} --features force-soft
4342
- run: cargo build --release --target ${{ matrix.target }} --all-features
4443

4544
# Tests for the portable software backend
@@ -74,7 +73,6 @@ jobs:
7473
- run: cargo test --release --target ${{ matrix.target }}
7574
- run: cargo test --release --target ${{ matrix.target }} --features compact
7675
- run: cargo test --release --target ${{ matrix.target }} --features ctr
77-
- run: cargo test --release --target ${{ matrix.target }} --features force-soft
7876
- run: cargo test --release --target ${{ matrix.target }} --all-features
7977

8078
# Tests for the AES-NI backend
@@ -113,7 +111,6 @@ jobs:
113111
- run: cargo test --release --target ${{ matrix.target }}
114112
- run: cargo test --release --target ${{ matrix.target }} --features compact
115113
- run: cargo test --release --target ${{ matrix.target }} --features ctr
116-
- run: cargo test --release --target ${{ matrix.target }} --features force-soft
117114
- run: cargo test --release --target ${{ matrix.target }} --all-features
118115

119116
# Cross-compiled tests
@@ -147,5 +144,4 @@ jobs:
147144
- run: cross test --release --target ${{ matrix.target }}
148145
- run: cross test --release --target ${{ matrix.target }} --features compact
149146
- run: cross test --release --target ${{ matrix.target }} --features ctr
150-
- run: cargo test --release --target ${{ matrix.target }} --features force-soft
151147
- run: cargo test --release --target ${{ matrix.target }} --all-features

aes/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ cipher = { version = "=0.3.0-pre", features = ["dev"] }
2727
cpuid-bool = "0.2"
2828

2929
[features]
30-
compact = [] # Reduce code size at the cost of performance
31-
force-soft = [] # Disable support for AES hardware intrinsics
30+
compact = [] # Reduce code size at the cost of slower performance
3231

3332
[package.metadata.docs.rs]
3433
features = ["ctr"]

aes/src/autodetect.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ pub(crate) mod ctr {
130130
}
131131

132132
mod $module {
133+
#[allow(clippy::large_enum_variant)]
133134
pub(super) enum Inner {
134135
Ni(crate::ni::$name),
135136
Soft(crate::soft::$name),

aes/src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,7 @@
6262
use cfg_if::cfg_if;
6363

6464
cfg_if! {
65-
if #[cfg(all(
66-
any(target_arch = "x86_64", target_arch = "x86"),
67-
not(feature = "force-soft")
68-
))] {
65+
if #[cfg(any(target_arch = "x86_64", target_arch = "x86"))] {
6966
mod autodetect;
7067
mod ni;
7168
mod soft;

aes/src/ni/aes128.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ impl BlockDecrypt for Aes128 {
112112
// Safety: `loadu` and `storeu` support unaligned access
113113
#[allow(clippy::cast_ptr_alignment)]
114114
let mut b = _mm_loadu_si128(block.as_ptr() as *const __m128i);
115+
115116
b = _mm_xor_si128(b, keys[10]);
116117
b = _mm_aesdec_si128(b, keys[9]);
117118
b = _mm_aesdec_si128(b, keys[8]);
@@ -123,6 +124,9 @@ impl BlockDecrypt for Aes128 {
123124
b = _mm_aesdec_si128(b, keys[2]);
124125
b = _mm_aesdec_si128(b, keys[1]);
125126
b = _mm_aesdeclast_si128(b, keys[0]);
127+
128+
// Safety: `loadu` and `storeu` support unaligned access
129+
#[allow(clippy::cast_ptr_alignment)]
126130
_mm_storeu_si128(block.as_mut_ptr() as *mut __m128i, b);
127131
}
128132

aes/src/ni/aes192.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ impl BlockDecrypt for Aes192 {
114114
// Safety: `loadu` and `storeu` support unaligned access
115115
#[allow(clippy::cast_ptr_alignment)]
116116
let mut b = _mm_loadu_si128(block.as_ptr() as *const __m128i);
117+
117118
b = _mm_xor_si128(b, keys[12]);
118119
b = _mm_aesdec_si128(b, keys[11]);
119120
b = _mm_aesdec_si128(b, keys[10]);
@@ -127,6 +128,9 @@ impl BlockDecrypt for Aes192 {
127128
b = _mm_aesdec_si128(b, keys[2]);
128129
b = _mm_aesdec_si128(b, keys[1]);
129130
b = _mm_aesdeclast_si128(b, keys[0]);
131+
132+
// Safety: `loadu` and `storeu` support unaligned access
133+
#[allow(clippy::cast_ptr_alignment)]
130134
_mm_storeu_si128(block.as_mut_ptr() as *mut __m128i, b);
131135
}
132136

aes/src/ni/aes256.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ impl BlockDecrypt for Aes256 {
118118
// Safety: `loadu` and `storeu` support unaligned access
119119
#[allow(clippy::cast_ptr_alignment)]
120120
let mut b = _mm_loadu_si128(block.as_ptr() as *const __m128i);
121+
121122
b = _mm_xor_si128(b, keys[14]);
122123
b = _mm_aesdec_si128(b, keys[13]);
123124
b = _mm_aesdec_si128(b, keys[12]);
@@ -133,6 +134,9 @@ impl BlockDecrypt for Aes256 {
133134
b = _mm_aesdec_si128(b, keys[2]);
134135
b = _mm_aesdec_si128(b, keys[1]);
135136
b = _mm_aesdeclast_si128(b, keys[0]);
137+
138+
// Safety: `loadu` and `storeu` support unaligned access
139+
#[allow(clippy::cast_ptr_alignment)]
136140
_mm_storeu_si128(block.as_mut_ptr() as *mut __m128i, b);
137141
}
138142

0 commit comments

Comments
 (0)