diff --git a/.fmf/version b/.fmf/version deleted file mode 100644 index d00491f..0000000 --- a/.fmf/version +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/libkcapi.spec b/libkcapi.spec index 9338486..80f6921 100644 --- a/libkcapi.spec +++ b/libkcapi.spec @@ -1,6 +1,6 @@ # Shared object version of libkcapi. %global vmajor 1 -%global vminor 5 +%global vminor 4 %global vpatch 0 # Do we build the replacements packages? @@ -84,9 +84,8 @@ %global hmaccalc_evr 0.9.14-10%{?dist} %endif -%global apps_coreutils sha1sum sha224sum sha256sum sha384sum sha512sum md5sum sm3sum %global apps_hmaccalc sha1hmac sha224hmac sha256hmac sha384hmac sha512hmac sm3hmac -%global apps_fipscheck fipscheck fipshmac +%global apps_fipscheck sha1sum sha224sum sha256sum sha384sum sha512sum md5sum sm3sum fipscheck fipshmac # On old kernels use mock hashers implemented via openssl %if %{lua:print(rpm.vercmp(posix.uname('%r'), '3.19'));} >= 0 @@ -97,21 +96,29 @@ %global fipshmac bash %{SOURCE3} %endif -# Add generation of HMAC checksum of the final stripped -# binary. %%define with lazy globbing is used here +# Add generation of HMAC checksums of the final stripped +# binaries. %%define with lazy globbing is used here # intentionally, because using %%global does not work. %define __spec_install_post \ %{?__debug_package:%{__debug_install_post}} \ %{__arch_install_post} \ %{__os_install_post} \ bin_path=%{buildroot}%{_bindir} \ -lib_path=%{buildroot}%{_libdir} \ -{ %sha512hmac "$bin_path"/kcapi-hasher || exit 1; } | \\\ - cut -f 1 -d ' ' >"$lib_path"/hmaccalc/kcapi-hasher.hmac \ -{ %sha512hmac "$lib_path"/libkcapi.so.%{version} || exit 1; } | \\\ - cut -f 1 -d ' ' >"$lib_path"/hmaccalc/libkcapi.so.%{version}.hmac \ +lib_path=%{buildroot}/%{_lib} \ +for app in %{apps_hmaccalc}; do \ + test -e "$bin_path"/$app || continue \ + { %sha512hmac "$bin_path"/$app || exit 1; } \\\ + | cut -f 1 -d ' ' >"$lib_path"/hmaccalc/$app.hmac \ +done \ +for app in %{apps_fipscheck}; do \ + test -e "$bin_path"/$app || continue \ + %fipshmac -d "$lib_path"/fipscheck "$bin_path"/$app || exit 1 \ +done \ +%{_bindir}/hardlink -cfv %{buildroot}%{_bindir} \ +%fipshmac -d "$lib_path"/fipscheck \\\ + "$lib_path"/libkcapi.so.%{version} || exit 1 \ %{__ln_s} libkcapi.so.%{version}.hmac \\\ - "$lib_path"/hmaccalc/libkcapi.so.%{vmajor}.hmac \ + "$lib_path"/fipscheck/libkcapi.so.%{vmajor}.hmac \ %{nil} Name: libkcapi @@ -119,10 +126,10 @@ Version: %{vmajor}.%{vminor}.%{vpatch} Release: %autorelease Summary: User space interface to the Linux Kernel Crypto API -License: BSD-3-Clause OR GPL-2.0-only -URL: https://www.chronox.de/%{name}/ -Source0: https://www.chronox.de/%{name}/releases/%{version}/%{name}-%{version}.tar.xz -Source1: https://www.chronox.de/%{name}/releases/%{version}/%{name}-%{version}.tar.xz.asc +License: BSD or GPLv2 +URL: https://www.chronox.de/%{name}.html +Source0: https://www.chronox.de/%{name}/%{name}-%{version}.tar.xz +Source1: https://www.chronox.de/%{name}/%{name}-%{version}.tar.xz.asc Source2: sha512hmac-openssl.sh Source3: fipshmac-openssl.sh @@ -190,18 +197,10 @@ User documentation for %{name}. %endif -%package hasher -Summary: Common %{name} hashing application -Requires: %{name}%{?_isa} == %{version}-%{release} - -%description hasher -Provides The kcapi-hasher binary used by other %{name} subpackages. - - %if %{with replace_coreutils} %package checksum Summary: Drop-in replacement for *sum utils provided by the %{name} package -Requires: %{name}-hasher%{?_isa} == %{version}-%{release} +Requires: %{name}%{?_isa} == %{version}-%{release} Requires: coreutils%{?_isa} >= %{coreutils_evr} @@ -217,7 +216,7 @@ coreutils) using %{name}. %if %{with replace_fipscheck} %package fipscheck Summary: Drop-in replacements for fipscheck/fipshmac provided by the %{name} package -Requires: %{name}-hasher%{?_isa} == %{version}-%{release} +Requires: %{name}%{?_isa} == %{version}-%{release} Obsoletes: fipscheck <= %{fipscheck_evr} @@ -233,7 +232,7 @@ package fipscheck) using %{name}. %if %{with replace_hmaccalc} %package hmaccalc Summary: Drop-in replacements for hmaccalc provided by the %{name} package -Requires: %{name}-hasher%{?_isa} == %{version}-%{release} +Requires: %{name}%{?_isa} == %{version}-%{release} Obsoletes: hmaccalc <= %{hmaccalc_evr} @@ -258,8 +257,7 @@ is highly discouraged. %package tools Summary: Utility applications for the %{name} package -Requires: %{name}%{?_isa} == %{version}-%{release} -Requires: %{name}-hasher%{?_isa} == %{version}-%{release} +Requires: %{name}%{?_isa} == %{version}-%{release} %description tools Utility applications that are provided with %{name}. This includes @@ -290,10 +288,6 @@ Auxiliary scripts for testing %{name}. %prep %autosetup -p 1 -S git -# Work around https://bugzilla.redhat.com/show_bug.cgi?id=2258240 -sed -i -e 's|XML V45|XML V4.1.2|' -e 's|/xml/4\.5/|/xml/4.1.2/|' \ - lib/doc/libkcapi.tmpl - %if %{with_sysctl_tweak} %{__cat} << EOF > README.%{distroname_ext} This package increases the default limit of the ancillary buffer size @@ -333,7 +327,7 @@ EOF %build %configure \ - --libdir=%{_libdir} \ + --libdir=/%{_lib} \ --disable-silent-rules \ --enable-kcapi-encapp \ --enable-kcapi-dgstapp \ @@ -344,7 +338,7 @@ EOF --enable-shared \ --enable-static \ --enable-sum-prefix= \ - --enable-sum-dir=%{_libdir} \ + --enable-sum-dir=/%{_lib} \ --with-pkgconfigdir=%{_libdir}/pkgconfig %if %{with doc} %make_build all doc @@ -377,22 +371,20 @@ EOF %endif # Install replacement tools, if enabled. -%if %{with replace_coreutils} -for app in %apps_coreutils; do - %{__ln_s} ../libexec/libkcapi/$app %{buildroot}%{_bindir}/$app -done +%if !%{with replace_coreutils} +%{__rm} -f \ + %{buildroot}%{_bindir}/md5sum \ + %{buildroot}%{_bindir}/sha*sum \ + %{buildroot}%{_bindir}/sm*sum %endif -%if %{with replace_fipscheck} -for app in %apps_fipscheck; do - %{__ln_s} ../libexec/libkcapi/$app %{buildroot}%{_bindir}/$app -done +%if !%{with replace_fipscheck} +%{__rm} -f %{buildroot}%{_bindir}/fips* %endif -%if %{with replace_hmaccalc} -for app in %apps_hmaccalc; do - %{__ln_s} ../libexec/libkcapi/$app %{buildroot}%{_bindir}/$app -done +%if !%{with replace_hmaccalc} +%{__rm} -f %{buildroot}%{_bindir}/sha*hmac +%{__rm} -f %{buildroot}%{_bindir}/sm*hmac %endif # We don't ship autocrap dumplings. @@ -424,11 +416,7 @@ done %make_build scan %endif %if %{with cppcheck} -# -UCHECK_DIR: string literal concatenation raises syntaxError -# with cppcheck-2.11 (https://trac.cppcheck.net/ticket/11830) -# --check-level=exhaustive: otherwise it emits warnings that get -# treated like errors -%make_build cppcheck CPPCHECK="cppcheck --check-level=exhaustive -UCHECK_DIR" +%make_build cppcheck %endif %if %{with test} @@ -458,10 +446,10 @@ popd %doc %dir %{_pkgdocdir} %doc %{_pkgdocdir}/README.md %license COPYING* -%{_libdir}/%{name}.so.%{vmajor} -%{_libdir}/%{name}.so.%{version} -%{_libdir}/hmaccalc/%{name}.so.%{vmajor}.hmac -%{_libdir}/hmaccalc/%{name}.so.%{version}.hmac +/%{_lib}/%{name}.so.%{vmajor} +/%{_lib}/%{name}.so.%{version} +/%{_lib}/fipscheck/%{name}.so.%{vmajor}.hmac +/%{_lib}/fipscheck/%{name}.so.%{version}.hmac %if %{with_sysctl_tweak} %doc %{_pkgdocdir}/README.%{distroname_ext} %{_sysctldir}/%{sysctl_prio}-%{name}-optmem_max.conf @@ -473,7 +461,7 @@ popd %doc %{_pkgdocdir}/TODO %{_includedir}/kcapi.h %{_mandir}/man3/kcapi_*.3.* -%{_libdir}/%{name}.so +/%{_lib}/%{name}.so %{_libdir}/pkgconfig/%{name}.pc @@ -485,60 +473,43 @@ popd %endif -%files hasher -%{_bindir}/kcapi-hasher -%{_libexecdir}/%{name}/md5sum -%{_libexecdir}/%{name}/sha*sum -%{_libexecdir}/%{name}/sm*sum -%{_libexecdir}/%{name}/fips* -%{_libexecdir}/%{name}/sha*hmac -%{_libexecdir}/%{name}/sm*hmac -%{_libdir}/hmaccalc/kcapi-hasher.hmac -%{_mandir}/man1/kcapi-hasher.1.* - - %if %{with replace_coreutils} %files checksum %{_bindir}/md5sum %{_bindir}/sha*sum %{_bindir}/sm*sum +/%{_lib}/fipscheck/md5sum.hmac +/%{_lib}/fipscheck/sha*sum.hmac +/%{_lib}/fipscheck/sm*sum.hmac %endif %if %{with replace_fipscheck} %files fipscheck %{_bindir}/fips* +/%{_lib}/fipscheck/fips*.hmac %endif %if %{with replace_hmaccalc} %files hmaccalc %{_bindir}/sha*hmac %{_bindir}/sm*hmac +/%{_lib}/hmaccalc/sha*hmac.hmac +/%{_lib}/hmaccalc/sm*hmac.hmac %endif %files static -%{_libdir}/%{name}.a +/%{_lib}/%{name}.a %files tools -%{_bindir}/kcapi -%{_bindir}/kcapi-convenience -%{_bindir}/kcapi-dgst -%{_bindir}/kcapi-enc -%{_bindir}/kcapi-enc-test-large -%{_bindir}/kcapi-rng -%{_bindir}/kcapi-speed -%{_mandir}/man1/kcapi-dgst.1.* -%{_mandir}/man1/kcapi-enc.1.* -%{_mandir}/man1/kcapi-rng.1.* +%{_bindir}/kcapi* +%{_mandir}/man1/kcapi*.1.* %if %{with test_package} %files tests -%{_libexecdir}/%{name}/kcapi -%{_libexecdir}/%{name}/kcapi-convenience -%{_libexecdir}/%{name}/kcapi-enc-test-large -%{_libexecdir}/%{name}/*.sh +%{_libexecdir}/%{name}/* %endif diff --git a/plans/ci.fmf b/plans/ci.fmf deleted file mode 100644 index d3cd36f..0000000 --- a/plans/ci.fmf +++ /dev/null @@ -1,5 +0,0 @@ -summary: Run CI tests -discover: - how: fmf -execute: - how: tmt diff --git a/sources b/sources index 0f7842a..7e8a98f 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (libkcapi-1.5.0.tar.xz) = db156ee94fc63815a31876ab072aca72a806b26961c43f2caf8495c53b95484de71cd3be84dc9e5c9560e9ee704979be059ff6c102b4893d6bbdf9a8a69a667a -SHA512 (libkcapi-1.5.0.tar.xz.asc) = 69cfb6bf98f89c503e7fda07a54eddb9fcc2dafe418f1bc1216c051565c214a6caab83495c19b650a5c6e46e22080f8df4dd2152ab364993ed5badd256495159 +SHA512 (libkcapi-1.4.0.tar.xz) = fa3df1fe22eba32585de5df044f907d3ad189c33f5704fe29b0fdeda92e772ef077055b80e17bc1646a8cdedaf4f195aadf0b133f493597f0f7657b04ea93a99 +SHA512 (libkcapi-1.4.0.tar.xz.asc) = a41303cba88b214c82537bb5de2584a72a239670318753ba6873a2c3ebe3b56ffd381fdf7ae266aa21857e850bebdfbfdec487c98655ddbc2b9a0ba0d4f383ca diff --git a/tests/fipscheck-smoke-test/Makefile b/tests/fipscheck-smoke-test/Makefile new file mode 100644 index 0000000..0e0dda3 --- /dev/null +++ b/tests/fipscheck-smoke-test/Makefile @@ -0,0 +1,71 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/libgcrypt/smoke-test +# Description: Test calls upstream test suite. +# Author: Ondrej Moris +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2010 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/CoreOS/libgcrypt/smoke-test +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Ondrej Moris " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Test calls upstream test suite." >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 15m" >> $(METADATA) + @echo "RunFor: libgcrypt" >> $(METADATA) + @echo "Requires: libgcrypt" >> $(METADATA) + @echo "Requires: nfs-utils" >> $(METADATA) + @echo "Requires: rpm-build" >> $(METADATA) + @echo "Requires: gawk" >> $(METADATA) + @echo "Requires: gcc-c++ fipscheck" >> $(METADATA) + @echo "Requires: libgpg-error-devel wget" >> $(METADATA) + @echo "Requires: pkgconfig texinfo libselinux-utils" >> $(METADATA) + @echo "Releases: -RHEL3 -RHEL4" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "Architectures: i386 x86_64 s390x ia64" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/fipscheck-smoke-test/PURPOSE b/tests/fipscheck-smoke-test/PURPOSE new file mode 100644 index 0000000..5df6ca9 --- /dev/null +++ b/tests/fipscheck-smoke-test/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /CoreOS/libgcrypt/Sanity/smoke-test +Description: Test calls upstream test suite. +Author: Ondrej Moris diff --git a/tests/fipscheck-smoke-test/runtest.sh b/tests/fipscheck-smoke-test/runtest.sh new file mode 100755 index 0000000..dd1803d --- /dev/null +++ b/tests/fipscheck-smoke-test/runtest.sh @@ -0,0 +1,71 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/libgcrypt/smoke-test +# Description: Test calls upstream test suite. +# Author: Ondrej Moris +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2010 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include rhts environment +#. /usr/bin/rhts-environment.sh +. /usr/share/beakerlib/beakerlib.sh + +PACKAGE="libgcrypt" + +rlJournalStart + + rlPhaseStartSetup + TmpDir=`mktemp -d` + rlAssertRpm $PACKAGE + rlFileBackup --clean "/etc/gcrypt/fips_enabled" + rlRun "pushd $TmpDir" 0 + rlFetchSrcForInstalled $PACKAGE + rlRun "rpm -ihv `ls *.rpm`" 0 + if grep '1' /proc/sys/crypto/fips_enabled; then + rlRun "echo '1' > /etc/gcrypt/fips_enabled" 0 + fi + rlPhaseEnd + + rlPhaseStartTest + TOPDIR=`rpm --eval %_topdir` + rlRun "pushd $TOPDIR" 0 + rlRun "rm -rf BUILD/libgcrypt-*" 0-255 + rlRun "rpmbuild -vv -bc SPECS/libgcrypt.spec" 0 + rlRun "pushd BUILD/libgcrypt-*" 0 + rlRun "fipshmac src/.libs/libgcrypt.so.??" 0 + rlRun "make check > $TmpDir/make_check.out" 0 + rlRun "popd" 0 + rlRun "popd" 0 + rlRun "grep \"All [0-9]\+ tests passed\" $TmpDir/make_check.out" 0 \ + "All tests passed" + rlRun "cat $TmpDir/make_check.out" 0 + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" 0 + rlRun "rm -r $TmpDir" 0 + rlFileRestore + rlPhaseEnd + +rlJournalPrintText +rlJournalEnd diff --git a/tests/main.fmf b/tests/main.fmf deleted file mode 100644 index 4b6064e..0000000 --- a/tests/main.fmf +++ /dev/null @@ -1,29 +0,0 @@ -component: libkcapi -contact: Ondrej Mosnacek - -/upstream: - require: [libkcapi-tests] - tier: 1 - - /basic: - summary: Basic functionality - test: /usr/libexec/libkcapi/test.sh - /encrypt: - summary: Encryption/decryption - test: /usr/libexec/libkcapi/kcapi-enc-test.sh - /encrypt-large: - summary: Encryption/decryption of large data - test: /usr/libexec/libkcapi/kcapi-enc-test-large.sh - /digest: - summary: Message digest - test: /usr/libexec/libkcapi/kcapi-dgst-test.sh - /digest-convenience: - summary: Message digest convenience functions - test: /usr/libexec/libkcapi/kcapi-convenience.sh - /hasher: - summary: Checksum helpers - test: /usr/libexec/libkcapi/hasher-test.sh - /fuzz-test: - summary: Fuzz test - test: /usr/libexec/libkcapi/kcapi-fuzz-test.sh - duration: 2h diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..1a0db89 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,45 @@ +- hosts: localhost + tags: + - classic + - container + roles: + - role: standard-test-basic + required_packages: + - libkcapi-tests + tests: + - upstream-basic-test: + run: /usr/libexec/libkcapi/test.sh + - upstream-enc-test: + run: /usr/libexec/libkcapi/kcapi-enc-test.sh + - upstream-enc-test-large: + run: /usr/libexec/libkcapi/kcapi-enc-test-large.sh + - upstream-dgst-test: + run: /usr/libexec/libkcapi/kcapi-dgst-test.sh + - upstream-hasher-test: + run: /usr/libexec/libkcapi/hasher-test.sh + - upstream-convenience-test: + run: /usr/libexec/libkcapi/kcapi-convenience.sh + - upstream-fuzz-test: + run: /usr/libexec/libkcapi/kcapi-fuzz-test.sh + +- hosts: localhost + tags: + - classic + - container + roles: + - role: standard-test-beakerlib + required_packages: + - fipscheck + - gawk + - gcc-c++ + - libgcrypt + - libgpg-error-devel + - libselinux-utils + - libtool + - nfs-utils + - pkgconfig + - rpm-build + - texinfo + - wget + tests: + - fipscheck-smoke-test