Skip to content

Commit cfad004

Browse files
authored
Prepare backports for 42.0.6 release (#10929)
* Upgrade openssl package for libressl 3.9.1 support * Ensure a good error message when cffi module fails to import * CHANGELOG * Bump version for 42.0.6 release * It's not FIPS anymore * Resolve new clippy warnings (#10755) The fixes themselves are of marginal value 🙃 * fix warning from latest nightly rust (#10486) * fix warning from latest nightly rust * Update lib.rs
1 parent 33833f0 commit cfad004

File tree

12 files changed

+49
-30
lines changed

12 files changed

+49
-30
lines changed

.github/workflows/ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ jobs:
4242
- {VERSION: "3.12", NOXSESSION: "tests", NOXARGS: "--enable-fips=1", OPENSSL: {TYPE: "openssl", CONFIG_FLAGS: "enable-fips", VERSION: "3.2.1"}}
4343
- {VERSION: "3.12", NOXSESSION: "tests", OPENSSL: {TYPE: "libressl", VERSION: "3.7.3"}}
4444
- {VERSION: "3.12", NOXSESSION: "tests", OPENSSL: {TYPE: "libressl", VERSION: "3.8.2"}}
45+
- {VERSION: "3.12", NOXSESSION: "tests", OPENSSL: {TYPE: "libressl", VERSION: "3.9.1"}}
4546
- {VERSION: "3.12", NOXSESSION: "tests-randomorder"}
4647
# Latest commit on the BoringSSL master branch, as of Jan 23, 2024.
4748
- {VERSION: "3.12", NOXSESSION: "tests", OPENSSL: {TYPE: "boringssl", VERSION: "a4c3f8de4406c2382e43e88a638882fb1a32da32"}}

CHANGELOG.rst

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Changelog
22
=========
33

4+
.. _v42-0-6:
5+
6+
42.0.6 - 2024-05-04
7+
~~~~~~~~~~~~~~~~~~~
8+
9+
* Fixed compilation when using LibreSSL 3.9.1.
10+
411
.. _v42-0-5:
512

613
42.0.5 - 2024-02-23

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ build-backend = "setuptools.build_meta"
1212

1313
[project]
1414
name = "cryptography"
15-
version = "42.0.5"
15+
version = "42.0.6"
1616
authors = [
1717
{name = "The Python Cryptographic Authority and individual contributors", email = "[email protected]"}
1818
]

src/cryptography/__about__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"__copyright__",
1111
]
1212

13-
__version__ = "42.0.5"
13+
__version__ = "42.0.6"
1414

1515

1616
__author__ = "The Python Cryptographic Authority and individual contributors"

src/cryptography/hazmat/backends/openssl/backend.py

+2-10
Original file line numberDiff line numberDiff line change
@@ -535,20 +535,12 @@ def dh_x942_serialization_supported(self) -> bool:
535535
return self._lib.Cryptography_HAS_EVP_PKEY_DHX == 1
536536

537537
def x25519_supported(self) -> bool:
538-
# Beginning with OpenSSL 3.2.0, X25519 is considered FIPS.
539-
if (
540-
self._fips_enabled
541-
and not self._lib.CRYPTOGRAPHY_OPENSSL_320_OR_GREATER
542-
):
538+
if self._fips_enabled:
543539
return False
544540
return True
545541

