File tpm2-tss.spec of Package tpm2-tss
%define realname tpm2-tss
%define realver 3.1.1
%define srcext tar.gz
%define so_ver 0
%define fapi_so_ver 1
%define sys_so_ver 1
# turn off the generation of debuginfo rpm (RH9) ??
%global debug_package %{nil}
# Common info
Name: %{realname}
Version: %{realver}%{?extraver}
Release: wiz%{?extraver:0.}1%{?dist}
License: BSD-2-Clause
Group: Productivity/Security
URL: https://github.com/tpm2-software/tpm2-tss
Summary: OSS implementation of the TCG TPM2 Software Stack (TSS2)
# Build-time parameters
BuildRequires: autoconf autoconf-archive >= 2017.03.21 automake libtool
BuildRequires: pkg-config
BuildRequires: libgcrypt-devel >= 1.6.0
BuildRequires: pkgconfig(libcrypto)
BuildRequires: pkgconfig(json-c)
BuildRequires: pkgconfig(libcurl)
# >= 7.80.0
BuildRequires: systemd
BuildRequires: shadow%{?rhel:-utils}
BuildRequires: acl
BuildRequires: doxygen
BuildRoot: %{_tmppath}/%{name}-root
Source: https://github.com/tpm2-software/tpm2-tss/archive/refs/tags/%{realver}.%{srcext}#/%{realname}-%{realver}%{?extraver}.%{srcext}
%description
This repository hosts source code implementing the Trusted Computing
Group's (TCG) TPM2 Software Stack (TSS). This stack consists of the
following layers from top to bottom:
* Feature API (FAPI)
* Enhanced System API (ESAPI)
* System API (SAPI)
* Marshaling/Unmarshaling (MU)
* TPM Command Transmission Interface (TCTI)
* The TCG TSS 2.0 Overview and Common Structures Specification
%package devel
Group: Development/Languages/C and C++
Summary: Development files for %{name}
Requires: libtss2-esys%{?so_ver} = %{version}-%{release}
Provides: libtss2-esys%{?so_ver}-devel = %{version}-%{release}
Provides: libtss2-esys-devel = %{version}-%{release}
Requires: libtss2-fapi%{?fapi_so_ver} = %{version}-%{release}
Provides: libtss2-fapi%{?fapi_so_ver}-devel = %{version}-%{release}
Provides: libtss2-fapi-devel = %{version}-%{release}
Requires: libtss2-mu%{?so_ver} = %{version}-%{release}
Provides: libtss2-mu%{?so_ver}-devel = %{version}-%{release}
Provides: libtss2-mu-devel = %{version}-%{release}
Requires: libtss2-rc%{?so_ver} = %{version}-%{release}
Provides: libtss2-rc%{?so_ver}-devel = %{version}-%{release}
Provides: libtss2-rc-devel = %{version}-%{release}
Requires: libtss2-sys%{?sys_so_ver} = %{version}-%{release}
Provides: libtss2-sys%{?sys_so_ver}-devel = %{version}-%{release}
Provides: libtss2-sys-devel = %{version}-%{release}
Requires: libtss2-tctildr%{?so_ver} = %{version}-%{release}
Provides: libtss2-tctildr%{?so_ver}-devel = %{version}-%{release}
Provides: libtss2-tctildr-devel = %{version}-%{release}
%description devel
This package contains heades and libraries required to build software against
Trusted Computing Group's (TCG) TPM2 Software Stack (TSS).
%package -n libtss2-esys%{?so_ver}
Group: System/Libraries
Summary: TCG TSS 2.0 Enhanced System API (ESAPI) implementation library
%description -n libtss2-esys%{?so_ver}
The Enhanced System API (ESAPI) is an interface that is intended to sit directly
above the System API. The primary purpose of the ESAPI is to reduce the
programming complexity of applications that desire to send individual “system
level” TPM calls to the TPM, but that also require cryptographic operations on
the data being passed to and from the TPM. In particular, applications that wish
to utilize secure sessions to perform Hash-based Message Authentication
Code (HMAC) operations, parameter encryption, parameter decryption, TPM command
audit and TPM policy operations could benefit from using the ESAPI.
Additionally, context and object management are provided by the ESAPI.
%files -n libtss2-esys%{?so_ver}
%defattr(-,root,root)
%{_libdir}/libtss2-esys.so.%{?so_ver}*
%post -n libtss2-esys%{?so_ver} -p /sbin/ldconfig
%postun -n libtss2-esys%{?so_ver} -p /sbin/ldconfig
%package -n libtss2-fapi%{?fapi_so_ver}
Group: System/Libraries
Summary: TCG TSS 2.0 Feature API (FAPI) implementation library
%description -n libtss2-fapi%{?fapi_so_ver}
This TSS 2.0 Feature API is meant to be a very high-level API, aimed at
providing 80% of programmers who write a program using the TPM with everything
they require. The remaining 20% of programmers will have to supplement this set
of APIs with the Extended System API (ESAPI) or System API (SAPI).
This specification is intended to make programming with the TPM as simple as
possible – but no simpler. The cognitive load for a new programmer using this
API is meant to be as low as possible.
%files -n libtss2-fapi%{?fapi_so_ver}
%defattr(-,root,root)
%dir %{_sysconfdir}/%{name}/fapi-profiles
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/fapi-profiles/*.json
%config(noreplace) %{_sysconfdir}/%{name}/fapi-config.json
%{_tmpfilesdir}/%{name}-fapi.conf
%{_libdir}/libtss2-fapi.so.%{?fapi_so_ver}*
%doc %{_mandir}/man5/fapi-*.5*
%ghost /var/lib/tpm2-tss/system/keystore
%post -n libtss2-fapi%{?fapi_so_ver}
/sbin/ldconfig
%tmpfiles_create %{_tmpfilesdir}/%{name}-fapi.conf
%postun -n libtss2-fapi%{?fapi_so_ver} -p /sbin/ldconfig
%package -n libtss2-mu%{?so_ver}
Group: System/Libraries
Summary: TCG TSS 2.0 Marshaling/Unmarshaling API implementation library
%description -n libtss2-mu%{?so_ver}
The MUAPI builds TPM command byte streams (marshalling) and decomposes TPM
response byte streams (unmarshalling). It is useful for both the SAPI and ESAPI
and is therefore kept in its own namespace with its own API.
The MUAPI is in a separate namespace that is shared by both the SAPI and ESAPI
to do all their marshaling and unmarshaling functions. This makes it unnecessary
to replicate this complex functionality in both the SAPI and ESAPI layers.
%files -n libtss2-mu%{?so_ver}
%defattr(-,root,root)
%{_libdir}/libtss2-mu.so.%{?so_ver}*
%post -n libtss2-mu%{?so_ver} -p /sbin/ldconfig
%postun -n libtss2-mu%{?so_ver} -p /sbin/ldconfig
%package -n libtss2-rc%{?so_ver}
Group: System/Libraries
Summary: TCG TSS 2.0 Response Code API implementation library
%description -n libtss2-rc%{?so_ver}
Response codes returned by TPM 2.0 devices and the TSS2 APIs follow the encoding
scheme. Developers using the TSS2 APIs need to provide actionable information to
users of their applications (e.g. system administrators, end users). The TSS2_RC
(UINT32) encoding is insufficient for this purpose as it leaves the burden of
decoding this value into a human understandable form to the user.
%files -n libtss2-rc%{?so_ver}
%defattr(-,root,root)
%{_libdir}/libtss2-rc.so.%{?so_ver}*
%post -n libtss2-rc%{?so_ver} -p /sbin/ldconfig
%postun -n libtss2-rc%{?so_ver} -p /sbin/ldconfig
%package -n libtss2-sys%{?sys_so_ver}
Group: System/Libraries
Summary: TCG TSS 2.0 System Level API (SAPI) implementation library
%description -n libtss2-sys%{?sys_so_ver}
Use of the SAPI requires expert knowledge of the underlying TPM 2.0 commands and
architecture. The purpose of the SAPI is to enable applications to perform TPM2.0
specification Part 3 commands using all possible variations of inputs to those
commands and receiving all possible variations of outputs. The System API may use
the MU API to marshal inputs from C structures to command byte streams and
unmarshal responses from response byte stream format to C structures. It uses the
TCTI to communicate with the TPM.
%files -n libtss2-sys%{?sys_so_ver}
%defattr(-,root,root)
%{_libdir}/libtss2-sys.so.%{?sys_so_ver}*
%post -n libtss2-sys%{?sys_so_ver} -p /sbin/ldconfig
%postun -n libtss2-sys%{?sys_so_ver} -p /sbin/ldconfig
%package -n libtss2-tctildr%{?so_ver}
Group: System/Libraries
Summary: TCG TSS 2.0 TPM Command Transmission Interface (TCTI) implementation library
Provides: libtss2-tcti-device%{?so_ver} = %{version}-%{release}
Provides: libtss2-tcti-mssim%{?so_ver} = %{version}-%{release}
Obsoletes: libtss2-tcti-device%{?so_ver} < %{version}-%{release}
Obsoletes: libtss2-tcti-mssim%{?so_ver} < %{version}-%{release}
%description -n libtss2-tctildr%{?so_ver}
The TPM command transmission interface (TCTI) handles all the communication to
and from the lower layers of the TSS software stack. For instance, different
interfaces are required for local hardware TPMs, firmware TPMs, virtual TPMs,
remote TPMs, and software TPM simulators.
This package contains also drivers for TPM devices:
- libtss2-tcti-device - for Linux kernel interface
- libtss2-tcti-mssim - for the Microsoft TPM2 Simulator
%files -n libtss2-tctildr%{?so_ver}
%defattr(-,root,root)
%{_sysusersdir}/%{name}.conf
%{_udevrulesdir}/tpm-udev.rules
%{_libdir}/libtss2-tcti*.so.%{?so_ver}*
%doc %{_mandir}/man7/tss2-tcti*
%post -n libtss2-tctildr%{?so_ver} -p /sbin/ldconfig
%postun -n libtss2-tctildr%{?so_ver} -p /sbin/ldconfig
%prep
%setup -q -n %{realname}-%{realver}%{?extraver}
if [ ! -x configure ]; then
test -x bootstrap && ./bootstrap || autoreconf --install
fi
%build
export PATH=$PATH:/sbin:/usr/sbin
_CFLAGS='%{optflags} %{?gcc_lto}'
_LDFLAGS='-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,now -Wl,-z,relro %{?gcc_lto}'
%{configure} \
--disable-static \
--disable-weakcrypto \
\
--with-sysusersdir=%{_sysusersdir} \
--with-tmpfilesdir=%{_tmpfilesdir} \
--with-udevrulesdir=%{_udevrulesdir} \
\
CFLAGS="$_CFLAGS" \
LDFLAGS="$_LDFLAGS"
%{__make} %{?_smp_mflags}
%install
%{__make} install DESTDIR=%{buildroot}
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%files devel
%defattr(-,root,root)
%doc CHANGELOG.md CONTRIBUTING.md LICENSE MAINTAINERS README.md RELEASE.md
%{_includedir}/tss2/
%{_libdir}/*.so
%{_libdir}/pkgconfig/tss2-*.pc
%doc %{_mandir}/man3/*
%exclude %{_libdir}/*.la
%changelog