Skip to contentSkip to conversation

Fix OpenSSL 4.0.1 build failures across meta-openembedded

RFC New Jaipaul Cheernam 1 participant 21 messages Aug 27

lore
Share & tools
lore
#0 lore raw

cover Fix OpenSSL 4.0.1 build failures across meta-openembedded

OpenSSL 4.0.1 upgrade in OE-Core (RFC v4 series on openembedded-core ML) introduces several breaking API changes that affect recipes across meta-openembedded:

- ENGINE API removed entirely
- ASN1_STRING, ASN1_TIME, ASN1_OCTET_STRING made opaque
- const qualifiers added to X509 getter return types
- Per-version TLS method functions removed
- ASN1_STRING_data() and ERR_remove_state() removed

This series fixes 20 recipes across meta-oe, meta-networking, meta-python, meta-perl, and meta-multimedia. All patches have upstream references — either backports from merged commits or submitted PRs.

Tested with bitbake world -k on qemux86-64.

Known remaining failures (not addressed in this series):

ENGINE API dependent (needs Provider API rewrite):
- imx-cst: NXP proprietary, no public upstream
- extract-cert: needs Provider API migration

Dead/unmaintained upstream:
- wvstreams/wvdial: archived 2018
- ntp (classic): EOL 2023, recommend chrony
- loudmouth: last activity 2019

