Skip to contentSkip to conversation

openssl: Upgrade 4.0.3 -> 4.1.0 and dependencies update

PATCH New Jaipaul Cheernam 1 participant 4 messages Oct 29

lore
Share & tools
lore
#0 lore raw

v3 cover openssl: Upgrade 4.0.3 -> 4.1.0 and dependencies update

python3-cryptography and python3-pyopenssl changes works fine on 4.0.3 as well

Jaipaul Cheernam (3):
python3-cryptography: backport InvalidTag fix for openssl 4.1.0
python3-pyopenssl: Add patch to return None for TLS 1.3
openssl: Upgrade 4.0.3 -> 4.1.0

 ...1-Configure-do-not-tweak-mips-cflags.patch |  6 +-
 ...sysroot-and-debug-prefix-map-from-co.patch | 14 ++--
 .../0001-extend-check_cwm-test-timeout.patch  |  2 +-
 .../{openssl_4.0.3.bb => openssl_4.1.0.bb}    |  2 +-
 .../python/python3-cryptography.bb            |  1 +
 ...-on-AEAD-finalize-failure-regardless.patch | 53 +++++++++++++++
 ...m-master_key-for-TLS-1.3-connections.patch | 66 +++++++++++++++++++
 .../python/python3-pyopenssl_26.4.0.bb        |  1 +
 8 files changed, 133 insertions(+), 12 deletions(-)
 rename meta/recipes-connectivity/openssl/{openssl_4.0.3.bb => openssl_4.1.0.bb} (99%)
 create mode 100644 meta/recipes-devtools/python/python3-cryptography/0001-Raise-InvalidTag-on-AEAD-finalize-failure-regardless.patch
 create mode 100644 meta/recipes-devtools/python/python3-pyopenssl/0001-Return-None-from-master_key-for-TLS-1.3-connections.patch
#1 lore raw

PATCH v3 1/3 python3-cryptography: backport InvalidTag fix for openssl 4.1.0

openssl 4.1.0 changed the AEAD error queue, so bad-tag ptests now raise ValueError instead of InvalidTag. Backport pyca/cryptography#15596.

Backport of https://github.com/pyca/cryptography/pull/15596

---
 .../python/python3-cryptography.bb            |  1 +
 ...-on-AEAD-finalize-failure-regardless.patch | 53 +++++++++++++++++++
 2 files changed, 54 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-cryptography/0001-Raise-InvalidTag-on-AEAD-finalize-failure-regardless.patch
meta/recipes-devtools/python/python3-cryptography.bb +1 -0
index 5a1ce9fe2d..311b7313f0 100644
@@ -16,6 +16,7 @@ SRC_URI[sha256sum] = "7b46165bb56eb4704e2eaaf86f3c940d19154535d9b0ca7d6d590b0406
 SRC_URI += "file://0001-pyproject.toml-remove-benchmark-disable-option.patch \
             file://check-memfree.py \
             file://run-ptest \
+            file://0001-Raise-InvalidTag-on-AEAD-finalize-failure-regardless.patch \
            "
 
 require ${BPN}-crates.inc
meta/recipes-devtools/python/python3-cryptography/0001-Raise-InvalidTag-on-AEAD-finalize-failure-regardless.patch new file +53 -0

53 lines not on this page · raw message

#2 lore raw

PATCH v3 2/3 python3-pyopenssl: Add patch to return None for TLS 1.3

In reply to Jaipaul Cheernam

- Patch is needed for openssl 4.1.0 upgrade and working on 4.0.3 as well
- PR is opened upstream https://github.com/pyca/pyopenssl/pull/1545

ptest results:
PASS: 432
FAIL: 0
ERROR: 0
TOTAL: 1 FAIL: 0

---
 ...m-master_key-for-TLS-1.3-connections.patch | 66 +++++++++++++++++++
 .../python/python3-pyopenssl_26.4.0.bb        |  1 +
 2 files changed, 67 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-pyopenssl/0001-Return-None-from-master_key-for-TLS-1.3-connections.patch
