input/botan2.spec
raw · 7.1 KiB
%global major_version 2
Name: botan2
Version: 2.19.5
Release: 2%{?dist}
Summary: Botan 2 cryptography library
Summary(ru): Библиотека криптографии Botan 2
License: BSD-2-Clause
URL: https://botan.randombit.net/
Packager: NICE SOFT GROUP LLC (ООО "НАЙС СОФТ ГРУПП") 5024245440 <niceos@ncsgp.ru>
Vendor: NiceSOFT
Distribution: NiceOS.Core
BugURL: https://bugs.niceos.ru/
VCS: https://specs.niceos.ru/rmps/%{name}
Source0: https://botan.randombit.net/releases/Botan-%{version}.tar.xz
# Backport: remove usage of deprecated asio API.
Patch0: https://src.fedoraproject.org/rpms/botan2/raw/rawhide/f/37fec38ff97604f964122cd2d33f5d503f319b10.patch
# Fix build with GCC 15.
Patch1: https://src.fedoraproject.org/rpms/botan2/raw/rawhide/f/f765f0b312f2998498f629d93369babfb2c975b4.patch
# CVE-2026-32877:
# SM2 decryption heap over-read via unchecked C3 MAC length.
# Backported from upstream Botan commit f3c31f96f58f1d1d482032d8f4286dc9ebbc6712.
Patch100: botan2-2.19.5-CVE-2026-32877.patch
BuildRequires: bzip2-devel
BuildRequires: gcc-c++
BuildRequires: make
BuildRequires: python3
BuildRequires: python3-devel
BuildRequires: python3-docutils
BuildRequires: python3-setuptools
BuildRequires: python3-sphinx
BuildRequires: zlib-devel
BuildRequires: libstdc++-devel
BuildRequires: python3-xml
%description
Botan is a modern cryptography library providing a wide range of algorithms and protocols for data
security. It supports symmetric and asymmetric encryption, hashing, digital signatures, and more.
Botan is intended for applications that require strong and well-tested cryptographic primitives.
%description -l ru
Botan2 — современная библиотека криптографии, предоставляющая широкий спектр алгоритмов и протоколов
для обеспечения безопасности данных. Поддерживает симметричное и асимметричное шифрование,
хеширование, цифровые подписи и многое другое. Предназначена для приложений, требующих высокого
уровня криптографической защиты.
%package devel
Summary: Development files for the Botan 2 cryptography library
Summary(ru): Файлы разработки для библиотеки Botan 2
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
The devel subpackage contains header files and development symlinks needed to build applications
using Botan 2.
%description -l ru devel
Подпакет devel содержит файлы разработки для Botan2, включая заголовочные файлы и библиотеки,
необходимые для сборки приложений, использующих Botan2.
%package doc
Summary: Documentation for the Botan 2 cryptography library
Summary(ru): Документация для библиотеки криптографии Botan 2
BuildArch: noarch
%description doc
This subpackage contains the Botan 2 handbook and documentation materials.
%description -l ru doc
Подпакет doc содержит документацию для Botan 2, включая руководство и справочные материалы.
%package -n python3-%{name}
Summary: Python 3 bindings for the Botan 2 library
Summary(ru): Python 3 bindings для библиотеки Botan 2
BuildArch: noarch
Requires: %{name} = %{version}-%{release}
%{?python_provide:%python_provide python3-%{name}}
%description -n python3-%{name}
This subpackage provides Python 3 bindings for Botan 2, allowing Botan functionality to be used
from Python applications.
%description -l ru -n python3-%{name}
Подпакет python3-botan2 предоставляет Python 3 bindings для библиотеки Botan 2, позволяя
использовать её криптографический функционал в приложениях на Python 3.
%prep
%autosetup -n Botan-%{version} -p1
%build
export CXXFLAGS="${CXXFLAGS:-%{optflags}}"
# RU: Включаем поддержку дополнительных модулей (как в исходном spec).
# EN: Enable additional modules support (as in the original spec).
%global enable_modules bzip2,zlib
%{__python3} ./configure.py \
--prefix=%{_prefix} \
--libdir=%{_lib} \
--docdir=%{_docdir} \
--cc=gcc \
--os=linux \
--cpu=%{_arch} \
--enable-modules=%{enable_modules} \
--with-python-version=%{python3_version} \
--with-sphinx \
--with-rst2man \
--distribution-info="NiceOS" \
--disable-static-library \
--with-debug-info
%make_build PYTHON_EXE=%{__python3}
%check
LD_LIBRARY_PATH=%{buildroot}%{_libdir} ./botan-test
%install
make install PYTHON_EXE=%{__python3} DESTDIR=%{buildroot}
# RU: Убираем shebang из Python-модуля.
# EN: Drop shebang from the Python module.
sed -e '1{/^#!/d}' -i %{buildroot}%{python3_sitearch}/botan2.py
%if "%{python3_sitelib}" != "%{python3_sitearch}"
mkdir -p %{buildroot}%{python3_sitelib}
mv %{buildroot}%{python3_sitearch}/botan2.py %{buildroot}%{python3_sitelib}/botan2.py
%endif
# RU: Исправления для документации.
# EN: Documentation adjustments.
mv %{buildroot}%{_docdir}/botan-%{version} %{buildroot}%{_pkgdocdir}
rm -r %{buildroot}%{_pkgdocdir}/handbook/{.doctrees,.buildinfo}
%ldconfig_scriptlets
%files
%defattr(-,root,root,-)
%license license.txt
%dir %{_pkgdocdir}
%{_pkgdocdir}/*.txt
%{_bindir}/botan
%{_libdir}/libbotan-%{major_version}.so.19*
%{_mandir}/man1/botan.1*
%files devel
%defattr(-,root,root,-)
%license license.txt
%{_includedir}/*
%{_libdir}/libbotan-%{major_version}.so
%{_libdir}/pkgconfig/botan-%{major_version}.pc
%files doc
%defattr(-,root,root,-)
%license license.txt
%dir %{_pkgdocdir}/handbook
%{_pkgdocdir}/handbook
%files -n python3-%{name}
%defattr(-,root,root,-)
%license license.txt
%{python3_sitelib}/*
%changelog
* Tue May 26 2026 NiceOS Team <support@niceos.ru> - 2.19.5-2
- EN: Backport the Botan upstream SM2 C3 length verification fix for CVE-2026-32877. Malformed SM2 ciphertext could trigger a heap over-read during decryption; the patch adds a length check before comparing the C3/authentication value and prevents out-of-bounds reads.
- RU: Назадпортировать исправление Botan для проверки длины поля C3 в SM2, устраняющее CVE-2026-32877. Некорректно сформированный SM2-шифртекст мог вызывать heap over-read при расшифровании; патч добавляет проверку длины перед сравнением значения C3/authentication code и предотвращает чтение за пределами буфера.
* Sun Jan 11 2026 NiceOS Team <niceos@ncsgp.ru> - 2.19.5-1
- Initial build for NiceOS (Первая сборка для НАЙС.ОС)