diff --git a/libkcapi-1.1.1-kcapi-hasher_Fix_command-line_parsing.patch b/libkcapi-1.1.1-kcapi-hasher_Fix_command-line_parsing.patch new file mode 100644 index 0000000..e22a1f5 --- /dev/null +++ b/libkcapi-1.1.1-kcapi-hasher_Fix_command-line_parsing.patch @@ -0,0 +1,34 @@ +From 912ab6d55ef5af594d22d01a39cf7e035c797335 Mon Sep 17 00:00:00 2001 +From: Ondrej Mosnacek +Date: Wed, 11 Jul 2018 09:42:26 +0200 +Subject: [PATCH] kcapi-hasher: Fix command-line parsing + +I made a mistake in commit 3be3e18d4a2e ("kcapi-hasher: Allow picking +basename via cmdline"), which apparently broke command-line parsing when +the '-n' options is not used. This patch fixes the issue by resetting +the right variable and also silences error messages when checking for +the '-n' option. + +Fedora BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1599831 +--- + apps/kcapi-hasher.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/apps/kcapi-hasher.c b/apps/kcapi-hasher.c +index ae88211..90707a6 100644 +--- a/apps/kcapi-hasher.c ++++ b/apps/kcapi-hasher.c +@@ -841,10 +841,12 @@ int main(int argc, char *argv[]) + } + basen = basename(basec); + ++ opterr = 0; + if (getopt_long(argc, argv, opts_name_short, opts_name, &opt_index) == 'n') + basen = optarg; + else +- opt_index = 0; ++ optind = 1; ++ opterr = 1; + + params_self = &PARAMS_SELF_FIPSCHECK; + if (0 == strncmp(basen, "sha256sum", 9)) { diff --git a/libkcapi.spec b/libkcapi.spec index c46b46f..83995f1 100644 --- a/libkcapi.spec +++ b/libkcapi.spec @@ -91,7 +91,7 @@ bin/kcapi-hasher -n fipshmac "$lib_path"/libkcapi.so.%{version} \\\ Name: libkcapi Version: %{vmajor}.%{vminor}.%{vpatch} -Release: 1%{?dist} +Release: 2%{?dist} Summary: User space interface to the Linux Kernel Crypto API License: BSD or GPLv2 @@ -99,6 +99,8 @@ URL: http://www.chronox.de/%{name}.html Source0: http://www.chronox.de/%{name}/%{name}-%{version}.tar.xz Source1: http://www.chronox.de/%{name}/%{name}-%{version}.tar.xz.asc +Patch0: %{giturl}/pull/60.patch#/%{name}-1.1.1-kcapi-hasher_Fix_command-line_parsing.patch + BuildRequires: clang BuildRequires: coreutils BuildRequires: cppcheck @@ -416,6 +418,9 @@ popd %changelog +* Mon Jun 18 2018 Ondrej Mosnáček - 1.1.1-2 +- Fix command-line parsing in libkcapi-hmaccalc + * Mon Jun 18 2018 Ondrej Mosnáček - 1.1.1-1 - Update to upstream version 1.1.1