Merge #10 Add . prefix to files created by fipshmac if -d option is not specified

This commit is contained in:
Sahana Prasad 2020-04-23 13:44:44 +00:00
commit bb0939a388
2 changed files with 35 additions and 1 deletions

30
110-fipshmac-compat.patch Normal file
View File

@ -0,0 +1,30 @@
diff -up libkcapi-1.1.5/apps/kcapi-hasher.c.fipshmac-compat libkcapi-1.1.5/apps/kcapi-hasher.c
--- libkcapi-1.1.5/apps/kcapi-hasher.c.fipshmac-compat 2019-01-23 07:14:51.000000000 +0100
+++ libkcapi-1.1.5/apps/kcapi-hasher.c 2020-04-23 14:37:59.518173594 +0200
@@ -386,10 +386,16 @@ static char *paste(char *dst, const char
static char *get_hmac_file(const char *filename, const char *checkdir)
{
size_t i, filelen, pathlen, namelen, basenamestart = 0;
- size_t prefixlen = strlen(CHECK_PREFIX);
+ const char *check_prefix = CHECK_PREFIX;
+ size_t prefixlen = strlen(check_prefix);
size_t suffixlen = strlen(CHECK_SUFFIX);
char *cursor, *checkfile = NULL;
+ if (prefixlen == 0 && checkdir == NULL) {
+ check_prefix = ".";
+ prefixlen = 1;
+ }
+
filelen = strlen(filename);
if (filelen > 4096) {
fprintf(stderr, "File too long\n");
@@ -415,7 +421,7 @@ static char *get_hmac_file(const char *f
} else if (pathlen > 0)
cursor = paste(cursor, filename, pathlen);
- cursor = paste(cursor, CHECK_PREFIX, prefixlen);
+ cursor = paste(cursor, check_prefix, prefixlen);
cursor = paste(cursor, filename + basenamestart, namelen);
cursor = paste(cursor, "."CHECK_SUFFIX, 1 + suffixlen);
strncpy(cursor, "\0", 1);

View File

@ -101,7 +101,7 @@ bin/kcapi-hasher -n fipshmac -d "$lib_path"/fipscheck \\\
Name: libkcapi Name: libkcapi
Version: %{vmajor}.%{vminor}.%{vpatch} Version: %{vmajor}.%{vminor}.%{vpatch}
Release: 3%{?dist} Release: 4%{?dist}
Summary: User space interface to the Linux Kernel Crypto API Summary: User space interface to the Linux Kernel Crypto API
License: BSD or GPLv2 License: BSD or GPLv2
@ -110,6 +110,7 @@ Source0: http://www.chronox.de/%{name}/%{name}-%{version}.tar.xz
Source1: http://www.chronox.de/%{name}/%{name}-%{version}.tar.xz.asc Source1: http://www.chronox.de/%{name}/%{name}-%{version}.tar.xz.asc
Patch100: 100-workaround-cppcheck-bug.patch Patch100: 100-workaround-cppcheck-bug.patch
Patch110: 110-fipshmac-compat.patch
BuildRequires: clang BuildRequires: clang
BuildRequires: coreutils BuildRequires: coreutils
@ -453,6 +454,9 @@ popd
%changelog %changelog
* Thu Apr 23 2020 Tomáš Mráz <tmraz@redhat.com> - 1.1.5-4
- Add . prefix to files created by fipshmac if -d option is not specified
* Wed Apr 22 2020 Sahana Prasad <sahana@redhat.com> - 1.1.5-3 * Wed Apr 22 2020 Sahana Prasad <sahana@redhat.com> - 1.1.5-3
- Disables kcapi-enc tests until the kernel bug bz 1826022 is fixed. - Disables kcapi-enc tests until the kernel bug bz 1826022 is fixed.
- Produce also the fipscheck replacement package - Produce also the fipscheck replacement package