Skip to content

Commit 4054596

Browse files
alexbotovq
andauthored
Backport LibreSSL 3.8.2 support for a 41.0.7 release (#9931)
* Backport LibreSSL 3.8.2 support for a 41.0.7 release * ci fixes * LibreSSL 3.8.1 and later is OPENSSL_NO_ENGINE (#9456) Unfortunately, some projects are not prepared to build without ENGINE symbols, so just like BoringSSL we needed to keep some stubs. * Don't build dh code on BoringSSL (#9103) It doesn't support DH via EVP * Update ci.yml (#9527) --------- Co-authored-by: Theo Buehler <[email protected]>
1 parent f09c261 commit 4054596

File tree

10 files changed

+42
-19
lines changed

10 files changed

+42
-19
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ jobs:
4040
- {VERSION: "3.11", NOXSESSION: "tests", NOXARGS: "--enable-fips=1", OPENSSL: {TYPE: "openssl", CONFIG_FLAGS: "enable-fips", VERSION: "3.1.3"}}
4141
- {VERSION: "3.11", NOXSESSION: "tests", OPENSSL: {TYPE: "libressl", VERSION: "3.6.3"}}
4242
- {VERSION: "3.11", NOXSESSION: "tests", OPENSSL: {TYPE: "libressl", VERSION: "3.7.3"}}
43-
- {VERSION: "3.11", NOXSESSION: "tests", OPENSSL: {TYPE: "libressl", VERSION: "3.8.0"}}
43+
- {VERSION: "3.11", NOXSESSION: "tests", OPENSSL: {TYPE: "libressl", VERSION: "3.8.2"}}
4444
- {VERSION: "3.11", NOXSESSION: "tests-randomorder"}
4545
- {VERSION: "3.12-dev", NOXSESSION: "tests"}
46-
# Latest commit on the BoringSSL master branch, as of May 27, 2023.
47-
- {VERSION: "3.11", NOXSESSION: "tests", OPENSSL: {TYPE: "boringssl", VERSION: "b0a026f8541c551854efd617021bb276f1fe5c23"}}
46+
# Latest commit on the BoringSSL master branch, as of Nov 24, 2023.
47+
- {VERSION: "3.12", NOXSESSION: "tests", OPENSSL: {TYPE: "boringssl", VERSION: "b3d1666b989c39c6e2f78d9c37de79b308c57a92"}}
4848
# Latest commit on the OpenSSL master branch, as of May 30, 2023.
4949
- {VERSION: "3.11", NOXSESSION: "tests", OPENSSL: {TYPE: "openssl", VERSION: "36424806d699233b9a90a3a97fff3011828e2548"}}
5050
# Builds with various Rust versions. Includes MSRV and potential

CHANGELOG.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Changelog
22
=========
33

4+
.. _v41-0-7:
5+
6+
41.0.7 - 2023-11-27
7+
~~~~~~~~~~~~~~~~~~~
8+
9+
* Fixed compilation when using LibreSSL 3.8.2.
10+
411
.. _v41-0-6:
512

613
41.0.6 - 2023-11-27

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ build-backend = "setuptools.build_meta"
1111

1212
[project]
1313
name = "cryptography"
14-
version = "41.0.6"
14+
version = "41.0.7"
1515
authors = [
1616
{name = "The Python Cryptographic Authority and individual contributors", email = "[email protected]"}
1717
]

src/_cffi_src/openssl/engine.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,20 @@
4242
typedef void UI_METHOD;
4343
#endif
4444
45-
/* Despite being OPENSSL_NO_ENGINE, BoringSSL defines these symbols. */
46-
#if !CRYPTOGRAPHY_IS_BORINGSSL
45+
/* Despite being OPENSSL_NO_ENGINE, BoringSSL/LibreSSL define these symbols. */
46+
#if !CRYPTOGRAPHY_IS_BORINGSSL && !CRYPTOGRAPHY_IS_LIBRESSL
4747
int (*ENGINE_free)(ENGINE *) = NULL;
4848
void (*ENGINE_load_builtin_engines)(void) = NULL;
4949
#endif
5050
51-
ENGINE *(*ENGINE_by_id)(const char *) = NULL;
52-
int (*ENGINE_init)(ENGINE *) = NULL;
53-
int (*ENGINE_finish)(ENGINE *) = NULL;
5451
ENGINE *(*ENGINE_get_default_RAND)(void) = NULL;
5552
int (*ENGINE_set_default_RAND)(ENGINE *) = NULL;
5653
void (*ENGINE_unregister_RAND)(ENGINE *) = NULL;
54+
55+
#if !CRYPTOGRAPHY_IS_LIBRESSL
56+
ENGINE *(*ENGINE_by_id)(const char *) = NULL;
57+
int (*ENGINE_init)(ENGINE *) = NULL;
58+
int (*ENGINE_finish)(ENGINE *) = NULL;
5759
int (*ENGINE_ctrl_cmd)(ENGINE *, const char *, long, void *,
5860
void (*)(void), int) = NULL;
5961
@@ -66,6 +68,7 @@
6668
void *) = NULL;
6769
EVP_PKEY *(*ENGINE_load_public_key)(ENGINE *, const char *,
6870
UI_METHOD *, void *) = NULL;
71+
#endif
6972
7073
#else
7174
static const long Cryptography_HAS_ENGINE = 1;

src/cryptography/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"__copyright__",
1111
]
1212