meta/recipes-devtools/python/python3-pyopenssl/0001-Return-None-from-master_key-for-TLS-1.3-connections.patch new file +66 -0
new file mode 100644
index 0000000000..0942cbdc56
@@ -0,0 +1,66 @@
+From a0d7c02047a991ad2bd32621ac5f1b57062dc296 Mon Sep 17 00:00:00 2001
+From: Jaipaul Cheernam <[email protected]>
+Date: Thu, 29 Oct 2026 07:44:15 +0000
+Subject: [PATCH] Return None from master_key() for TLS 1.3 connections
+
+TLS 1.3 has no master secret, so SSL_SESSION_get_master_key() reports a
+length of 0. master_key() asserted length > 0 and raised
+OpenSSL.SSL.Error([]) for TLS 1.3 connections; return None instead,
+matching the existing bytes | None return type.
+
+Fixes https://github.com/pyca/pyopenssl/issues/1544
+
+Upstream-Status: Submitted [https://github.com/pyca/pyopenssl/pull/1545]
+
+Note: Exclude ChangeLog change for backport
+
+Signed-off-by: Jaipaul Cheernam <[email protected]>
+---
+ src/OpenSSL/SSL.py | 7 +++++--
+ tests/test_ssl.py  | 8 +++++++-
+ 2 files changed, 12 insertions(+), 3 deletions(-)
+
+diff --git a/src/OpenSSL/SSL.py b/src/OpenSSL/SSL.py
+index b7d5887..15ac4ab 100644
+--- a/src/OpenSSL/SSL.py
++++ b/src/OpenSSL/SSL.py
+@@ -2803,14 +2803,17 @@ class Connection:
+         """
+         Retrieve the value of the master key for this session.
+ 
+-        :return: A string representing the state
++        :return: The master key, or :obj:`None` if there is no session or the
++            connection uses TLS 1.3, which has no master secret.
+         """
+         session = _lib.SSL_get_session(self._ssl)
+         if session == _ffi.NULL:
+             return None
+ 
+         length = _lib.SSL_SESSION_get_master_key(session, _ffi.NULL, 0)
+-        _openssl_assert(length > 0)
++        # TLS 1.3 has no master secret, so the length is 0.
++        if length == 0:
++            return None
+         outp = _no_zero_allocator("unsigned char[]", length)
+         _lib.SSL_SESSION_get_master_key(session, outp, length)
+         return _ffi.buffer(outp, length)[:]
+diff --git a/tests/test_ssl.py b/tests/test_ssl.py
+index a551fc7..085ab35 100644
+--- a/tests/test_ssl.py
++++ b/tests/test_ssl.py
+@@ -4259,8 +4259,13 @@ class TestMemoryBIO:
+         # speaking any more.
+         assert interact_in_memory(client_conn, server_conn) is None
+ 
+-        # Now that the handshake is done, there should be a key and nonces.
+-        assert server_conn.master_key() is not None
++        # Now that the handshake is done, there should be nonces. For TLS <=
++        # 1.2 there is also a master secret; TLS 1.3 has none, so master_key()
++        # may be None there (it is with OpenSSL 4.1+) and must not raise.
++        if server_conn.get_protocol_version() < TLS1_3_VERSION:
++            assert server_conn.master_key() is not None
++        else:
++            server_conn.master_key()
+         assert server_conn.client_random() is not None
+         assert server_conn.server_random() is not None
+         assert server_conn.client_random() == client_conn.client_random()
meta/recipes-devtools/python/python3-pyopenssl_26.4.0.bb +1 -0
index 0aa1e8991e..500027fa25 100644
@@ -5,6 +5,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
 
 DEPENDS += "openssl python3-cryptography"
 
+SRC_URI += "file://0001-Return-None-from-master_key-for-TLS-1.3-connections.patch"
 SRC_URI[sha256sum] = "28dfcce0162b9211413e26dfbfdf1d24317fbeba18fc93c12400a1856b2a0bc7"
 
 inherit pypi setuptools3 ptest-python-pytest
#3 lore raw

PATCH v3 3/3 openssl: Upgrade 4.0.3 -> 4.1.0

In reply to Jaipaul Cheernam

Release information [1]:

OpenSSL 4.1.0 is a feature release adding significant new functionality to OpenSSL.

This release incorporates the following potentially significant or incompatible changes:

- Added VC-WIN32-MSVC2013 and VC-WIN64A-MSVC2013 build targets to provide internal functions for bridging the gaps in C99 standard support that are present in MSVC 2013.
- Added optimized ML-DSA and ML-KEM NTT operations on ppc64le; optimized ML-DSA operations on x86_64; AVX-512-optimized SHAKE x4 operations for ML-DSA on x86_64; AVX-512 and VAES optimizations for AES-CBC decryption on x86_64.
- Changed tsget utility to use Net::Curl::Easy (from the Net-Curl CPAN distribution) instead of the abandoned WWW::Curl::Easy. Users who rely on tsget should install Net::Curl::Easy before upgrading.
- Dropped Windows-on-Itanium (VC-WIN64I) and Windows CE (VC-CE) targets from Configurations.
- Dropped no-ecdsa and no-ecdh options from Configure, as these options did not really disable the implementations. Use no-ec to disable the elliptic curve support.

This release adds the following new features:

- Support for DTLS 1.3 (RFC 9147). Refer to the ossl-guide-dtlsv13(7) manual page for details.
- Support for RFC 8701 GREASE (Generate Random Extensions And Sustain Extensibility).
- DTLS support in the SSL listener API.
- Support for IKEV2 KDF.
- Initial support for the Elbrus2000 (e2k) architecture.

[1] https://github.com/openssl/openssl/blob/openssl-4.1/NEWS.md#major-changes-between-openssl-40-and-openssl-410-23-oct-2026

- Refresh existing patches
- Verified with world
- Verified ptest python3-cryptography
TOTAL: 4650
PASS: 4443
FAIL: 0
ERROR: 0
TOTAL: 1 FAIL: 0

---
Changes since v2:
- Add patch for python3-pyopenssl

Changes since v1:
- Add patch for python3-cryptography

 .../0001-Configure-do-not-tweak-mips-cflags.patch  |  6 +++---
 ...trip-sysroot-and-debug-prefix-map-from-co.patch | 14 +++++++-------
 .../0001-extend-check_cwm-test-timeout.patch       |  2 +-
 .../openssl/{openssl_4.0.3.bb => openssl_4.1.0.bb} |  2 +-
 4 files changed, 12 insertions(+), 12 deletions(-)
 rename meta/recipes-connectivity/openssl/{openssl_4.0.3.bb => openssl_4.1.0.bb} (99%)
meta/recipes-connectivity/openssl/openssl/0001-Configure-do-not-tweak-mips-cflags.patch +3 -3
index 77bfe4e4e5..2991082a5f 100644
@@ -1,4 +1,4 @@
-From b5cee0cb0f14a78056ef7722a34b361491f1fdda Mon Sep 17 00:00:00 2001
+From 89d2702e00b0826fded82b06a9866e0fe7380540 Mon Sep 17 00:00:00 2001
 From: Alexander Kanavin <[email protected]>
 Date: Tue, 30 May 2023 09:11:27 -0700
 Subject: [PATCH] Configure: do not tweak mips cflags
@@ -17,10 +17,10 @@ Signed-off-by: Tim Orling <[email protected]>
  1 file changed, 10 deletions(-)
 
 diff --git a/Configure b/Configure
-index c05a30b..db8adee 100755
+index e66424a..62141fe 100755
 --- a/Configure
 +++ b/Configure
-@@ -1575,16 +1575,6 @@ if ($target =~ /^mingw/ && `$config{CC} --target-help 2>&1` =~ m/-mno-cygwin/m)
+@@ -1617,16 +1617,6 @@ if ($target =~ /^mingw/ && `$config{CC} --target-help 2>&1` =~ m/-mno-cygwin/m)
          push @{$config{shared_ldflag}}, "-mno-cygwin";
          }
  
