a16adc
%bcond_without gnutls
a16adc
fa86fe
%global gitdate     20211109
fa86fe
%global gitcommit   b79fd91c4b4a74c9c5027b517c5036952c5525db
a16adc
%global gitshortcommit  %(c=%{gitcommit}; echo ${c:0:7})
a16adc
a16adc
# Macros needed by SELinux
a16adc
%global selinuxtype targeted
a16adc
%global moduletype  contrib
a16adc
%global modulename  swtpm
a16adc
a16adc
Summary: TPM Emulator
a16adc
Name:           swtpm
fa86fe
Version:        0.7.0
3a4686
Release:        4.%{gitdate}git%{gitshortcommit}%{?dist}
a16adc
License:        BSD
a16adc
Url:            http://github.com/stefanberger/swtpm
a16adc
Source0:        %{url}/archive/%{gitcommit}/%{name}-%{gitshortcommit}.tar.gz
a16adc
ExcludeArch:    i686
3a4686
Patch0001:      0001-swtpm-Check-header-size-indicator-against-expected-s.patch
3a4686
Patch0002:      0001-swtpm-Disable-OpenSSL-FIPS-mode-to-avoid-libtpms-fai.patch
3a4686
Patch0003:      0001-swtpm_localca-Test-for-available-issuercert-before-c.patch
a16adc
a16adc
BuildRequires: make
a16adc
BuildRequires:  git-core
a16adc
BuildRequires:  automake
a16adc
BuildRequires:  autoconf
a16adc
BuildRequires:  libtool
a16adc
BuildRequires:  libtpms-devel >= 0.6.0
a16adc
BuildRequires:  expect
a16adc
BuildRequires:  net-tools
a16adc
BuildRequires:  openssl-devel
a16adc
BuildRequires:  socat
a16adc
BuildRequires:  softhsm
a16adc
BuildRequires:  json-glib-devel
a16adc
%if %{with gnutls}
a16adc
BuildRequires:  gnutls >= 3.4.0
a16adc
BuildRequires:  gnutls-devel
a16adc
BuildRequires:  gnutls-utils
a16adc
BuildRequires:  libtasn1-devel
a16adc
BuildRequires:  libtasn1
a16adc
%endif
a16adc
BuildRequires:  selinux-policy-devel
a16adc
BuildRequires:  gcc
a16adc
BuildRequires:  libseccomp-devel
a16adc
BuildRequires:  tpm2-tools tpm2-abrmd
fa86fe
BuildRequires:  python3-devel
a16adc
a16adc
Requires:       %{name}-libs = %{version}-%{release}
a16adc
Requires:       libtpms >= 0.6.0
a16adc
%{?selinux_requires}
a16adc
a16adc
%description
a16adc
TPM emulator built on libtpms providing TPM functionality for QEMU VMs
a16adc
a16adc
%package        libs
a16adc
Summary:        Private libraries for swtpm TPM emulators
a16adc
License:        BSD
a16adc
a16adc
%description    libs
a16adc
A private library with callback functions for libtpms based swtpm TPM emulator
a16adc
a16adc
%package        devel
a16adc
Summary:        Include files for the TPM emulator's CUSE interface for usage by clients
a16adc
License:        BSD
a16adc
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}
a16adc
a16adc
%description    devel
a16adc
Include files for the TPM emulator's CUSE interface.
a16adc
a16adc
%package        tools
a16adc
Summary:        Tools for the TPM emulator
a16adc
License:        BSD
a16adc
Requires:       swtpm = %{version}-%{release}
a16adc
Requires:       bash gnutls-utils
a16adc
a16adc
%description    tools
a16adc
Tools for the TPM emulator from the swtpm package
a16adc
a16adc
%package        tools-pkcs11
a16adc
Summary:        Tools for creating a local CA based on a TPM pkcs11 device
a16adc
License:        BSD
a16adc
Requires:       swtpm-tools = %{version}-%{release}
a16adc
Requires:       tpm2-tools tpm2-abrmd
a16adc
Requires:       expect gnutls-utils
a16adc
a16adc
%description   tools-pkcs11
a16adc
Tools for creating a local CA based on a pkcs11 device
a16adc
a16adc
%prep
a16adc
%autosetup -S git -n %{name}-%{gitcommit} -p1
a16adc
a16adc
%build
a16adc
a16adc
NOCONFIGURE=1 ./autogen.sh
a16adc
%configure \
a16adc
%if %{with gnutls}
a16adc
        --with-gnutls \
a16adc
%endif
fa86fe
        --without-cuse \
fa86fe
        --without-tpm1
