Skip to content

Commit 638b54e

Browse files
committed
update cipher
1 parent 0362f58 commit 638b54e

File tree

11 files changed

+40
-40
lines changed

11 files changed

+40
-40
lines changed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aes/src/armv8.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,14 +247,14 @@ macro_rules! define_aes_impl {
247247

248248
impl<'a> BlockBackend for $name_back_enc<'a> {
249249
#[inline(always)]
250-
fn proc_block(&mut self, block: InOut<'_, Block>) {
250+
fn proc_block(&mut self, block: InOut<'_, '_, Block>) {
251251
unsafe {
252252
encrypt1(&self.0.round_keys, block);
253253
}
254254
}
255255

256256
#[inline(always)]
257-
fn proc_par_blocks(&mut self, blocks: InOut<'_, Block8>) {
257+
fn proc_par_blocks(&mut self, blocks: InOut<'_, '_, Block8>) {
258258
unsafe { encrypt8(&self.0.round_keys, blocks) }
259259
}
260260
}
@@ -271,14 +271,14 @@ macro_rules! define_aes_impl {
271271

272272
impl<'a> BlockBackend for $name_back_dec<'a> {
273273
#[inline(always)]
274-
fn proc_block(&mut self, block: InOut<'_, Block>) {
274+
fn proc_block(&mut self, block: InOut<'_, '_, Block>) {
275275
unsafe {
276276
decrypt1(&self.0.round_keys, block);
277277
}
278278
}
279279

280280
#[inline(always)]
281-
fn proc_par_blocks(&mut self, blocks: InOut<'_, Block8>) {
281+
fn proc_par_blocks(&mut self, blocks: InOut<'_, '_, Block8>) {
282282
unsafe { decrypt8(&self.0.round_keys, blocks) }
283283
}
284284
}

aes/src/armv8/encdec.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use core::arch::aarch64::*;
99
#[target_feature(enable = "neon")]
1010
pub(super) unsafe fn encrypt1<const N: usize>(
1111
expanded_keys: &[uint8x16_t; N],
12-
block: InOut<'_, Block>,
12+
block: InOut<'_, '_, Block>,
1313
) {
1414
let rounds = N - 1;
1515
assert!(rounds == 10 || rounds == 12 || rounds == 14);
@@ -40,7 +40,7 @@ pub(super) unsafe fn encrypt1<const N: usize>(
4040
#[target_feature(enable = "neon")]
4141
pub(super) unsafe fn encrypt8<const N: usize>(
4242
expanded_keys: &[uint8x16_t; N],
43-
blocks: InOut<'_, Block8>,
43+
blocks: InOut<'_, '_, Block8>,
4444
) {
4545
let rounds = N - 1;
4646
assert!(rounds == 10 || rounds == 12 || rounds == 14);
@@ -86,7 +86,7 @@ pub(super) unsafe fn encrypt8<const N: usize>(
8686
#[target_feature(enable = "neon")]
8787
pub(super) unsafe fn decrypt1<const N: usize>(
8888
expanded_keys: &[uint8x16_t; N],
89-
block: InOut<'_, Block>,
89+
block: InOut<'_, '_, Block>,
9090
) {
9191
let rounds = N - 1;
9292
assert!(rounds == 10 || rounds == 12 || rounds == 14);
@@ -116,7 +116,7 @@ pub(super) unsafe fn decrypt1<const N: usize>(
116116
#[target_feature(enable = "neon")]
117117
pub(super) unsafe fn decrypt8<const N: usize>(
118118
expanded_keys: &[uint8x16_t; N],
119-
blocks: InOut<'_, Block8>,
119+
blocks: InOut<'_, '_, Block8>,
120120
) {
121121
let rounds = N - 1;
122122
assert!(rounds == 10 || rounds == 12 || rounds == 14);

aes/src/ni.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,14 +260,14 @@ macro_rules! define_aes_impl {
260260

261261
impl<'a> BlockBackend for $name_back_enc<'a> {
262262
#[inline(always)]
263-
fn proc_block(&mut self, block: InOut<'_, Block>) {
263+
fn proc_block(&mut self, block: InOut<'_, '_, Block>) {
264264
unsafe {
265265
$module::encrypt1(&self.0.round_keys, block);
266266
}
267267
}
268268

269269
#[inline(always)]
270-
fn proc_par_blocks(&mut self, blocks: InOut<'_, Block8>) {
270+
fn proc_par_blocks(&mut self, blocks: InOut<'_, '_, Block8>) {
271271
unsafe {
272272
$module::encrypt8(&self.0.round_keys, blocks);
273273
}
@@ -286,14 +286,14 @@ macro_rules! define_aes_impl {
286286

287287
impl<'a> BlockBackend for $name_back_dec<'a> {
288288
#[inline(always)]
289-
fn proc_block(&mut self, block: InOut<'_, Block>) {
289+
fn proc_block(&mut self, block: InOut<'_, '_, Block>) {
290290
unsafe {
291291
$module::decrypt1(&self.0.round_keys, block);
292292
}
293293
}
294294

295295
#[inline(always)]
296-
fn proc_par_blocks(&mut self, blocks: InOut<'_, Block8>) {
296+
fn proc_par_blocks(&mut self, blocks: InOut<'_, '_, Block8>) {
297297
unsafe {
298298
$module::decrypt8(&self.0.round_keys, blocks);
299299
}

aes/src/ni/aes128.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub(super) type RoundKeys = [__m128i; 11];
88

99
#[inline]
1010
#[target_feature(enable = "aes")]
11-
pub(super) unsafe fn encrypt1(keys: &RoundKeys, block: InOut<'_, Block>) {
11+
pub(super) unsafe fn encrypt1(keys: &RoundKeys, block: InOut<'_, '_, Block>) {
1212
let (in_ptr, out_ptr) = block.into_raw();
1313
let mut b = _mm_loadu_si128(in_ptr as *const __m128i);
1414
b = _mm_xor_si128(b, keys[0]);
@@ -27,7 +27,7 @@ pub(super) unsafe fn encrypt1(keys: &RoundKeys, block: InOut<'_, Block>) {
2727

2828
#[inline]
2929
#[target_feature(enable = "aes")]
30-
pub(super) unsafe fn encrypt8(keys: &RoundKeys, blocks: InOut<'_, Block8>) {
30+
pub(super) unsafe fn encrypt8(keys: &RoundKeys, blocks: InOut<'_, '_, Block8>) {
3131
let (in_ptr, out_ptr) = blocks.into_raw();
3232
let mut b = load8(in_ptr);
3333
xor8(&mut b, keys[0]);
@@ -46,7 +46,7 @@ pub(super) unsafe fn encrypt8(keys: &RoundKeys, blocks: InOut<'_, Block8>) {
4646

4747
#[inline]
4848
#[target_feature(enable = "aes")]
49-
pub(super) unsafe fn decrypt1(keys: &RoundKeys, block: InOut<'_, Block>) {
49+
pub(super) unsafe fn decrypt1(keys: &RoundKeys, block: InOut<'_, '_, Block>) {
5050
let (in_ptr, out_ptr) = block.into_raw();
5151
let mut b = _mm_loadu_si128(in_ptr as *const __m128i);
5252
b = _mm_xor_si128(b, keys[10]);
@@ -65,7 +65,7 @@ pub(super) unsafe fn decrypt1(keys: &RoundKeys, block: InOut<'_, Block>) {
6565

6666
#[inline]
6767
#[target_feature(enable = "aes")]
68-
pub(super) unsafe fn decrypt8(keys: &RoundKeys, blocks: InOut<'_, Block8>) {
68+
pub(super) unsafe fn decrypt8(keys: &RoundKeys, blocks: InOut<'_, '_, Block8>) {
6969
let (in_ptr, out_ptr) = blocks.into_raw();
7070
let mut b = load8(in_ptr);
7171
xor8(&mut b, keys[10]);

aes/src/ni/aes192.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub(super) type RoundKeys = [__m128i; 13];
88

99
#[inline]
1010
#[target_feature(enable = "aes")]
11-
pub(super) unsafe fn encrypt1(keys: &RoundKeys, block: InOut<'_, Block>) {
11+
pub(super) unsafe fn encrypt1(keys: &RoundKeys, block: InOut<'_, '_, Block>) {
1212
let (in_ptr, out_ptr) = block.into_raw();
1313
let mut b = _mm_loadu_si128(in_ptr as *const __m128i);
1414
b = _mm_xor_si128(b, keys[0]);
@@ -29,7 +29,7 @@ pub(super) unsafe fn encrypt1(keys: &RoundKeys, block: InOut<'_, Block>) {
2929

3030
#[inline]
3131
#[target_feature(enable = "aes")]
32-
pub(super) unsafe fn encrypt8(keys: &RoundKeys, blocks: InOut<'_, Block8>) {
32+
pub(super) unsafe fn encrypt8(keys: &RoundKeys, blocks: InOut<'_, '_, Block8>) {
3333
let (in_ptr, out_ptr) = blocks.into_raw();
3434
let mut b = load8(in_ptr);
3535
xor8(&mut b, keys[0]);
@@ -50,7 +50,7 @@ pub(super) unsafe fn encrypt8(keys: &RoundKeys, blocks: InOut<'_, Block8>) {
5050

5151
#[inline]
5252
#[target_feature(enable = "aes")]
53-
pub(super) unsafe fn decrypt1(keys: &RoundKeys, block: InOut<'_, Block>) {
53+
pub(super) unsafe fn decrypt1(keys: &RoundKeys, block: InOut<'_, '_, Block>) {
5454
let (in_ptr, out_ptr) = block.into_raw();
5555
let mut b = _mm_loadu_si128(in_ptr as *const __m128i);
5656
b = _mm_xor_si128(b, keys[12]);
@@ -71,7 +71,7 @@ pub(super) unsafe fn decrypt1(keys: &RoundKeys, block: InOut<'_, Block>) {
7171

7272
#[inline]
7373
#[target_feature(enable = "aes")]
74-
pub(super) unsafe fn decrypt8(keys: &RoundKeys, blocks: InOut<'_, Block8>) {
74+
pub(super) unsafe fn decrypt8(keys: &RoundKeys, blocks: InOut<'_, '_, Block8>) {
7575
let (in_ptr, out_ptr) = blocks.into_raw();
7676
let mut b = load8(in_ptr);
7777
xor8(&mut b, keys[12]);

aes/src/ni/aes256.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub(super) type RoundKeys = [__m128i; 15];
88

99
#[inline]
1010
#[target_feature(enable = "aes")]
11-
pub(super) unsafe fn encrypt1(keys: &RoundKeys, block: InOut<'_, Block>) {
11+
pub(super) unsafe fn encrypt1(keys: &RoundKeys, block: InOut<'_, '_, Block>) {
1212
let (in_ptr, out_ptr) = block.into_raw();
1313
let mut b = _mm_loadu_si128(in_ptr as *const __m128i);
1414
b = _mm_xor_si128(b, keys[0]);
@@ -31,7 +31,7 @@ pub(super) unsafe fn encrypt1(keys: &RoundKeys, block: InOut<'_, Block>) {
3131

3232
#[inline]
3333
#[target_feature(enable = "aes")]
34-
pub(super) unsafe fn encrypt8(keys: &RoundKeys, blocks: InOut<'_, Block8>) {
34+
pub(super) unsafe fn encrypt8(keys: &RoundKeys, blocks: InOut<'_, '_, Block8>) {
3535
let (in_ptr, out_ptr) = blocks.into_raw();
3636
let mut b = load8(in_ptr);
3737
xor8(&mut b, keys[0]);
@@ -54,7 +54,7 @@ pub(super) unsafe fn encrypt8(keys: &RoundKeys, blocks: InOut<'_, Block8>) {
5454

5555
#[inline]
5656
#[target_feature(enable = "aes")]
57-
pub(super) unsafe fn decrypt1(keys: &RoundKeys, block: InOut<'_, Block>) {
57+
pub(super) unsafe fn decrypt1(keys: &RoundKeys, block: InOut<'_, '_, Block>) {
5858
let (in_ptr, out_ptr) = block.into_raw();
5959
let mut b = _mm_loadu_si128(in_ptr as *const __m128i);
6060
b = _mm_xor_si128(b, keys[14]);
@@ -77,7 +77,7 @@ pub(super) unsafe fn decrypt1(keys: &RoundKeys, block: InOut<'_, Block>) {
7777

7878
#[inline]
7979
#[target_feature(enable = "aes")]
80-
pub(super) unsafe fn decrypt8(keys: &RoundKeys, blocks: InOut<'_, Block8>) {
80+
pub(super) unsafe fn decrypt8(keys: &RoundKeys, blocks: InOut<'_, '_, Block8>) {
8181
let (in_ptr, out_ptr) = blocks.into_raw();
8282
let mut b = load8(in_ptr);
8383
xor8(&mut b, keys[14]);

aes/src/soft.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,15 +240,15 @@ macro_rules! define_aes_impl {
240240

241241
impl<'a> BlockBackend for $name_back_enc<'a> {
242242
#[inline(always)]
243-
fn proc_block(&mut self, mut block: InOut<'_, Block>) {
243+
fn proc_block(&mut self, mut block: InOut<'_, '_, Block>) {
244244
let mut blocks = BatchBlocks::default();
245245
blocks[0] = block.clone_in().into();
246246
let res = $fixslice_encrypt(&self.0.keys, &blocks);
247247
*block.get_out() = res[0].into();
248248
}
249249

250250
#[inline(always)]
251-
fn proc_par_blocks(&mut self, mut blocks: InOut<'_, BatchBlocks>) {
251+
fn proc_par_blocks(&mut self, mut blocks: InOut<'_, '_, BatchBlocks>) {
252252
let res = $fixslice_encrypt(&self.0.keys, blocks.get_in());
253253
*blocks.get_out() = res;
254254
}
@@ -266,15 +266,15 @@ macro_rules! define_aes_impl {
266266

267267
impl<'a> BlockBackend for $name_back_dec<'a> {
268268
#[inline(always)]
269-
fn proc_block(&mut self, mut block: InOut<'_, Block>) {
269+
fn proc_block(&mut self, mut block: InOut<'_, '_, Block>) {
270270
let mut blocks = BatchBlocks::default();
271271
blocks[0] = block.clone_in();
272272
let res = $fixslice_decrypt(&self.0.keys, &blocks);
273273
*block.get_out() = res[0];
274274
}
275275

276276
#[inline(always)]
277-
fn proc_par_blocks(&mut self, mut blocks: InOut<'_, BatchBlocks>) {
277+
fn proc_par_blocks(&mut self, mut blocks: InOut<'_, '_, BatchBlocks>) {
278278
let res = $fixslice_decrypt(&self.0.keys, blocks.get_in());
279279
*blocks.get_out() = res;
280280
}

idea/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl Idea {
8787
}
8888
}
8989

90-
fn crypt(&self, mut block: InOut<'_, Block<Self>>, sub_keys: &[u16; LENGTH_SUB_KEYS]) {
90+
fn crypt(&self, mut block: InOut<'_, '_, Block<Self>>, sub_keys: &[u16; LENGTH_SUB_KEYS]) {
9191
let b = block.get_in();
9292
let mut x1 = u16::from_be_bytes(b[0..2].try_into().unwrap());
9393
let mut x2 = u16::from_be_bytes(b[2..4].try_into().unwrap());

kuznyechik/src/soft/backends.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl<'a> ParBlocksSizeUser for EncBackend<'a> {
124124

125125
impl<'a> BlockBackend for EncBackend<'a> {
126126
#[inline]
127-
fn proc_block(&mut self, mut block: InOut<'_, Block>) {
127+
fn proc_block(&mut self, mut block: InOut<'_, '_, Block>) {
128128
let mut b = *block.get_in();
129129
for i in 0..9 {
130130
lsx(&mut b, &self.0[i]);
@@ -134,7 +134,7 @@ impl<'a> BlockBackend for EncBackend<'a> {
134134
}
135135

136136
#[inline(always)]
137-
fn proc_par_blocks(&mut self, mut blocks: InOut<'_, ParBlocks<Self>>) {
137+
fn proc_par_blocks(&mut self, mut blocks: InOut<'_, '_, ParBlocks<Self>>) {
138138
self.proc_block(blocks.get(0));
139139
}
140140
}
@@ -151,7 +151,7 @@ impl<'a> ParBlocksSizeUser for DecBackend<'a> {
151151

152152
impl<'a> BlockBackend for DecBackend<'a> {
153153
#[inline]
154-
fn proc_block(&mut self, mut block: InOut<'_, Block>) {
154+
fn proc_block(&mut self, mut block: InOut<'_, '_, Block>) {
155155
let mut b = *block.get_in();
156156
for i in 0..9 {
157157
lsx_inv(&mut b, &self.0[9 - i]);
@@ -161,7 +161,7 @@ impl<'a> BlockBackend for DecBackend<'a> {
161161
}
162162

163163
#[inline(always)]
164-
fn proc_par_blocks(&mut self, mut blocks: InOut<'_, ParBlocks<Self>>) {
164+
fn proc_par_blocks(&mut self, mut blocks: InOut<'_, '_, ParBlocks<Self>>) {
165165
self.proc_block(blocks.get(0));
166166
}
167167
}

kuznyechik/src/sse2/backends.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl<'a> ParBlocksSizeUser for EncBackend<'a> {
171171

172172
impl<'a> BlockBackend for EncBackend<'a> {
173173
#[inline]
174-
fn proc_block(&mut self, block: InOut<'_, Block>) {
174+
fn proc_block(&mut self, block: InOut<'_, '_, Block>) {
175175
let k = self.0;
176176
unsafe {
177177
let (in_ptr, out_ptr) = block.into_raw();
@@ -187,7 +187,7 @@ impl<'a> BlockBackend for EncBackend<'a> {
187187
}
188188

189189
#[inline]
190-
fn proc_par_blocks(&mut self, blocks: InOut<'_, ParBlocks<Self>>) {
190+
fn proc_par_blocks(&mut self, blocks: InOut<'_, '_, ParBlocks<Self>>) {
191191
let k = self.0;
192192
unsafe {
193193
let (in_ptr, out_ptr) = blocks.into_raw();
@@ -230,7 +230,7 @@ impl<'a> ParBlocksSizeUser for DecBackend<'a> {
230230

231231
impl<'a> BlockBackend for DecBackend<'a> {
232232
#[inline]
233-
fn proc_block(&mut self, block: InOut<'_, Block>) {
233+
fn proc_block(&mut self, block: InOut<'_, '_, Block>) {
234234
let k = self.0;
235235
unsafe {
236236
let (in_ptr, out_ptr) = block.into_raw();
@@ -253,7 +253,7 @@ impl<'a> BlockBackend for DecBackend<'a> {
253253
}
254254

255255
#[inline]
256-
fn proc_par_blocks(&mut self, blocks: InOut<'_, ParBlocks<Self>>) {
256+
fn proc_par_blocks(&mut self, blocks: InOut<'_, '_, ParBlocks<Self>>) {
257257
let k = self.0;
258258
unsafe {
259259
let (in_ptr, out_ptr) = blocks.into_raw();

0 commit comments

Comments
 (0)