546542
def x448_supported(self) -> bool:
547-
# Beginning with OpenSSL 3.2.0, X448 is considered FIPS.
548-
if (
549-
self._fips_enabled
550-
and not self._lib.CRYPTOGRAPHY_OPENSSL_320_OR_GREATER
551-
):
543+
if self._fips_enabled:
552544
return False
553545
return (
554546
not self._lib.CRYPTOGRAPHY_IS_LIBRESSL

src/rust/Cargo.lock

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/rust/cryptography-cffi/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub fn create_module(py: pyo3::Python<'_>) -> pyo3::PyResult<&pyo3::types::PyMod
2727
// SAFETY: `PyInit__openssl` returns an owned reference.
2828
let openssl_mod = unsafe {
2929
let ptr = PyInit__openssl();
30-
pyo3::types::PyModule::from_owned_ptr(py, ptr)
30+
pyo3::types::PyModule::from_owned_ptr_or_err(py, ptr)?
3131
};
3232

3333
Ok(openssl_mod)

src/rust/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// for complete details.
44

55
#![deny(rust_2018_idioms, clippy::undocumented_unsafe_blocks)]
6+
#![allow(unknown_lints, non_local_definitions)]
67

78
use crate::error::CryptographyResult;
89
#[cfg(CRYPTOGRAPHY_OPENSSL_300_OR_GREATER)]

src/rust/src/x509/crl.rs

+12-5
Original file line numberDiff line numberDiff line change
@@ -455,11 +455,18 @@ fn try_map_arc_data_mut_crl_iterator<E>(
455455
) -> Result<crl::RevokedCertificate<'this>, E>,
456456
) -> Result<OwnedRevokedCertificate, E> {
457457
OwnedRevokedCertificate::try_new(Arc::clone(it.borrow_owner()), |inner_it| {
458-
// SAFETY: This is safe because `Arc::clone` ensures the data is
459-
// alive, but Rust doesn't understand the lifetime relationship it
460-
// produces. Open-coded implementation of the API discussed in
461-
// https://github.com/joshua-maros/ouroboros/issues/38
462-
it.with_dependent_mut(|_, value| f(inner_it, unsafe { std::mem::transmute(value) }))
458+
it.with_dependent_mut(|_, value| {
459+
// SAFETY: This is safe because `Arc::clone` ensures the data is
460+
// alive, but Rust doesn't understand the lifetime relationship it
461+
// produces. Open-coded implementation of the API discussed in
462+
// https://github.com/joshua-maros/ouroboros/issues/38
463+
f(inner_it, unsafe {
464+
std::mem::transmute::<
465+
&mut Option<asn1::SequenceOf<'_, crl::RevokedCertificate<'_>>>,
466+
&mut Option<asn1::SequenceOf<'_, crl::RevokedCertificate<'_>>>,
467+
>(value)
468+
})
469+
})
463470
})
464471
}
465472

src/rust/src/x509/ocsp_resp.rs

+17-6
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,11 @@ fn map_arc_data_ocsp_response(
418418
// alive, but Rust doesn't understand the lifetime relationship it
419419
// produces. Open-coded implementation of the API discussed in
420420
// https://github.com/joshua-maros/ouroboros/issues/38
421-
f(inner_it.as_bytes(py), unsafe { std::mem::transmute(value) })
421+
f(inner_it.as_bytes(py), unsafe {
422+
std::mem::transmute::<&ocsp_resp::OCSPResponse<'_>, &ocsp_resp::OCSPResponse<'_>>(
423+
value,
424+
)
425+
})
422426
})
423427
})
424428
}
@@ -430,11 +434,18 @@ fn try_map_arc_data_mut_ocsp_response_iterator<E>(
430434
) -> Result<ocsp_resp::SingleResponse<'this>, E>,
431435
) -> Result<OwnedSingleResponse, E> {
432436
OwnedSingleResponse::try_new(Arc::clone(it.borrow_owner()), |inner_it| {
433-
// SAFETY: This is safe because `Arc::clone` ensures the data is
434-
// alive, but Rust doesn't understand the lifetime relationship it
435-
// produces. Open-coded implementation of the API discussed in
436-
// https://github.com/joshua-maros/ouroboros/issues/38
437-
it.with_dependent_mut(|_, value| f(inner_it, unsafe { std::mem::transmute(value) }))
437+
it.with_dependent_mut(|_, value| {
438+
// SAFETY: This is safe because `Arc::clone` ensures the data is
439+
// alive, but Rust doesn't understand the lifetime relationship it
440+
// produces. Open-coded implementation of the API discussed in
441+
// https://github.com/joshua-maros/ouroboros/issues/38
442+
f(inner_it, unsafe {
443+
std::mem::transmute::<
444+
&mut asn1::SequenceOf<'_, ocsp_resp::SingleResponse<'_>>,
445+
&mut asn1::SequenceOf<'_, ocsp_resp::SingleResponse<'_>>,
446+
>(value)
447+
})
448+
})
438449
})
439450
}
440451

vectors/cryptography_vectors/__about__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
"__version__",
77
]
88

9-
__version__ = "42.0.5"
9+
__version__ = "42.0.6"

vectors/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi"
44

55
[project]
66
name = "cryptography_vectors"
7-
version = "42.0.5"
7+
version = "42.0.6"
88
authors = [
99
{name = "The Python Cryptographic Authority and individual contributors", email = "[email protected]"}
1010
]

0 commit comments

Comments
 (0)