public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Dmitry Belyavskiy <beldmit@gmail.com>
To: git-commits@fedoraproject.org
Subject: [rpms/rb_libtorrent] rawhide: Fix build with OpenSSL 4.0 (opaque ASN1_STRING)
Date: Fri, 12 Jun 2026 19:58:00 GMT	[thread overview]
Message-ID: <178129428060.1.16992514117402240616.rpms-rb_libtorrent-0ade805c22d6@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/rb_libtorrent
Branch : rawhide
Commit : 0ade805c22d6851d8dc056c379c41b69c71e0968
Author : Dmitry Belyavskiy <beldmit@gmail.com>
Date   : 2026-06-12T15:57:19-04:00
Stats  : +68/-2 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/rb_libtorrent/c/0ade805c22d6851d8dc056c379c41b69c71e0968?branch=rawhide

Log:
Fix build with OpenSSL 4.0 (opaque ASN1_STRING)

---
diff --git a/8270.patch b/8270.patch
new file mode 100644
index 0000000..034351d
--- /dev/null
+++ b/8270.patch
@@ -0,0 +1,59 @@
+From 50bd3a46c2c5ccd7298415d1a66ef27c96d0fa2b Mon Sep 17 00:00:00 2001
+From: Chocobo1 <Chocobo1@users.noreply.github.com>
+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.
+---
+ 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: ";

diff --git a/rb_libtorrent.spec b/rb_libtorrent.spec
index 940a3a2..27e084c 100644
--- a/rb_libtorrent.spec
+++ b/rb_libtorrent.spec
@@ -2,7 +2,7 @@
  
 Name:		rb_libtorrent
 Version:	2.0.11
-Release:	6%{?dist}
+Release:	7%{?dist}
 Summary:	A C++ BitTorrent library aiming to be the best alternative
 
 # Most of the code is BSD-3-Clause
@@ -18,11 +18,15 @@ Source1:	%{name}-README-renames.Fedora
 Source2:	%{name}-COPYING.Boost
 Source3:	%{name}-COPYING.zlib
 
+# Add support for OpenSSL 4.0
+# https://github.com/arvidn/libtorrent/pull/8270
+Patch0:		%{git_url}/pull/8270.patch
+
 BuildRequires:	cmake
 BuildRequires:	gcc-c++
 BuildRequires:	ninja-build
 BuildRequires:	openssl-devel
-%if 0%{?fedora} && 0%{?fedora} >= 40
+%if 0%{?fedora} >= 40 && 0%{?fedora} < 45
 BuildRequires:	openssl-devel-engine
 %endif
 BuildRequires:	pkgconfig(zlib)
@@ -182,6 +186,9 @@ install -p -m 0644 %{SOURCE1} ./README-renames.Fedora
 %{python3_sitearch}/libtorrent.cpython-*.so
 
 %changelog
+* Fri Jun 12 2026 Dmitry Belyavskiy <beldmit@gmail.com> - 2.0.11-7
+- Fix build with OpenSSL 4.0 (opaque ASN1_STRING)
+
 * Thu Jun 04 2026 Python Maint <python-maint@redhat.com> - 2.0.11-6
 - Rebuilt for Python 3.15
 

                 reply	other threads:[~2026-06-12 19:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178129428060.1.16992514117402240616.rpms-rb_libtorrent-0ade805c22d6@fedoraproject.org \
    --to=beldmit@gmail.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox