Skip to content

Commit fb92bbc

Browse files
committed
Added CI support for bitsliced AES
1 parent fd578e4 commit fb92bbc

File tree

3 files changed

+38
-6
lines changed

3 files changed

+38
-6
lines changed

.github/workflows/runtest.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ on:
1515
required: false
1616
type: string
1717
default: ''
18+
extra-features:
19+
required: false
20+
type: string
21+
default: ''
1822

1923
jobs:
2024
test:
@@ -36,5 +40,5 @@ jobs:
3640
- name: Test
3741
run: |
3842
chmod 777 ./ci/run-docker.sh
39-
./ci/run-docker.sh ${{ inputs.arch }} ${{ inputs.target }} ${{ inputs.channel == 'nightly' && '--features=nightly' || '' }}
43+
./ci/run-docker.sh ${{ inputs.arch }} ${{ inputs.target }} ${{ inputs.extra-features }}
4044
shell: bash

.github/workflows/rust.yml

+31-3
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,21 @@ jobs:
3232
target: x86_64-unknown-linux-gnu
3333
caps: X86_64_UNKNOWN_LINUX_GNU
3434
target-features: +vaes
35+
extra-features: --features=nightly
3536
- name: AES-NI with VAES and AVX-512
3637
target: x86_64-unknown-linux-gnu
3738
caps: X86_64_UNKNOWN_LINUX_GNU
3839
target-features: +vaes,+avx512f
40+
extra-features: --features=nightly
3941
- name: Neon
4042
target: aarch64-unknown-linux-gnu
4143
caps: AARCH64_UNKNOWN_LINUX_GNU
4244
target-features: +aes
45+
- name: ARMv8
46+
target: armv7-unknown-linux-gnueabihf
47+
caps: ARMV7_UNKNOWN_LINUX_GNUEABIHF
48+
target-features: +v8,+aes
49+
extra-features: --features=nightly
4350
- name: RV64
4451
target: riscv64gc-unknown-linux-gnu
4552
caps: RISCV64GC_UNKNOWN_LINUX_GNU
@@ -52,6 +59,11 @@ jobs:
5259
target: x86_64-unknown-linux-gnu
5360
caps: X86_64_UNKNOWN_LINUX_GNU
5461
target-features: ''
62+
- name: Constant-Time
63+
target: x86_64-unknown-linux-gnu
64+
caps: X86_64_UNKNOWN_LINUX_GNU
65+
target-features: ''
66+
extra-features: --features=constant-time
5567
steps:
5668
- uses: actions/checkout@v3
5769

@@ -67,7 +79,7 @@ jobs:
6779
override: true
6880

6981
- name: Clippy Check
70-
run: cargo clippy --target ${{ matrix.impl.target }} --features=nightly --no-deps -- -D clippy::pedantic
82+
run: cargo clippy --target ${{ matrix.impl.target }} ${{ matrix.impl.extra-features }} --no-deps -- -D clippy::pedantic
7183

7284
test-aesni:
7385
strategy:
@@ -89,6 +101,7 @@ jobs:
89101
target: x86_64-unknown-linux-gnu
90102
channel: nightly
91103
target-features: +vaes
104+
extra-features: --features=nightly
92105

93106
test-aesni-vaes-avx512:
94107
name: Test of AESNI with VAES and AVX512F
@@ -98,6 +111,7 @@ jobs:
98111
target: x86_64-unknown-linux-gnu
99112
channel: nightly
100113
target-features: +vaes,+avx512f
114+
extra-features: --features=nightly
101115

102116
test-neon:
103117
strategy:
@@ -118,7 +132,8 @@ jobs:
118132
arch: arm
119133
target: armv7-unknown-linux-gnueabihf
120134
channel: nightly
121-
target-features: +aes
135+
target-features: +v8,+aes
136+
extra-features: --features=nightly
122137

123138
test-riscv64:
124139
name: Test of RiscV-64
@@ -128,6 +143,7 @@ jobs:
128143
target: riscv64gc-unknown-linux-gnu
129144
channel: nightly
130145
target-features: +zkne,+zknd
146+
extra-features: --features=nightly
131147

132148
test-software:
133149
strategy:
@@ -138,4 +154,16 @@ jobs:
138154
with:
139155
arch: x86_64
140156
target: x86_64-unknown-linux-gnu
141-
channel: ${{ matrix.channel }}
157+
channel: ${{ matrix.channel }}
158+
159+
test-constant-time:
160+
strategy:
161+
matrix:
162+
channel: [ stable, beta, nightly ]
163+
name: Test of Constant-time Implementation with ${{ matrix.channel }}
164+
uses: ./.github/workflows/runtest.yml
165+
with:
166+
arch: x86_64
167+
target: x86_64-unknown-linux-gnu
168+
channel: ${{ matrix.channel }}
169+
extra-features: --features=constant-time

src/aes_bitslice.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const fn step_b(a: u128, mask: u128) -> u128 {
2828
(x | (x >> 1)) ^ ((a << 1) & mask)
2929
}
3030

31+
#[allow(clippy::cast_possible_truncation)]
3132
const fn sub_word(x: u32) -> u32 {
3233
// Check if rustc is enough to optimize this
3334
subbytes(x as u128) as u32
@@ -155,9 +156,8 @@ const fn invsubbytes(x: u128) -> u128 {
155156
let y = ror1(y);
156157
let x = x ^ (y & rep(0xfb));
157158
let y = ror1(y);
158-
let x = x ^ (y & rep(0x7d));
159159

160-
x
160+
x ^ (y & rep(0x7d))
161161
}
162162

163163
const fn shiftrows(state: [u8; 16]) -> [u8; 16] {

0 commit comments

Comments
 (0)