0e205c
#global prever rc1
0e205c
#global prerelease yes
0e205c
0e205c
Summary: Software version of a PKCS#11 Hardware Security Module
0e205c
Name: softhsm
0e205c
Version: 2.6.1
0e205c
Release: %{?prever:0.}7%{?prever:.%{prever}}%{?dist}.2
0e205c
License: BSD
0e205c
Url: http://www.opendnssec.org/
0e205c
Source: http://dist.opendnssec.org/source/%{?prever:testing/}%{name}-%{version}.tar.gz
0e205c
Source1: http://dist.opendnssec.org/source/%{?prever:testing/}%{name}-%{version}.tar.gz.sig
0e205c
0e205c
Patch1: softhsm-2.6.1-rh1831086-exit.patch
0e205c
Patch2: softhsm-openssl3-tests.patch
0e205c
0e205c
BuildRequires: make
0e205c
BuildRequires: openssl-devel >= 1.0.1k-6, sqlite-devel >= 3.4.2, cppunit-devel
0e205c
BuildRequires: gcc-c++, pkgconfig, p11-kit-devel
0e205c
0e205c
Requires(pre): shadow-utils
0e205c
Requires: p11-kit
0e205c
Requires: openssl-libs >= 1.0.1k-6
0e205c
0e205c
%global _hardened_build 1
0e205c
0e205c
%global softhsm_module "SoftHSM PKCS #11 Module"
0e205c
0e205c
%description
0e205c
OpenDNSSEC is providing a software implementation of a generic
0e205c
cryptographic device with a PKCS#11 interface, the SoftHSM. SoftHSM is
0e205c
designed to meet the requirements of OpenDNSSEC, but can also work together
0e205c
with other cryptographic products because of the PKCS#11 interface.
0e205c
0e205c
%package devel
0e205c
Summary: Development package of softhsm that includes the header files
0e205c
Requires: %{name} = %{version}-%{release}, openssl-devel, sqlite-devel
0e205c
%if 0%{?prever:1} || 0%{?prerelease:1}
0e205c
BuildRequires: autoconf, libtool, automake
0e205c
%endif
0e205c
0e205c
%description devel
0e205c
The devel package contains the libsofthsm include files
0e205c
0e205c
%prep
0e205c
%setup -q -n %{name}-%{version}%{?prever}
0e205c
%patch1 -p1
0e205c
%patch2 -p1
0e205c
0e205c
%if 0%{?prever:1} || 0%{?prerelease:1}
0e205c
   # pre-release or post-release snapshots fixup
0e205c
   sed -i 's:^full_libdir=":#full_libdir=":g' configure.ac
0e205c
   sed -i "s:libdir)/@PACKAGE@:libdir):" Makefile.in
0e205c
autoreconf -fiv
0e205c
%else
0e205c
   # remove softhsm/ subdir auto-added to --libdir
0e205c
   sed -i 's:full_libdir/softhsm:full_libdir:g' configure
0e205c
%endif
0e205c
0e205c
%build
0e205c
# This package fails its testsuite with LTO enabled and needs further
0e205c
# investigation
0e205c
%define _lto_cflags %{nil}
0e205c
0e205c
%configure --libdir=%{_libdir}/pkcs11 --with-openssl=%{_prefix} --enable-ecc --enable-eddsa --disable-gost \
0e205c
           --with-migrate --enable-visibility --with-p11-kit=%{_datadir}/p11-kit/modules/