meta/recipes-connectivity/openssl/openssl/0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch +7 -7
index 1d9e7539f6..04f46a3d3e 100644
@@ -1,4 +1,4 @@
-From 6df53bfebcf8ca65910a18220a6576fb110918a5 Mon Sep 17 00:00:00 2001
+From 4df92463252f8f0695db0143d3a26566a1736b2c Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Martin=20Hundeb=C3=B8ll?= <[email protected]>
 Date: Tue, 6 Nov 2018 14:50:47 +0100
 Subject: [PATCH] buildinfo: strip sysroot and debug-prefix-map from compiler
@@ -34,12 +34,12 @@ Signed-off-by: Khem Raj <[email protected]>
  2 files changed, 16 insertions(+), 2 deletions(-)
 
 diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
-index eff66e5..bc48f51 100644
+index f8a5b16..807439f 100644
 --- a/Configurations/unix-Makefile.tmpl
 +++ b/Configurations/unix-Makefile.tmpl
-@@ -503,13 +503,27 @@ BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (),
-                          '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
- BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
+@@ -532,13 +532,27 @@ BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
+ CMOCKA_LIBS={- $config{cmocka_libs} // '' -}
+ DETOURS_LIBS={- $config{detours_libs} // '' -}
  
 -# CPPFLAGS_Q is used for one thing only: to build up buildinf.h
 +# *_Q variables are used for one thing only: to build up buildinf.h
@@ -67,10 +67,10 @@ index eff66e5..bc48f51 100644
  
  # For x86 assembler: Set PROCESSOR to 386 if you want to support
 diff --git a/crypto/build.info b/crypto/build.info
-index 8e4a885..95b0902 100644
+index 422f4aa..3573af9 100644
 --- a/crypto/build.info
 +++ b/crypto/build.info
-@@ -114,7 +114,7 @@ DEFINE[../libcrypto]=$UPLINKDEF
+@@ -113,7 +113,7 @@ DEFINE[../libcrypto]=$UPLINKDEF
  
  DEPEND[info.o]=buildinf.h
  DEPEND[cversion.o]=buildinf.h
meta/recipes-connectivity/openssl/openssl/0001-extend-check_cwm-test-timeout.patch +1 -1
index 26622fd1b1..29b9728479 100644
@@ -1,4 +1,4 @@
-From 07bbd037ca61264bcc311856a119b664ce13f586 Mon Sep 17 00:00:00 2001
+From ff0de34474c0dfec4f13dfb4079689c8731bf6ce Mon Sep 17 00:00:00 2001
 From: Gyorgy Sarvari <[email protected]>
 Date: Thu, 23 Oct 2025 11:24:36 +0200
 Subject: [PATCH] extend check_cwm test timeout
meta/recipes-connectivity/openssl/openssl_4.1.0.bb renamed from meta/recipes-connectivity/openssl/openssl_4.0.3.bb +1 -1
similarity index 99%
rename from meta/recipes-connectivity/openssl/openssl_4.0.3.bb
rename to meta/recipes-connectivity/openssl/openssl_4.1.0.bb
index 122bf61f59..1e47c3cf34 100644
@@ -18,7 +18,7 @@ SRC_URI:append:class-nativesdk = " \
            file://environment.d-openssl.sh \
            "
 
-SRC_URI[sha256sum] = "325b5c806167c13b40b1ffeadfe0248197c00eccc4cf123ec1e28d2d2fd216d9"
+SRC_URI[sha256sum] = "50c17baf54cb008f6ce42d50deb4b28050a1aad711636cabd4b241c7e90cc2fd"
 
 inherit lib_package multilib_header ptest perlnative manpages