Skip to content

Commit bdbf6d1

Browse files
authored
Bump MSRV to 1.70.0 (#822)
* Bump MSRV to 1.70.0 * Use toml_edit v0.23 * Fix format * 'untrusted' dependency remains on 0.7.1
1 parent 209f779 commit bdbf6d1

File tree

21 files changed

+146
-156
lines changed

21 files changed

+146
-156
lines changed

.github/workflows/integration.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,13 +335,13 @@ jobs:
335335
- name: Install MSRV Rust version
336336
uses: dtolnay/rust-toolchain@stable
337337
with:
338-
toolchain: 1.63.0 # TODO: dynamically identify MSRV
338+
toolchain: 1.70.0 # TODO: dynamically identify MSRV
339339

340340
- name: Update dependencies
341341
run: |
342-
cargo +1.63.0 update
343-
cargo +1.63.0 tree
342+
cargo +1.70.0 update
343+
cargo +1.70.0 tree
344344
345345
- name: Verify msrv
346346
working-directory: ./aws-lc-rs
347-
run: cargo +1.63.0 check --features bindgen
347+
run: cargo +1.70.0 check --features bindgen

Cargo.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,24 @@ exclude = [
1515
]
1616
resolver = "2"
1717

18+
[workspace.dependencies]
19+
bindgen = "0.72.0"
20+
cc = "1.2.26"
21+
clap = "=4.4.18"# v4.5 is MSRV 1.74
22+
cmake = "0.1.54"
23+
criterion = "0.5.1" # v0.6.0 depends on clap v4.5
24+
dunce = "1.0.5"
25+
fs_extra = "1.3.0"
26+
hex = "0.4.3"
27+
lazy_static = "1.5.0"
28+
openssl = "0.10.73"
29+
paste = "1.0.15"
30+
regex = "1.11.1"
31+
ring = "0.17.14"
32+
untrusted = "0.7.1"
33+
zeroize = "1.8.1"
34+
toml_edit = "0.23.0"
35+
1836
[profile.bench]
1937
lto = true
2038

aws-lc-fips-sys/Cargo.toml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ authors = ["AWS-LC"]
77
edition = "2021"
88
repository = "https://github.com/aws/aws-lc-rs"
99
license = "ISC AND (Apache-2.0 OR ISC) AND OpenSSL"
10-
rust-version = "1.63.0"
10+
rust-version = "1.70.0"
1111
include = [
1212
"LICENSE",
1313
"/aws-lc/**/*.c",
@@ -65,21 +65,20 @@ bindgen = [
6565
] # Generate the bindings on the targeted platform as a fallback mechanism.
6666

6767
[build-dependencies]
68-
cmake = "0.1.48"
69-
dunce = "1.0"
70-
fs_extra = "1.3"
71-
cc = "1.0.100"
72-
regex = "1"
68+
cmake.workspace = true
69+
dunce.workspace = true
70+
fs_extra.workspace = true
71+
cc.workspace = true
72+
regex.workspace = true
7373

7474
[target.'cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), any(target_os = "linux", target_os = "macos"), any(target_env = "gnu", target_env = "musl", target_env = "")))'.build-dependencies]
75-
bindgen = { version = "0.69.5", optional = true }
75+
bindgen = { workspace = true, optional = true }
7676

7777
[target.'cfg(not(all(any(target_arch = "x86_64", target_arch = "aarch64"), any(target_os = "linux", target_os = "macos"), any(target_env = "gnu", target_env = "musl", target_env = ""))))'.build-dependencies]
78-
bindgen = { version = "0.69.5" }
78+
bindgen = { workspace = true }
7979

8080
[dev-dependencies]
81-
# Pinned dependency to preserve MSRV: 1.60.0 <= rust-version < 1.65.0
82-
regex = "~1.9.6"
81+
regex.workspace = true
8382

8483
[package.metadata.aws-lc-fips-sys]
8584
commit-hash = "205ad181868086a090e6b766c076a9732ad354c7"

aws-lc-fips-sys/builder/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ fn invoke_external_bindgen(
775775
"functions,types,vars,methods,constructors,destructors",
776776
header.as_str(),
777777
"--rust-target",
778-
r"1.59",
778+
r"1.70",
779779
"--output",
780780
gen_bindings_path.to_str().unwrap(),
781781
"--formatter",

aws-lc-fips-sys/builder/sys_bindgen.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ fn prepare_bindings_builder(manifest_dir: &Path, options: &BindingOptions) -> bi
4242
.allowlist_file(r".*(/|\\)openssl((/|\\)[^/\\]+)+\.h")
4343
.allowlist_file(r".*(/|\\)rust_wrapper\.h")
4444
.rustified_enum(r"point_conversion_form_t")
45+
.rust_target(bindgen::RustTarget::stable(70, 0).unwrap())
4546
.default_macro_constant_type(bindgen::MacroTypeVariation::Signed)
4647
.generate_comments(true)
4748
.fit_macro_constants(false)

aws-lc-rs-testing/Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "aws-lc-rs-testing"
33
authors = ["AWS-LibCrypto"]
44
version = "0.1.0"
55
edition = "2021"
6-
rust-version = "1.63"
6+
rust-version = "1.70.0"
77
publish = false
88

99
[features]
@@ -16,11 +16,11 @@ asan = ["aws-lc-rs/asan"]
1616

1717
[dev-dependencies]
1818
aws-lc-rs = { version = "1.0", path = "../aws-lc-rs", features = ["ring-sig-verify", "unstable"] }
19-
untrusted = { version = "0.7.1" }
20-
paste = "1.0.11"
21-
criterion = { version = "0.5.0", features = ["csv_output"] }
22-
ring = "0.17"
23-
openssl = { version = "0.10.52", features = ["vendored"] }
19+
untrusted.workspace = true
20+
paste.workspace = true
21+
criterion = { workspace = true, features = ["csv_output"] }
22+
ring.workspace = true
23+
openssl = { workspace = true, features = ["vendored"] }
2424

2525
[[bench]]
2626
name = "aead_benchmark"

aws-lc-rs/Cargo.toml

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ version = "1.13.3"
55
# this crate re-exports whatever sys crate that was selected
66
links = "aws_lc_rs_1_13_3_sys"
77
edition = "2021"
8-
rust-version = "1.63.0"
8+
rust-version = "1.70.0"
99
keywords = ["crypto", "cryptography", "security"]
1010
license = "ISC AND (Apache-2.0 OR ISC)"
1111
description = "aws-lc-rs is a cryptographic library using AWS-LC for its cryptographic operations. This library strives to be API-compatible with the popular Rust library named ring."
@@ -46,31 +46,17 @@ non-fips = ["aws-lc-sys"]
4646
fips = ["dep:aws-lc-fips-sys"]
4747

4848
[dependencies]
49-
untrusted = { version = "0.7.1", optional = true }
49+
untrusted = { workspace = true, optional = true }
5050
aws-lc-sys = { version = "0.30.0", path = "../aws-lc-sys", optional = true }
5151
aws-lc-fips-sys = { version = "0.13.1", path = "../aws-lc-fips-sys", optional = true }
52-
zeroize = "1.7"
52+
zeroize.workspace = true
5353

5454
[dev-dependencies]
55-
paste = "1.0.11"
56-
lazy_static = "1.4.0"
57-
clap = { version = "4.1.8", features = ["derive"] }
58-
hex = "0.4.3"
59-
60-
# Pinned dependency to preserve MSRV: 1.63.0 <= rust-version < 1.70.0
61-
which = "5.0.0"
62-
# Pinned dependency to preserve MSRV: ??? <= rust-version < 1.70.0
63-
home = "=0.5.5"
64-
# Pinned dependency to preserve MSRV: 1.60.0 <= rust-version < 1.65.0
65-
regex = "<1.10.0"
66-
# Pinned dependency to preserve MSRV: ??? <= rust-version < 1.65.0
67-
regex-automata = "~0.3.9"
68-
# Pinned dependency to preserve MSRV: 1.60.0 <= rust-version < 1.65.0
69-
regex-syntax = "~0.7.5"
70-
# Pinned to avoid build failure in older versions
71-
proc-macro2 = "1.0.60"
72-
# Pinned dependency to preserve MSRV: 1.60.0 <= rust-version < 1.70.0
73-
once_cell = "~1.20.3"
55+
paste.workspace = true
56+
lazy_static.workspace = true
57+
clap = { workspace = true, features = ["derive"] }
58+
hex.workspace = true
59+
regex.workspace = true
7460

7561
[package.metadata.cargo-udeps.ignore]
7662
development = ["which", "home", "regex", "regex-automata", "regex-syntax", "proc-macro2", "jobserver", "cc", "once_cell"]

aws-lc-rs/src/cipher/aes.rs

Lines changed: 42 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,11 @@ pub(super) fn encrypt_ctr_mode(
4949
context: EncryptionContext,
5050
in_out: &mut [u8],
5151
) -> Result<DecryptionContext, Unspecified> {
52-
#[allow(clippy::match_wildcard_for_single_variants)]
53-
let key = match &key {
54-
SymmetricCipherKey::Aes128 { enc_key, .. }
55-
| SymmetricCipherKey::Aes192 { enc_key, .. }
56-
| SymmetricCipherKey::Aes256 { enc_key, .. } => enc_key,
57-
_ => unreachable!(),
52+
let (SymmetricCipherKey::Aes128 { enc_key, .. }
53+
| SymmetricCipherKey::Aes192 { enc_key, .. }
54+
| SymmetricCipherKey::Aes256 { enc_key, .. }) = &key
55+
else {
56+
unreachable!()
5857
};
5958

6059
let mut iv = {
@@ -65,7 +64,7 @@ pub(super) fn encrypt_ctr_mode(
6564

6665
let mut buffer = [0u8; AES_BLOCK_LEN];
6766

68-
aes_ctr128_encrypt(key, &mut iv, &mut buffer, in_out);
67+
aes_ctr128_encrypt(enc_key, &mut iv, &mut buffer, in_out);
6968
iv.zeroize();
7069

7170
Ok(context.into())
@@ -85,12 +84,11 @@ pub(super) fn encrypt_cbc_mode(
8584
context: EncryptionContext,
8685
in_out: &mut [u8],
8786
) -> Result<DecryptionContext, Unspecified> {
88-
#[allow(clippy::match_wildcard_for_single_variants)]
89-
let key = match &key {
90-
SymmetricCipherKey::Aes128 { enc_key, .. }
91-
| SymmetricCipherKey::Aes192 { enc_key, .. }
92-
| SymmetricCipherKey::Aes256 { enc_key, .. } => enc_key,
93-
_ => unreachable!(),
87+
let (SymmetricCipherKey::Aes128 { enc_key, .. }
88+
| SymmetricCipherKey::Aes192 { enc_key, .. }
89+
| SymmetricCipherKey::Aes256 { enc_key, .. }) = &key
90+
else {
91+
unreachable!()
9492
};
9593

9694
let mut iv = {
@@ -99,7 +97,7 @@ pub(super) fn encrypt_cbc_mode(
9997
iv
10098
};
10199

102-
aes_cbc_encrypt(key, &mut iv, in_out);
100+
aes_cbc_encrypt(enc_key, &mut iv, in_out);
103101
iv.zeroize();
104102

105103
Ok(context.into())
@@ -111,12 +109,11 @@ pub(super) fn decrypt_cbc_mode<'in_out>(
111109
context: DecryptionContext,
112110
in_out: &'in_out mut [u8],
113111
) -> Result<&'in_out mut [u8], Unspecified> {
114-
#[allow(clippy::match_wildcard_for_single_variants)]
115-
let key = match &key {
116-
SymmetricCipherKey::Aes128 { dec_key, .. }
117-
| SymmetricCipherKey::Aes192 { dec_key, .. }
118-
| SymmetricCipherKey::Aes256 { dec_key, .. } => dec_key,
119-
_ => unreachable!(),
112+
let (SymmetricCipherKey::Aes128 { dec_key, .. }
113+
| SymmetricCipherKey::Aes192 { dec_key, .. }
114+
| SymmetricCipherKey::Aes256 { dec_key, .. }) = &key
115+
else {
116+
unreachable!()
120117
};
121118

122119
let mut iv = {
@@ -125,7 +122,7 @@ pub(super) fn decrypt_cbc_mode<'in_out>(
125122
iv
126123
};
127124

128-
aes_cbc_decrypt(key, &mut iv, in_out);
125+
aes_cbc_decrypt(dec_key, &mut iv, in_out);
129126
iv.zeroize();
130127

131128
Ok(in_out)
@@ -138,12 +135,11 @@ pub(super) fn encrypt_cfb_mode(
138135
context: EncryptionContext,
139136
in_out: &mut [u8],
140137
) -> Result<DecryptionContext, Unspecified> {
141-
#[allow(clippy::match_wildcard_for_single_variants)]
142-
let key = match &key {
143-
SymmetricCipherKey::Aes128 { enc_key, .. }
144-
| SymmetricCipherKey::Aes192 { enc_key, .. }
145-
| SymmetricCipherKey::Aes256 { enc_key, .. } => enc_key,
146-
_ => unreachable!(),
138+
let (SymmetricCipherKey::Aes128 { enc_key, .. }
139+
| SymmetricCipherKey::Aes192 { enc_key, .. }
140+
| SymmetricCipherKey::Aes256 { enc_key, .. }) = &key
141+
else {
142+
unreachable!()
147143
};
148144

149145
let mut iv = {
@@ -158,7 +154,7 @@ pub(super) fn encrypt_cfb_mode(
158154
_ => unreachable!(),
159155
};
160156

161-
cfb_encrypt(key, &mut iv, in_out);
157+
cfb_encrypt(enc_key, &mut iv, in_out);
162158
iv.zeroize();
163159

164160
Ok(context.into())
@@ -171,12 +167,11 @@ pub(super) fn decrypt_cfb_mode<'in_out>(
171167
context: DecryptionContext,
172168
in_out: &'in_out mut [u8],
173169
) -> Result<&'in_out mut [u8], Unspecified> {
174-
#[allow(clippy::match_wildcard_for_single_variants)]
175-
let key = match &key {
176-
SymmetricCipherKey::Aes128 { enc_key, .. }
177-
| SymmetricCipherKey::Aes192 { enc_key, .. }
178-
| SymmetricCipherKey::Aes256 { enc_key, .. } => enc_key,
179-
_ => unreachable!(),
170+
let (SymmetricCipherKey::Aes128 { enc_key, .. }
171+
| SymmetricCipherKey::Aes192 { enc_key, .. }
172+
| SymmetricCipherKey::Aes256 { enc_key, .. }) = &key
173+
else {
174+
unreachable!()
180175
};
181176

182177
let mut iv = {
@@ -191,7 +186,7 @@ pub(super) fn decrypt_cfb_mode<'in_out>(
191186
_ => unreachable!(),
192187
};
193188

194-
cfb_decrypt(key, &mut iv, in_out);
189+
cfb_decrypt(enc_key, &mut iv, in_out);
195190

196191
iv.zeroize();
197192

@@ -208,18 +203,17 @@ pub(super) fn encrypt_ecb_mode(
208203
unreachable!();
209204
}
210205

211-
#[allow(clippy::match_wildcard_for_single_variants)]
212-
let key = match &key {
213-
SymmetricCipherKey::Aes128 { enc_key, .. }
214-
| SymmetricCipherKey::Aes192 { enc_key, .. }
215-
| SymmetricCipherKey::Aes256 { enc_key, .. } => enc_key,
216-
_ => unreachable!(),
206+
let (SymmetricCipherKey::Aes128 { enc_key, .. }
207+
| SymmetricCipherKey::Aes192 { enc_key, .. }
208+
| SymmetricCipherKey::Aes256 { enc_key, .. }) = &key
209+
else {
210+
unreachable!()
217211
};
218212

219213
let mut in_out_iter = in_out.chunks_exact_mut(AES_BLOCK_LEN);
220214

221215
for block in in_out_iter.by_ref() {
222-
aes_ecb_encrypt(key, block);
216+
aes_ecb_encrypt(enc_key, block);
223217
}
224218

225219
// This is a sanity check that should not happen. We validate in `encrypt` that in_out.len() % block_len == 0
@@ -239,19 +233,18 @@ pub(super) fn decrypt_ecb_mode<'in_out>(
239233
unreachable!();
240234
}
241235

242-
#[allow(clippy::match_wildcard_for_single_variants)]
243-
let key = match &key {
244-
SymmetricCipherKey::Aes128 { dec_key, .. }
245-
| SymmetricCipherKey::Aes192 { dec_key, .. }
246-
| SymmetricCipherKey::Aes256 { dec_key, .. } => dec_key,
247-
_ => unreachable!(),
236+
let (SymmetricCipherKey::Aes128 { dec_key, .. }
237+
| SymmetricCipherKey::Aes192 { dec_key, .. }
238+
| SymmetricCipherKey::Aes256 { dec_key, .. }) = &key
239+
else {
240+
unreachable!()
248241
};
249242

250243
{
251244
let mut in_out_iter = in_out.chunks_exact_mut(AES_BLOCK_LEN);
252245

253246
for block in in_out_iter.by_ref() {
254-
aes_ecb_decrypt(key, block);
247+
aes_ecb_decrypt(dec_key, block);
255248
}
256249

257250
// This is a sanity check hat should not fail. We validate in `decrypt` that in_out.len() % block_len == 0 for

aws-lc-rs/src/digest.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,14 @@ use crate::aws_lc::{
3939
};
4040
use crate::error::Unspecified;
4141
use crate::ptr::ConstPointer;
42+
use core::ffi::c_uint;
4243
use core::mem::MaybeUninit;
4344
use digest_ctx::DigestContext;
4445
pub use sha::{
4546
SHA1_FOR_LEGACY_USE_ONLY, SHA1_OUTPUT_LEN, SHA224, SHA224_OUTPUT_LEN, SHA256,
4647
SHA256_OUTPUT_LEN, SHA384, SHA384_OUTPUT_LEN, SHA3_256, SHA3_384, SHA3_512, SHA512, SHA512_256,
4748
SHA512_256_OUTPUT_LEN, SHA512_OUTPUT_LEN,
4849
};
49-
// TODO: Uncomment when MSRV >= 1.64
50-
//use core::ffi::c_uint;
51-
use std::os::raw::c_uint;
5250

5351
/// A context for multi-step (Init-Update-Finish) digest calculations.
5452
//

aws-lc-rs/src/ec.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ use crate::error::{KeyRejected, Unspecified};
2020
use crate::fips::indicator_check;
2121
use crate::ptr::{ConstPointer, LcPtr};
2222
use crate::signature::Signature;
23-
// TODO: Uncomment when MSRV >= 1.64
24-
//use core::ffi::c_int;
25-
use std::os::raw::c_int;
23+
use core::ffi::c_int;
2624
use std::ptr::null;
2725

2826
pub(crate) mod encoding;

0 commit comments

Comments
 (0)