Skip to content

Commit fd0ecda

Browse files
committed
rc6: 2024 edition; upgrade to cipher v0.5.0-rc.1
Updates `rc6` to use the latest Rust version and version of `cipher` that all of the other crates are using
1 parent 4a65fa4 commit fd0ecda

File tree

6 files changed

+31
-44
lines changed

6 files changed

+31
-44
lines changed

.github/workflows/rc6.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
strategy:
2222
matrix:
2323
rust:
24-
- 1.65.0 # MSRVs
24+
- 1.85.0 # MSRVs
2525
- stable
2626
target:
2727
- thumbv7em-none-eabi
@@ -38,14 +38,14 @@ jobs:
3838
minimal-versions:
3939
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
4040
with:
41-
working-directory: ${{ github.workflow }}
41+
working-directory: ${{ github.workflow }}
4242

4343
test:
4444
runs-on: ubuntu-latest
4545
strategy:
4646
matrix:
4747
rust:
48-
- 1.65.0 # MSRVs
48+
- 1.85.0 # MSRVs
4949
- stable
5050
steps:
5151
- uses: actions/checkout@v3

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rc6/Cargo.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
[package]
22
name = "rc6"
3-
version = "0.1.0"
3+
version = "0.0.0"
44
description = "RC6 block cipher"
55
authors = ["RustCrypto Developers"]
6-
edition = "2021"
6+
edition = "2024"
7+
rust-version = "1.85"
78
license = "MIT OR Apache-2.0"
89
readme = "README.md"
910
repository = "https://github.com/RustCrypto/block-ciphers"
1011
keywords = ["crypto", "rc6", "block-cipher"]
1112
categories = ["cryptography"]
1213

1314
[dependencies]
14-
cipher = { version = "0.5.0-pre.6", features = ["zeroize"] }
15+
cipher = { version = "0.5.0-rc.1", features = ["zeroize"] }
1516

1617
[dev-dependencies]
17-
cipher = { version = "0.5.0-pre.6", features = ["dev"] }
18+
cipher = { version = "0.5.0-rc.1", features = ["dev"] }
1819

1920
[features]
2021
zeroize = []

rc6/src/block_cipher.rs

Lines changed: 20 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
use core::ops::{Add, Div, Mul, Sub};
22

33
use cipher::{
4+
AlgorithmName, Block, BlockSizeUser, KeyInit, KeySizeUser, ParBlocksSizeUser,
45
array::ArraySize,
6+
block::{
7+
BlockCipherDecBackend, BlockCipherDecClosure, BlockCipherDecrypt, BlockCipherEncBackend,
8+
BlockCipherEncClosure, BlockCipherEncrypt,
9+
},
510
crypto_common::BlockSizes,
611
inout::InOut,
7-
typenum::{Diff, IsLess, Le, NonZero, Sum, Unsigned, U1, U12, U16, U2, U20, U24, U256, U4, U8},
8-
AlgorithmName, Block, BlockBackend, BlockCipher, BlockCipherDecrypt, BlockCipherEncrypt,
9-
BlockSizeUser, KeyInit, KeySizeUser, ParBlocksSizeUser,
12+
typenum::{Diff, IsLess, Le, NonZero, Sum, U1, U2, U4, U8, U12, U16, U20, U24, U256, Unsigned},
1013
};
1114

12-
use crate::core::{BlockSize, ExpandedKeyTableSize, KeyAsWordsSize, Word, RC6};
15+
use crate::core::{BlockSize, ExpandedKeyTableSize, KeyAsWordsSize, RC6, Word};
1316

1417
impl<W, R, B> KeyInit for RC6<W, R, B>
1518
where
@@ -59,23 +62,6 @@ where
5962
type KeySize = B;
6063
}
6164

62-
impl<W, R, B> BlockCipher for RC6<W, R, B>
63-
where
64-
W: Word,
65-
// Block size
66-
W::Bytes: Mul<U4>,
67-
BlockSize<W>: BlockSizes,
68-
// Rounds range
69-
R: Unsigned,
70-
R: IsLess<U256>,
71-
Le<R, U256>: NonZero,
72-
// ExpandedKeyTableSize
73-
R: Add<U2>,
74-
Sum<R, U2>: Mul<U2>,
75-
ExpandedKeyTableSize<R>: ArraySize,
76-
{
77-
}
78-
7965
impl<W, R, B> BlockSizeUser for RC6<W, R, B>
8066
where
8167
W: Word,
@@ -118,8 +104,8 @@ where
118104
Diff<Sum<B, W::Bytes>, U1>: Div<W::Bytes>,
119105
KeyAsWordsSize<W, B>: ArraySize,
120106
{
121-
fn encrypt_with_backend(&self, f: impl cipher::BlockClosure<BlockSize = Self::BlockSize>) {
122-
f.call(&mut RC6EncryptBackend { enc_dec: self })
107+
fn encrypt_with_backend(&self, f: impl BlockCipherEncClosure<BlockSize = Self::BlockSize>) {
108+
f.call(&RC6EncryptBackend { enc_dec: self })
123109
}
124110
}
125111

@@ -140,7 +126,7 @@ where
140126
{
141127
enc_dec: &'a RC6<W, R, B>,
142128
}
143-
impl<'a, W, R, B> BlockSizeUser for RC6EncryptBackend<'a, W, R, B>
129+
impl<W, R, B> BlockSizeUser for RC6EncryptBackend<'_, W, R, B>
144130
where
145131
W: Word,
146132
// Block size
@@ -158,7 +144,7 @@ where
158144
type BlockSize = BlockSize<W>;
159145
}
160146