a16adc
fa86fe
%make_build V=1
a16adc
a16adc
%check
fa86fe
make %{?_smp_mflags} check VERBOSE=1
a16adc
a16adc
%install
a16adc
a16adc
%make_install
a16adc
rm -f $RPM_BUILD_ROOT%{_libdir}/%{name}/*.{a,la,so}
a16adc
a16adc
%post
a16adc
for pp in /usr/share/selinux/packages/swtpm.pp \
a16adc
          /usr/share/selinux/packages/swtpm_svirt.pp; do
a16adc
  %selinux_modules_install -s %{selinuxtype} ${pp}
a16adc
done
a16adc
restorecon %{_bindir}/swtpm
a16adc
a16adc
%postun
a16adc
if [ $1 -eq  0 ]; then
a16adc
  for p in swtpm swtpm_svirt; do
a16adc
    %selinux_modules_uninstall -s %{selinuxtype} $p
a16adc
  done
a16adc
fi
a16adc
a16adc
%posttrans
a16adc
%selinux_relabel_post -s %{selinuxtype}
a16adc
a16adc
%ldconfig_post libs
a16adc
%ldconfig_postun libs
a16adc
a16adc
%files
a16adc
%license LICENSE
a16adc
%doc README
a16adc
%{_bindir}/swtpm
a16adc
%{_mandir}/man8/swtpm.8*
a16adc
%{_datadir}/selinux/packages/swtpm.pp
a16adc
%{_datadir}/selinux/packages/swtpm_svirt.pp
a16adc
a16adc
%files libs
a16adc
%license LICENSE
a16adc
%doc README
a16adc
a16adc
%dir %{_libdir}/%{name}
a16adc
%{_libdir}/%{name}/libswtpm_libtpms.so.0
a16adc
%{_libdir}/%{name}/libswtpm_libtpms.so.0.0.0
a16adc
a16adc
%files devel
a16adc
%dir %{_includedir}/%{name}
a16adc
%{_includedir}/%{name}/*.h
a16adc
%{_mandir}/man3/swtpm_ioctls.3*
a16adc
a16adc
%files tools
a16adc
%doc README
a16adc
%{_bindir}/swtpm_bios
a16adc
%if %{with gnutls}
a16adc
%{_bindir}/swtpm_cert
a16adc
%endif
a16adc
%{_bindir}/swtpm_setup
a16adc
%{_bindir}/swtpm_ioctl
fa86fe
%{_bindir}/swtpm_localca
a16adc
%{_mandir}/man8/swtpm_bios.8*
a16adc
%{_mandir}/man8/swtpm_cert.8*
a16adc
%{_mandir}/man8/swtpm_ioctl.8*
a16adc
%{_mandir}/man8/swtpm-localca.conf.8*
a16adc
%{_mandir}/man8/swtpm-localca.options.8*
a16adc
%{_mandir}/man8/swtpm-localca.8*
fa86fe
%{_mandir}/man8/swtpm_localca.8*
a16adc
%{_mandir}/man8/swtpm_setup.8*
a16adc
%{_mandir}/man8/swtpm_setup.conf.8*
a16adc
%config(noreplace) %{_sysconfdir}/swtpm_setup.conf
a16adc
%config(noreplace) %{_sysconfdir}/swtpm-localca.options
a16adc
%config(noreplace) %{_sysconfdir}/swtpm-localca.conf
a16adc
%dir %{_datadir}/swtpm
a16adc
%{_datadir}/swtpm/swtpm-localca
a16adc
%{_datadir}/swtpm/swtpm-create-user-config-files
a16adc
%attr( 750, tss, root) %{_localstatedir}/lib/swtpm-localca
a16adc
a16adc
%files tools-pkcs11
a16adc
%{_mandir}/man8/swtpm-create-tpmca.8*
a16adc
%{_datadir}/swtpm/swtpm-create-tpmca
a16adc
a16adc
%changelog
3a4686
* Mon Jul 18 2022 Marc-André Lureau <marcandre.lureau@redhat.com> - 0.7.0-4.20211109gitb79fd91
3a4686
- swtpm_localca: Test for available issuercert before creating CA
3a4686
  Resolves: rhbz#2100508
3a4686
3a4686
* Mon Jun 20 2022 Marc-André Lureau <marcandre.lureau@redhat.com> - 0.7.0-3.20211109gitb79fd91
3a4686
- Disable OpenSSL FIPS mode to avoid libtpms failures
3a4686
  Resolves: rhbz#2097947
3a4686
3a4686
* Mon Feb 21 2022 Marc-André Lureau <marcandre.lureau@redhat.com> - 0.7.0-2.20211109gitb79fd91
3a4686
- Add fix for CVE-2022-23645.
3a4686
  Resolves: rhbz#2056517
3a4686
fa86fe
* Tue Jan 04 2022 Marc-André Lureau <marcandre.lureau@redhat.com> - 0.7.0-1.20211109gitb79fd91
fa86fe
- Rebase to 0.7.0, disable TPM 1.2.
fa86fe
  Resovles: rhbz#2029612
fa86fe
a16adc
* Thu Sep 16 2021 Marc-André Lureau <marcandre.lureau@redhat.com> - 0.6.0-2.20210607gitea627b3
a16adc
- rebuilt with missing CFLAGS fix.
a16adc
a16adc
* Mon Jun 28 2021 Marc-André Lureau <marcandre.lureau@redhat.com> - 0.6.0-1.20210607gitea627b3
a16adc
- Update to 0.6.0.
a16adc
  Resolves: rhbz#1972783
a16adc
a16adc
* Tue Dec  1 20:40:07 +04 2020 Marc-André Lureau <marcandre.lureau@redhat.com> - 0.4.2-1.20201201git2df14e3
a16adc
- Update to 0.4.2, to address potential symlink vulnerabilities (CVE-2020-28407).
a16adc
  Resolves: rhbz#1906043
a16adc
a16adc
* Thu Sep 24 2020 Marc-André Lureau <marcandre.lureau@redhat.com> - 0.4.0-3.20200828git0c238a2
a16adc
- swtpm_setup: Add missing .config path when using ${HOME}. Resolves: rhbz#1881418
a16adc
a16adc
* Thu Sep 17 2020 Marc-André Lureau <marcandre.lureau@redhat.com> - 0.4.0-2.20200828git0c238a2
a16adc
- Backport fixes from 0.4.0 stable branch. Resolves: rhbz#1868375
a16adc
  (fixes usage of swtpm-localca with passwords when signing keys)
a16adc
a16adc
* Sat Sep 12 2020 Marc-André Lureau <marcandre.lureau@redhat.com> - 0.4.0-1.20200828git0c238a2
a16adc
- Update to v0.4.0. Resolves: rhbz#1868375
a16adc
a16adc
* Thu May 28 2020 Marc-André Lureau <marcandre.lureau@gmail.com> - 0.3.0-1.20200218git74ae43b
a16adc
- Update to v0.3.0. Fixes rhbz#1809778
a16adc
- exclude i686 build
a16adc
a16adc
* Mon Jan 27 2020 Marc-André Lureau <marcandre.lureau@redhat.com> - 0.2.0-2.20200127gitff5a83b
a16adc
- Update to latest 0.2-stable branch, fix random test failure. rhbz#1782451
a16adc
a16adc
* Fri Oct 18 2019 Marc-André Lureau <marcandre.lureau@redhat.com> - 0.2.0-1.20191018git9227cf4
a16adc
- rebuilt
a16adc
a16adc
* Tue Aug 13 2019 Marc-André Lureau <marcandre.lureau@redhat.com> - 0.1.0-1.20190425gitca85606.1
a16adc
- Fix SELinux labels on /usr/bin/swtpm installation rhbz#1739994
a16adc
a16adc
* Thu Apr 25 2019 Stefan Berger <stefanb@linux.ibm.com> - 0.1.0-0.20190425gitca85606
a16adc
- pick up bug fixes
a16adc
a16adc
* Mon Feb 04 2019 Stefan Berger <stefanb@linux.ibm.com> - 0.1.0-0.20190204git2c25d13.1
a16adc
- v0.1.0 release of swtpm
a16adc
a16adc
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.0-0.20181212git8b9484a.1
a16adc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
a16adc
a16adc
* Wed Dec 12 2018 Stefan Berger <stefanb@linux.ibm.com> - 0.1.0-0.20181212git8b9484a
a16adc
- Follow improvements in swtpm repo primarily related to fixes for 'ubsan'
a16adc
a16adc
* Tue Nov 06 2018 Stefan Berger <stefanb@linux.ibm.com> - 0.1.0-0.20181106git05d8160
a16adc
- Follow improvements in swtpm repo
a16adc
- Remove ownership change of swtpm_setup.sh; have root own the file as required
a16adc
a16adc
* Wed Oct 31 2018 Stefan Berger <stefanb@linux.ibm.com> - 0.1.0-0.20181031gitc782a85
a16adc
- Follow improvements and fixes in swtpm
a16adc
a16adc
* Tue Oct 02 2018 Stefan Berger <stefanb@linux.vnet.ibm.com> - 0.1.0-0.20181002git0143c41
a16adc
- Fixes to SELinux policy
a16adc
- Improvements on various other parts
a16adc
* Tue Sep 25 2018 Stefan Berger <stefanb@linux.vnet.ibm.com> - 0.1.0-0.20180924gitce13edf
a16adc
- Initial Fedora build
a16adc
* Mon Sep 17 2018 Stefan Berger <stefanb@linux.vnet.ibm.com> - 0.1.0-0.20180918git67d7ea3
a16adc
- Created initial version of rpm spec files
a16adc
- Version is now 0.1.0
a16adc
- Bugzilla for this spec: https://bugzilla.redhat.com/show_bug.cgi?id=1611829