diff --git a/nettle.spec b/nettle.spec index d0f980d..a4f30fd 100644 --- a/nettle.spec +++ b/nettle.spec @@ -1,3 +1,9 @@ +%if 0%{?rhel} +%bcond_with fips +%else +%bcond_without fips +%endif + Name: nettle Version: 3.4 Release: 2%{?dist} @@ -12,6 +18,9 @@ Patch0: nettle-3.3-remove-ecc-testsuite.patch BuildRequires: gmp-devel, m4 BuildRequires: libtool, automake, autoconf, gettext-devel +%if %{with fips} +BuildRequires: fipscheck +%endif Requires(post): info Requires(preun): info @@ -50,6 +59,17 @@ autoreconf -ifv %configure --enable-shared --enable-fat make %{?_smp_mflags} +%if %{with fips} +%define __spec_install_post \ + %{?__debug_package:%{__debug_install_post}} \ + %{__arch_install_post} \ + %{__os_install_post} \ + fipshmac -d $RPM_BUILD_ROOT%{_libdir} $RPM_BUILD_ROOT%{_libdir}/libnettle.so.4.* \ + fipshmac -d $RPM_BUILD_ROOT%{_libdir} $RPM_BUILD_ROOT%{_libdir}/libhogweed.so.2.* \ + file=`basename $RPM_BUILD_ROOT%{_libdir}/libnettle.so.4.*.hmac` && mv $RPM_BUILD_ROOT%{_libdir}/$file $RPM_BUILD_ROOT%{_libdir}/.$file && ln -s .$file $RPM_BUILD_ROOT%{_libdir}/.libnettle.so.4.hmac \ + file=`basename $RPM_BUILD_ROOT%{_libdir}/libhogweed.so.2.*.hmac` && mv $RPM_BUILD_ROOT%{_libdir}/$file $RPM_BUILD_ROOT%{_libdir}/.$file && ln -s .$file $RPM_BUILD_ROOT%{_libdir}/.libhogweed.so.2.hmac \ +%{nil} +%endif %install make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p" @@ -78,6 +98,10 @@ make check %{_libdir}/libnettle.so.6.* %{_libdir}/libhogweed.so.4 %{_libdir}/libhogweed.so.4.* +%if %{with fips} +%{_libdir}/.libhogweed.so.*.hmac +%{_libdir}/.libnettle.so.*.hmac +%endif %files devel %doc descore.README nettle.html nettle.pdf