diff --git a/meta-oe/recipes-connectivity/libtorrent-rasterbar/libtorrent-rasterbar/0001-Add-support-for-OpenSSL-4.0.patch b/meta-oe/recipes-connectivity/libtorrent-rasterbar/libtorrent-rasterbar/0001-Add-support-for-OpenSSL-4.0.patch new file mode 100644 index 0000000000..5b3407fc52 --- /dev/null +++ b/meta-oe/recipes-connectivity/libtorrent-rasterbar/libtorrent-rasterbar/0001-Add-support-for-OpenSSL-4.0.patch @@ -0,0 +1,61 @@ +From 50bd3a46c2c5ccd7298415d1a66ef27c96d0fa2b Mon Sep 17 00:00:00 2001 +From: Chocobo1 +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 +--- + 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 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(domain->data); +- auto const name_length = aux::numeric_cast(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(ASN1_STRING_get0_data(domain)); ++ auto const name_length = aux::numeric_cast(ASN1_STRING_length(domain)); + + #ifndef TORRENT_DISABLE_LOGGING + if (i > 1) names += " | n: "; +@@ -1654,18 +1654,22 @@ aux::vector 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(common_name->data); +- auto const name_length = aux::numeric_cast(common_name->length); ++ auto const* torrent_name = reinterpret_cast(ASN1_STRING_get0_data(common_name)); ++ auto const name_length = aux::numeric_cast(ASN1_STRING_length(common_name)); + + #ifndef TORRENT_DISABLE_LOGGING + if (!names.empty()) names += " | n: "; diff --git a/meta-oe/recipes-connectivity/libtorrent-rasterbar/libtorrent-rasterbar_2.0.12.bb b/meta-oe/recipes-connectivity/libtorrent-rasterbar/libtorrent-rasterbar_2.0.12.bb index 6a61286f7a..726bb059ef 100644 --- a/meta-oe/recipes-connectivity/libtorrent-rasterbar/libtorrent-rasterbar_2.0.12.bb +++ b/meta-oe/recipes-connectivity/libtorrent-rasterbar/libtorrent-rasterbar_2.0.12.bb @@ -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"