Name:          tpm2-tss
Version:       3.1.0
Release:       3
Summary:       TPM2.0 Software Stack
License:       BSD
URL:           https://github.com/tpm2-software/tpm2-tss
Source0:       https://github.com/tpm2-software/tpm2-tss/releases/download/%{version}/%{name}-%{version}.tar.gz

Patch1: backport-CVE-2023-22745.patch

BuildRequires: gcc-c++ autoconf-archive libtool pkgconfig systemd libgcrypt-devel openssl-devel doxygen json-c-devel libcurl-devel

%description
tpm2-tss is a software stack supporting Trusted Platform Module(TPM) 2.0 system
APIs which provides TPM2.0 specified APIs for applications to access TPM module through kernel TPM drivers.

%package devel
Summary: Headers and libraries for building apps that use tpm2-tss
Requires: %{name} = %{version}-%{release}
%description devel
It contains headers and static libraries for tpm2-tss.

Provides:  %{name}-static
Obsoletes: %{name}-static

%package_help

%prep
%autosetup -n %{name}-%{version} -p1

%build
%configure --disable-static --disable-silent-rules --with-udevrulesdir=%{_udevrulesdir} --with-udevrulesprefix=80- \
           --with-runstatedir=%{_rundir} --with-tmpfilesdir=%{_tmpfilesdir} --with-sysusersdir=%{_sysusersdir}

%make_build

%install
rm -rf  %{buildroot}
%make_install

%check
make check

%pre

%preun

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc README.md CHANGELOG.md
%license LICENSE
%{_sysconfdir}/tpm2-tss/
%{_sysusersdir}/tpm2-tss.conf
%{_tmpfilesdir}/tpm2-tss-fapi.conf
%{_libdir}/*.so.*
%{_libdir}/*.so
%{_udevrulesdir}/80-tpm-udev.rules

%files devel
%defattr(-,root,root)
%{_includedir}/*
%{_libdir}/*.la
%{_libdir}/pkgconfig/*.pc

%files help
%defattr(-,root,root)
%{_mandir}/man*/*

%changelog
* Tue Jan 31 2023 huangzq6 <huangzhenqiang2@huawei.com> - 3.1.0-3
- Type:CVE
- ID:NA
- SUG:NA
- DESC:fix CVE-2023-22745

* Tue Oct 18 2022 jinlun <jinlun@huawei.com> - 3.1.0-2
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:Rebuild for new release number

* Wed Dec 1 2021 panxiaohe <panxiaohe@huawei.com> - 3.1.0-1
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:update version to 3.1.0

* Mon Jan 25 2021 panxiaohe <panxiaohe@huawe.com> - 3.0.3-1
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:update version to 3.0.3
       use proper rundir tmpfilesdir and sysusersdir, so proper directories are used

* Fri Jan 15 2021 yangzhuangzhuang <yangzhuangzhuang@huawei.com> - 2.4.1-3
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:enable the fapi module

* Thu Jan 14 2021 Hugel<gengqihu1@huawei.com> - 2.4.1-2
- Type:CVE
- ID:NA
- SUG:NA
- DESC: fix CVE-2020-24455

* Wed Jul 29 2020 yang_zhuang_zhuang <yangzhuangzhuang1@huawei.com> - 2.4.1-1
- Type:enhancement
- ID:NA
- SUG:NA
- DESC: update version to 2.4.1

* Tue Sep 24 2019 openEuler Buildteam <buildteam@openeuler.org> - 2.0.1-4 
- Type:enhancement
- ID:NA
- SUG:NA
- DESC: revise spec file with new rules

* Sat Aug 31 2019 lizaiwang <lizaiwang1@huawei.com> - 2.0.1-3
- Type:enhancement
- ID:NA
- SUG:NA
- DESC: strengthen spec

* Thu Aug 15 2019 openEuler Buildteam <buildteam@openeuler.org> - 2.0.1-2
- Package init
