Skip to content

Commit 2d9c1c9

Browse files
authored
bump MSRV to 1.74 (#12919)
* bump MSRV to 1.74 * update linux distro version info
1 parent 6c18874 commit 2d9c1c9

File tree

8 files changed

+18
-17
lines changed

8 files changed

+18
-17
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,11 @@ jobs:
4848
- {VERSION: "3.13", NOXSESSION: "tests", OPENSSL: {TYPE: "openssl", VERSION: "10bd6fa8ca93b4cf53f005f110c827ed923c89a4"}}
4949
# Builds with various Rust versions. Includes MSRV and next
5050
# potential future MSRV.
51-
# - 1.70: crates.io sparse protocol by default
5251
# - 1.77: offset_of! in std (for pyo3)
5352
# - 1.80: LazyLock in std
54-
- {VERSION: "3.13", NOXSESSION: "rust,tests", RUST: "1.65.0"}
53+
# - 1.83: const context Option<T>::unwrap()
54+
- {VERSION: "3.13", NOXSESSION: "rust,tests", RUST: "1.74.0"}
55+
- {VERSION: "3.13", NOXSESSION: "rust,tests", RUST: "1.80.0"}
5556
- {VERSION: "3.13", NOXSESSION: "rust,tests", RUST: "beta"}
5657
- {VERSION: "3.13", NOXSESSION: "rust,tests", RUST: "nightly"}
5758
- {VERSION: "3.13", NOXSESSION: "tests-rust-debug"}

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Changelog
1010

1111
* Support for Python 3.7 is deprecated and will be removed in the next
1212
``cryptography`` release.
13+
* Updated the minimum supported Rust version (MSRV) to 1.74.0, from 1.65.0.
1314
* Added support for serialization of PKCS#12 Java truststores in
1415
:func:`~cryptography.hazmat.primitives.serialization.pkcs12.serialize_java_truststore`
1516
* Added :meth:`~cryptography.hazmat.primitives.kdf.argon2.Argon2id.derive_phc_encoded` and

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ authors = ["The cryptography developers <cryptography-dev@python.org>"]
1717
edition = "2021"
1818
publish = false
1919
# This specifies the MSRV
20-
rust-version = "1.65.0"
20+
rust-version = "1.74.0"
2121
license = "Apache-2.0 OR BSD-3-Clause"
2222

2323
[workspace.dependencies]

docs/installation.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ above supported platforms:
4646
* ``OpenSSL 3.4-latest``
4747
* ``OpenSSL 3.5-latest``
4848

49-
We also test against the latest commit of BoringSSL, the latest ``aws-lc`` release,
50-
and versions of LibreSSL that are receiving security support at the time of a
49+
We also test against the latest commit of BoringSSL, the latest ``aws-lc`` release,
50+
and versions of LibreSSL that are receiving security support at the time of a
5151
given ``cryptography`` release.
5252

5353

@@ -113,7 +113,7 @@ available<installation:Rust>`.
113113

114114
.. warning::
115115

116-
The Rust available by default in Alpine < 3.17 is older than the minimum
116+
The Rust available by default in Alpine < 3.19 is older than the minimum
117117
supported version. See the :ref:`Rust installation instructions
118118
<installation:Rust>` for information about installing a newer Rust.
119119

@@ -127,7 +127,7 @@ available<installation:Rust>`.
127127

128128
.. warning::
129129

130-
The Rust available in Debian versions prior to Bookworm are older than the
130+
The Rust available in Debian versions prior to Trixie are older than the
131131
minimum supported version. See the :ref:`Rust installation instructions
132132
<installation:Rust>` for information about installing a newer Rust.
133133

@@ -140,8 +140,8 @@ available<installation:Rust>`.
140140

141141
.. warning::
142142

143-
For RHEL and CentOS you must be on version 8.8 or newer for the command
144-
below to install a sufficiently new Rust. If your Rust is less than 1.65.0
143+
For RHEL and CentOS you must be on version 8.10 or newer for the command
144+
below to install a sufficiently new Rust. If your Rust is less than 1.74.0
145145
please see the :ref:`Rust installation instructions <installation:Rust>`
146146
for information about installing a newer Rust.
147147

@@ -319,7 +319,7 @@ Rust
319319
a Rust toolchain.
320320

321321
Building ``cryptography`` requires having a working Rust toolchain. The current
322-
minimum supported Rust version is 1.65.0. **This is newer than the Rust some
322+
minimum supported Rust version is 1.74.0. **This is newer than the Rust some
323323
package managers ship**, so users may need to install with the
324324
instructions below.
325325

src/rust/build.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ fn main() {
4040
println!("cargo:rustc-cfg=CRYPTOGRAPHY_IS_AWSLC");
4141
}
4242

43-
if env::var("CRYPTOGRAPHY_BUILD_OPENSSL_NO_LEGACY").map_or(false, |v| !v.is_empty() && v != "0")
44-
{
43+
if env::var("CRYPTOGRAPHY_BUILD_OPENSSL_NO_LEGACY").is_ok_and(|v| !v.is_empty() && v != "0") {
4544
println!("cargo:rustc-cfg=CRYPTOGRAPHY_BUILD_OPENSSL_NO_LEGACY");
4645
}
4746

src/rust/cryptography-crypto/src/pkcs12.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ pub fn kdf(
3939
// then so is P.
4040
//
4141
// 4. Set I=S||P to be the concatenation of S and P.
42-
let s_len = block_size * ((salt.len() + block_size - 1) / block_size);
43-
let p_len = block_size * ((pass.len() + block_size - 1) / block_size);
42+
let s_len = block_size * salt.len().div_ceil(block_size);
43+
let p_len = block_size * pass.len().div_ceil(block_size);
4444

4545
let mut init_key = vec![0; s_len + p_len];
4646
for i in 0..s_len {

src/rust/cryptography-x509-verification/src/policy/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ impl Subject<'_> {
183183
fn subject_alt_name_matches(&self, general_name: &GeneralName<'_>) -> bool {
184184
match (general_name, self) {
185185
(GeneralName::DNSName(pattern), Self::DNS(name)) => {
186-
DNSPattern::new(pattern.0).map_or(false, |p| p.matches(name))
186+
DNSPattern::new(pattern.0).is_some_and(|p| p.matches(name))
187187
}
188188
(GeneralName::IPAddress(addr), Self::IP(name)) => {
189189
IPAddress::from_bytes(addr) == Some(*name)
@@ -438,7 +438,7 @@ impl<'a, B: CryptoOps> Policy<'a, B> {
438438
// to test here.
439439
if bc
440440
.path_length
441-
.map_or(false, |len| u64::from(current_depth) > len)
441+
.is_some_and(|len| u64::from(current_depth) > len)
442442
{
443443
return Err(ValidationError::new(ValidationErrorKind::Other(
444444
"path length constraint violated".to_string(),

src/rust/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ fn _initialize_providers(py: pyo3::Python<'_>) -> CryptographyResult<LoadedProvi
6262
// any time soon.
6363

6464
let load_legacy = !cfg!(CRYPTOGRAPHY_BUILD_OPENSSL_NO_LEGACY)
65-
&& !env::var("CRYPTOGRAPHY_OPENSSL_NO_LEGACY").map_or(false, |v| !v.is_empty() && v != "0");
65+
&& !env::var("CRYPTOGRAPHY_OPENSSL_NO_LEGACY").is_ok_and(|v| !v.is_empty() && v != "0");
6666

6767
let legacy = if load_legacy {
6868
let legacy_result = provider::Provider::load(None, "legacy");

0 commit comments

Comments
 (0)