13-
__version__ = "41.0.6"
13+
__version__ = "41.0.7"
1414

1515

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

src/rust/Cargo.lock

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

src/rust/src/backend/dh.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ fn dh_parameters_from_numbers(
105105
Ok(openssl::dh::Dh::from_pqg(p, q, g)?)
106106
}
107107

108+
#[cfg(not(CRYPTOGRAPHY_IS_BORINGSSL))]
108109
#[pyo3::prelude::pyfunction]
109110
fn from_private_numbers(
110111
py: pyo3::Python<'_>,
@@ -131,6 +132,7 @@ fn from_private_numbers(
131132
Ok(DHPrivateKey { pkey })
132133
}
133134

135+
#[cfg(not(CRYPTOGRAPHY_IS_BORINGSSL))]
134136
#[pyo3::prelude::pyfunction]
135137
fn from_public_numbers(
136138
py: pyo3::Python<'_>,
@@ -226,6 +228,7 @@ impl DHPrivateKey {
226228
)?)
227229
}
228230

231+
#[cfg(not(CRYPTOGRAPHY_IS_BORINGSSL))]
229232
fn public_key(&self) -> CryptographyResult<DHPublicKey> {
230233
let orig_dh = self.pkey.dh().unwrap();
231234
let dh = clone_dh(&orig_dh)?;
@@ -353,6 +356,7 @@ impl DHPublicKey {
353356

354357
#[pyo3::prelude::pymethods]
355358
impl DHParameters {
359+
#[cfg(not(CRYPTOGRAPHY_IS_BORINGSSL))]
356360
fn generate_private_key(&self) -> CryptographyResult<DHPrivateKey> {
357361
let dh = clone_dh(&self.dh)?.generate_key()?;
358362
Ok(DHPrivateKey {
@@ -424,7 +428,9 @@ pub(crate) fn create_module(py: pyo3::Python<'_>) -> pyo3::PyResult<&pyo3::prelu
424428
m.add_function(pyo3::wrap_pyfunction!(public_key_from_ptr, m)?)?;
425429
m.add_function(pyo3::wrap_pyfunction!(from_der_parameters, m)?)?;
426430
m.add_function(pyo3::wrap_pyfunction!(from_pem_parameters, m)?)?;
431+
#[cfg(not(CRYPTOGRAPHY_IS_BORINGSSL))]
427432
m.add_function(pyo3::wrap_pyfunction!(from_private_numbers, m)?)?;
433+
#[cfg(not(CRYPTOGRAPHY_IS_BORINGSSL))]
428434
m.add_function(pyo3::wrap_pyfunction!(from_public_numbers, m)?)?;
429435
m.add_function(pyo3::wrap_pyfunction!(from_parameter_numbers, m)?)?;
430436

src/rust/src/backend/ed25519.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ impl Ed25519PrivateKey {
121121
impl Ed25519PublicKey {
122122
fn verify(&self, signature: &[u8], data: &[u8]) -> CryptographyResult<()> {
123123
let valid = openssl::sign::Verifier::new_without_digest(&self.pkey)?
124-
.verify_oneshot(signature, data)?;
124+
.verify_oneshot(signature, data)
125+
.unwrap_or(false);
125126

126127
if !valid {
127128
return Err(CryptographyError::from(

vectors/cryptography_vectors/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
"__version__",
77
]
88

9-
__version__ = "41.0.6"
9+
__version__ = "41.0.7"

vectors/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

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

0 commit comments

Comments
 (0)