No upstream fix available:
- ldns: heavy deprecated API usage (issue #243 since 2024)
- unbound: upstream PR #1437 attempted, closed
- softhsm: upstream PR #882 in progress
- ipmiutil, synergy, spdm-emu: no upstream fix

Indirect:
- mercurial: Python 3.14 + OpenSSL 4.0 reports TLS 1.2 as unavailable (upstream CPython limitation, only Python 3.15 officially supports OpenSSL 4.0)

3 upstream PRs submitted by us: ntopng (merged), thrift, snort3

Jaipaul Cheernam (20):
freediameter: remove openssl-engines from RDEPENDS
krb5: fix build with OpenSSL 4.0
libnet-ssleay-perl: fix build with OpenSSL 4.0
libtorrent-rasterbar: fix build with OpenSSL 4.0
pkcs11-helper: fix build with OpenSSL 4.0
opensc: fix build with OpenSSL 4.0
grpc: fix build with OpenSSL 4.0
python3-grpcio: fix build with OpenSSL 4.0
thrift: fix build with OpenSSL 4.0
boinc-client: fix build with OpenSSL 4.0
imapfilter: fix build with OpenSSL 4.0
lftp: fix build with OpenSSL 4.0
civetweb: fix build with OpenSSL 4.0
freeradius: fix build with OpenSSL 4.0
snort3: fix build with OpenSSL 4.0
znc: fix build with OpenSSL 4.0
libesmtp: fix build with OpenSSL 4.0
ntopng: fix build with OpenSSL 4.0
libcoap: fix build with OpenSSL 4.0
pjproject: fix build with OpenSSL 4.0

 ...k_ossl-fix-OpenSSL-4.0-compatibility.patch |  40 ++
 .../pjproject/pjproject_2.17.bb               |   4 +-
 .../0001-Fix-compilation-with-openssl-4.patch |  27 +
 .../civetweb/civetweb_1.16.bb                 |   1 +
 ...ING-functions-for-OpenSSL-4.0-compat.patch |  78 +++
 .../freeradius/freeradius_3.2.10.bb           |   1 +
 .../0001-allow-build-with-OpenSSL-4.x.patch   |  55 ++
 .../recipes-connectivity/lftp/lftp_4.9.3.bb   |   1 +
 ...fix-const-qualifiers-for-OpenSSL-4.0.patch |  53 ++
 .../snort/snort3_3.12.2.0.bb                  |   1 +
 ...OpenSSL-Support-4.0-and-later-builds.patch | 507 ++++++++++++++
 .../libcoap/libcoap_4.3.5b.bb                 |   1 +
 .../0001-Fix-build-error-with-OpenSSL-4.patch |  51 ++
 meta-networking/recipes-irc/znc/znc_1.10.2.bb |   4 +-
 .../freediameter/freediameter_1.6.0.bb        |   2 +-
 ...-with-OpenSSL-4.0-opaque-ASN1_STRING.patch |  31 +
 .../libesmtp/libesmtp_1.1.0.bb                |   4 +-
 .../0001-Fix-build-with-OpenSSL-4.0.patch     |  42 ++
 .../recipes-support/ntopng/ntopng_6.6.bb      |   1 +
 ...Improve-future-OpenSSL-compatibility.patch | 285 ++++++++
 .../0002-Remove-OpenSSL-1.0-support.patch     | 627 ++++++++++++++++++
 ...ing-const-qualifiers-for-OpenSSL-4.0.patch |  67 ++
 .../recipes-connectivity/krb5/krb5_1.22.2.bb  |   3 +
 .../0001-Add-support-for-OpenSSL-4.0.patch    |  61 ++
 .../libtorrent-rasterbar_2.0.12.bb            |   4 +-
 ...SSLSocket-fix-build-with-OpenSSL-4.0.patch | 113 ++++
 .../thrift/thrift_0.24.0.bb                   |   1 +
 ...1-crypto-openssl-use-ASN1_TIME_to_tm.patch |  45 ++
 .../pkcs11-helper/pkcs11-helper_1.31.0.bb     |   4 +-
 ...ls-Fix-OpenSSL-3.0-4.0-compatibility.patch |  85 +++
 ...L-4.0-const-and-opaque-compatibility.patch |  61 ++
 ...sport_security_utils-for-OpenSSL-4.0.patch |  63 ++
 ...ing-const-qualifiers-for-OpenSSL-4.0.patch |  49 ++
 meta-oe/recipes-devtools/grpc/grpc_1.83.0.bb  |   4 +
 .../0001-Fix-build-with-OpenSSL-4.0.patch     |  41 ++
 .../boinc/boinc-client_8.2.15.bb              |   1 +
 ...NG-accessors-for-opaque-ASN1_INTEGER.patch |  45 ++
 .../imapfilter/imapfilter_2.8.5.bb            |   1 +
 .../0001-Changes-for-OpenSSL-4.0.0.patch      | 331 +++++++++
 .../recipes-support/opensc/opensc_0.27.1.bb   |   4 +-
 .../0001-Fix-SSLv3-in-OpenSSL-4.0.0.patch     |  34 +
 ...emove-support-for-some-TLS-functions.patch | 192 ++++++
 ...SSLeay-to-support-opaque-ASN1_STRING.patch | 175 +++++
 .../libnet/libnet-ssleay-perl_1.96.bb         |   6 +-
 .../0001-Fix-OpenSSL-4.0-compatibility.patch  | 140 ++++
 .../python/python3-grpcio_1.78.0.bb           |   1 +
 46 files changed, 3339 insertions(+), 8 deletions(-)
 create mode 100644 meta-multimedia/recipes-multimedia/pjproject/pjproject/0001-ssl_sock_ossl-fix-OpenSSL-4.0-compatibility.patch
 create mode 100644 meta-networking/recipes-connectivity/civetweb/civetweb/0001-Fix-compilation-with-openssl-4.patch
 create mode 100644 meta-networking/recipes-connectivity/freeradius/freeradius/0001-Use-ASN1_STRING-functions-for-OpenSSL-4.0-compat.patch
 create mode 100644 meta-networking/recipes-connectivity/lftp/lftp/0001-allow-build-with-OpenSSL-4.x.patch
 create mode 100644 meta-networking/recipes-connectivity/snort/snort3/0001-ssl-fix-const-qualifiers-for-OpenSSL-4.0.patch
 create mode 100644 meta-networking/recipes-devtools/libcoap/libcoap/0001-OpenSSL-Support-4.0-and-later-builds.patch
 create mode 100644 meta-networking/recipes-irc/znc/znc/0001-Fix-build-error-with-OpenSSL-4.patch
 create mode 100644 meta-networking/recipes-support/libesmtp/libesmtp/0001-Fix-build-with-OpenSSL-4.0-opaque-ASN1_STRING.patch
 create mode 100644 meta-networking/recipes-support/ntopng/ntopng/0001-Fix-build-with-OpenSSL-4.0.patch
 create mode 100644 meta-oe/recipes-connectivity/krb5/krb5/0001-Improve-future-OpenSSL-compatibility.patch
 create mode 100644 meta-oe/recipes-connectivity/krb5/krb5/0002-Remove-OpenSSL-1.0-support.patch
 create mode 100644 meta-oe/recipes-connectivity/krb5/krb5/0003-k5tls-fix-remaining-const-qualifiers-for-OpenSSL-4.0.patch
 create mode 100644 meta-oe/recipes-connectivity/libtorrent-rasterbar/libtorrent-rasterbar/0001-Add-support-for-OpenSSL-4.0.patch
 create mode 100644 meta-oe/recipes-connectivity/thrift/thrift/0001-TSSLSocket-fix-build-with-OpenSSL-4.0.patch
 create mode 100644 meta-oe/recipes-crypto/pkcs11-helper/pkcs11-helper/0001-crypto-openssl-use-ASN1_TIME_to_tm.patch
 create mode 100644 meta-oe/recipes-devtools/grpc/grpc/0001-credentials-Fix-OpenSSL-3.0-4.0-compatibility.patch
 create mode 100644 meta-oe/recipes-devtools/grpc/grpc/0002-tsi-fix-OpenSSL-4.0-const-and-opaque-compatibility.patch
 create mode 100644 meta-oe/recipes-devtools/grpc/grpc/0003-tsi-fix-ssl_transport_security_utils-for-OpenSSL-4.0.patch
 create mode 100644 meta-oe/recipes-devtools/grpc/grpc/0004-tsi-fix-remaining-const-qualifiers-for-OpenSSL-4.0.patch
 create mode 100644 meta-oe/recipes-extended/boinc/boinc-client/0001-Fix-build-with-OpenSSL-4.0.patch
 create mode 100644 meta-oe/recipes-support/imapfilter/imapfilter/0001-Use-ASN1_STRING-accessors-for-opaque-ASN1_INTEGER.patch
 create mode 100644 meta-oe/recipes-support/opensc/opensc/0001-Changes-for-OpenSSL-4.0.0.patch
 create mode 100644 meta-perl/recipes-perl/libnet/libnet-ssleay-perl/0001-Fix-SSLv3-in-OpenSSL-4.0.0.patch
 create mode 100644 meta-perl/recipes-perl/libnet/libnet-ssleay-perl/0002-OpenSSL-4.0.0-remove-support-for-some-TLS-functions.patch
 create mode 100644 meta-perl/recipes-perl/libnet/libnet-ssleay-perl/0003-Fix-Net-SSLeay-to-support-opaque-ASN1_STRING.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-grpcio/0001-Fix-OpenSSL-4.0-compatibility.patch
#1 lore raw

RFC 1/20 freediameter: remove openssl-engines from RDEPENDS

OpenSSL 4.0 removed the ENGINE API entirely, so the openssl-engines package no longer exists. Remove it from RDEPENDS.

---
 .../recipes-protocols/freediameter/freediameter_1.6.0.bb        | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta-networking/recipes-protocols/freediameter/freediameter_1.6.0.bb +1 -1
index 44be5044b1..4d4d8f32ef 100644
@@ -125,7 +125,7 @@ FILES:${PN}-dbg += "${libdir}/${fd_pkgname}/.debug/*"
 FILES:${PN} += "${libdir}/${fd_pkgname}/*"
 
 RDEPENDS:${PN}  = "glib-2.0 gnutls libidn"
-RDEPENDS:${PN} += "openssl openssl-conf openssl-engines"
+RDEPENDS:${PN} += "openssl openssl-conf"
 RRECOMMENDS:${PN} += "kernel-module-tipc kernel-module-sctp"
 RRECOMMENDS:${PN} += "kernel-module-udp-tunnel kernel-module-ipip"
 RDEPENDS:${PN}-ptest = "cmake"
#2 lore raw

RFC 2/20 krb5: fix build with OpenSSL 4.0

In reply to Jaipaul Cheernam

OpenSSL 4.0 adds const qualifiers to X509 accessor return types, makes ASN1_STRING opaque, and removes OpenSSL 1.0 compatibility functions.

Backport three patches:
- Improve future OpenSSL compatibility (upstream 5e4e84523288)
- Remove OpenSSL 1.0 support (upstream f8a47bf037af, context adjusted)
- Fix remaining const qualifiers in k5tls for 1.22.x (functions removed on trunk, fix only needed for this version)

Upstream-Status: Backport / Inappropriate (patch 3)

---
 ...Improve-future-OpenSSL-compatibility.patch | 285 ++++++++
 .../0002-Remove-OpenSSL-1.0-support.patch     | 627 ++++++++++++++++++
 ...ing-const-qualifiers-for-OpenSSL-4.0.patch |  67 ++
 .../recipes-connectivity/krb5/krb5_1.22.2.bb  |   3 +
 4 files changed, 982 insertions(+)
 create mode 100644 meta-oe/recipes-connectivity/krb5/krb5/0001-Improve-future-OpenSSL-compatibility.patch
 create mode 100644 meta-oe/recipes-connectivity/krb5/krb5/0002-Remove-OpenSSL-1.0-support.patch
 create mode 100644 meta-oe/recipes-connectivity/krb5/krb5/0003-k5tls-fix-remaining-const-qualifiers-for-OpenSSL-4.0.patch
meta-oe/recipes-connectivity/krb5/krb5/0001-Improve-future-OpenSSL-compatibility.patch new file +285 -0
new file mode 100644
index 0000000000..3ae23f0031
@@ -0,0 +1,285 @@
+From 5e4e8452328804948d042235bbf58ca457795857 Mon Sep 17 00:00:00 2001
+From: Bob Beck <[email protected]>
+Date: Mon, 16 Feb 2026 15:15:55 -0700
+Subject: [PATCH] Improve future OpenSSL compatibility
+
+Avoid calling deprecated OpenSSL functions when compiling against
+versions of OpenSSL where they are deprecated.  Add
+-DOPENSSL_NO_DEPRECATED to the linux-clang-openssl CI build to help
+detect calls to deprecated functions in the future.
+
+Use const pointer variables to hold values retrieved by accessors
+which will return const pointers in OpenSSL 4.0.  Define macros to
+make certain functions accept these const pointers in versions of
+OpenSSL where they don't already do so.
+
+Use accessor functions instead of direct field access for ASN1_STRING
+values, as the type will become opaque in OpenSSL 4.0.
+
+The PKINIT code is written to assume that DHX support was not present
+until OpenSSL 1.1, but it was added in release 1.0.2, causing a
+compilation error against 1.0.2 from a double definition of
+EVP_PKEY_DHX.  Minimally fix the compilation error.  (The custom DHX
+marshalling code to support 1.0.x could be removed, as 1.0.2 is the
+minimum version after commit f5bbfa4821cf590a4748f96d0e016bc0485e95c4,
+but the plan is to remove 1.0.x compatibility shortly.)
+
+Contains work by Frederik Wedel-Heinen
+<[email protected]> and Dimitri John Ledkov
+<[email protected]>.
+
+[[email protected]: combined numerous commits; added compatibility
+macros; rewrote commit message; fixed 1.0.2 compatibility issue]
+Upstream-Status: Backport [https://github.com/krb5/krb5/commit/5e4e84523288]
+
+Note: .github/workflows/build.yml hunk dropped (CI-only, not relevant
+for OE builds).
+Signed-off-by: Jaipaul Cheernam <[email protected]>
+---
+ .github/workflows/build.yml                   | 10 ++--
+ .../preauth/pkinit/pkinit_crypto_openssl.c    | 54 ++++++++++++++-----
+ src/plugins/tls/k5tls/openssl.c               | 26 +++++++--
+ 3 files changed, 68 insertions(+), 22 deletions(-)
+
+diff --git a/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c b/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
+index d1fe18e5ab..aa969aa37c 100644
+--- a/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
++++ b/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
+@@ -209,13 +209,20 @@ create_identifiers_from_stack(STACK_OF(X509) *sk,
+ #define EVP_MD_CTX_new EVP_MD_CTX_create
+ #define EVP_MD_CTX_free EVP_MD_CTX_destroy
+ #define ASN1_STRING_get0_data ASN1_STRING_data
++#define X509_STORE_CTX_set0_trusted_stack X509_STORE_CTX_trusted_stack
+ 
+ /*
+- * 1.1 adds DHX support, which uses the RFC 3279 DomainParameters encoding we
++ * 1.0.2 adds DHX support, which uses the RFC 3279 DomainParameters encoding we
+  * need for PKINIT.  For 1.0 we must use the original DH type when creating
+  * EVP_PKEY objects.
+  */
++#ifndef EVP_PKEY_DHX
+ #define EVP_PKEY_DHX EVP_PKEY_DH
++#endif
++
++/* Make X509_NAME_print_ex() accept a const name pointer by adding a cast. */
++#define X509_NAME_print_ex(a, b, c, d)          \
++    X509_NAME_print_ex(a, (X509_NAME *)b, c, d)
+ 
+ /* 1.1 makes many handle types opaque and adds accessors.  Add compatibility
+  * versions of the new accessors we use for pre-1.1. */
+@@ -295,6 +302,10 @@ compat_ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s)
+ #define EVP_PKEY_get_bits EVP_PKEY_bits
+ #define EVP_PKEY_get_base_id EVP_PKEY_base_id
+ 
++/* Make X509_dup() accept a const pointer by adding a cast. */
++#define X509_dup(a) X509_dup((X509 *)a)
++#define i2d_X509_NAME(a, b) i2d_X509_NAME((X509_NAME *)a, b)
++
+ /*
+  * Convert *dh to an EVP_PKEY object, taking ownership of *dh and setting it to
+  * NULL.  On error, return NULL and do not take ownership of or change *dh.
+@@ -318,6 +329,11 @@ dh_to_pkey(DH **dh)
+ }
+ #endif /* OPENSSL_VERSION_NUMBER < 0x30000000L */
+ 
++#if OPENSSL_VERSION_NUMBER < 0x40000000L
++/* Make X509V3_EXT_d2i() accept a const pointer by adding a cast. */
++#define X509V3_EXT_d2i(a) X509V3_EXT_d2i((X509_EXTENSION *)a)
++#endif
++
+ /* Encode a bignum as an ASN.1 integer in DER. */
+ static int
+ encode_bn_der(const BIGNUM *bn, uint8_t **der_out, int *len_out)
+@@ -1134,6 +1150,13 @@ oerr_cert(krb5_context context, krb5_error_code code, X509_STORE_CTX *certctx,
+     return oerr(context, code, _("%s (depth %d): %s"), msg, depth, errstr);
+ }
+ 
++/* Convert an OpenSSL ASN.1 string value to krb5_data, without copying. */
++static inline krb5_data
++asn1string_to_data(ASN1_STRING *s)
++{
++    return make_data((char *)ASN1_STRING_get0_data(s), ASN1_STRING_length(s));
++}
++
+ krb5_error_code
+ pkinit_init_plg_crypto(krb5_context context,
+                        pkinit_plg_crypto_context *cryptoctx)
+@@ -1775,7 +1798,7 @@ cms_signeddata_create(krb5_context context,
+             goto cleanup;
+         X509_STORE_CTX_init(certctx, certstore, id_cryptoctx->my_cert,
+                             id_cryptoctx->intermediateCAs);
+-        X509_STORE_CTX_trusted_stack(certctx, id_cryptoctx->trustedCAs);
++        X509_STORE_CTX_set0_trusted_stack(certctx, id_cryptoctx->trustedCAs);
+         if (!X509_verify_cert(certctx)) {
+             retval = oerr_cert(context, 0, certctx,
+                                _("Failed to verify own certificate"));
+@@ -2002,7 +2025,7 @@ cms_signeddata_verify(krb5_context context,
+         unsigned char *d;
+         *is_signed = 0;
+         octets = CMS_get0_content(cms);
+-        if (!octets || ((*octets)->type != V_ASN1_OCTET_STRING)) {
++        if (!octets || (ASN1_STRING_type(*octets) != V_ASN1_OCTET_STRING)) {
+             retval = KRB5KDC_ERR_PREAUTH_FAILED;
+             krb5_set_error_message(context, retval,
+                                    _("Invalid pkinit packet: octet string "
+@@ -2058,7 +2081,8 @@ cms_signeddata_verify(krb5_context context,
+         /* We cannot use CMS_dataInit because there may be no digest */
+         octets = CMS_get0_content(cms);
+         if (octets)
+-            out = BIO_new_mem_buf((*octets)->data, (*octets)->length);
++            out = BIO_new_mem_buf(ASN1_STRING_get0_data(*octets),
++                                  ASN1_STRING_length(*octets));
+         if (out == NULL)
+             goto cleanup;
+     } else {
+@@ -2118,7 +2142,7 @@ cms_signeddata_verify(krb5_context context,
+ 
+         /* add trusted CAs certificates for cert verification */
+         if (idctx->trustedCAs != NULL)
+-            X509_STORE_CTX_trusted_stack(cert_ctx, idctx->trustedCAs);
++            X509_STORE_CTX_set0_trusted_stack(cert_ctx, idctx->trustedCAs);
+         else {
+             pkiDebug("unable to find any trusted CAs\n");
+             goto cleanup;
+@@ -2156,7 +2180,7 @@ cms_signeddata_verify(krb5_context context,
+         i = X509_verify_cert(cert_ctx);
+         if (i <= 0) {
+             int j = X509_STORE_CTX_get_error(cert_ctx);
+-            X509 *cert;
++            const X509 *cert;
+ 
+             cert = X509_STORE_CTX_get_current_cert(cert_ctx);
+             reqctx->received_cert = X509_dup(cert);
+@@ -2316,7 +2340,7 @@ crypto_retrieve_X509_sans(krb5_context context,
+     krb5_principal *princs = NULL;
+     char **upns = NULL;
+     unsigned char **dnss = NULL;
+-    X509_EXTENSION *ext = NULL;
++    const X509_EXTENSION *ext = NULL;
+     GENERAL_NAMES *ialt = NULL;
+     GENERAL_NAME *gen = NULL;
+ 
+@@ -2379,8 +2403,7 @@ crypto_retrieve_X509_sans(krb5_context context,
+         gen = sk_GENERAL_NAME_value(ialt, i);
+         switch (gen->type) {
+         case GEN_OTHERNAME:
+-            name.length = gen->d.otherName->value->value.sequence->length;
+-            name.data = (char *)gen->d.otherName->value->value.sequence->data;
++            name = asn1string_to_data(gen->d.otherName->value->value.sequence);
+             if (princs != NULL &&
+                 OBJ_cmp(plgctx->id_pkinit_san,
+                         gen->d.otherName->type_id) == 0) {
+@@ -2414,12 +2437,13 @@ crypto_retrieve_X509_sans(krb5_context context,
+         case GEN_DNS:
+             if (dnss != NULL) {
+                 /* Prevent abuse of embedded null characters. */
+-                if (memchr(gen->d.dNSName->data, '\0', gen->d.dNSName->length))
++                if (memchr(ASN1_STRING_get0_data(gen->d.dNSName), '\0',
++                           ASN1_STRING_length(gen->d.dNSName)))
+                     break;
+                 pkiDebug("%s: found dns name = %s\n", __FUNCTION__,
+-                         gen->d.dNSName->data);
++                         ASN1_STRING_get0_data(gen->d.dNSName));
+                 dnss[d] = (unsigned char *)
+-                    strdup((char *)gen->d.dNSName->data);
++                    strdup((char *)ASN1_STRING_get0_data(gen->d.dNSName));
+                 if (dnss[d] == NULL) {
+                     pkiDebug("%s: failed to duplicate dns name\n",
+                              __FUNCTION__);
+@@ -3094,8 +3118,10 @@ int
+ pkinit_openssl_init(void)
+ {
+     /* Initialize OpenSSL. */
++#if OPENSSL_VERSION_NUMBER < 0x10100000L
+     ERR_load_crypto_strings();
+     OpenSSL_add_all_algorithms();
++#endif
+     return 0;
+ }
+ 
+@@ -4766,7 +4792,7 @@ crypto_retrieve_X509_key_usage(krb5_context context,
+ }
+ 
+ static krb5_error_code
+-rfc2253_name(X509_NAME *name, char **str_out)
++rfc2253_name(const X509_NAME *name, char **str_out)
+ {
+     BIO *b = NULL;
+     char *str;
+@@ -5227,7 +5253,7 @@ create_identifiers_from_stack(STACK_OF(X509) *sk,
+     int i = 0, sk_size = sk_X509_num(sk);
+     krb5_external_principal_identifier **krb5_cas = NULL;
+     X509 *x = NULL;
+-    X509_NAME *xn = NULL;
++    const X509_NAME *xn = NULL;
+     unsigned char *p = NULL;
+     int len = 0;
+     PKCS7_ISSUER_AND_SERIAL *is = NULL;
+diff --git a/src/plugins/tls/k5tls/openssl.c b/src/plugins/tls/k5tls/openssl.c
+index 42d72dc9ec..7763327b7a 100644
+--- a/src/plugins/tls/k5tls/openssl.c
++++ b/src/plugins/tls/k5tls/openssl.c
+@@ -38,6 +38,24 @@
+ #include <openssl/x509v3.h>
+ #include <dirent.h>
+ 
++#if OPENSSL_VERSION_NUMBER < 0x10100000L
++/* Make X509_get_subject_name() accept a const pointer by adding a cast. */
++#define X509_get_subject_name(a) X509_get_subject_name((X509 *)a)
++
++/* OpenSSL 1.0 did not have TLS_client_method(); use the best alternative. */
++#define TLS_client_method() SSLv23_client_method()
++#endif
++
++#if OPENSSL_VERSION_NUMBER < 0x40000000L
++/*
++ * OpenSSL 4.0 constifies the result of X509_STORE_CTX_get_current_cert() and
++ * the input of X509_check_host() and X509_check_ip_asc().  For prior versions,
++ * make the latter two functions accept const pointers via a cast.
++ */
++#define X509_check_host(a, b, c, d, e) X509_check_host((X509 *)a, b, c, d, e)
++#define X509_check_ip_asc(a, b, c) X509_check_ip_asc((X509 *)a, b, c)
++#endif
++
+ struct k5_tls_handle_st {
+     SSL *ssl;
+     char *servername;
+@@ -51,9 +69,11 @@ MAKE_INIT_FUNCTION(init_openssl);
+ int
+ init_openssl(void)
+ {
++#if OPENSSL_VERSION_NUMBER < 0x10100000L
+     SSL_library_init();
+     SSL_load_error_strings();
+     OpenSSL_add_all_algorithms();
++#endif
+     ex_context_id = SSL_get_ex_new_index(0, NULL, NULL, NULL, NULL);
+     ex_handle_id = SSL_get_ex_new_index(0, NULL, NULL, NULL, NULL);
+     return 0;
+@@ -72,7 +92,7 @@ flush_errors(krb5_context context)
+ }
+ 
+ static krb5_boolean
+-check_cert_name_or_ip(X509 *x, const char *expected_name)
++check_cert_name_or_ip(const X509 *x, const char *expected_name)
+ {
+     struct in_addr in;
+     struct in6_addr in6;
+@@ -89,7 +109,7 @@ check_cert_name_or_ip(X509 *x, const char *expected_name)
+ static int
+ verify_callback(int preverify_ok, X509_STORE_CTX *store_ctx)
+ {
+-    X509 *x;
++    const X509 *x;
+     SSL *ssl;
+     BIO *bio;
+     krb5_context context;
+@@ -246,7 +266,7 @@ setup(krb5_context context, SOCKET fd, const char *servername,
+         return KRB5_PLUGIN_OP_NOTSUPP;
+ 
+     /* Do general SSL library setup. */
+-    ctx = SSL_CTX_new(SSLv23_client_method());
++    ctx = SSL_CTX_new(TLS_client_method());
+     if (ctx == NULL)
+         goto error;
+ 
meta-oe/recipes-connectivity/krb5/krb5/0002-Remove-OpenSSL-1.0-support.patch new file +627 -0

627 lines not on this page · raw message

meta-oe/recipes-connectivity/krb5/krb5/0003-k5tls-fix-remaining-const-qualifiers-for-OpenSSL-4.0.patch new file +67 -0

67 lines not on this page · raw message

meta-oe/recipes-connectivity/krb5/krb5_1.22.2.bb +3 -0
index 89e5502847..7666ec5671 100644
@@ -24,6 +24,9 @@ SRC_URI = "http://web.mit.edu/kerberos/dist/${BPN}/${SHRT_VER}/${BP}.tar.gz \
            file://fix-strchr-conformance-to-C23.patch;striplevel=2 \
            file://crosscompile_nm.patch \
            file://0001-configure.ac-replace-K5_AC_INIT-with-explicit-AC_INI.patch;striplevel=2 \
+           file://0001-Improve-future-OpenSSL-compatibility.patch;striplevel=2 \
+           file://0002-Remove-OpenSSL-1.0-support.patch;striplevel=2 \
+           file://0003-k5tls-fix-remaining-const-qualifiers-for-OpenSSL-4.0.patch;striplevel=2 \
            file://etc/init.d/krb5-kdc \
            file://etc/init.d/krb5-admin-server \
            file://etc/default/krb5-kdc \
#3 lore raw

RFC 3/20 libnet-ssleay-perl: fix build with OpenSSL 4.0

In reply to Jaipaul Cheernam

Backport three patches from upstream PR #553 (merged):
- Fix SSLv3 in OpenSSL 4.0.0
- Remove support for some TLS functions
- Support opaque ASN1_STRING

Upstream-Status: Backport [https://github.com/radiator-software/p5-net-ssleay/pull/553]

---
 .../0001-Fix-SSLv3-in-OpenSSL-4.0.0.patch     |  34 ++++
 ...emove-support-for-some-TLS-functions.patch | 192 ++++++++++++++++++
 ...SSLeay-to-support-opaque-ASN1_STRING.patch | 175 ++++++++++++++++
 .../libnet/libnet-ssleay-perl_1.96.bb         |   6 +-
 4 files changed, 406 insertions(+), 1 deletion(-)
 create mode 100644 meta-perl/recipes-perl/libnet/libnet-ssleay-perl/0001-Fix-SSLv3-in-OpenSSL-4.0.0.patch
 create mode 100644 meta-perl/recipes-perl/libnet/libnet-ssleay-perl/0002-OpenSSL-4.0.0-remove-support-for-some-TLS-functions.patch
 create mode 100644 meta-perl/recipes-perl/libnet/libnet-ssleay-perl/0003-Fix-Net-SSLeay-to-support-opaque-ASN1_STRING.patch
meta-perl/recipes-perl/libnet/libnet-ssleay-perl/0001-Fix-SSLv3-in-OpenSSL-4.0.0.patch new file +34 -0
new file mode 100644
index 0000000000..269e39c1bf
@@ -0,0 +1,34 @@
+From 361b3adc1dd09f70be7bd8972992626a3240b58d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Michal=20Josef=20=C5=A0pa=C4=8Dek?= <[email protected]>
+Date: Tue, 14 Apr 2026 12:37:39 +0200
+Subject: [PATCH] Fix SSLv3 in OpenSSL 4.0.0
+
+Support for SSLv3 was removed.
+Upstream-Status: Backport [https://github.com/radiator-software/p5-net-ssleay/pull/553]
+Signed-off-by: Jaipaul Cheernam <[email protected]>
+---
+ SSLeay.xs | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/SSLeay.xs b/SSLeay.xs
+index 0ed7d967..5407fa1a 100644
+--- a/SSLeay.xs
++++ b/SSLeay.xs
+@@ -2454,7 +2454,7 @@ SSL_CTX_v2_new()
+ 
+ #endif
+ #endif
+-#ifndef OPENSSL_NO_SSL3
++#if !defined(OPENSSL_NO_SSL3) && OPENSSL_VERSION_NUMBER < 0x40000000L
+ 
+ SSL_CTX *
+ SSL_CTX_v3_new()
+@@ -5600,7 +5600,7 @@ SSLv2_method()
+ #endif
+ #endif
+ 
+-#ifndef OPENSSL_NO_SSL3
++#if !defined(OPENSSL_NO_SSL3) && OPENSSL_VERSION_NUMBER < 0x40000000L
+ 
+ const SSL_METHOD *
+ SSLv3_method()
meta-perl/recipes-perl/libnet/libnet-ssleay-perl/0002-OpenSSL-4.0.0-remove-support-for-some-TLS-functions.patch new file +192 -0

192 lines not on this page · raw message

meta-perl/recipes-perl/libnet/libnet-ssleay-perl/0003-Fix-Net-SSLeay-to-support-opaque-ASN1_STRING.patch new file +175 -0

175 lines not on this page · raw message

meta-perl/recipes-perl/libnet/libnet-ssleay-perl_1.96.bb +5 -1
index d2c3bee645..e5f8718f68 100644
@@ -24,7 +24,11 @@ RDEPENDS:${PN} += "\
 "
 
 SRC_URI = "${CPAN_MIRROR}/authors/id/C/CH/CHRISN/Net-SSLeay-${PV}.tar.gz \
-           file://run-ptest"
+           file://run-ptest \
+           file://0001-Fix-SSLv3-in-OpenSSL-4.0.0.patch \
+           file://0002-OpenSSL-4.0.0-remove-support-for-some-TLS-functions.patch \
+           file://0003-Fix-Net-SSLeay-to-support-opaque-ASN1_STRING.patch \
+           "
 SRC_URI[sha256sum] = "ab213691685fb2a576c669cbc8d9266f8165a31563ad15b7c4030b94adfc0753"
 
 S = "${UNPACKDIR}/Net-SSLeay-${PV}"
#4 lore raw

RFC 4/20 libtorrent-rasterbar: fix build with OpenSSL 4.0

In reply to Jaipaul Cheernam

OpenSSL 4.0 makes ASN1_IA5STRING opaque. Backport upstream fix.

Upstream-Status: Backport [https://github.com/arvidn/libtorrent/commit/50bd3a46c2c5]

---
 .../0001-Add-support-for-OpenSSL-4.0.patch    | 61 +++++++++++++++++++
 .../libtorrent-rasterbar_2.0.12.bb            |  4 +-
 2 files changed, 64 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-connectivity/libtorrent-rasterbar/libtorrent-rasterbar/0001-Add-support-for-OpenSSL-4.0.patch
meta-oe/recipes-connectivity/libtorrent-rasterbar/libtorrent-rasterbar/0001-Add-support-for-OpenSSL-4.0.patch new file +61 -0
new file mode 100644
index 0000000000..5b3407fc52
@@ -0,0 +1,61 @@
+From 50bd3a46c2c5ccd7298415d1a66ef27c96d0fa2b Mon Sep 17 00:00:00 2001
+From: Chocobo1 <[email protected]>
+Date: Sun, 19 Apr 2026 01:01:53 +0800
+Subject: [PATCH] Add support for OpenSSL 4.0
+
+The accessor functions for `ASN1_STRING` are available since OpenSSL 1.0.1 so we are free to use
+them without conditional guards.
+See: https://openssl-library.org/post/2026-04-13-asn1_string/
+
+Closes #8268.
+Upstream-Status: Backport [https://github.com/arvidn/libtorrent/commit/50bd3a46c2c5]
+Signed-off-by: Jaipaul Cheernam <[email protected]>
+---
+ src/torrent.cpp | 20 ++++++++++++--------
+ 1 file changed, 12 insertions(+), 8 deletions(-)
+
+diff --git a/src/torrent.cpp b/src/torrent.cpp
+index c6564b67f82..7fcc75b3ed4 100644
+--- a/src/torrent.cpp
++++ b/src/torrent.cpp
+@@ -1630,9 +1630,9 @@ aux::vector<download_priority_t, piece_index_t> file_to_piece_prio(
+ 			GENERAL_NAME* gen = sk_GENERAL_NAME_value(gens, i);
+ 			if (gen->type != GEN_DNS) continue;
+ 			ASN1_IA5STRING* domain = gen->d.dNSName;
+-			if (domain->type != V_ASN1_IA5STRING || !domain->data || !domain->length) continue;
+-			auto const* torrent_name = reinterpret_cast<char const*>(domain->data);
+-			auto const name_length = aux::numeric_cast<std::size_t>(domain->length);
++			if (ASN1_STRING_type(domain) != V_ASN1_IA5STRING || !ASN1_STRING_get0_data(domain) || !ASN1_STRING_length(domain)) continue;
++			auto const* torrent_name = reinterpret_cast<char const*>(ASN1_STRING_get0_data(domain));
++			auto const name_length = aux::numeric_cast<std::size_t>(ASN1_STRING_length(domain));
+ 
+ #ifndef TORRENT_DISABLE_LOGGING
+ 			if (i > 1) names += " | n: ";
+@@ -1654,18 +1654,22 @@ aux::vector<download_priority_t, piece_index_t> file_to_piece_prio(
+ 
+ 		// no match in the alternate names, so try the common names. We should only
+ 		// use the "most specific" common name, which is the last one in the list.
++#if OPENSSL_VERSION_NUMBER >= 0x30000000L
++		X509_NAME const* name = X509_get_subject_name(cert);
++#else
+ 		X509_NAME* name = X509_get_subject_name(cert);
++#endif
+ 		int i = -1;
+-		ASN1_STRING* common_name = nullptr;
++		ASN1_STRING const* common_name = nullptr;
+ 		while ((i = X509_NAME_get_index_by_NID(name, NID_commonName, i)) >= 0)
+ 		{
+-			X509_NAME_ENTRY* name_entry = X509_NAME_get_entry(name, i);
++			X509_NAME_ENTRY const* name_entry = X509_NAME_get_entry(name, i);
+ 			common_name = X509_NAME_ENTRY_get_data(name_entry);
+ 		}
+-		if (common_name && common_name->data && common_name->length)
++		if (common_name && ASN1_STRING_get0_data(common_name) && ASN1_STRING_length(common_name))
+ 		{
+-			auto const* torrent_name = reinterpret_cast<char const*>(common_name->data);
+-			auto const name_length = aux::numeric_cast<std::size_t>(common_name->length);
++			auto const* torrent_name = reinterpret_cast<char const*>(ASN1_STRING_get0_data(common_name));
++			auto const name_length = aux::numeric_cast<std::size_t>(ASN1_STRING_length(common_name));
+ 
+ #ifndef TORRENT_DISABLE_LOGGING
+ 			if (!names.empty()) names += " | n: ";
meta-oe/recipes-connectivity/libtorrent-rasterbar/libtorrent-rasterbar_2.0.12.bb +3 -1
index 6a61286f7a..726bb059ef 100644
@@ -8,7 +8,9 @@ DEPENDS = "boost openssl"
 
 SRC_URI = "git://github.com/arvidn/libtorrent.git;branch=master;protocol=https;tag=v${PV} \
 	git://github.com/arvidn/try_signal.git;branch=master;protocol=https;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/deps/try_signal;name=try_signal \
-           file://0001-Fix-Python3-site-packages-path-to-fix-package-QA-Iss.patch"
+           file://0001-Fix-Python3-site-packages-path-to-fix-package-QA-Iss.patch \
+           file://0001-Add-support-for-OpenSSL-4.0.patch \
+           "
 
 SRCREV = "740a0b9aeabe00e762cc0efe4a0f27593db2550b"
 SRCREV_try_signal = "105cce59972f925a33aa6b1c3109e4cd3caf583d"
#5 lore raw

RFC 5/20 pkcs11-helper: fix build with OpenSSL 4.0

In reply to Jaipaul Cheernam

OpenSSL 4.0 makes ASN1_TIME opaque. Replace manual field access with ASN1_TIME_to_tm() API.

Upstream-Status: Backport [https://github.com/OpenSC/pkcs11-helper/commit/59cc22b8d656]

---
 ...1-crypto-openssl-use-ASN1_TIME_to_tm.patch | 45 +++++++++++++++++++
 .../pkcs11-helper/pkcs11-helper_1.31.0.bb     |  4 +-
 2 files changed, 48 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-crypto/pkcs11-helper/pkcs11-helper/0001-crypto-openssl-use-ASN1_TIME_to_tm.patch
meta-oe/recipes-crypto/pkcs11-helper/pkcs11-helper/0001-crypto-openssl-use-ASN1_TIME_to_tm.patch new file +45 -0
new file mode 100644
index 0000000000..3bc5d3d817
@@ -0,0 +1,45 @@
+From 59cc22b8d65669da599f1c435fdfe35d4e07db0e Mon Sep 17 00:00:00 2001
+From: Ravi Kant Sharma <[email protected]>
+Date: Thu, 4 Jun 2026 12:49:44 +0200
+Subject: [PATCH] crypto-openssl: use ASN1_TIME_to_tm
+
+Introduced in openssl-1.1.1 and is required for openssl-4.
+Upstream-Status: Backport [https://github.com/OpenSC/pkcs11-helper/commit/59cc22b8d656]
+
+Note: ChangeLog hunk dropped as it does not apply to the released tarball.
+Signed-off-by: Jaipaul Cheernam <[email protected]>
+---
+ lib/_pkcs11h-crypto-openssl.c | 16 +++++-----------
+ 1 file changed, 5 insertions(+), 11 deletions(-)
+
+diff --git a/lib/_pkcs11h-crypto-openssl.c b/lib/_pkcs11h-crypto-openssl.c
+index 05af65e1..aa58722c 100644
+--- a/lib/_pkcs11h-crypto-openssl.c
++++ b/lib/_pkcs11h-crypto-openssl.c
+@@ -148,21 +148,15 @@ __pkcs11h_crypto_openssl_certificate_get_expiration (
+ 		notBefore != NULL &&
+ 		notAfter != NULL &&
+ 		X509_cmp_current_time (notBefore) <= 0 &&
+-		X509_cmp_current_time (notAfter) >= 0 &&
+-		notAfter->length >= 12
++		X509_cmp_current_time (notAfter) >= 0
+ 	) {
+ 		struct tm tm1;
+ 
+ 		memset (&tm1, 0, sizeof (tm1));
+-		tm1.tm_year = (notAfter->data[ 0] - '0') * 10 + (notAfter->data[ 1] - '0') + 100;
+-		tm1.tm_mon  = (notAfter->data[ 2] - '0') * 10 + (notAfter->data[ 3] - '0') - 1;
+-		tm1.tm_mday = (notAfter->data[ 4] - '0') * 10 + (notAfter->data[ 5] - '0');
+-		tm1.tm_hour = (notAfter->data[ 6] - '0') * 10 + (notAfter->data[ 7] - '0');
+-		tm1.tm_min  = (notAfter->data[ 8] - '0') * 10 + (notAfter->data[ 9] - '0');
+-		tm1.tm_sec  = (notAfter->data[10] - '0') * 10 + (notAfter->data[11] - '0');
+-
+-		*expiration = mktime (&tm1);
+-		*expiration += (int)(mktime (localtime (expiration)) - mktime (gmtime (expiration)));
++		if (ASN1_TIME_to_tm (notAfter, &tm1)) {
++			*expiration = mktime (&tm1);
++			*expiration += (int)(mktime (localtime (expiration)) - mktime (gmtime (expiration)));
++		}
+ 	}
+ 
+ cleanup:
meta-oe/recipes-crypto/pkcs11-helper/pkcs11-helper_1.31.0.bb +3 -1
index 3e776993f4..fd81ad888d 100644
@@ -14,7 +14,9 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=008a5b65f5d167bd0f646530ad3d3293 \
                     file://COPYING.GPL;md5=8a71d0475d08eee76d8b6d0c6dbec543 \
                     file://COPYING.BSD;md5=66b7a37c3c10483c1fd86007726104d7 \
                     "
-SRC_URI = "git://github.com/OpenSC/${BPN}.git;branch=master;protocol=https"
+SRC_URI = "git://github.com/OpenSC/${BPN}.git;branch=master;protocol=https \
+           file://0001-crypto-openssl-use-ASN1_TIME_to_tm.patch \
+           "
 
 # master
 SRCREV = "286b4415b95f298ab35d62508a37c2aefc055037"
#6 lore raw

RFC 6/20 opensc: fix build with OpenSSL 4.0

In reply to Jaipaul Cheernam

OpenSSL 4.0 makes ASN1_STRING opaque. Use accessor functions.

Upstream-Status: Backport [https://github.com/OpenSC/OpenSC/commit/8226c67d832f]

---
 .../0001-Changes-for-OpenSSL-4.0.0.patch      | 331 ++++++++++++++++++
 .../recipes-support/opensc/opensc_0.27.1.bb   |   4 +-
 2 files changed, 334 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-support/opensc/opensc/0001-Changes-for-OpenSSL-4.0.0.patch
meta-oe/recipes-support/opensc/opensc/0001-Changes-for-OpenSSL-4.0.0.patch new file +331 -0
new file mode 100644
index 0000000000..4308217058
@@ -0,0 +1,331 @@
+From 8226c67d832f9adaf1f7c65e5abb49687d8cf949 Mon Sep 17 00:00:00 2001
+From: Doug Engert <[email protected]>
+Date: Wed, 15 Apr 2026 15:10:42 -0500
+Subject: [PATCH] Changes for OpenSSL-4.0.0
+
+Changes to get OpenSC to compile  with OpenSSl-4.0.0
+
+OpenSSL says:
+"Opaque Structures: ASN1_STRING has been made opaque, and further work has been
+done to make X509 structures more memory-efficient and const-correct."
+
+ASN1_STRING was made opaque thus requiring the use of ASN1_STRING_get0_data,
+and ASN1_STRING_length. These routines have been in OpenSSL since 1.1.1
+and are also in libressl.
+
+ASN1_STRING_get0_data returns a const pointer, so the data can not be changed.
+There  are a number of reverse() functions one of which was reversing the
+bytes in a EC pubkey.
+
+Changes not addressed:
+"Global Cleanup: libcrypto no longer uses atexit() for cleanup;
+OPENSSL_cleanup() now runs in a global destructor."
+
+ On branch OpenSSL-4.0.0
+ Changes to be committed:
+	modified:   src/libopensc/cwa-dnie.c
+	modified:   src/pkcs11/openssl.c
+	modified:   src/pkcs15init/pkcs15-oberthur-awp.c
+	modified:   src/tests/p11test/p11test_case_common.c
+	modified:   src/tools/netkey-tool.c
+	modified:   src/tools/pkcs11-tool.c
+	modified:   src/tools/pkcs15-init.c
+Upstream-Status: Backport [https://github.com/OpenSC/OpenSC/commit/8226c67d832f]
+Signed-off-by: Jaipaul Cheernam <[email protected]>
+---
+ src/libopensc/cwa-dnie.c                |  2 +-
+ src/pkcs11/openssl.c                    | 14 ++++++----
+ src/pkcs15init/pkcs15-oberthur-awp.c    | 16 +++++------
+ src/tests/p11test/p11test_case_common.c | 24 ++++++++--------
+ src/tools/netkey-tool.c                 | 37 +++++++++++++++++--------
+ src/tools/pkcs11-tool.c                 | 22 +++++++--------
+ src/tools/pkcs15-init.c                 |  4 +--
+ 7 files changed, 68 insertions(+), 51 deletions(-)
+
+diff --git a/src/libopensc/cwa-dnie.c b/src/libopensc/cwa-dnie.c
+index 47f3792dad..6020921dbc 100644
+--- a/src/libopensc/cwa-dnie.c
++++ b/src/libopensc/cwa-dnie.c
+@@ -646,7 +646,7 @@ static int dnie_set_channel_data(sc_card_t * card, X509 * icc_intermediate_ca_ce
+ 	dnie_private_data_t *priv_data = GET_DNIE_PRIV_DATA(card);
+ 	LOG_FUNC_CALLED(card->ctx);
+ 
+-	X509_NAME *issuer = X509_get_issuer_name(icc_intermediate_ca_cert);
++	const X509_NAME *issuer = X509_get_issuer_name(icc_intermediate_ca_cert);
+ 	if (issuer) {
+ 		buf = X509_NAME_oneline(issuer, buf, 0);
+ 		if (!buf) {
+diff --git a/src/pkcs11/openssl.c b/src/pkcs11/openssl.c
+index 0a5d4394a2..a4027339b2 100644
+--- a/src/pkcs11/openssl.c
++++ b/src/pkcs11/openssl.c
+@@ -463,6 +463,7 @@ static CK_RV gostr3410_verify_data(const CK_BYTE_PTR pubkey, CK_ULONG pubkey_len
+ 	EC_POINT *P;
+ 	BIGNUM *X, *Y;
+ 	ASN1_OCTET_STRING *octet = NULL;
++	unsigned char *octet_rev = NULL;
+ 	char paramset[2] = "A";
+ 	int r = -1, ret_vrf = 0;
+ #if OPENSSL_VERSION_NUMBER < 0x30000000L
+@@ -516,13 +517,16 @@ static CK_RV gostr3410_verify_data(const CK_BYTE_PTR pubkey, CK_ULONG pubkey_len
+ 		if (group && pubkey_len <= LONG_MAX) {
+ 			const unsigned char *p = pubkey;
+ 			octet = d2i_ASN1_OCTET_STRING(NULL, &p, (long)pubkey_len);
++			if (octet)
++				octet_rev = malloc(ASN1_STRING_length(octet));
+ 		}
+-		if (group && octet) {
+-			reverse(octet->data, octet->length);
+-			Y = BN_bin2bn(octet->data, octet->length / 2, NULL);
+-			X = BN_bin2bn((const unsigned char*)octet->data +
+-					octet->length / 2, octet->length / 2, NULL);
++		if (group && octet && octet_rev) {
++			memcpy(octet_rev, ASN1_STRING_get0_data(octet), ASN1_STRING_length(octet));
++			reverse(octet_rev, ASN1_STRING_length(octet));
++			Y = BN_bin2bn(octet_rev, ASN1_STRING_length(octet) / 2, NULL);
++			X = BN_bin2bn(octet_rev + ASN1_STRING_length(octet) / 2, ASN1_STRING_length(octet) / 2, NULL);
+ 			ASN1_OCTET_STRING_free(octet);
++			free(octet_rev);
+ 			P = EC_POINT_new(group);
+ 			if (P && X && Y)
+ 				r = EC_POINT_set_affine_coordinates(group, P, X, Y, NULL);
+diff --git a/src/pkcs15init/pkcs15-oberthur-awp.c b/src/pkcs15init/pkcs15-oberthur-awp.c
+index 22c943127b..fdb06ab6b4 100644
+--- a/src/pkcs15init/pkcs15-oberthur-awp.c
++++ b/src/pkcs15init/pkcs15-oberthur-awp.c
+@@ -51,21 +51,21 @@ awp_get_commonName(X509 *x)
+    	r = X509_NAME_get_index_by_NID(X509_get_subject_name(x),
+ 		   NID_commonName, -1);
+ 	if (r >= 0)   {
+-		X509_NAME_ENTRY *ne;
+-		ASN1_STRING *a_str;
++		const X509_NAME_ENTRY *ne;
++		const ASN1_STRING *a_str;
+ 
+ 		if (!(ne = X509_NAME_get_entry(X509_get_subject_name(x), r)))
+ 			;
+ 		else if (!(a_str = X509_NAME_ENTRY_get_data(ne)))
+ 			;
+-		else if (a_str->type == 0x0C)   {
+-			ret = malloc(a_str->length + 1);
++		else if (ASN1_STRING_type(a_str) == V_ASN1_UTF8STRING) {
++			ret = malloc(ASN1_STRING_length(a_str) + 1);
+ 			if (ret)   {
+-				memcpy(ret, a_str->data, a_str->length);
+-				*(ret + a_str->length) = '\0';
++				memcpy(ret, ASN1_STRING_get0_data(a_str), ASN1_STRING_length(a_str));
++
++				*(ret + ASN1_STRING_length(a_str)) = '\0';
+ 			}
+-		}
+-		else    {
++		} else {
+ 			unsigned char *tmp = NULL;
+ 
+ 			r = ASN1_STRING_to_UTF8(&tmp, a_str);
+diff --git a/src/tests/p11test/p11test_case_common.c b/src/tests/p11test/p11test_case_common.c
+index 1dd6eaba67..f571cd1598 100644
+--- a/src/tests/p11test/p11test_case_common.c
++++ b/src/tests/p11test/p11test_case_common.c
+@@ -776,34 +776,34 @@ int callback_public_keys(test_certs_t *objects,
+ 			switch (o->key_type) {
+ #ifdef EVP_PKEY_ED25519
+ 			case CKK_EC_EDWARDS:
+-				if (strcmp((char *)curve->data, "edwards25519") == 0) {
++				if (strcmp((char *)ASN1_STRING_get0_data(curve), "edwards25519") == 0) {
+ 					evp_type = EVP_PKEY_ED25519;
+ 					break;
+ #ifdef EVP_PKEY_ED448
+-				} else if (strcmp((char *)curve->data, "edwards448") == 0) {
++				} else if (strcmp((char *)ASN1_STRING_get0_data(curve), "edwards448") == 0) {
+ 					evp_type = EVP_PKEY_ED448;
+ 					break;
+ #endif /* EVP_PKEY_ED448 */
+ 				}
+ 				debug_print(" [WARN %s ] Unknown curve name. "
+ 					    " expected edwards25519 or edwards448, got %s",
+-						o->id_str, curve->data);
++						o->id_str, ASN1_STRING_get0_data(curve));
+ 				break;
+ #endif
+ #ifdef EVP_PKEY_X25519
+ 			case CKK_EC_MONTGOMERY:
+-				if (strcmp((char *)curve->data, "curve25519") == 0) {
++				if (strcmp((char *)ASN1_STRING_get0_data(curve), "curve25519") == 0) {
+ 					evp_type = EVP_PKEY_X25519;
+ 					break;
+ #ifdef EVP_PKEY_X448
+-				} else if (strcmp((char *)curve->data, "curve448") == 0) {
++				} else if (strcmp((char *)ASN1_STRING_get0_data(curve), "curve448") == 0) {
+ 					evp_type = EVP_PKEY_X448;
+ 					break;
+ #endif /* EVP_PKEY_X448 */
+ 				}
+ 				debug_print(" [WARN %s ] Unknown curve name. "
+ 					    " expected curve25519 or curve448, got %s",
+-						o->id_str, curve->data);
++						o->id_str, ASN1_STRING_get0_data(curve));
+ 				break;
+ #endif
+ 			default:
+@@ -893,14 +893,14 @@ int callback_public_keys(test_certs_t *objects,
+ 			break;
+ #endif
+ 		}
+-		if (os->length != exp_length) {
++		if (ASN1_STRING_length(os) != exp_length) {
+ 			debug_print(" [WARN %s ] Invalid length of EC_POINT value. Got %d, expected %d",
+-					o->id_str, os->length, exp_length);
++					o->id_str, ASN1_STRING_length(os), exp_length);
+ 			return -1;
+ 		}
+ 		key = EVP_PKEY_new_raw_public_key(evp_type, NULL,
+-			(const uint8_t *)os->data,
+-			os->length);
++				(const uint8_t *)ASN1_STRING_get0_data(os),
++				ASN1_STRING_length(os));
+ 		if (key == NULL) {
+ 			debug_print(" [WARN %s ] Out of memory", o->id_str);
+ 			ASN1_STRING_free(os);
+@@ -925,8 +925,8 @@ int callback_public_keys(test_certs_t *objects,
+ 			}
+ 
+ 			if (EVP_PKEY_get_raw_public_key(o->key, pub, &publen) != 1 ||
+-				publen != (size_t)os->length ||
+-				memcmp(pub, os->data, publen) != 0) {
++					publen != (size_t)ASN1_STRING_length(os) ||
++					memcmp(pub, ASN1_STRING_get0_data(os), publen) != 0) {
+ 				debug_print(" [WARN %s ] Got different public"
+ 					"key then from the certificate",
+ 					o->id_str);
+diff --git a/src/tools/netkey-tool.c b/src/tools/netkey-tool.c
+index 23bab2a8ec..683ac182bd 100644
+--- a/src/tools/netkey-tool.c
++++ b/src/tools/netkey-tool.c
+@@ -144,25 +144,38 @@ static void show_certs(sc_card_t *card)
+ 			if(q[4]==6 && q[5]<10 && q[q[5]+6]==0x30 && q[q[5]+7]==0x82) q+=q[5]+6;
+ 			printf(", Len=%d\n", (q[2]<<8)|q[3]);
+ 			if((c=d2i_X509(NULL,&q,f->size))){
+-				char buf2[2000];
+-				if (X509_NAME_get_text_by_NID(X509_get_subject_name(c), NID_commonName, buf2, sizeof(buf2)) < 0) {
++				int idx;
++				const X509_NAME_ENTRY *ne = NULL; /* no free */
++				const ASN1_STRING *a_str = NULL;  /* no free */
++				int out_len = 0;
++				unsigned char *tmp = NULL;
++
++				idx = X509_NAME_get_index_by_NID(X509_get_subject_name(c), NID_commonName, -1);
++				if (idx >= 0 &&
++						((ne = X509_NAME_get_entry(X509_get_subject_name(c), idx)) != NULL) &&
++						((a_str = X509_NAME_ENTRY_get_data(ne)) != NULL) &&
++						((out_len = ASN1_STRING_to_UTF8(&tmp, a_str)) > 0)) {
++					printf("  Subject-CN: %s\n", tmp);
++					OPENSSL_free(tmp);
++					tmp = NULL;
++				} else {
+ 					sc_log_openssl(card->ctx);
+ 					printf("  Invalid Subject-CN\n");
+-					X509_free(c);
+-					continue;
+ 				}
+-				printf("  Subject-CN: %s\n", buf2);
+-				if (X509_NAME_get_text_by_NID(X509_get_issuer_name(c), NID_commonName, buf2, sizeof(buf2)) < 0) {
++
++				idx = X509_NAME_get_index_by_NID(X509_get_issuer_name(c), NID_commonName, -1);
++				if (idx >= 0 &&
++						((ne = X509_NAME_get_entry(X509_get_issuer_name(c), idx)) != NULL) &&
++						((a_str = X509_NAME_ENTRY_get_data(ne)) != NULL) &&
++						((out_len = ASN1_STRING_to_UTF8(&tmp, a_str)) > 0)) {
++					printf("  Issuer-CN:  %s\n", tmp);
++					OPENSSL_free(tmp);
++					tmp = NULL;
++				} else {
+ 					sc_log_openssl(card->ctx);
+ 					printf("  Invalid Issuer-CN\n");
+-					X509_free(c);
+-					continue;
+ 				}
+-				printf("  Issuer-CN:  %s\n", buf2);
+ 				X509_free(c);
+-			} else {
+-				sc_log_openssl(card->ctx);
+-				printf("  Invalid Certificate-Data\n");
+ 			}
+ 		} else printf(", empty\n");
+ 	}
+diff --git a/src/tools/pkcs11-tool.c b/src/tools/pkcs11-tool.c
+index f3ac4e6bf1..21c22864ee 100644
+--- a/src/tools/pkcs11-tool.c
++++ b/src/tools/pkcs11-tool.c
+@@ -7389,8 +7389,8 @@ static int read_object(CK_SESSION_HANDLE session)
+ #endif
+ 				point = EC_POINT_new(group);
+ 				if (os) {
+-					a = os->data;
+-					a_len = os->length;
++					a = ASN1_STRING_get0_data(os);
++					a_len = ASN1_STRING_length(os);
+ 					success = EC_POINT_oct2point(group, point, a, a_len, NULL);
+ 				}
+ 				if (!success) { /* Workaround for broken PKCS#11 modules */
+@@ -7464,9 +7464,9 @@ static int read_object(CK_SESSION_HANDLE session)
+ 
+ 					a = params;
+ 					if (d2i_ASN1_PRINTABLESTRING(&curve, &a, (long)len) != NULL) {
+-						if (strcmp((char *)curve->data, "edwards25519") &&
+-								strcmp((char *)curve->data, "curve25519")) {
+-							util_fatal("Unknown curve name \"%si\"", curve->data);
++						if (strcmp((char *)ASN1_STRING_get0_data(curve), "edwards25519") &&
++								strcmp((char *)ASN1_STRING_get0_data(curve), "curve25519")) {
++							util_fatal("Unknown curve name \"%si\"", (char *)ASN1_STRING_get0_data(curve));
+ 						}
+ 						ASN1_PRINTABLESTRING_free(curve);
+ 					} else if (d2i_ASN1_OBJECT(&obj, &a, (long)len) != NULL) {
+@@ -7526,26 +7526,26 @@ static int read_object(CK_SESSION_HANDLE session)
+ 					}
+ 				}
+ 
+-				if (type == CKK_EC_EDWARDS && os->length == BYTES4BITS(256)) /* note extra bit */
++				if (type == CKK_EC_EDWARDS && len == BYTES4BITS(256)) /* note extra bit */
+ 					raw_pk = EVP_PKEY_ED25519;
+ #ifdef EVP_PKEY_ED448
+-				else if (type == CKK_EC_EDWARDS && os->length == ED448_KEY_SIZE_BYTES)
++				else if (type == CKK_EC_EDWARDS && len == ED448_KEY_SIZE_BYTES)
+ 					raw_pk = EVP_PKEY_ED448;
+ #endif /* EVP_PKEY_ED448 */
+ #ifdef EVP_PKEY_X25519
+-				else if (type == CKK_EC_MONTGOMERY && os->length == BYTES4BITS(256)) /* note extra bit */
++				else if (type == CKK_EC_MONTGOMERY && len == BYTES4BITS(256)) /* note extra bit */
+ 					raw_pk = EVP_PKEY_X25519;
+ #endif /*EVP_PKEY_X25519 */
+ #ifdef EVP_PKEY_X448
+-				else if (type == CKK_EC_MONTGOMERY && os->length == BYTES4BITS(448))
++				else if (type == CKK_EC_MONTGOMERY && len == BYTES4BITS(448))
+ 					raw_pk = EVP_PKEY_X448;
+ #endif /* EVP_PKEY_X448 */
+ 				else
+ 					util_fatal("Invalid or not supported CKK_EC_EDWARDS or CKK_EC_MONTGOMERY public key");
+ 
+ 				key = EVP_PKEY_new_raw_public_key(raw_pk, NULL,
+-						(const uint8_t *)os->data,
+-						os->length);
++						(const uint8_t *)ASN1_STRING_get0_data(os),
++						ASN1_STRING_length(os));
+ 				ASN1_STRING_free(os);
+ 				if (key == NULL) {
+ 					util_fatal("out of memory");
+diff --git a/src/tools/pkcs15-init.c b/src/tools/pkcs15-init.c
+index e011232987..b978e0677a 100644
+--- a/src/tools/pkcs15-init.c
++++ b/src/tools/pkcs15-init.c
+@@ -2593,8 +2593,8 @@ do_read_data_object(const char *name, u8 **out, size_t *outlen, size_t expected)
+ static char *
+ cert_common_name(X509 *x509)
+ {
+-	X509_NAME_ENTRY *ne = NULL;
+-	ASN1_STRING *a_str = NULL;
++	const X509_NAME_ENTRY *ne = NULL;
++	const ASN1_STRING *a_str = NULL;
+ 	char *out = NULL;
+ 	unsigned char *tmp = NULL;
+ 	int idx, out_len = 0;
meta-oe/recipes-support/opensc/opensc_0.27.1.bb +3 -1
index d659fd1bee..05b7a58be5 100644
@@ -12,7 +12,9 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=cb8aedd3bced19bd8026d96a8b6876d7"
 DEPENDS = "openssl"
 
 SRCREV = "19868984dc4dc697af6a86d65ab32a1f19a43ea4"
-SRC_URI = "git://github.com/OpenSC/OpenSC;branch=master;protocol=https"
+SRC_URI = "git://github.com/OpenSC/OpenSC;branch=master;protocol=https \
+           file://0001-Changes-for-OpenSSL-4.0.0.patch \
+           "
 
 CVE_STATUS[CVE-2024-8443] = "fixed-version: this is fixed since 0.26.0"
 
#7 lore raw

RFC 7/20 grpc: fix build with OpenSSL 4.0

In reply to Jaipaul Cheernam

OpenSSL 4.0 returns const pointers from X509 accessor functions, makes ASN1_OCTET_STRING opaque, and deprecates HMAC one-shot API.

Four patches addressing credentials, TSI transport security, and TSI utils.

Upstream-Status: Submitted [https://github.com/grpc/grpc/pull/41932]

---
 ...ls-Fix-OpenSSL-3.0-4.0-compatibility.patch | 85 +++++++++++++++++++
 ...L-4.0-const-and-opaque-compatibility.patch | 59 +++++++++++++
 ...sport_security_utils-for-OpenSSL-4.0.patch | 61 +++++++++++++
 ...ing-const-qualifiers-for-OpenSSL-4.0.patch | 47 ++++++++++
 meta-oe/recipes-devtools/grpc/grpc_1.83.0.bb  |  4 +
 5 files changed, 256 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/grpc/grpc/0001-credentials-Fix-OpenSSL-3.0-4.0-compatibility.patch
 create mode 100644 meta-oe/recipes-devtools/grpc/grpc/0002-tsi-fix-OpenSSL-4.0-const-and-opaque-compatibility.patch
 create mode 100644 meta-oe/recipes-devtools/grpc/grpc/0003-tsi-fix-ssl_transport_security_utils-for-OpenSSL-4.0.patch
 create mode 100644 meta-oe/recipes-devtools/grpc/grpc/0004-tsi-fix-remaining-const-qualifiers-for-OpenSSL-4.0.patch
meta-oe/recipes-devtools/grpc/grpc/0001-credentials-Fix-OpenSSL-3.0-4.0-compatibility.patch new file +85 -0
new file mode 100644
index 0000000000..f062ecce08
@@ -0,0 +1,85 @@
+From b07ee3b98c30251094692b84d1253e3ca881ff96 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Bj=C3=B6rn=20Svensson?= <[email protected]>
+Date: Tue, 24 Mar 2026 13:12:07 +0100
+Subject: [PATCH] credentials: Fix OpenSSL 3.0+/4.0 compatibility
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+- Guard openssl/hmac.h include behind OpenSSL < 3.0 version check
+- Replace one-shot HMAC() with EVP_Q_mac() for OpenSSL 3.0+
+- Handle X509_CRL_get_issuer() which returns const in OpenSSL 4.0,
+  with const_cast for i2d_X509_NAME()
+
+Signed-off-by: Björn Svensson <[email protected]>
+Upstream-Status: Submitted [https://github.com/grpc/grpc/pull/41932]
+Signed-off-by: Jaipaul Cheernam <[email protected]>
+---
+ .../credentials/call/external/aws_request_signer.cc | 13 +++++++++++++
+ .../transport/tls/grpc_tls_crl_provider.cc          |  4 ++--
+ 2 files changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/src/core/credentials/call/external/aws_request_signer.cc b/src/core/credentials/call/external/aws_request_signer.cc
+index f7fb7a25b1d0b..26c70ccc7c174 100644
+--- a/src/core/credentials/call/external/aws_request_signer.cc
++++ b/src/core/credentials/call/external/aws_request_signer.cc
+@@ -18,7 +18,9 @@
+ #include <grpc/support/port_platform.h>
+ #include <openssl/crypto.h>
+ #include <openssl/evp.h>
++#if OPENSSL_VERSION_NUMBER < 0x30000000L
+ #include <openssl/hmac.h>
++#endif
+ #include <openssl/sha.h>
+ 
+ #include <utility>
+@@ -41,6 +43,7 @@ namespace {
+ 
+ #if OPENSSL_VERSION_NUMBER >= 0x30000000L
+ const char kSha256[] = "SHA256";
++const char kHmacName[] = "HMAC";
+ #endif
+ const char kAlgorithm[] = "AWS4-HMAC-SHA256";
+ const char kDateFormat[] = "%a, %d %b %E4Y %H:%M:%S %Z";
+@@ -67,12 +70,22 @@ std::string SHA256Hex(const std::string& str) {
+ }
+ 
+ std::string HMAC(const std::string& key, const std::string& msg) {
++#if OPENSSL_VERSION_NUMBER < 0x30000000L
+   unsigned int len;
+   unsigned char digest[EVP_MAX_MD_SIZE];
+   HMAC(EVP_sha256(), key.c_str(), key.length(),
+        reinterpret_cast<const unsigned char*>(msg.c_str()), msg.length(),
+        digest, &len);
+   return std::string(digest, digest + len);
++#else
++  size_t len = 0;
++  unsigned char digest[EVP_MAX_MD_SIZE];
++  EVP_Q_mac(nullptr, kHmacName, nullptr, kSha256, nullptr,
++            reinterpret_cast<const unsigned char*>(key.c_str()), key.length(),
++            reinterpret_cast<const unsigned char*>(msg.c_str()), msg.length(),
++            digest, sizeof(digest), &len);
++  return std::string(digest, digest + len);
++#endif
+ }
+ 
+ }  // namespace
+diff --git a/src/core/credentials/transport/tls/grpc_tls_crl_provider.cc b/src/core/credentials/transport/tls/grpc_tls_crl_provider.cc
+index 7bd4c5ab0b49f..99ed93d5d2944 100644
+--- a/src/core/credentials/transport/tls/grpc_tls_crl_provider.cc
++++ b/src/core/credentials/transport/tls/grpc_tls_crl_provider.cc
+@@ -56,12 +56,12 @@ absl::StatusOr<std::string> IssuerFromCrl(X509_CRL* crl) {
+   if (crl == nullptr) {
+     return absl::InvalidArgumentError("crl cannot be null");
+   }
+-  X509_NAME* issuer = X509_CRL_get_issuer(crl);
++  auto* issuer = X509_CRL_get_issuer(crl);
+   if (issuer == nullptr) {
+     return absl::InvalidArgumentError("crl cannot have null issuer");
+   }
+   unsigned char* buf = nullptr;
+-  int len = i2d_X509_NAME(issuer, &buf);
++  int len = i2d_X509_NAME(const_cast<X509_NAME*>(issuer), &buf);
+   if (len < 0 || buf == nullptr) {
+     return absl::InvalidArgumentError("crl cannot have null issuer");
+   }
meta-oe/recipes-devtools/grpc/grpc/0002-tsi-fix-OpenSSL-4.0-const-and-opaque-compatibility.patch new file +59 -0

59 lines not on this page · raw message

meta-oe/recipes-devtools/grpc/grpc/0003-tsi-fix-ssl_transport_security_utils-for-OpenSSL-4.0.patch new file +61 -0

61 lines not on this page · raw message

meta-oe/recipes-devtools/grpc/grpc/0004-tsi-fix-remaining-const-qualifiers-for-OpenSSL-4.0.patch new file +47 -0

47 lines not on this page · raw message

meta-oe/recipes-devtools/grpc/grpc_1.83.0.bb +4 -0
index 3e03bf510e..34ec8863ac 100644
@@ -27,6 +27,10 @@ SRCREV = "c876f4da50f7da2f331888b88b2a7243514139fe"
 BRANCH = "v1.83.x"
 SRC_URI = "gitsm://github.com/grpc/grpc.git;protocol=https;branch=${BRANCH};tag=v${PV} \
            file://0001-cmake-Link-with-libatomic-on-rv32-rv64.patch \
+           file://0001-credentials-Fix-OpenSSL-3.0-4.0-compatibility.patch \
+           file://0002-tsi-fix-OpenSSL-4.0-const-and-opaque-compatibility.patch \
+           file://0003-tsi-fix-ssl_transport_security_utils-for-OpenSSL-4.0.patch \
+           file://0004-tsi-fix-remaining-const-qualifiers-for-OpenSSL-4.0.patch \
            "
 
 inherit cmake pkgconfig
#8 lore raw

RFC 8/20 python3-grpcio: fix build with OpenSSL 4.0

In reply to Jaipaul Cheernam

python3-grpcio bundles grpc 1.78.0 C core which has the same OpenSSL 4.0 const and opaque type issues as grpc 1.83.0.

Upstream-Status: Submitted [https://github.com/grpc/grpc/pull/41932]

---
 .../0001-Fix-OpenSSL-4.0-compatibility.patch  | 140 ++++++++++++++++++
 .../python/python3-grpcio_1.78.0.bb           |   1 +
 2 files changed, 141 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-grpcio/0001-Fix-OpenSSL-4.0-compatibility.patch
meta-python/recipes-devtools/python/python3-grpcio/0001-Fix-OpenSSL-4.0-compatibility.patch new file +140 -0
new file mode 100644
index 0000000000..895ceab88c
@@ -0,0 +1,140 @@
+From 664032e1cee574e5d3874bbf55466448f537ab1a Mon Sep 17 00:00:00 2001
+From: Jaipaul Cheernam <[email protected]>
+Date: Thu, 27 Aug 2026 10:55:42 +0000
+Subject: [PATCH] Fix OpenSSL 4.0 compatibility in bundled grpc
+
+OpenSSL 4.0 returns const pointers from X509 accessor functions
+and makes ASN1_OCTET_STRING opaque. Use auto* for const returns
+and ASN1_STRING accessors for opaque access.
+
+Upstream-Status: Submitted [https://github.com/grpc/grpc/pull/41932]
+
+Note: Fixes bundled grpc 1.78.0 C core. Our fix for areas not
+covered by the upstream PR.
+
+Signed-off-by: Jaipaul Cheernam <[email protected]>
+---
+ .../transport/tls/grpc_tls_crl_provider.cc      |  2 +-
+ src/core/tsi/ssl_transport_security.cc          | 17 ++++++++---------
+ src/core/tsi/ssl_transport_security_utils.cc    | 10 +++++-----
+ 3 files changed, 14 insertions(+), 15 deletions(-)
+
+diff --git a/src/core/credentials/transport/tls/grpc_tls_crl_provider.cc b/src/core/credentials/transport/tls/grpc_tls_crl_provider.cc
+index 7bd4c5a..22d266e 100644
+--- a/src/core/credentials/transport/tls/grpc_tls_crl_provider.cc
++++ b/src/core/credentials/transport/tls/grpc_tls_crl_provider.cc
+@@ -56,7 +56,7 @@ absl::StatusOr<std::string> IssuerFromCrl(X509_CRL* crl) {
+   if (crl == nullptr) {
+     return absl::InvalidArgumentError("crl cannot be null");
+   }
+-  X509_NAME* issuer = X509_CRL_get_issuer(crl);
++  auto* issuer = X509_CRL_get_issuer(crl);
+   if (issuer == nullptr) {
+     return absl::InvalidArgumentError("crl cannot have null issuer");
+   }
+diff --git a/src/core/tsi/ssl_transport_security.cc b/src/core/tsi/ssl_transport_security.cc
+index 6526d3f..ff03697 100644
+--- a/src/core/tsi/ssl_transport_security.cc
++++ b/src/core/tsi/ssl_transport_security.cc
+@@ -406,9 +406,9 @@ static int looks_like_ip_address(absl::string_view name) {
+ static tsi_result ssl_get_x509_common_name(X509* cert, unsigned char** utf8,
+                                            size_t* utf8_size) {
+   int common_name_index = -1;
+-  X509_NAME_ENTRY* common_name_entry = nullptr;
+-  ASN1_STRING* common_name_asn1 = nullptr;
+-  X509_NAME* subject_name = X509_get_subject_name(cert);
++  const X509_NAME_ENTRY* common_name_entry = nullptr;
++  const ASN1_STRING* common_name_asn1 = nullptr;
++  auto* subject_name = X509_get_subject_name(cert);
+   int utf8_returned_size = 0;
+   if (subject_name == nullptr) {
+     VLOG(2) << "Could not get subject name from certificate.";
+@@ -466,7 +466,7 @@ static tsi_result peer_property_from_x509_common_name(
+ static tsi_result peer_property_from_x509_subject(X509* cert,
+                                                   tsi_peer_property* property,
+                                                   bool is_verified_root_cert) {
+-  X509_NAME* subject_name = X509_get_subject_name(cert);
++  auto* subject_name = X509_get_subject_name(cert);
+   if (subject_name == nullptr) {
+     GRPC_TRACE_LOG(tsi, INFO) << "Could not get subject name from certificate.";
+     return TSI_NOT_FOUND;
+@@ -562,16 +562,16 @@ static tsi_result add_subject_alt_names_properties_to_peer(
+       char ntop_buf[INET6_ADDRSTRLEN];
+       int af;
+ 
+-      if (subject_alt_name->d.iPAddress->length == 4) {
++      if (ASN1_STRING_length(subject_alt_name->d.iPAddress) == 4) {
+         af = AF_INET;
+-      } else if (subject_alt_name->d.iPAddress->length == 16) {
++      } else if (ASN1_STRING_length(subject_alt_name->d.iPAddress) == 16) {
+         af = AF_INET6;
+       } else {
+         LOG(ERROR) << "SAN IP Address contained invalid IP";
+         result = TSI_INTERNAL_ERROR;
+         break;
+       }
+-      const char* name = inet_ntop(af, subject_alt_name->d.iPAddress->data,
++      const char* name = inet_ntop(af, ASN1_STRING_get0_data(subject_alt_name->d.iPAddress),
+                                    ntop_buf, INET6_ADDRSTRLEN);
+       if (name == nullptr) {
+         LOG(ERROR) << "Could not get IP string from asn1 octet.";
+@@ -855,13 +855,12 @@ static tsi_result x509_store_load_certs(X509_STORE* cert_store,
+       break;  // We're at the end of stream.
+     }
+     if (root_names != nullptr) {
+-      root_name = X509_get_subject_name(root);
++      root_name = X509_NAME_dup(X509_get_subject_name(root));
+       if (root_name == nullptr) {
+         LOG(ERROR) << "Could not get name from root certificate.";
+         result = TSI_INVALID_ARGUMENT;
+         break;
+       }
+-      root_name = X509_NAME_dup(root_name);
+       if (root_name == nullptr) {
+         result = TSI_OUT_OF_RESOURCES;
+         break;
+diff --git a/src/core/tsi/ssl_transport_security_utils.cc b/src/core/tsi/ssl_transport_security_utils.cc
+index 8f6607c..93876bb 100644
+--- a/src/core/tsi/ssl_transport_security_utils.cc
++++ b/src/core/tsi/ssl_transport_security_utils.cc
+@@ -281,11 +281,11 @@ bool VerifyCrlCertIssuerNamesMatch(X509_CRL* crl, X509* cert) {
+   if (cert == nullptr || crl == nullptr) {
+     return false;
+   }
+-  X509_NAME* cert_issuer_name = X509_get_issuer_name(cert);
++  auto* cert_issuer_name = X509_get_issuer_name(cert);
+   if (cert == nullptr) {
+     return false;
+   }
+-  X509_NAME* crl_issuer_name = X509_CRL_get_issuer(crl);
++  auto* crl_issuer_name = X509_CRL_get_issuer(crl);
+   if (crl_issuer_name == nullptr) {
+     return false;
+   }
+@@ -316,7 +316,7 @@ absl::StatusOr<std::string> IssuerFromCert(X509* cert) {
+   if (cert == nullptr) {
+     return absl::InvalidArgumentError("cert cannot be null");
+   }
+-  X509_NAME* issuer = X509_get_issuer_name(cert);
++  auto* issuer = X509_get_issuer_name(cert);
+   unsigned char* buf = nullptr;
+   int len = i2d_X509_NAME(issuer, &buf);
+   if (len < 0 || buf == nullptr) {
+@@ -331,7 +331,7 @@ absl::StatusOr<std::string> AkidFromCertificate(X509* cert) {
+   if (cert == nullptr) {
+     return absl::InvalidArgumentError("cert cannot be null.");
+   }
+-  ASN1_OCTET_STRING* akid = nullptr;
++  const ASN1_OCTET_STRING* akid = nullptr;
+   int j = X509_get_ext_by_NID(cert, NID_authority_key_identifier, -1);
+   // Can't have multiple occurrences
+   if (j >= 0) {
+@@ -356,7 +356,7 @@ absl::StatusOr<std::string> AkidFromCrl(X509_CRL* crl) {
+   if (crl == nullptr) {
+     return absl::InvalidArgumentError("Could not get AKID from crl.");
+   }
+-  ASN1_OCTET_STRING* akid = nullptr;
++  const ASN1_OCTET_STRING* akid = nullptr;
+   int j = X509_CRL_get_ext_by_NID(crl, NID_authority_key_identifier, -1);
+   // Can't have multiple occurrences
+   if (j >= 0) {
meta-python/recipes-devtools/python/python3-grpcio_1.78.0.bb +1 -0
index a926ac2baf..5cd530f1c4 100644
@@ -11,6 +11,7 @@ LIC_FILES_CHKSUM = " \
 DEPENDS += "c-ares openssl python3-protobuf re2 zlib"
 
 SRC_URI += "file://0001-python-enable-unbundled-cross-compilation.patch \
+           file://0001-Fix-OpenSSL-4.0-compatibility.patch \
            file://abseil-ppc-fixes.patch \
            "
 SRC_URI[sha256sum] = "7382b95189546f375c174f53a5fa873cef91c4b8005faa05cc5b3beea9c4f1c5"
#9 lore raw

RFC 9/20 thrift: fix build with OpenSSL 4.0

In reply to Jaipaul Cheernam

OpenSSL 4.0 removes SSLv3_method(), per-version TLS method functions, ERR_remove_state(), ASN1_STRING_data(), and returns const pointers from X509 accessor functions. Fix both C++ and C GLib bindings.

Upstream-Status: Submitted [https://github.com/apache/thrift/pull/3752]

---
 ...SSLSocket-fix-build-with-OpenSSL-4.0.patch | 113 ++++++++++++++++++
 .../thrift/thrift_0.24.0.bb                   |   1 +
 2 files changed, 114 insertions(+)
 create mode 100644 meta-oe/recipes-connectivity/thrift/thrift/0001-TSSLSocket-fix-build-with-OpenSSL-4.0.patch
meta-oe/recipes-connectivity/thrift/thrift/0001-TSSLSocket-fix-build-with-OpenSSL-4.0.patch new file +113 -0
new file mode 100644
index 0000000000..965f024b6e
@@ -0,0 +1,113 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jaipaul Cheernam <[email protected]>
+Date: Thu, 27 Aug 2026 11:00:00 +0000
+Subject: [PATCH] Fix build with OpenSSL 4.0
+
+OpenSSL 4.0 removes SSLv3_method(), per-version TLS method functions,
+ERR_remove_state(), ASN1_STRING_data(), and returns const pointers
+from X509 accessor functions.
+
+C++ (TSSLSocket.cpp):
+- Guard SSLv3 and TLS version methods with version check
+- Replace ASN1_STRING_data with ASN1_STRING_get0_data
+- Add const qualifiers for X509_NAME, X509_NAME_ENTRY, ASN1_STRING
+
+C (thrift_ssl_socket.c):
+- Remove ERR_remove_state() calls (no-op since OpenSSL 1.1)
+- Guard SSLv3 and TLS version methods with version check
+
+Upstream-Status: Submitted [https://github.com/apache/thrift/pull/3752]
+
+Signed-off-by: Jaipaul Cheernam <[email protected]>
+---
+diff --git a/lib/cpp/src/thrift/transport/TSSLSocket.cpp b/lib/cpp/src/thrift/transport/TSSLSocket.cpp
+--- a/lib/cpp/src/thrift/transport/TSSLSocket.cpp	2026-08-27 11:26:40.242005669 +0000
++++ b/lib/cpp/src/thrift/transport/TSSLSocket.cpp	2026-08-27 11:26:40.263005736 +0000
+@@ -182,16 +182,18 @@
+ SSLContext::SSLContext(const SSLProtocol& protocol) {
+   if (protocol == SSLTLS) {
+     ctx_ = SSL_CTX_new(SSLv23_method());
+-#ifndef OPENSSL_NO_SSL3
++#if !defined(OPENSSL_NO_SSL3) && OPENSSL_VERSION_NUMBER < 0x40000000L
+   } else if (protocol == SSLv3) {
+     ctx_ = SSL_CTX_new(SSLv3_method());
+ #endif
++#if OPENSSL_VERSION_NUMBER < 0x40000000L
+   } else if (protocol == TLSv1_0) {
+     ctx_ = SSL_CTX_new(TLSv1_method());
+   } else if (protocol == TLSv1_1) {
+     ctx_ = SSL_CTX_new(TLSv1_1_method());
+   } else if (protocol == TLSv1_2) {
+     ctx_ = SSL_CTX_new(TLSv1_2_method());
++#endif
+   } else {
+     /// UNKNOWN PROTOCOL!
+     throw TSSLException("SSL_CTX_new: Unknown protocol");
+@@ -770,7 +772,7 @@
+       if (name == nullptr) {
+         continue;
+       }
+-      char* data = (char*)ASN1_STRING_data(name->d.ia5);
++      const char* data = (const char*)ASN1_STRING_get0_data(name->d.ia5);
+       int length = ASN1_STRING_length(name->d.ia5);
+       switch (name->type) {
+       case GEN_DNS:
+@@ -796,19 +798,19 @@
+   }
+ 
+   // extract commonName
+-  X509_NAME* name = X509_get_subject_name(cert);
++  const X509_NAME* name = X509_get_subject_name(cert);
+   if (name != nullptr) {
+-    X509_NAME_ENTRY* entry;
++    const X509_NAME_ENTRY* entry;
+     unsigned char* utf8;
+     int last = -1;
+     while (decision == AccessManager::SKIP) {
+-      last = X509_NAME_get_index_by_NID(name, NID_commonName, last);
++      last = X509_NAME_get_index_by_NID((X509_NAME *)name, NID_commonName, last);
+       if (last == -1)
+         break;
+       entry = X509_NAME_get_entry(name, last);
+       if (entry == nullptr)
+         continue;
+-      ASN1_STRING* common = X509_NAME_ENTRY_get_data(entry);
++      const ASN1_STRING* common = X509_NAME_ENTRY_get_data(entry);
+       int size = ASN1_STRING_to_UTF8(&utf8, common);
+       if (host.empty()) {
+         host = (server() ? getPeerHost() : getHost());
+diff --git a/lib/c_glib/src/thrift/c_glib/transport/thrift_ssl_socket.c b/lib/c_glib/src/thrift/c_glib/transport/thrift_ssl_socket.c
+--- a/lib/c_glib/src/thrift/c_glib/transport/thrift_ssl_socket.c	2026-08-27 11:26:40.245005679 +0000
++++ b/lib/c_glib/src/thrift/c_glib/transport/thrift_ssl_socket.c	2026-08-27 11:26:52.923045957 +0000
+@@ -285,7 +285,6 @@
+       SSL_shutdown(ssl_socket->ssl);
+       SSL_free(ssl_socket->ssl);
+       ssl_socket->ssl = NULL;
+-      ERR_remove_state(0);
+   }
+   return thrift_socket_close(transport, error);
+ }
+@@ -710,7 +709,6 @@
+   ERR_free_strings();
+   EVP_cleanup();
+   CRYPTO_cleanup_all_ex_data();
+-  ERR_remove_state(0);
+ }
+ 
+ 
+@@ -835,6 +833,7 @@
+     case SSLTLS:
+       context = SSL_CTX_new(SSLv23_method());
+       break;
++#if OPENSSL_VERSION_NUMBER < 0x40000000L
+ #ifndef OPENSSL_NO_SSL3
+     case SSLv3:
+       context = SSL_CTX_new(SSLv3_method());
+@@ -849,6 +848,7 @@
+     case TLSv1_2:
+       context = SSL_CTX_new(TLSv1_2_method());
+       break;
++#endif /* OPENSSL_VERSION_NUMBER < 0x40000000L */
+     default:
+       g_set_error (error, THRIFT_TRANSPORT_ERROR,
+ 		   THRIFT_SSL_SOCKET_ERROR_CIPHER_NOT_AVAILABLE,
meta-oe/recipes-connectivity/thrift/thrift_0.24.0.bb +1 -0
index 6a5efdabdf..aa822d8696 100644
@@ -10,6 +10,7 @@ DEPENDS = "thrift-native boost flex-native bison-native openssl zlib"
 
 SRC_URI = "https://downloads.apache.org/${BPN}/${PV}/${BP}.tar.gz \
            file://0001-DefineInstallationPaths.cmake-Define-libdir-in-terms.patch \
+           file://0001-TSSLSocket-fix-build-with-OpenSSL-4.0.patch \
            "
 SRC_URI[sha256sum] = "e0fa5839a4c5c1d631b0931cf2c554ebbfa4e2fee3a9fb3ffd4f82ce4396c6e4"
 
#10 lore raw

RFC 10/20 boinc-client: fix build with OpenSSL 4.0

In reply to Jaipaul Cheernam

OpenSSL 4.0 returns const X509_NAME* from X509_get_subject_name(). Minimal fix for the const qualifier issue in cert_verify_file.

Upstream-Status: Submitted [https://github.com/BOINC/boinc/pull/7209]

---
 .../0001-Fix-build-with-OpenSSL-4.0.patch     | 41 +++++++++++++++++++
 .../boinc/boinc-client_8.2.15.bb              |  1 +
 2 files changed, 42 insertions(+)
 create mode 100644 meta-oe/recipes-extended/boinc/boinc-client/0001-Fix-build-with-OpenSSL-4.0.patch
meta-oe/recipes-extended/boinc/boinc-client/0001-Fix-build-with-OpenSSL-4.0.patch new file +41 -0
new file mode 100644
index 0000000000..71162ac3af
@@ -0,0 +1,41 @@
+From 910aad27e06cf7180599c1dc5649a2dfadae6597 Mon Sep 17 00:00:00 2001
+From: Jaipaul Cheernam <[email protected]>
+Date: Thu, 27 Aug 2026 09:14:24 +0000
+Subject: [PATCH] lib/crypt: fix const X509_NAME for OpenSSL 4.0
+
+OpenSSL 4.0 returns const X509_NAME* from X509_get_subject_name().
+Cast where X509_NAME_oneline requires non-const.
+
+Upstream-Status: Submitted [https://github.com/BOINC/boinc/pull/7209]
+
+Note: The upstream fix is part of a large 29-commit refactoring PR
+that rewrites the entire crypt.cpp. This is a minimal standalone fix
+for the const X509_NAME issue only.
+
+Signed-off-by: Jaipaul Cheernam <[email protected]>
+---
+ lib/crypt.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/lib/crypt.cpp b/lib/crypt.cpp
+index 904fe2736c..a06b453324 100644
+--- a/lib/crypt.cpp
++++ b/lib/crypt.cpp
+@@ -774,7 +774,7 @@ int cert_verify_file(
+     DATA_BLOCK sig_db;
+     BIO *bio;
+     X509 *cert;
+-    X509_NAME *subj;
++    const X509_NAME *subj;
+ 
+     if (signatures->signatures.size() == 0) {
+         printf("No signatures available for file ('%s').\n", origFile);
+@@ -824,7 +824,7 @@ int cert_verify_file(
+             }
+             fflush(stdout);
+             subj = X509_get_subject_name(cert);
+-            X509_NAME_oneline(subj, buf, 256);
++            X509_NAME_oneline((X509_NAME *)subj, buf, 256);
+             // ???
+             //X509_NAME_free(subj);
+             X509_free(cert);
meta-oe/recipes-extended/boinc/boinc-client_8.2.15.bb +1 -0
index 62aa757a59..2d386d066c 100644
@@ -39,6 +39,7 @@ TAG = "client_release/8.2/8.2.15"
 SRC_URI = "git://github.com/BOINC/boinc;protocol=https;branch=${BRANCH};tag=${TAG} \
            file://boinc-AM_CONDITIONAL.patch \
            file://0001-scripts-Do-not-check-for-files-on-build-host.patch \
+           file://0001-Fix-build-with-OpenSSL-4.0.patch \
 "
 
 UPSTREAM_CHECK_GITTAGREGEX = "client_release/8.2/(?P<pver>\d+(\.\d+)+)"
#11 lore raw

RFC 11/20 imapfilter: fix build with OpenSSL 4.0

In reply to Jaipaul Cheernam

OpenSSL 4.0 makes ASN1_INTEGER opaque. Use ASN1_STRING accessors.

Upstream-Status: Submitted [https://github.com/lefcha/imapfilter/pull/317]

---
 ...NG-accessors-for-opaque-ASN1_INTEGER.patch | 45 +++++++++++++++++++
 .../imapfilter/imapfilter_2.8.5.bb            |  1 +
 2 files changed, 46 insertions(+)
 create mode 100644 meta-oe/recipes-support/imapfilter/imapfilter/0001-Use-ASN1_STRING-accessors-for-opaque-ASN1_INTEGER.patch
meta-oe/recipes-support/imapfilter/imapfilter/0001-Use-ASN1_STRING-accessors-for-opaque-ASN1_INTEGER.patch new file +45 -0
new file mode 100644
index 0000000000..4342de42c9
@@ -0,0 +1,45 @@
+From d0e1b29ee5ae0e6e91944fd5c04b943fc810e13c Mon Sep 17 00:00:00 2001
+From: Ravi Kant Sharma <[email protected]>
+Date: Mon, 3 Aug 2026 23:02:04 +0200
+Subject: [PATCH] Use ASN1_STRING accessors for opaque ASN1_INTEGER
+
+OpenSSL 4.0 made ASN1_INTEGER opaque. Replace direct struct member
+access (->length, ->type, ->data) with ASN1_STRING_length(),
+ASN1_STRING_type(), ASN1_STRING_get0_data().
+Upstream-Status: Submitted [https://github.com/lefcha/imapfilter/pull/317]
+Signed-off-by: Jaipaul Cheernam <[email protected]>
+---
+ src/cert.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/cert.c b/src/cert.c
+index a6f614a..b188dd0 100644
+--- a/src/cert.c
++++ b/src/cert.c
+@@ -186,21 +186,21 @@ get_serial(X509 *cert)
+ 	serial = X509_get_serialNumber(cert);
+ 	buf = xmalloc(LINE_MAX);
+ 	*buf = '\0';
+-	if (serial->length <= (int)sizeof(long)) {
++	if (ASN1_STRING_length(serial) <= (int)sizeof(long)) {
+ 		num = ASN1_INTEGER_get(serial);
+-		if (serial->type == V_ASN1_NEG_INTEGER) {
++		if (ASN1_STRING_type(serial) == V_ASN1_NEG_INTEGER) {
+ 			snprintf(buf, LINE_MAX, "-%lX", -num);
+ 		} else {
+ 			snprintf(buf, LINE_MAX, "%lX", num);
+ 		}
+ 	} else {
+-		if (serial->type == V_ASN1_NEG_INTEGER) {
++		if (ASN1_STRING_type(serial) == V_ASN1_NEG_INTEGER) {
+ 			snprintf(buf, LINE_MAX, "-");
+ 		}
+-		for (i = 0; i < serial->length; i++) {
++		for (i = 0; i < ASN1_STRING_length(serial); i++) {
+ 			len = strlen(buf);
+ 			snprintf(buf + len, LINE_MAX - len, "%02X",
+-			    serial->data[i]);
++			    ASN1_STRING_get0_data(serial)[i]);
+ 		}
+ 	}
+ 	return buf;
meta-oe/recipes-support/imapfilter/imapfilter_2.8.5.bb +1 -0
index 754e793faa..3e449523ca 100644
@@ -6,6 +6,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=c9e8d74e78283c6319317d3cb15eded4"
 SRCREV = "23b693f7f7cad8b459beb5cf748078f9cc0e5dc8"
 SRC_URI = "git://github.com/lefcha/imapfilter;protocol=https;branch=master;tag=v${PV} \
            file://ldflags.patch \
+           file://0001-Use-ASN1_STRING-accessors-for-opaque-ASN1_INTEGER.patch \
 "
 
 DEPENDS = "openssl lua libpcre2"
#12 lore raw

RFC 12/20 lftp: fix build with OpenSSL 4.0

In reply to Jaipaul Cheernam

Backport upstream fix allowing build with OpenSSL 4.x.

Upstream-Status: Backport [https://github.com/lavv17/lftp/commit/68d42105d788]

---
 .../0001-allow-build-with-OpenSSL-4.x.patch   | 55 +++++++++++++++++++
 .../recipes-connectivity/lftp/lftp_4.9.3.bb   |  1 +
 2 files changed, 56 insertions(+)
 create mode 100644 meta-networking/recipes-connectivity/lftp/lftp/0001-allow-build-with-OpenSSL-4.x.patch
meta-networking/recipes-connectivity/lftp/lftp/0001-allow-build-with-OpenSSL-4.x.patch new file +55 -0
new file mode 100644
index 0000000000..f617a0e269
@@ -0,0 +1,55 @@
+From 68d42105d78838d0ab155296b69fcb99d28d22c2 Mon Sep 17 00:00:00 2001
+From: Rudi Heitbaum <[email protected]>
+Date: Sat, 21 Mar 2026 03:56:46 +0000
+Subject: [PATCH] allow build with OpenSSL 4.x
+
+Upstream-Status: Backport [https://github.com/lavv17/lftp/commit/68d42105d788]
+Signed-off-by: Jaipaul Cheernam <[email protected]>
+---
+ src/lftp_ssl.cc | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/src/lftp_ssl.cc b/src/lftp_ssl.cc
+index f53edf24..49328f74 100644
+--- a/src/lftp_ssl.cc
++++ b/src/lftp_ssl.cc
+@@ -1022,8 +1022,8 @@ const char *lftp_ssl_openssl::strerror()
+ int lftp_ssl_openssl::verify_crl(X509_STORE_CTX *ctx)
+ {
+     X509_OBJECT *obj=0;
+-    X509_NAME *subject=0;
+-    X509_NAME *issuer=0;
++    const X509_NAME *subject=0;
++    const X509_NAME *issuer=0;
+     X509 *xs=0;
+     X509_CRL *crl=0;
+     X509_REVOKED *revoked=0;
+@@ -1436,7 +1436,7 @@ void lftp_ssl_openssl::check_certificate()
+     unsigned char *nulstr = (unsigned char *)"";
+     unsigned char *peer_CN = nulstr;
+ 
+-    X509_NAME *name = X509_get_subject_name(server_cert) ;
++    const X509_NAME *name = X509_get_subject_name(server_cert) ;
+     if(name)
+       while((j = X509_NAME_get_index_by_NID(name, NID_commonName, i))>=0)
+         i=j;
+@@ -1446,7 +1446,7 @@ void lftp_ssl_openssl::check_certificate()
+        UTF8 etc. */
+ 
+     if(i>=0) {
+-      ASN1_STRING *tmp = X509_NAME_ENTRY_get_data(X509_NAME_get_entry(name,i));
++      const ASN1_STRING *tmp = X509_NAME_ENTRY_get_data(X509_NAME_get_entry(name,i));
+ 
+       /* In OpenSSL 0.9.7d and earlier, ASN1_STRING_to_UTF8 fails if the input
+          is already UTF-8 encoded. We check for this case and copy the raw
+@@ -1522,8 +1522,8 @@ int lftp_ssl_openssl::verify_callback(int ok,X509_STORE_CTX *ctx)
+    if(cert!=prev_cert)
+    {
+       int depth          = X509_STORE_CTX_get_error_depth(ctx);
+-      X509_NAME *subject = X509_get_subject_name(cert);
+-      X509_NAME *issuer  = X509_get_issuer_name(cert);
++      const X509_NAME *subject = X509_get_subject_name(cert);
++      const X509_NAME *issuer  = X509_get_issuer_name(cert);
+       char *subject_line = X509_NAME_oneline(subject, NULL, 0);
+       char *issuer_line  = X509_NAME_oneline(issuer, NULL, 0);
+       Log::global->Format(3,"Certificate depth: %d; subject: %s; issuer: %s\n",
meta-networking/recipes-connectivity/lftp/lftp_4.9.3.bb +1 -0
index d132813403..e46b5c7f10 100644
@@ -8,6 +8,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
 
 SRC_URI = "http://lftp.yar.ru/ftp/lftp-${PV}.tar.bz2 \
            file://0001-gnulib-fix-lftp-build-with-clang-lld-and-gcc16.patch \
+           file://0001-allow-build-with-OpenSSL-4.x.patch \
            "
 
 SRC_URI[sha256sum] = "adceaef1bd21a38d07c973233fab603813c431f0a8dcbd23239fa9a41ae17b6e"
#13 lore raw

RFC 13/20 civetweb: fix build with OpenSSL 4.0

In reply to Jaipaul Cheernam

OpenSSL 4.0 adds const qualifiers to X509_NAME returns.

Upstream-Status: Submitted [https://github.com/civetweb/civetweb/pull/1423]

---
 .../0001-Fix-compilation-with-openssl-4.patch | 27 +++++++++++++++++++
 .../civetweb/civetweb_1.16.bb                 |  1 +
 2 files changed, 28 insertions(+)
 create mode 100644 meta-networking/recipes-connectivity/civetweb/civetweb/0001-Fix-compilation-with-openssl-4.patch
meta-networking/recipes-connectivity/civetweb/civetweb/0001-Fix-compilation-with-openssl-4.patch new file +27 -0
new file mode 100644
index 0000000000..134760d8ea
@@ -0,0 +1,27 @@
+From b3449269bbf13852824d19f164d00810432649d0 Mon Sep 17 00:00:00 2001
+From: Mattias Ellert <[email protected]>
+Date: Thu, 20 Aug 2026 21:04:22 +0200
+Subject: [PATCH] Fix compilation with openssl 4
+
+X509_get_subject_name() and X509_get_issuer_name() now return const.
+Upstream-Status: Submitted [https://github.com/civetweb/civetweb/pull/1423]
+Signed-off-by: Jaipaul Cheernam <[email protected]>
+---
+ src/civetweb.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/civetweb.c b/src/civetweb.c
+index f6a60e214..e093e094e 100644
+--- a/src/civetweb.c
++++ b/src/civetweb.c
+@@ -17125,8 +17125,8 @@ ssl_get_client_cert_info(const struct mg_connection *conn,
+ 		const EVP_MD *digest = EVP_get_digestbyname("sha1");
+ 
+ 		/* Get Subject and issuer */
+-		X509_NAME *subj = X509_get_subject_name(cert);
+-		X509_NAME *iss = X509_get_issuer_name(cert);
++		const X509_NAME *subj = X509_get_subject_name(cert);
++		const X509_NAME *iss = X509_get_issuer_name(cert);
+ 
+ 		/* Get serial number */
+ 		ASN1_INTEGER *serial = X509_get_serialNumber(cert);
meta-networking/recipes-connectivity/civetweb/civetweb_1.16.bb +1 -0
index 0e13bc6deb..d9ca7ccd53 100644
@@ -8,6 +8,7 @@ SRCREV = "b6ef58f4c4c7fbe90fd1065bccf45b143345f1a6"
 PV .= "+git"
 SRC_URI = "git://github.com/civetweb/civetweb.git;branch=master;protocol=https \
            file://0001-Unittest-Link-librt-and-libm-using-l-option.patch \
+           file://0001-Fix-compilation-with-openssl-4.patch \
            "
 
 CVE_STATUS[CVE-2025-55763] = "fixed-version: The vulnerability is fixed in the used revision"
#14 lore raw

RFC 14/20 freeradius: fix build with OpenSSL 4.0

In reply to Jaipaul Cheernam

OpenSSL 4.0 makes ASN1_STRING opaque. Use ASN1_STRING accessor functions.

Upstream-Status: Submitted [https://github.com/FreeRADIUS/freeradius-server/pull/5841]

---
 ...ING-functions-for-OpenSSL-4.0-compat.patch | 78 +++++++++++++++++++
 .../freeradius/freeradius_3.2.10.bb           |  1 +
 2 files changed, 79 insertions(+)
 create mode 100644 meta-networking/recipes-connectivity/freeradius/freeradius/0001-Use-ASN1_STRING-functions-for-OpenSSL-4.0-compat.patch
meta-networking/recipes-connectivity/freeradius/freeradius/0001-Use-ASN1_STRING-functions-for-OpenSSL-4.0-compat.patch new file +78 -0
new file mode 100644
index 0000000000..9c7c9a15b0
@@ -0,0 +1,78 @@
+From e2c69353ed1702c22eac2191b67977853d7d4277 Mon Sep 17 00:00:00 2001
+From: Antonio Torres <[email protected]>
+Date: Tue, 5 May 2026 14:42:27 +0200
+Subject: [PATCH] Use ASN1_STRING functions for OpenSSL 4.0 compat
+
+Use ASN1_STRING accessor functions instead of direct field access
+for ASN1_IA5STRING, ASN1_INTEGER, and ASN1_TIME structures.
+
+This fixes compatibility with OpenSSL 4.0.
+
+Signed-off-by: Antonio Torres <[email protected]>
+Upstream-Status: Submitted [https://github.com/FreeRADIUS/freeradius-server/pull/5841]
+Signed-off-by: Jaipaul Cheernam <[email protected]>
+---
+ src/main/tls.c | 26 ++++++++++++++++----------
+ 1 file changed, 16 insertions(+), 10 deletions(-)
+
+diff --git a/src/main/tls.c b/src/main/tls.c
+index bcb65cecca8b..211eb0f9ff9d 100644
+--- a/src/main/tls.c
++++ b/src/main/tls.c
+@@ -2568,7 +2568,7 @@ static int ocsp_parse_cert_url(X509 *cert, char **host_out, char **port_out,
+ 		if (OBJ_obj2nid(ad->method) != NID_ad_OCSP) continue;
+ 		if (ad->location->type != GEN_URI) continue;
+ 
+-		if (OCSP_parse_url((char *) ad->location->d.ia5->data, host_out,
++		if (OCSP_parse_url((const char *) ASN1_STRING_get0_data(ad->location->d.ia5), host_out,
+ 				   port_out, path_out, is_https)) {
+ 			ret = 1;
+ 			break;
+@@ -3050,12 +3050,14 @@ int cbtls_verify(int ok, X509_STORE_CTX *ctx)
+ 	 *	we're at the client or issuing certificate.
+ 	 */
+ 	if (certs &&
+-	    (lookup <= 1) && sn && ((size_t) sn->length < (sizeof(buf) / 2))) {
++	    (lookup <= 1) && sn && ((size_t) ASN1_STRING_length(sn) < (sizeof(buf) / 2))) {
+ 		char *p = buf;
+ 		int i;
++		int sn_len = ASN1_STRING_length(sn);
++		const unsigned char *sn_data = ASN1_STRING_get0_data(sn);
+ 
+-		for (i = 0; i < sn->length; i++) {
+-			sprintf(p, "%02x", (unsigned int)sn->data[i]);
++		for (i = 0; i < sn_len; i++) {
++			sprintf(p, "%02x", (unsigned int)sn_data[i]);
+ 			p += 2;
+ 		}
+ 		vp = fr_pair_make(talloc_ctx, certs, cert_attr_names[FR_TLS_SERIAL][lookup], buf, T_OP_SET);
+@@ -3068,9 +3070,11 @@ int cbtls_verify(int ok, X509_STORE_CTX *ctx)
+ 	buf[0] = '\0';
+ 	asn_time = X509_get_notAfter(client_cert);
+ 	if (certs && (lookup <= 1) && asn_time &&
+-	    (asn_time->length < (int) sizeof(buf))) {
+-		memcpy(buf, (char*) asn_time->data, asn_time->length);
+-		buf[asn_time->length] = '\0';
++	    (ASN1_STRING_length(asn_time) < (int) sizeof(buf))) {
++		int time_len = ASN1_STRING_length(asn_time);
++		const unsigned char *time_data = ASN1_STRING_get0_data(asn_time);
++		memcpy(buf, time_data, time_len);
++		buf[time_len] = '\0';
+ 		vp = fr_pair_make(talloc_ctx, certs, cert_attr_names[FR_TLS_EXPIRATION][lookup], buf, T_OP_SET);
+ 		rdebug_pair(L_DBG_LVL_2, request, vp, NULL);
+ 	}
+@@ -3081,9 +3085,11 @@ int cbtls_verify(int ok, X509_STORE_CTX *ctx)
+ 	buf[0] = '\0';
+ 	asn_time = X509_get_notBefore(client_cert);
+ 	if (certs && (lookup <= 1) && asn_time &&
+-	    (asn_time->length < (int) sizeof(buf))) {
+-		memcpy(buf, (char*) asn_time->data, asn_time->length);
+-		buf[asn_time->length] = '\0';
++	    (ASN1_STRING_length(asn_time) < (int) sizeof(buf))) {
++		int time_len = ASN1_STRING_length(asn_time);
++		const unsigned char *time_data = ASN1_STRING_get0_data(asn_time);
++		memcpy(buf, time_data, time_len);
++		buf[time_len] = '\0';
+ 		vp = fr_pair_make(talloc_ctx, certs, cert_attr_names[FR_TLS_VALID_SINCE][lookup], buf, T_OP_SET);
+ 		rdebug_pair(L_DBG_LVL_2, request, vp, NULL);
+ 	}
meta-networking/recipes-connectivity/freeradius/freeradius_3.2.10.bb +1 -0
index 19d8e69db0..2ff1a9e2be 100644
@@ -39,6 +39,7 @@ SRC_URI = "git://github.com/FreeRADIUS/freeradius-server.git;branch=v3.2.x;tag=$
     file://0016-version.c-don-t-print-build-flags.patch \
     file://0017-Add-acinclude.m4-to-include-required-macros.patch \
     file://0018-Fix-permissions-after-generating-certificates-with-m.patch \
+    file://0001-Use-ASN1_STRING-functions-for-OpenSSL-4.0-compat.patch \
 "
 
 raddbdir = "${sysconfdir}/${MLPREFIX}raddb"
#15 lore raw

RFC 15/20 snort3: fix build with OpenSSL 4.0

In reply to Jaipaul Cheernam

OpenSSL 4.0 returns const pointers from X509_get_subject_name(), X509_get_issuer_name(), X509_NAME_get_entry(), and X509_NAME_ENTRY_get_data().

Upstream-Status: Submitted [https://github.com/snort3/snort3/pull/477]

---
 ...fix-const-qualifiers-for-OpenSSL-4.0.patch | 53 +++++++++++++++++++
 .../snort/snort3_3.12.2.0.bb                  |  1 +
 2 files changed, 54 insertions(+)
 create mode 100644 meta-networking/recipes-connectivity/snort/snort3/0001-ssl-fix-const-qualifiers-for-OpenSSL-4.0.patch
meta-networking/recipes-connectivity/snort/snort3/0001-ssl-fix-const-qualifiers-for-OpenSSL-4.0.patch new file +53 -0
new file mode 100644
index 0000000000..21085d1037
@@ -0,0 +1,53 @@
+From 799739f51e8bc40c55f58a8dcbcb00ddb7ff679e Mon Sep 17 00:00:00 2001
+From: Jaipaul Cheernam <[email protected]>
+Date: Wed, 26 Aug 2026 16:39:34 +0000
+Subject: [PATCH] ssl: fix const qualifiers for OpenSSL 4.0
+
+OpenSSL 4.0 returns const pointers from X509_get_subject_name(),
+X509_get_issuer_name(), X509_NAME_get_entry(), and
+X509_NAME_ENTRY_get_data(). Update local variables to match.
+
+Upstream-Status: Submitted [https://github.com/snort3/snort3/pull/477]
+
+Signed-off-by: Jaipaul Cheernam <[email protected]>
+---
+ src/protocols/ssl.cc | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/src/protocols/ssl.cc b/src/protocols/ssl.cc
+index 733d19adf..4afac05dd 100644
+--- a/src/protocols/ssl.cc
++++ b/src/protocols/ssl.cc
+@@ -860,8 +860,8 @@ ParseResult parse_server_certificates(SSLV3ServerCertData* server_cert_data)
+     while (len > 2 and !(common_name and org_unit))
+     {
+         X509* cert = nullptr;
+-        X509_NAME* cert_subject = nullptr;
+-        X509_NAME* cert_issuer = nullptr;
++        const X509_NAME* cert_subject = nullptr;
++        const X509_NAME* cert_issuer = nullptr;
+ 
+         int cert_len = ntoh3(data);
+         data += 3;
+@@ -918,8 +918,8 @@ ParseResult parse_server_certificates(SSLV3ServerCertData* server_cert_data)
+             lastpos = X509_NAME_get_index_by_NID(cert_subject, NID_commonName, lastpos);
+             if (lastpos != -1)
+             {
+-                X509_NAME_ENTRY* e = X509_NAME_get_entry(cert_subject, lastpos);
+-                ASN1_STRING* asn1_str = X509_NAME_ENTRY_get_data(e);
++                const X509_NAME_ENTRY* e = X509_NAME_get_entry(cert_subject, lastpos);
++                const ASN1_STRING* asn1_str = X509_NAME_ENTRY_get_data(e);
+                 const unsigned char* str_data = ASN1_STRING_get0_data(asn1_str);
+                 int length = ASN1_STRING_length(asn1_str);
+                 
+@@ -941,8 +941,8 @@ ParseResult parse_server_certificates(SSLV3ServerCertData* server_cert_data)
+             lastpos = X509_NAME_get_index_by_NID(cert_subject, NID_organizationalUnitName, lastpos);
+             if (lastpos != -1)
+             {
+-                X509_NAME_ENTRY* e = X509_NAME_get_entry(cert_subject, lastpos);
+-                ASN1_STRING* asn1_str = X509_NAME_ENTRY_get_data(e);
++                const X509_NAME_ENTRY* e = X509_NAME_get_entry(cert_subject, lastpos);
++                const ASN1_STRING* asn1_str = X509_NAME_ENTRY_get_data(e);
+                 const unsigned char* str_data = ASN1_STRING_get0_data(asn1_str);
+                 org_unit_len = ASN1_STRING_length(asn1_str);
+                 
meta-networking/recipes-connectivity/snort/snort3_3.12.2.0.bb +1 -0
index b95de9490d..0d972b8aed 100644
@@ -10,6 +10,7 @@ DEPENDS = "flex-native hwloc libdaq libdnet libpcap libpcre libtirpc libunwind l
 SRC_URI = "git://github.com/snort3/snort3.git;protocol=https;branch=master;tag=${PV} \
            file://0001-cmake-Check-for-HP-libunwind.patch \
            file://0001-cmake-Pass-noline-flag-to-flex.patch \
+           file://0001-ssl-fix-const-qualifiers-for-OpenSSL-4.0.patch \
 		  "
 
 SRCREV = "14aeb09f5a0856812dbe08ead3c21f99e8860aa0"
#16 lore raw

RFC 16/20 znc: fix build with OpenSSL 4.0

In reply to Jaipaul Cheernam

OpenSSL 4.0 adds const qualifiers to X509_NAME and ASN1_STRING returns. Backport upstream fix.

Upstream-Status: Backport [https://github.com/znc/znc/commit/c6b7fece1ec3]

---
 .../0001-Fix-build-error-with-OpenSSL-4.patch | 51 +++++++++++++++++++
 meta-networking/recipes-irc/znc/znc_1.10.2.bb |  4 +-
 2 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100644 meta-networking/recipes-irc/znc/znc/0001-Fix-build-error-with-OpenSSL-4.patch
meta-networking/recipes-irc/znc/znc/0001-Fix-build-error-with-OpenSSL-4.patch new file +51 -0
new file mode 100644
index 0000000000..7e43eeff7f
@@ -0,0 +1,51 @@
+From c6b7fece1ec318c67ed8afa80ef914a135180a4f Mon Sep 17 00:00:00 2001
+From: Ravi Kant Sharma <[email protected]>
+Date: Tue, 16 Jun 2026 10:08:17 +0200
+Subject: [PATCH] Fix build error with OpenSSL 4
+
+Upstream-Status: Backport [https://github.com/znc/znc/commit/c6b7fece1ec3]
+Signed-off-by: Jaipaul Cheernam <[email protected]>
+---
+ src/SSLVerifyHost.cpp | 4 ++--
+ src/Utils.cpp         | 5 ++++-
+ 2 files changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/src/SSLVerifyHost.cpp b/src/SSLVerifyHost.cpp
+index ccc20898e2..99b215bc23 100644
+--- a/src/SSLVerifyHost.cpp
++++ b/src/SSLVerifyHost.cpp
+@@ -306,8 +306,8 @@ typedef enum {
+ static HostnameValidationResult matches_common_name(const char* hostname,
+                                                     const X509* server_cert) {
+     int common_name_loc = -1;
+-    X509_NAME_ENTRY* common_name_entry = nullptr;
+-    ASN1_STRING* common_name_asn1 = nullptr;
++    const X509_NAME_ENTRY* common_name_entry = nullptr;
++    const ASN1_STRING* common_name_asn1 = nullptr;
+     CONST_ASN1_STRING_DATA char* common_name_str = nullptr;
+ 
+     // Find the position of the CN field in the Subject field of the certificate
+diff --git a/src/Utils.cpp b/src/Utils.cpp
+index ed2c9c8386..744f61d195 100644
+--- a/src/Utils.cpp
++++ b/src/Utils.cpp
+@@ -129,7 +129,8 @@ void CUtils::GenerateCert(FILE* pOut) {
+     sEmailAddr += "@";
+     sEmailAddr += sHostName;
+ 
+-    X509_NAME* pName = X509_get_subject_name(pCert.get());
++    X509_NAME* pName = X509_NAME_new();
++    if (!pName) return;
+     X509_NAME_add_entry_by_txt(pName, "OU", MBSTRING_ASC,
+                                (unsigned char*)pLogName, -1, -1, 0);
+     X509_NAME_add_entry_by_txt(pName, "CN", MBSTRING_ASC,
+@@ -137,7 +138,9 @@ void CUtils::GenerateCert(FILE* pOut) {
+     X509_NAME_add_entry_by_txt(pName, "emailAddress", MBSTRING_ASC,
+                                (unsigned char*)sEmailAddr.c_str(), -1, -1, 0);
+ 
++    X509_set_subject_name(pCert.get(), pName);
+     X509_set_issuer_name(pCert.get(), pName);
++    X509_NAME_free(pName);
+ 
+     if (!X509_sign(pCert.get(), pKey.get(), EVP_sha256())) return;
+ 
meta-networking/recipes-irc/znc/znc_1.10.2.bb +3 -1
index 7793813234..31984742d8 100644
@@ -4,7 +4,9 @@ LICENSE = "Apache-2.0"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
 
 DEPENDS = "zlib"
-SRC_URI = "gitsm://github.com/znc/znc.git;branch=master;protocol=https;tag=${BP}"
+SRC_URI = "gitsm://github.com/znc/znc.git;branch=master;protocol=https;tag=${BP} \
+           file://0001-Fix-build-error-with-OpenSSL-4.patch \
+           "
 
 SRCREV = "59af2206c62724eec0d8c43d3c1c0b70610ca1d9"
 
#17 lore raw

RFC 17/20 libesmtp: fix build with OpenSSL 4.0

In reply to Jaipaul Cheernam

OpenSSL 4.0 makes ASN1_STRING opaque. Use accessor functions.

Upstream-Status: Submitted [https://github.com/libesmtp/libESMTP/pull/34]

---
 ...-with-OpenSSL-4.0-opaque-ASN1_STRING.patch | 31 +++++++++++++++++++
 .../libesmtp/libesmtp_1.1.0.bb                |  4 ++-
 2 files changed, 34 insertions(+), 1 deletion(-)
 create mode 100644 meta-networking/recipes-support/libesmtp/libesmtp/0001-Fix-build-with-OpenSSL-4.0-opaque-ASN1_STRING.patch
meta-networking/recipes-support/libesmtp/libesmtp/0001-Fix-build-with-OpenSSL-4.0-opaque-ASN1_STRING.patch new file +31 -0
new file mode 100644
index 0000000000..a949639502
@@ -0,0 +1,31 @@
+From f74ac43fcd2af19dac28901bfb9dd1e62a8ec7b0 Mon Sep 17 00:00:00 2001
+From: Ravi Kant Sharma <[email protected]>
+Date: Tue, 28 Jul 2026 20:35:48 +0200
+Subject: [PATCH] Fix build with OpenSSL 4.0 opaque ASN1_STRING
+
+OpenSSL 4.0 made ASN1_STRING opaque, so direct access to ->data and
+->length fields no longer compiles. Use ASN1_STRING_get0_data() and
+ASN1_STRING_length() accessors which are available since OpenSSL 1.1.0.
+
+Fixes #33
+Upstream-Status: Submitted [https://github.com/libesmtp/libESMTP/pull/34]
+Signed-off-by: Jaipaul Cheernam <[email protected]>
+---
+ smtp-tls.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/smtp-tls.c b/smtp-tls.c
+index 9f3e50e..981284e 100644
+--- a/smtp-tls.c
++++ b/smtp-tls.c
+@@ -599,8 +599,8 @@ check_acceptable_security (smtp_session_t session, SSL *ssl)
+ 
+ 	      if (name->type == GEN_DNS)
+ 		{
+-		  const char *ia5str = (const char *) name->d.ia5->data;
+-		  size_t ia5len = name->d.ia5->length;
++		  const char *ia5str = (const char *) ASN1_STRING_get0_data(name->d.ia5);
++		  size_t ia5len = ASN1_STRING_length(name->d.ia5);
+ 
+ 		  hasaltname = 1;
+ 		  if (strlen (ia5str) == ia5len && match_domain (host, ia5str))
meta-networking/recipes-support/libesmtp/libesmtp_1.1.0.bb +3 -1
index 50f83221c0..d1364a8948 100644
@@ -9,7 +9,9 @@ SECTION = "libs"
 DEPENDS = "openssl"
 
 SRC_URI = "git://github.com/libesmtp/libESMTP.git;branch=master;protocol=https \
-           file://0001-Add-build-option-for-NTLM-support.patch"
+           file://0001-Add-build-option-for-NTLM-support.patch \
+           file://0001-Fix-build-with-OpenSSL-4.0-opaque-ASN1_STRING.patch \
+           "
 SRCREV = "1d0af244310a66943ab400be56b15a9087f181eb"
 
 
#18 lore raw

RFC 18/20 ntopng: fix build with OpenSSL 4.0

In reply to Jaipaul Cheernam

OpenSSL 4.0 returns const X509_NAME* from X509_get_subject_name(). Cast where non-const API (X509_NAME_oneline, X509_NAME_get_text_by_NID) requires it.

Upstream-Status: Backport [https://github.com/ntop/ntopng/pull/10830]

---
 .../0001-Fix-build-with-OpenSSL-4.0.patch     | 42 +++++++++++++++++++
 .../recipes-support/ntopng/ntopng_6.6.bb      |  1 +
 2 files changed, 43 insertions(+)
 create mode 100644 meta-networking/recipes-support/ntopng/ntopng/0001-Fix-build-with-OpenSSL-4.0.patch
meta-networking/recipes-support/ntopng/ntopng/0001-Fix-build-with-OpenSSL-4.0.patch new file +42 -0
new file mode 100644
index 0000000000..4f142092c3
@@ -0,0 +1,42 @@
+From 0c9dcc44df3592d8e08b46f5dfca664de5918bc5 Mon Sep 17 00:00:00 2001
+From: Jaipaul Cheernam <[email protected]>
+Date: Thu, 27 Aug 2026 09:13:35 +0000
+Subject: [PATCH] HTTPserver: fix const X509_NAME for OpenSSL 4.0
+
+OpenSSL 4.0 changed X509_get_subject_name() to return const X509_NAME*.
+Update the local variable to match and cast where non-const API requires it.
+
+Upstream-Status: Backport [https://github.com/ntop/ntopng/pull/10830]
+Signed-off-by: Jaipaul Cheernam <[email protected]>
+---
+ src/HTTPserver.cpp | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/HTTPserver.cpp b/src/HTTPserver.cpp
+index 21895bf10e..f7b4164ab4 100644
+--- a/src/HTTPserver.cpp
++++ b/src/HTTPserver.cpp
+@@ -403,7 +403,7 @@ static bool ssl_client_x509_auth(const struct mg_connection *const conn,
+ 				 char *const group, bool *const localuser) {
+   bool ret = false;
+   X509 *cert = NULL;
+-  X509_NAME *subj = NULL;
++  const X509_NAME *subj = NULL;
+   char subject[256];
+   char key[CONST_MAX_LEN_REDIS_KEY];
+ 
+@@ -411,12 +411,12 @@ static bool ssl_client_x509_auth(const struct mg_connection *const conn,
+ 
+   if ((cert = SSL_get_peer_certificate(conn->ssl))) {
+     if ((subj = X509_get_subject_name(cert))) {
+-      X509_NAME_oneline(subj, subject, sizeof(subject));
++      X509_NAME_oneline((X509_NAME *)subj, subject, sizeof(subject));
+       
+       ntop->getTrace()->traceEvent(TRACE_INFO, "Client X.509 certificate subject name: '%s'", subject);
+ 
+       if (SSL_get_verify_result(conn->ssl) == X509_V_OK &&
+-          X509_NAME_get_text_by_NID(subj, NID_commonName, username, NTOP_USERNAME_MAXLEN) >= 0) {
++          X509_NAME_get_text_by_NID((X509_NAME *)subj, NID_commonName, username, NTOP_USERNAME_MAXLEN) >= 0) {
+         snprintf(key, sizeof(key), CONST_STR_USER_GROUP, username);
+       
+         ntop->getTrace()->traceEvent(TRACE_INFO, "Client X.509 certificate CN: '%s'", username);
meta-networking/recipes-support/ntopng/ntopng_6.6.bb +1 -0
index 3c039781d8..03350f240c 100644
@@ -18,6 +18,7 @@ SRC_URI = "gitsm://github.com/ntop/ntopng;protocol=https;branch=6.6-stable \
            file://0001-configure.ac.in-Allow-dynamic-linking-against-ndpi-3.patch \
            file://0001-luaengine-Use-lua-5.5-API-signature-for-lua_newstate.patch \
            file://ntopng.service \
+           file://0001-Fix-build-with-OpenSSL-4.0.patch \
            "
 
 # don't use the lua under thirdparty as it supports cross compiling badly
#19 lore raw

RFC 19/20 libcoap: fix build with OpenSSL 4.0

In reply to Jaipaul Cheernam

OpenSSL 4.0 removes ENGINE API entirely. Backport upstream fix that guards all ENGINE references with version check.

Upstream-Status: Backport [https://github.com/obgm/libcoap/commit/5ea8b7d5e956]

---
 ...OpenSSL-Support-4.0-and-later-builds.patch | 507 ++++++++++++++++++
 .../libcoap/libcoap_4.3.5b.bb                 |   1 +
 2 files changed, 508 insertions(+)
 create mode 100644 meta-networking/recipes-devtools/libcoap/libcoap/0001-OpenSSL-Support-4.0-and-later-builds.patch
meta-networking/recipes-devtools/libcoap/libcoap/0001-OpenSSL-Support-4.0-and-later-builds.patch new file +507 -0
new file mode 100644
index 0000000000..a139ad9044
@@ -0,0 +1,507 @@
+From 26ef10509e760e931d527982edf7fca8c00cbf4e Mon Sep 17 00:00:00 2001
+From: Jon Shallow <[email protected]>
+Date: Fri, 5 Jun 2026 14:58:02 +0100
+Subject: [PATCH] OpenSSL: Support 4.0 and later builds
+
+Remove all references to ENGINE_*() as support has been removed in 4.0.
+
+There currently is no tested Provider support for PKCS11.
+
+Upstream-Status: Backport [https://github.com/obgm/libcoap/commit/5ea8b7d5e956]
+
+Note: Context adjusted for v4.3.5b (one hunk had minor comment difference).
+
+Signed-off-by: Jaipaul Cheernam <[email protected]>
+---
+ src/coap_openssl.c | 205 +++++++++++++++++++++++++--------------------
+ 1 file changed, 114 insertions(+), 91 deletions(-)
+
+diff --git a/src/coap_openssl.c b/src/coap_openssl.c
+index dc397071..b5afa7a8 100644
+--- a/src/coap_openssl.c
++++ b/src/coap_openssl.c
+@@ -69,7 +69,9 @@
+  *
+  */
+ #include <openssl/ssl.h>
++#if OPENSSL_VERSION_NUMBER < 0x40000000L
+ #include <openssl/engine.h>
++#endif /* OPENSSL_VERSION_NUMBER < 0x40000000L */
+ #include <openssl/err.h>
+ #include <openssl/rand.h>
+ #include <openssl/hmac.h>
+@@ -246,7 +248,11 @@ coap_dtls_pki_is_supported(void) {
+  */
+ int
+ coap_dtls_pkcs11_is_supported(void) {
++#if OPENSSL_VERSION_NUMBER < 0x40000000L
+   return 1;
++#else /* OPENSSL_VERSION_NUMBER >= 0x40000000L */
++  return 0;
++#endif /* OPENSSL_VERSION_NUMBER >= 0x40000000L */
+ }
+ 
+ /*
+@@ -285,14 +291,18 @@ coap_get_tls_library_version(void) {
+   return &version;
+ }
+ 
++#if OPENSSL_VERSION_NUMBER < 0x40000000L
+ static ENGINE *pkcs11_engine = NULL;
+ static ENGINE *defined_engine = NULL;
++#endif /* OPENSSL_VERSION_NUMBER < 0x40000000L */
+ 
+ void
+ coap_dtls_startup(void) {
+   SSL_load_error_strings();
+   SSL_library_init();
++#if OPENSSL_VERSION_NUMBER < 0x40000000L
+   ENGINE_load_dynamic();
++#endif /* OPENSSL_VERSION_NUMBER < 0x40000000L */
+ }
+ 
+ void
+@@ -308,10 +318,10 @@ coap_dtls_shutdown(void) {
+     ENGINE_finish(defined_engine);
+     defined_engine = NULL;
+   }
+-#else /* OPENSSL_VERSION_NUMBER >= 0x30000000L */
++#elif OPENSSL_VERSION_NUMBER < 0x40000000L
+   pkcs11_engine = NULL;
+   defined_engine = NULL;
+-#endif /* OPENSSL_VERSION_NUMBER >= 0x30000000L */
++#endif /* OPENSSL_VERSION_NUMBER >= 0x30000000L && < 0x40000000L */
+   ERR_free_strings();
+   coap_dtls_set_log_level(COAP_LOG_EMERG);
+ }
+@@ -331,6 +341,7 @@ coap_dtls_get_tls(const coap_session_t *c_session,
+   return NULL;
+ }
+ 
++#if OPENSSL_VERSION_NUMBER < 0x40000000L
+ static int
+ get_split_conf_entry(const uint8_t **start, size_t size, const char *get_keyword,
+                      coap_str_const_t **p1, coap_str_const_t **p2) {
+@@ -552,6 +563,19 @@ coap_tls_engine_remove(void) {
+   }
+   return 0;
+ }
++#else /*  OPENSSL_VERSION_NUMBER >= 0x40000000L */
++
++int
++coap_tls_engine_configure(coap_str_const_t *conf_mem) {
++  (void)conf_mem;
++  return 0;
++}
++
++int
++coap_tls_engine_remove(void) {
++  return 0;
++}
++#endif /* OPENSSL_VERSION_NUMBER >= 0x40000000L */
+ 
+ /*
+  * Logging levels use the standard CoAP logging levels
+@@ -1408,6 +1432,7 @@ add_ca_to_cert_store(X509_STORE *st, X509 *x509) {
+   }
+ }
+ 
++#if OPENSSL_VERSION_NUMBER < 0x40000000L
+ static X509 *
+ missing_ENGINE_load_cert(ENGINE *engine, const char *cert_id) {
+   struct {
+@@ -1456,6 +1481,7 @@ check_pkcs11_engine(void) {
+   }
+   return 1;
+ }
++#endif /* OPENSSL_VERSION_NUMBER < 0x40000000L */
+ 
+ #if OPENSSL_VERSION_NUMBER < 0x10101000L && COAP_SERVER_SUPPORT
+ 
+@@ -1899,10 +1925,11 @@ setup_pki_server(SSL_CTX *ctx,
+ 
+   return 1;
+ }
+-#endif /* OPENSSL_VERSION_NUMBER < 0x10101000L */
++#endif /* OPENSSL_VERSION_NUMBER < 0x10101000L && COAP_SERVER_SUPPORT */
+ 
+ #if OPENSSL_VERSION_NUMBER >= 0x10101000L || COAP_CLIENT_SUPPORT
+ 
++#if OPENSSL_VERSION_NUMBER < 0x40000000L
+ static int
+ install_engine_public_cert(ENGINE *engine, SSL *ssl, const char *public_cert,
+                            coap_dtls_role_t role) {
+@@ -1990,6 +2017,7 @@ install_engine_ca(ENGINE *engine, SSL *ssl, const char *ca,
+   X509_free(x509);
+   return 1;
+ }
++#endif /* OPENSSL_VERSION_NUMBER < 0x40000000L */
+ 
+ static int
+ load_in_cas(SSL *ssl,
+@@ -2052,9 +2080,7 @@ setup_pki_ssl(SSL *ssl,
+       if (!(SSL_use_PrivateKey_file(ssl,
+                                     key.key.define.private_key.s_byte,
+                                     SSL_FILETYPE_PEM))) {
+-        return coap_dtls_define_issue(COAP_DEFINE_KEY_PRIVATE,
+-                                      COAP_DEFINE_FAIL_BAD,
+-                                      &key, role, 0);
++        goto fail_bad_private;
+       }
+       break;
+     case COAP_PKI_KEY_DEF_PEM_BUF: /* define private key */
+@@ -2068,31 +2094,23 @@ setup_pki_ssl(SSL *ssl,
+             BIO_free(bp);
+           if (pkey)
+             EVP_PKEY_free(pkey);
+-          return coap_dtls_define_issue(COAP_DEFINE_KEY_PRIVATE,
+-                                        COAP_DEFINE_FAIL_BAD,
+-                                        &key, role, 0);
++          goto fail_bad_private;
+         }
+         if (bp)
+           BIO_free(bp);
+         if (pkey)
+           EVP_PKEY_free(pkey);
+       } else {
+-        return coap_dtls_define_issue(COAP_DEFINE_KEY_PRIVATE,
+-                                      COAP_DEFINE_FAIL_NONE,
+-                                      &key, role, 0);
++        goto fail_none_private;
+       }
+       break;
+     case COAP_PKI_KEY_DEF_RPK_BUF: /* define private key */
+-      return coap_dtls_define_issue(COAP_DEFINE_KEY_PRIVATE,
+-                                    COAP_DEFINE_FAIL_NOT_SUPPORTED,
+-                                    &key, role, 0);
++      goto fail_ns_private;
+     case COAP_PKI_KEY_DEF_DER: /* define private key */
+       if (!(SSL_use_PrivateKey_file(ssl,
+                                     key.key.define.private_key.s_byte,
+                                     SSL_FILETYPE_ASN1))) {
+-        return coap_dtls_define_issue(COAP_DEFINE_KEY_PRIVATE,
+-                                      COAP_DEFINE_FAIL_BAD,
+-                                      &key, role, 0);
++        goto fail_bad_private;
+       }
+       break;
+     case COAP_PKI_KEY_DEF_DER_BUF: /* define private key */
+@@ -2101,14 +2119,13 @@ setup_pki_ssl(SSL *ssl,
+                                     ssl,
+                                     key.key.define.private_key.u_byte,
+                                     (long)key.key.define.private_key_len))) {
+-        return coap_dtls_define_issue(COAP_DEFINE_KEY_PRIVATE,
+-                                      COAP_DEFINE_FAIL_BAD,
+-                                      &key, role, 0);
++        goto fail_bad_private;
+       }
+       break;
+     case COAP_PKI_KEY_DEF_PKCS11: /* define private key */
++#if OPENSSL_VERSION_NUMBER < 0x40000000L
+       if (!check_pkcs11_engine()) {
+-        return 0;
++        goto fail_bad_private;
+       }
+       if (key.key.define.user_pin) {
+         /* If not set, pin-value may be held in pkcs11: URI */
+@@ -2117,39 +2134,36 @@ setup_pki_ssl(SSL *ssl,
+                                    key.key.define.user_pin, 0) == 0) {
+           coap_log_warn("*** setup_pki: (D)TLS: PKCS11: %s: Unable to set pin\n",
+                         key.key.define.user_pin);
+-          return 0;
++          goto fail_bad_private;
+         }
+       }
+       if (!install_engine_private_key(pkcs11_engine, ssl,
+                                       key.key.define.private_key.s_byte,
+                                       role)) {
+-        return coap_dtls_define_issue(COAP_DEFINE_KEY_PRIVATE,
+-                                      COAP_DEFINE_FAIL_BAD,
+-                                      &key, role, 0);
++        goto fail_bad_private;
+       }
++#else /* OPENSSL_VERSION_NUMBER >= 0x40000000L */
++      goto fail_bad_private;
++#endif /* OPENSSL_VERSION_NUMBER >= 0x40000000L */
+       break;
+     case COAP_PKI_KEY_DEF_ENGINE: /* define private key */
++#if OPENSSL_VERSION_NUMBER < 0x40000000L
+       if (!defined_engine ||
+           !install_engine_private_key(defined_engine, ssl,
+                                       key.key.define.private_key.s_byte,
+                                       role)) {
+-        return coap_dtls_define_issue(COAP_DEFINE_KEY_PRIVATE,
+-                                      COAP_DEFINE_FAIL_BAD,
+-                                      &key, role, 0);
++        goto fail_bad_private;
+       }
+       break;
++#endif /* OPENSSL_VERSION_NUMBER < 0x40000000L */
+     case COAP_PKI_KEY_DEF_PKCS11_RPK: /* define private key */
+     default:
+-      return coap_dtls_define_issue(COAP_DEFINE_KEY_PRIVATE,
+-                                    COAP_DEFINE_FAIL_NOT_SUPPORTED,
+-                                    &key, role, 0);
++      goto fail_ns_private;
+     }
+   } else if (role == COAP_DTLS_ROLE_SERVER ||
+              (key.key.define.public_cert.u_byte &&
+               key.key.define.public_cert.u_byte[0])) {
+-    return coap_dtls_define_issue(COAP_DEFINE_KEY_PRIVATE,
+-                                  COAP_DEFINE_FAIL_NONE,
+-                                  &key, role, 0);
++    goto fail_none_private;
+   }
+ 
+   /*
+@@ -2165,16 +2179,12 @@ setup_pki_ssl(SSL *ssl,
+         if (!(SSL_use_certificate_file(ssl,
+                                        key.key.define.public_cert.s_byte,
+                                        SSL_FILETYPE_PEM))) {
+-          return coap_dtls_define_issue(COAP_DEFINE_KEY_PUBLIC,
+-                                        COAP_DEFINE_FAIL_BAD,
+-                                        &key, role, 0);
++          goto fail_bad_public;
+         }
+       } else {
+         if (!SSL_use_certificate_chain_file(ssl,
+                                             key.key.define.public_cert.s_byte)) {
+-          return coap_dtls_define_issue(COAP_DEFINE_KEY_PUBLIC,
+-                                        COAP_DEFINE_FAIL_BAD,
+-                                        &key, role, 0);
++          goto fail_bad_public;
+         }
+       }
+       break;
+@@ -2189,31 +2199,23 @@ setup_pki_ssl(SSL *ssl,
+             BIO_free(bp);
+           if (cert)
+             X509_free(cert);
+-          return coap_dtls_define_issue(COAP_DEFINE_KEY_PUBLIC,
+-                                        COAP_DEFINE_FAIL_BAD,
+-                                        &key, role, 0);
++          goto fail_bad_public;
+         }
+         if (bp)
+           BIO_free(bp);
+         if (cert)
+           X509_free(cert);
+       } else {
+-        return coap_dtls_define_issue(COAP_DEFINE_KEY_PUBLIC,
+-                                      COAP_DEFINE_FAIL_BAD,
+-                                      &key, role, 0);
++        goto fail_bad_public;
+       }
+       break;
+     case COAP_PKI_KEY_DEF_RPK_BUF: /* define public cert */
+-      return coap_dtls_define_issue(COAP_DEFINE_KEY_PUBLIC,
+-                                    COAP_DEFINE_FAIL_NOT_SUPPORTED,
+-                                    &key, role, 0);
++      goto fail_ns_public;
+     case COAP_PKI_KEY_DEF_DER: /* define public cert */
+       if (!(SSL_use_certificate_file(ssl,
+                                      key.key.define.public_cert.s_byte,
+                                      SSL_FILETYPE_ASN1))) {
+-        return coap_dtls_define_issue(COAP_DEFINE_KEY_PUBLIC,
+-                                      COAP_DEFINE_FAIL_BAD,
+-                                      &key, role, 0);
++        goto fail_bad_public;
+       }
+       break;
+     case COAP_PKI_KEY_DEF_DER_BUF: /* define public cert */
+@@ -2221,42 +2223,41 @@ setup_pki_ssl(SSL *ssl,
+           !(SSL_use_certificate_ASN1(ssl,
+                                      key.key.define.public_cert.u_byte,
+                                      (int)key.key.define.public_cert_len))) {
+-        return coap_dtls_define_issue(COAP_DEFINE_KEY_PUBLIC,
+-                                      COAP_DEFINE_FAIL_BAD,
+-                                      &key, role, 0);
++        goto fail_bad_public;
+       }
+       break;
+     case COAP_PKI_KEY_DEF_PKCS11: /* define public cert */
++#if OPENSSL_VERSION_NUMBER < 0x40000000L
+       if (!check_pkcs11_engine()) {
+-        return 0;
++        goto fail_bad_public;
+       }
+       if (!install_engine_public_cert(pkcs11_engine, ssl,
+                                       key.key.define.public_cert.s_byte,
+                                       role)) {
+-        return coap_dtls_define_issue(COAP_DEFINE_KEY_PUBLIC,
+-                                      COAP_DEFINE_FAIL_BAD,
+-                                      &key, role, 0);
++        goto fail_bad_public;
+       }
++#else /* OPENSSL_VERSION_NUMBER >= 0x40000000L */
++      goto fail_bad_public;
++#endif /* OPENSSL_VERSION_NUMBER >= 0x40000000L */
+       break;
+     case COAP_PKI_KEY_DEF_ENGINE: /* define public cert */
++#if OPENSSL_VERSION_NUMBER < 0x40000000L
+       if (!defined_engine ||
+           !install_engine_public_cert(defined_engine, ssl,
+                                       key.key.define.public_cert.s_byte,
+                                       role)) {
+-        return coap_dtls_define_issue(COAP_DEFINE_KEY_PUBLIC,
+-                                      COAP_DEFINE_FAIL_BAD,
+-                                      &key, role, 0);
++        goto fail_bad_public;
+       }
+       break;
++#endif /* OPENSSL_VERSION_NUMBER < 0x40000000L */
+     case COAP_PKI_KEY_DEF_PKCS11_RPK: /* define public cert */
+     default:
+-      return coap_dtls_define_issue(COAP_DEFINE_KEY_PUBLIC,
+-                                    COAP_DEFINE_FAIL_NOT_SUPPORTED,
+-                                    &key, role, 0);
++      goto fail_ns_public;
+     }
+   } else if (role == COAP_DTLS_ROLE_SERVER ||
+              (key.key.define.private_key.u_byte &&
+               key.key.define.private_key.u_byte[0])) {
++
+     return coap_dtls_define_issue(COAP_DEFINE_KEY_PUBLIC,
+                                   COAP_DEFINE_FAIL_NONE,
+                                   &key, role, 0);
+@@ -2270,9 +2271,7 @@ setup_pki_ssl(SSL *ssl,
+     switch (key.key.define.ca_def) {
+     case COAP_PKI_KEY_DEF_PEM:
+       if (!load_in_cas(ssl, key.key.define.ca.s_byte, role)) {
+-        return coap_dtls_define_issue(COAP_DEFINE_KEY_CA,
+-                                      COAP_DEFINE_FAIL_BAD,
+-                                      &key, role, 0);
++        goto fail_bad_ca;
+       }
+       break;
+     case COAP_PKI_KEY_DEF_PEM_BUF: /* define ca */
+@@ -2295,22 +2294,16 @@ setup_pki_ssl(SSL *ssl,
+           BIO_free(bp);
+         }
+       } else {
+-        return coap_dtls_define_issue(COAP_DEFINE_KEY_CA,
+-                                      COAP_DEFINE_FAIL_BAD,
+-                                      &key, role, 0);
++        goto fail_bad_ca;
+       }
+       break;
+     case COAP_PKI_KEY_DEF_RPK_BUF: /* define ca */
+-      return coap_dtls_define_issue(COAP_DEFINE_KEY_CA,
+-                                    COAP_DEFINE_FAIL_NOT_SUPPORTED,
+-                                    &key, role, 0);
++      goto fail_ns_ca;
+     case COAP_PKI_KEY_DEF_DER: /* define ca */
+       if (!(SSL_use_certificate_file(ssl,
+                                      key.key.define.ca.s_byte,
+                                      SSL_FILETYPE_ASN1))) {
+-        return coap_dtls_define_issue(COAP_DEFINE_KEY_CA,
+-                                      COAP_DEFINE_FAIL_BAD,
+-                                      &key, role, 0);
++        goto fail_bad_ca;
+       }
+       break;
+     case COAP_PKI_KEY_DEF_DER_BUF: /* define ca */
+@@ -2324,9 +2317,7 @@ setup_pki_ssl(SSL *ssl,
+         if (role == COAP_DTLS_ROLE_SERVER) {
+           if (!x509 || !SSL_add_client_CA(ssl, x509)) {
+             X509_free(x509);
+-            return coap_dtls_define_issue(COAP_DEFINE_KEY_CA,
+-                                          COAP_DEFINE_FAIL_BAD,
+-                                          &key, role, 0);
++            goto fail_bad_ca;
+           }
+         }
+ 
+@@ -2338,36 +2329,66 @@ setup_pki_ssl(SSL *ssl,
+       }
+       break;
+     case COAP_PKI_KEY_DEF_PKCS11: /* define ca */
++#if OPENSSL_VERSION_NUMBER < 0x40000000L
+       if (!check_pkcs11_engine()) {
+-        return 0;
++        goto fail_bad_ca;
+       }
+       if (!install_engine_ca(pkcs11_engine, ssl,
+                              key.key.define.ca.s_byte,
+                              role)) {
+-        return coap_dtls_define_issue(COAP_DEFINE_KEY_CA,
+-                                      COAP_DEFINE_FAIL_BAD,
+-                                      &key, role, 0);
++        goto fail_bad_ca;
+       }
++#else /* OPENSSL_VERSION_NUMBER >= 0x40000000L */
++      goto fail_bad_ca;
++#endif /* OPENSSL_VERSION_NUMBER >= 0x40000000L */
+       break;
+     case COAP_PKI_KEY_DEF_ENGINE: /* define ca */
++#if OPENSSL_VERSION_NUMBER < 0x40000000L
+       if (!defined_engine ||
+           !install_engine_ca(defined_engine, ssl,
+                              key.key.define.ca.s_byte,
+                              role)) {
+-        return coap_dtls_define_issue(COAP_DEFINE_KEY_CA,
+-                                      COAP_DEFINE_FAIL_BAD,
+-                                      &key, role, 0);
++        goto fail_bad_ca;
+       }
+       break;
++#endif /* OPENSSL_VERSION_NUMBER < 0x40000000L */
+     case COAP_PKI_KEY_DEF_PKCS11_RPK: /* define ca */
+     default:
+-      return coap_dtls_define_issue(COAP_DEFINE_KEY_CA,
+-                                    COAP_DEFINE_FAIL_NOT_SUPPORTED,
+-                                    &key, role, 0);
++      goto fail_ns_ca;
+     }
+   }
+ 
+   return 1;
++
++fail_bad_private:
++  return coap_dtls_define_issue(COAP_DEFINE_KEY_PRIVATE,
++                                COAP_DEFINE_FAIL_BAD,
++                                &key, role, 0);
++fail_ns_private:
++  return coap_dtls_define_issue(COAP_DEFINE_KEY_PRIVATE,
++                                COAP_DEFINE_FAIL_NOT_SUPPORTED,
++                                &key, role, 0);
++fail_none_private:
++  return coap_dtls_define_issue(COAP_DEFINE_KEY_PRIVATE,
++                                COAP_DEFINE_FAIL_NONE,
++                                &key, role, 0);
++fail_bad_public:
++  return coap_dtls_define_issue(COAP_DEFINE_KEY_PUBLIC,
++                                COAP_DEFINE_FAIL_BAD,
++                                &key, role, 0);
++fail_ns_public:
++  return coap_dtls_define_issue(COAP_DEFINE_KEY_PUBLIC,
++                                COAP_DEFINE_FAIL_NOT_SUPPORTED,
++                                &key, role, 0);
++fail_bad_ca:
++  return coap_dtls_define_issue(COAP_DEFINE_KEY_CA,
++                                COAP_DEFINE_FAIL_BAD,
++                                &key, role, 0);
++fail_ns_ca:
++  return coap_dtls_define_issue(COAP_DEFINE_KEY_CA,
++                                COAP_DEFINE_FAIL_NOT_SUPPORTED,
++                                &key, role, 0);
++
+ }
+ #endif /* OPENSSL_VERSION_NUMBER >= 0x10101000L || COAP_CLIENT_SUPPORT */
+ 
+@@ -3200,6 +3221,7 @@ coap_dtls_context_set_pki(coap_context_t *ctx,
+     return 0;
+   context->setup_data = *setup_data;
+ 
++#if OPENSSL_VERSION_NUMBER < 0x40000000L
+   if (context->setup_data.pki_key.key_type == COAP_PKI_KEY_DEFINE) {
+     if (context->setup_data.pki_key.key.define.ca_def == COAP_PKI_KEY_DEF_ENGINE ||
+         context->setup_data.pki_key.key.define.public_cert_def == COAP_PKI_KEY_DEF_ENGINE ||
+@@ -3210,6 +3232,7 @@ coap_dtls_context_set_pki(coap_context_t *ctx,
+       }
+     }
+   }
++#endif /* OPENSSL_VERSION_NUMBER < 0x40000000L */
+ 
+   if (!context->setup_data.verify_peer_cert) {
+     /* Needs to be clear so that no CA DNs are transmitted */
meta-networking/recipes-devtools/libcoap/libcoap_4.3.5b.bb +1 -0
index e5bbdb9e27..07b3670317 100644
@@ -9,6 +9,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=05d17535846895e23ea4c79b16a9e904"
 
 SRC_URI = "git://github.com/obgm/libcoap.git;branch=release-4.3.5-patches;protocol=https;tag=v${PV} \
            file://run-ptest \
+           file://0001-OpenSSL-Support-4.0-and-later-builds.patch \
            "
 SRCREV = "851533c3cf63d16984d370ce39d586ecb3694971"
 
#20 lore raw

RFC 20/20 pjproject: fix build with OpenSSL 4.0

In reply to Jaipaul Cheernam

OpenSSL 4.0 makes ASN1_TIME opaque. Backport upstream fix using ASN1_TIME_to_tm() API.

Upstream-Status: Backport [https://github.com/pjsip/pjproject/commit/3923fad2e4f6]

---
 ...k_ossl-fix-OpenSSL-4.0-compatibility.patch | 40 +++++++++++++++++++
 .../pjproject/pjproject_2.17.bb               |  4 +-
 ...L-4.0-const-and-opaque-compatibility.patch |  2 +
 ...sport_security_utils-for-OpenSSL-4.0.patch |  2 +
 ...ing-const-qualifiers-for-OpenSSL-4.0.patch |  2 +
 5 files changed, 49 insertions(+), 1 deletion(-)
 create mode 100644 meta-multimedia/recipes-multimedia/pjproject/pjproject/0001-ssl_sock_ossl-fix-OpenSSL-4.0-compatibility.patch
meta-multimedia/recipes-multimedia/pjproject/pjproject/0001-ssl_sock_ossl-fix-OpenSSL-4.0-compatibility.patch new file +40 -0
new file mode 100644
index 0000000000..938eb6620f
@@ -0,0 +1,40 @@
+From 3923fad2e4f6f3403c3d6f1176b113c1c1b91066 Mon Sep 17 00:00:00 2001
+From: Ravi Kant Sharma <[email protected]>
+Date: Wed, 24 Jun 2026 11:30:40 +0200
+Subject: [PATCH] ssl_sock_ossl: fix OpenSSL 4.0 compatibility (#5036)
+
+Upstream-Status: Backport [https://github.com/pjsip/pjproject/commit/3923fad2e4f6]
+Signed-off-by: Jaipaul Cheernam <[email protected]>
+---
+ pjlib/src/pj/ssl_sock_ossl.c | 11 ++++-------
+ 1 file changed, 4 insertions(+), 7 deletions(-)
+
+diff --git a/pjlib/src/pj/ssl_sock_ossl.c b/pjlib/src/pj/ssl_sock_ossl.c
+index 000aabad61..93fcf10f14 100644
+--- a/pjlib/src/pj/ssl_sock_ossl.c
++++ b/pjlib/src/pj/ssl_sock_ossl.c
+@@ -1645,10 +1645,7 @@ static pj_status_t init_ossl_ctx(pj_ssl_sock_t *ssock)
+                     if (PEM_read_bio_X509(new_bio, &x, NULL, NULL) == NULL)
+                         break;
+ 
+-                    if ((xn = X509_get_subject_name(x)) == NULL)
+-                        break;
+-
+-                    if ((xn = X509_NAME_dup(xn)) == NULL )
++                    if ((xn = X509_NAME_dup(X509_get_subject_name(x))) == NULL )
+                         break;
+ 
+ #if !USING_BORINGSSL
+@@ -2105,9 +2102,9 @@ static pj_bool_t parse_ossl_asn1_time(pj_time_val *tv, pj_bool_t *gmt,
+     pj_parsed_time pt;
+     int i;
+ 
+-    utc = tm->type == V_ASN1_UTCTIME;
+-    p = (char*)tm->data;
+-    len = tm->length;
++    utc = ASN1_STRING_type(tm) == V_ASN1_UTCTIME;
++    p = (char*)M_ASN1_STRING_data(tm);
++    len = M_ASN1_STRING_length(tm);
+     end = p + len - 1;
+ 
+     /* GMT */
meta-multimedia/recipes-multimedia/pjproject/pjproject_2.17.bb +3 -1
index 44100c8231..8aa7775205 100644
@@ -12,7 +12,9 @@ SECTION = "libs"
 LICENSE = "GPL-2.0-or-later"
 LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
 
-SRC_URI = "git://github.com/pjsip/pjproject.git;protocol=https;branch=master;tag=${PV}"
+SRC_URI = "git://github.com/pjsip/pjproject.git;protocol=https;branch=master;tag=${PV} \
+           file://0001-ssl_sock_ossl-fix-OpenSSL-4.0-compatibility.patch \
+           "
 SRCREV = "5a457451fa2712ba18e12b01738e8ff3af2b26fd"
 
 DEPENDS = "swig-native python3-setuptools-native"
meta-oe/recipes-devtools/grpc/grpc/0002-tsi-fix-OpenSSL-4.0-const-and-opaque-compatibility.patch +2 -0
index afaaf509ad..91f9c7e815 100644
@@ -10,6 +10,8 @@ and use ASN1_STRING accessors for opaque struct access.
 
 Upstream-Status: Submitted [https://github.com/grpc/grpc/pull/41932]
 
+Note: Our fix for areas not covered by the upstream PR.
+
 Signed-off-by: Jaipaul Cheernam <[email protected]>
 ---
  src/core/tsi/ssl_transport_security.cc | 10 +++++-----
meta-oe/recipes-devtools/grpc/grpc/0003-tsi-fix-ssl_transport_security_utils-for-OpenSSL-4.0.patch +2 -0
index a7d6c0f789..56eaa50ad4 100644
@@ -9,6 +9,8 @@ auto* for X509_NAME and const for ASN1_OCTET_STRING.
 
 Upstream-Status: Submitted [https://github.com/grpc/grpc/pull/41932]
 
+Note: Our fix for areas not covered by the upstream PR.
+
 Signed-off-by: Jaipaul Cheernam <[email protected]>
 ---
  src/core/tsi/ssl_transport_security_utils.cc | 10 +++++-----
meta-oe/recipes-devtools/grpc/grpc/0004-tsi-fix-remaining-const-qualifiers-for-OpenSSL-4.0.patch +2 -0
index 468aa9d669..956ea64f33 100644
@@ -10,6 +10,8 @@ to avoid const-to-non-const assignment.
 
 Upstream-Status: Submitted [https://github.com/grpc/grpc/pull/41932]
 
+Note: Our fix for areas not covered by the upstream PR.
+
 Signed-off-by: Jaipaul Cheernam <[email protected]>
 ---
  src/core/tsi/ssl_transport_security.cc | 7 +++----