161-
impl<'a, W, R, B> ParBlocksSizeUser for RC6EncryptBackend<'a, W, R, B>
147+
impl<W, R, B> ParBlocksSizeUser for RC6EncryptBackend<'_, W, R, B>
162148
where
163149
W: Word,
164150
// Block size
@@ -176,7 +162,7 @@ where
176162
type ParBlocksSize = U1;
177163
}
178164

179-
impl<'a, W, R, B> BlockBackend for RC6EncryptBackend<'a, W, R, B>
165+
impl<W, R, B> BlockCipherEncBackend for RC6EncryptBackend<'_, W, R, B>
180166
where
181167
W: Word,
182168
// Block size
@@ -191,7 +177,7 @@ where
191177
Sum<R, U2>: Mul<U2>,
192178
ExpandedKeyTableSize<R>: ArraySize,
193179
// Key range
194-
B: BlockSizes,
180+
B: ArraySize,
195181
B: IsLess<U256>,
196182
Le<B, U256>: NonZero,
197183
// KeyAsWordsSize
@@ -201,7 +187,7 @@ where
201187
KeyAsWordsSize<W, B>: ArraySize,
202188
{
203189
#[inline(always)]
204-
fn proc_block(&mut self, block: InOut<'_, '_, Block<Self>>) {
190+
fn encrypt_block(&self, block: InOut<'_, '_, Block<Self>>) {
205191
let backend = self.enc_dec;
206192
backend.encrypt(block)
207193
}
@@ -231,8 +217,8 @@ where
231217
Diff<Sum<B, W::Bytes>, U1>: Div<W::Bytes>,
232218
KeyAsWordsSize<W, B>: ArraySize,
233219
{
234-
fn decrypt_with_backend(&self, f: impl cipher::BlockClosure<BlockSize = Self::BlockSize>) {
235-
f.call(&mut RC6DecryptBackend { enc_dec: self })
220+
fn decrypt_with_backend(&self, f: impl BlockCipherDecClosure<BlockSize = Self::BlockSize>) {
221+
f.call(&RC6DecryptBackend { enc_dec: self })
236222
}
237223
}
238224

@@ -253,7 +239,7 @@ where
253239
{
254240
enc_dec: &'a RC6<W, R, B>,
255241
}
256-
impl<'a, W, R, B> BlockSizeUser for RC6DecryptBackend<'a, W, R, B>
242+
impl<W, R, B> BlockSizeUser for RC6DecryptBackend<'_, W, R, B>
257243
where
258244
W: Word,
259245
// Block size
@@ -271,7 +257,7 @@ where
271257
type BlockSize = BlockSize<W>;
272258
}
273259

274-
impl<'a, W, R, B> ParBlocksSizeUser for RC6DecryptBackend<'a, W, R, B>
260+
impl<W, R, B> ParBlocksSizeUser for RC6DecryptBackend<'_, W, R, B>
275261
where
276262
W: Word,
277263
// Block size
@@ -289,7 +275,7 @@ where
289275
type ParBlocksSize = U1;
290276
}
291277

292-
impl<'a, W, R, B> BlockBackend for RC6DecryptBackend<'a, W, R, B>
278+
impl<W, R, B> BlockCipherDecBackend for RC6DecryptBackend<'_, W, R, B>
293279
where
294280
W: Word,
295281
// Block size
@@ -314,7 +300,7 @@ where
314300
KeyAsWordsSize<W, B>: ArraySize,
315301
{
316302
#[inline(always)]
317-
fn proc_block(&mut self, block: InOut<'_, '_, Block<Self>>) {
303+
fn decrypt_block(&self, block: InOut<'_, '_, Block<Self>>) {
318304
let backend = self.enc_dec;
319305
backend.decrypt(block)
320306
}

rc6/src/core/backend.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use cipher::{
88
array::{Array, ArraySize},
99
crypto_common::BlockSizes,
1010
inout::InOut,
11-
typenum::{Diff, IsLess, Le, NonZero, Sum, Unsigned, U1, U2, U256, U4},
11+
typenum::{Diff, IsLess, Le, NonZero, Sum, U1, U2, U4, U256, Unsigned},
1212
};
1313

1414
use super::{

rc6/tests/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#[allow(deprecated)] // uses `clone_from_slice`
44
mod tests {
55
use cipher::consts::*;
6-
use cipher::{array::Array, BlockCipherDecrypt, BlockCipherEncrypt, KeyInit};
6+
use cipher::{BlockCipherDecrypt, BlockCipherEncrypt, KeyInit, array::Array};
77
use rc6::RC6;
88

99
#[test]

0 commit comments

Comments
 (0)