Blob Blame History Raw
%global commit0 2f3058c632ad0f1c2fe9d8f1ff7ba1bb4a9c63c8
%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})

Name:		tpm2-pkcs11
Version:	0
Release:	0.5.20190813git%{shortcommit0}%{?dist}
Summary:	PKCS#11 interface for TPM 2.0 hardware

License:	BSD
URL:		https://github.com/tpm2-software/tpm2-pkcs11
Source0:	https://github.com/tpm2-software/tpm2-pkcs11/archive/%{commit0}.tar.gz#/%{name}-%{version}-git%{shortcommit0}.tar.gz

BuildRequires:	automake
BuildRequires:	libtool
BuildRequires:	gcc
BuildRequires:	make
BuildRequires:	tpm2-tss-devel
BuildRequires:	tpm2-tools
BuildRequires:	python3
BuildRequires:	openssl-devel
BuildRequires:	autoconf-archive
BuildRequires:	sqlite-devel
BuildRequires:	libgcrypt-devel
BuildRequires:	p11-kit-devel
# for tests
BuildRequires:	libcmocka-devel
BuildRequires:	dbus-daemon
# for tools
BuildRequires:	python3-devel
BuildRequires:	python3-pyyaml
BuildRequires:	python3-cryptography

%package tools
Summary: The tools required to setup and configure TPM2 for PKCS#11

%description
PKCS #11 is a Public-Key Cryptography Standard that defines a standard method
to access cryptographic services from tokens/ devices such as hardware security
modules (HSM), smart cards, etc. In this project we intend to use a TPM2 device
as the cryptographic token.

%description tools
The tools required to setup and configure TPM2 for PKCS#11.

%prep
%setup -q -n tpm2-pkcs11-%{commit0}


%build
./bootstrap
%configure --enable-unit
make %{?_smp_mflags}
cd tools
%py3_build


%check
make check
cd tools
%{__python3} setup.py test

%install
%make_install
rm $RPM_BUILD_ROOT%{_libdir}/pkgconfig/tpm2-pkcs11.pc
[ -f $RPM_BUILD_ROOT%{_libdir}/pkcs11/libtpm2_pkcs11.la ] && \
  rm $RPM_BUILD_ROOT%{_libdir}/pkcs11/libtpm2_pkcs11.la
cd tools
%py3_install
sed -i "s/python/python3/g" tpm2_ptool
install -Dpm 755 tpm2_ptool $RPM_BUILD_ROOT%{_bindir}/tpm2_ptool

%files
%license LICENSE
%{_datadir}/p11-kit/modules/tpm2_pkcs11.module
%%dir %{_libdir}/pkcs11
%{_libdir}/pkcs11/libtpm2_pkcs11.so
%{_libdir}/pkcs11/libtpm2_pkcs11.so.0*

%files tools
%{_bindir}/tpm2_ptool
%{python3_sitelib}/tpm2_pkcs11/*
%{python3_sitelib}/tpm2_pkcs11_tools-*/*


%changelog
* Tue Aug 20 2019 Peter Robinson <pbrobinson@fedoraproject.org> 0-0.5.20190813git2f3058c
- Update to new git snapshot for better use of tss2-tools 4.0 features

* Mon Aug 19 2019 Miro HronĨok <mhroncok@redhat.com> - 0-0.4.20190219git1e84553
- Rebuilt for Python 3.8

* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.3.20190219git1e84553
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Tue Apr 23 2019 Jakub Jelen <jjelen@redhat.com> - 0-0.2.20190219git1e84553
- Package missing python tool for TPM2 initialization
- Update to current version from github

* Tue Feb 19 2019 Jakub Jelen <jjelen@redhat.com> - 0-0.1.20190219git836d715
- Initial release for Fedora