0e205c
0e205c
%make_build
0e205c
0e205c
%check
0e205c
make check
0e205c
0e205c
%install
0e205c
rm -rf %{buildroot}
0e205c
%make_install
0e205c
0e205c
rm %{buildroot}/%{_sysconfdir}/softhsm2.conf.sample
0e205c
rm -f %{buildroot}/%{_libdir}/pkcs11/*a
0e205c
mkdir -p %{buildroot}%{_includedir}/softhsm
0e205c
cp src/lib/*.h %{buildroot}%{_includedir}/softhsm
0e205c
mkdir -p %{buildroot}/%{_sharedstatedir}/softhsm/tokens
0e205c
0e205c
# leave a softlink where softhsm-1 installed its library. Programs like
0e205c
# opendnssec have that filename in their configuration file.
0e205c
mkdir -p %{buildroot}/%{_libdir}/softhsm/
0e205c
ln -s ../pkcs11/libsofthsm2.so %{buildroot}/%{_libdir}/softhsm/libsofthsm.so
0e205c
# rhbz#1272423 NSS needs it to be in the search path too
0e205c
( cd  %{buildroot}/%{_libdir} ; ln -s pkcs11/libsofthsm2.so)
0e205c
0e205c
%files
0e205c
%config(noreplace) %{_sysconfdir}/softhsm2.conf
0e205c
%{_bindir}/*
0e205c
%dir %{_libdir}/softhsm
0e205c
%{_libdir}/pkcs11/libsofthsm2.so
0e205c
%{_libdir}/libsofthsm2.so
0e205c
%{_libdir}/softhsm/libsofthsm.so
0e205c
%attr(0664,root,root) %{_datadir}/p11-kit/modules/softhsm2.module
0e205c
%attr(0750,ods,ods) %dir %{_sharedstatedir}/softhsm
0e205c
%attr(1770,ods,ods) %dir %{_sharedstatedir}/softhsm/tokens
0e205c
%doc LICENSE README.md NEWS
0e205c
%{_mandir}/*/*
0e205c
0e205c
%files devel
0e205c
%attr(0755,root,root) %dir %{_includedir}/softhsm
0e205c
%{_includedir}/softhsm/*.h
0e205c
0e205c
%pre
0e205c
getent group ods >/dev/null || groupadd -r ods
0e205c
getent passwd ods >/dev/null || \
0e205c
    useradd -r -g ods -d %{_sharedstatedir}/softhsm -s /sbin/nologin \
0e205c
    -c "softhsm private keys owner" ods
0e205c
exit 0
0e205c
0e205c
%post
0e205c
0e205c
%triggerpostun -- softhsm < 2.0.0
0e205c
if [ -f /var/softhsm/slot0.db ]; then
0e205c
      runuser -g ods ods -c 'softhsm2-migrate --db /var/softhsm/slot0.db --pin 1234 --slot 0' || :
0e205c
fi
0e205c
0e205c
%changelog
0e205c
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 2.6.1-7.2
0e205c
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
0e205c
  Related: rhbz#1991688
0e205c
0e205c
* Wed Jun 16 2021 Mohan Boddu <mboddu@redhat.com> - 2.6.1-7.1
0e205c
- Rebuilt for RHEL 9 BETA for openssl 3.0
0e205c
  Related: rhbz#1971065
0e205c
0e205c
* Wed Jun 02 2021 Alexander Bokovoy <abokovoy@redhat.com> - 2.6.1-7
0e205c
- Fix tests against OpenSSL 3.0: improve p11test
0e205c
- Resolves: rhbz#1964838
0e205c
0e205c
* Thu May 27 2021 Alexander Bokovoy <abokovoy@redhat.com> - 2.6.1-6
0e205c
- Fix tests against OpenSSL 3.0
0e205c
- Resolves: rhbz#1964838
0e205c
0e205c
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 2.6.1-5.2
0e205c
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
0e205c
0e205c
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.1-5.1
0e205c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
0e205c
0e205c
* Tue Dec  8 20:45:53 EST 2020 Paul Wouters <pwouters@redhat.com> - 2.6.1-5
0e205c
- rebuilt to fixup numbering clobbered by automatic bumps
0e205c
0e205c
* Mon Aug 11 2020 Jeff Law <law@redhat.org> - 2.6.1-3.4
0e205c
- Disable LTO
0e205c
0e205c
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.1-3.3
0e205c
- Second attempt - Rebuilt for
0e205c
  https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
0e205c
0e205c
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.1-3.2
0e205c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
0e205c
0e205c
* Tue Jul 14 2020 Tom Stellard <tstellar@redhat.com> - 2.6.1-3.1
0e205c
- Use make macros
0e205c
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
0e205c
0e205c
* Wed May 13 2020 David Woodhouse <dwmw2@infradead.org> - 2.6.1-3
0e205c
- Resolves: rhbz#1831086 softhsm use-after-free on process exit
0e205c
  Fix crash introduced by initial patch
0e205c
0e205c
* Tue May 12 2020 Paul Wouters <pwouters@redhat.com> - 2.6.1-2
0e205c
- Resolves: rhbz#1831086 softhsm use-after-free on process exit
0e205c
0e205c
* Thu Apr 30 2020 Paul Wouters <pwouters@redhat.com> - 2.6.1-1
0e205c
- Resolves: rhbz#1814324 -softhsm-2.6.1 is available
0e205c
0e205c
* Mon Mar 30 2020 Alexander Bokovoy <abokovoy@redhat.com> - 2.6.0-1
0e205c
- Resolves: rhbz#1814324 softhsm-2.6.0 is available
0e205c
0e205c
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.5.0-4.3
0e205c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
0e205c
0e205c
* Sat Dec 14 2019 Jeff Law <law@redhat.com> - 2.5.0-4.2
0e205c
- Fix missing #includes for gcc-10
0e205c
0e205c
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.5.0-4.1
0e205c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
0e205c
0e205c
* Fri May 31 2019 Paul Wouters <pwouters@redhat.com> - 2.5.0-4
0e205c
- Pull in git master fixes to address assertion failure in make check
0e205c
- Re-enable testing
0e205c
0e205c
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.5.0-3.1
0e205c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
0e205c
0e205c
* Wed Nov 14 2018 Nikos Mavrogiannopoulos <nmav@redhat.com> - 2.5.0-3
0e205c
- Removed dependency on NSS; it was not necessary.
0e205c
0e205c
* Mon Nov 05 2018 Nikos Mavrogiannopoulos <nmav@redhat.com> - 2.5.0-2
0e205c
- Rebuilt to match f29 version
0e205c
0e205c
* Mon Oct 29 2018 Simo Sorce <simo@redhat.com> - 2.5.0-1
0e205c
- Updated to latest upstream release
0e205c
0e205c
* Sat Aug 11 2018 Nikos Mavrogiannopoulos <nmav@redhat.com> - 2.4.0-1
0e205c
- Updated to latest upstream release
0e205c
0e205c
* Tue Jul 31 2018 Alexander Bokovoy <abokovoy@redhat.com> - 2.3.0-4
0e205c
- Fix crash when used via p11-kit (#1607635)
0e205c
0e205c
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.3.0-3.2
0e205c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
0e205c
0e205c
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.3.0-3.1
0e205c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
0e205c
0e205c
* Fri Feb 02 2018 Nikos Mavrogiannopoulos <nmav@redhat.com> - 2.3.0-3
0e205c
- Remove softhsm2-pk11install. Software modules are to be registered with
0e205c
  p11-kit as in https://fedoraproject.org/wiki/PackagingDrafts/Pkcs11Support (#1541095).
0e205c
0e205c
* Tue Dec 05 2017 Jakub Jelen <jjelen@redhat.com> - 2.3.0-2
0e205c
- Add support for RSA-PSS from upstrem PR#335
0e205c
0e205c
* Tue Dec 05 2017 Jakub Jelen <jjelen@redhat.com> - 2.3.0-1
0e205c
- New upstream release (#1467329)
0e205c
0e205c
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.0-2.2
0e205c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
0e205c
0e205c
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.0-2.1
0e205c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
0e205c
0e205c
* Tue Jun 27 2017 Nikos Mavrogiannopoulos <nmav@redhat.com> - 2.2.0-2
0e205c
- Increased the level of messages that go to syslog, thus softhsm
0e205c
  will no longer write on syslog when it cannot open the shared DB (#1425135)
0e205c
- Allow users in the 'ods' group to store their keys in /var/lib/softhsm/tokens/
0e205c
  while at the same time disallow deleting other users' keys (using the
0e205c
  sticky bit). Prevent users in the 'ods' group from writing in /var/lib/softhsm.
0e205c
0e205c
* Thu Jun 22 2017 Nikos Mavrogiannopoulos <nmav@redhat.com> - 2.2.0-1
0e205c
- Rebased to latest upstream release
0e205c
0e205c
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.0-2.1
0e205c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
0e205c
0e205c
* Fri Sep 23 2016 Paul Wouters <pwouters@redhat.com> - 2.1.0-2
0e205c
- Resolves: rhbz#1378800 Module cleanup crash
0e205c
0e205c
* Mon May 16 2016 Paul Wouters <pwouters@redhat.com> - 2.1.0-1
0e205c
- Resolves: rhbz#1244461 Updated to 2.1.0
0e205c
- Resolves: rhbz#1272423 Softhsm PKCS#11 module not visible to NSS becasue it is not in the search path
0e205c
- Resolves: rhbz#1177086 A marked as trusted certificate cannot be written in a softhsmv2 db
0e205c
- Resolves: rhbz#1272453 - A marked as CA certificate cannot be written in a softhsmv2 db
0e205c
- Removed merged in bug#162 patch
0e205c
- Temporarily disable make check because cppunit is broken
0e205c
0e205c
* Thu Feb 25 2016 Paul Wouters <pwouters@redhat.com> - 2.0.0-2
0e205c
- Resolves: rhbz#1272453 A marked as CA certificate cannot be written in a softhsmv2 db
0e205c
0e205c
* Fri Feb 05 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.0-1.1
0e205c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
0e205c
0e205c
* Wed Sep 02 2015 Paul Wouters <pwouters@redhat.com> - 2.0.0-1
0e205c
- Resolves: rhbz#1244461 Update to softhsm-2.0.0
0e205c
- Resolves: rhbz#1177086 A marked as trusted certificate cannot be written in a softhsmv2 db
0e205c
- Resolves: rhbz#1159827 Typo in homedir in /etc/passwd
0e205c
- Added global prever to toggle snapshot vs full release build changes
0e205c
0e205c
* Fri Jun 26 2015 Petr Spacek <pspacek@redhat.com> - 2.0.0rc1-3
0e205c
- Add dependency on OpenSSL with fixed AES wrapping support
0e205c
0e205c
* Fri Jun 19 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0rc1-2
0e205c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
0e205c
0e205c
* Mon Jun 01 2015 Petr Spacek <pspacek@redhat.com> - 2.0.0rc1-1
0e205c
- Rebase to latest upstream release
0e205c
0e205c
* Sat May 02 2015 Kalev Lember <kalevlember@gmail.com> - 2.0.0b1-4
0e205c
- Rebuilt for GCC 5 C++11 ABI change
0e205c
0e205c
* Tue Sep 30 2014 Paul Wouters <pwouters@redhat.com> - 2.0.0b1-3
0e205c
- Add support for CKM_RSA_PKCS_OAEP key un/wrapping [Petr Spacek]
0e205c
- Use OpenSSL EVP interface for AES key wrapping [Petr Spacek]
0e205c
- Fix softhsm2-pk11install buid and post call
0e205c
- Do not use --with-objectstore-backend-db (causes issues on i686)
0e205c
- Change install directory to /usr/lib*/pkcs11/
0e205c
- Install pkcs11 module file
0e205c
- Use official upstream tar ball
0e205c
- Create ods user to own softhsm/token files
0e205c
- Enable migration tools (for softhsm-v1 installs)
0e205c
- Add softlink for softhsm-v1 .so (needed for opendnssec's conf.xml)
0e205c
- Require p11-kit, nss-tools, for SoftHSM PKCS #11 Module file
0e205c
- Copy pk11install.c from coolkey package
0e205c
- Enable hardened build
0e205c
- Add upstream official source url
0e205c
0e205c
* Mon Aug 18 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.6-3
0e205c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
0e205c
0e205c
* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.6-2
0e205c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
0e205c
0e205c
* Fri Apr 18 2014 Paul Wouters <pwouters@redhat.com> - 1.3.6-1
0e205c
- Updated to 1.3.6 (rhbz#1070196)
0e205c
- Provide a p11-kit module file (rhbz#1085327)
0e205c
0e205c
* Sun Nov 03 2013 Paul Wouters <pwouters@redhat.com> - 1.3.5-1
0e205c
- Updated to 1.3.5 (rhbz#987721)
0e205c
0e205c
* Tue Jul 30 2013 Paul Wouters <pwouters@redhat.com> - 1.3.3-4
0e205c
- Rebuilt for new botan - requires --with-botan argument
0e205c
0e205c
* Fri Feb 15 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.3-3
0e205c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
0e205c
0e205c
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.3-2
0e205c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
0e205c
0e205c
* Mon Jun 04 2012 Paul Wouters <pwouters@redhat.com> - 1.3.3-1
0e205c
- Updated to 1.3.3
0e205c
0e205c
* Tue Apr 03 2012 Paul Wouters <pwouters@redhat.com> - 1.3.2-1
0e205c
- Updated to 1.3.2.
0e205c
- Changed user from opendnssec to ods, as used in the opendnssec package
0e205c
0e205c
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.0-4
0e205c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
0e205c
0e205c
* Thu Oct 27 2011 Paul Wouters <paul@xelerance.com> - 1.3.0-3
0e205c
- Initial Fedora package
0e205c
- Do not install the .a file
0e205c
- Use a separate "opendnssec" user to own /var/sofhsm
0e205c
0e205c
* Tue Oct 25 2011 Paul Wouters <paul@xelerance.com> - 1.3.0-2
0e205c
- Fix description texts w.r.t. include files
0e205c
0e205c
* Wed Oct 05 2011 Paul Wouters <paul@xelerance.com> - 1.3.0-1
0e205c
- Upgraded to 1.3.0
0e205c
0e205c
* Thu Mar  3 2011 Paul Wouters <paul@xelerance.com> - 1.2.0-1
0e205c
- Initial package for Fedora