From 3d265a417fd7ca80965e0cf6a0ec7785bdbfedb2 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 12 Jul 2021 07:54:35 -0400 Subject: [PATCH] Update to new upstream release 1.3.0 Include 2 upstream patches to fix build issues with i686 and issues with s390x builds. Resolves: #rhbz1981316 --- 001-fix-fuzz-test.patch | 37 ------------ 001-libkcapi-1.3.0-32bit-werror.patch | 83 +++++++++++++++++++++++++++ 002-libkcapi-1.3.0-s390-types.patch | 47 +++++++++++++++ libkcapi.spec | 13 +++-- sources | 4 +- 5 files changed, 141 insertions(+), 43 deletions(-) delete mode 100644 001-fix-fuzz-test.patch create mode 100644 001-libkcapi-1.3.0-32bit-werror.patch create mode 100644 002-libkcapi-1.3.0-s390-types.patch diff --git a/001-fix-fuzz-test.patch b/001-fix-fuzz-test.patch deleted file mode 100644 index c1fdbc5..0000000 --- a/001-fix-fuzz-test.patch +++ /dev/null @@ -1,37 +0,0 @@ -From e8c22fe01c6dd46399396694cd1d72a6988dc287 Mon Sep 17 00:00:00 2001 -From: Ondrej Mosnacek -Date: Sat, 27 Mar 2021 13:46:45 +0100 -Subject: [PATCH] kcapi: Fix hang in fuzz tests with recent kernels - -After kernel commit f3c802a1f300 ("crypto: algif_aead - Only wake up -when..."), the fuzz tests hang indefinitely, because they request more -output data than the operation can produce. Fix this by requesting at -most the expected size of the output data. - -Signed-off-by: Ondrej Mosnacek ---- - test/kcapi-main.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/test/kcapi-main.c b/test/kcapi-main.c -index 64e466c..975e8d1 100644 ---- a/test/kcapi-main.c -+++ b/test/kcapi-main.c -@@ -380,7 +380,7 @@ static int fuzz_cipher(struct kcapi_cavs *cavs_test, unsigned long flags, - } - - for (i = 0; i < sizeof(indata); i++) { -- unsigned int outlen = sizeof(outdata); -+ unsigned int outlen = i; - uint8_t *out = outdata; - uint8_t *iv = indata; - uint8_t *in = indata; -@@ -474,7 +474,7 @@ static int fuzz_aead(struct kcapi_cavs *cavs_test, unsigned long flags, - } - - for (i = 0; i < sizeof(indata); i++) { -- unsigned int outlen = sizeof(outdata); -+ unsigned int outlen = i; - uint8_t *out = outdata; - uint8_t *iv = indata; - uint8_t *in = indata; diff --git a/001-libkcapi-1.3.0-32bit-werror.patch b/001-libkcapi-1.3.0-32bit-werror.patch new file mode 100644 index 0000000..ef2b0b2 --- /dev/null +++ b/001-libkcapi-1.3.0-32bit-werror.patch @@ -0,0 +1,83 @@ +From 299e5e8c38de9be99b86885c1af60dd5e1cc9888 Mon Sep 17 00:00:00 2001 +From: Ondrej Mosnacek +Date: Mon, 17 May 2021 22:19:32 +0200 +Subject: [PATCH] docproc: fix -Wconversion warnings on 32-bit + +On i686, GCC 11.1.1 complains: +``` +lib/doc/bin/docproc.c: In function 'find_all_symbols': +lib/doc/bin/docproc.c:433:17: error: conversion to 'ssize_t' {aka 'int'} from 'unsigned int' may change the sign of the result [-Werror=sign-conversion] + 433 | start = all_list_len; + | ^~~~~~~~~~~~ +lib/doc/bin/docproc.c:441:48: error: comparison of integer expressions of different signedness: 'ssize_t' {aka 'int'} and 'unsigned int' [-Werror=sign-compare] + 441 | for (i = 0; i < (int)data_len && start != all_list_len; i++) { + | ^~ +cc1: all warnings being treated as errors +``` + +Fix this by declaring all of all_list_len, i, count, and start as +size_t and remove a few casts that are no longer necessary. + +Signed-off-by: Ondrej Mosnacek +Signed-off-by: Stephan Mueller +--- + lib/doc/bin/docproc.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/lib/doc/bin/docproc.c b/lib/doc/bin/docproc.c +index 556d5d4..74b3cdb 100644 +--- a/lib/doc/bin/docproc.c ++++ b/lib/doc/bin/docproc.c +@@ -77,11 +77,11 @@ FILELINE * docsection; + static char *srctree, *kernsrctree; + + static char **all_list = NULL; +-static unsigned int all_list_len = 0; ++static size_t all_list_len = 0; + + static void consume_symbol(const char *sym) + { +- unsigned int i; ++ size_t i; + + for (i = 0; i < all_list_len; i++) { + if (!all_list[i]) +@@ -361,11 +361,11 @@ static void find_all_symbols(char *filename) + { + char *vec[4]; /* kerneldoc -list file NULL */ + pid_t pid; +- ssize_t ret, i, count, start; ++ ssize_t ret; + char real_filename[PATH_MAX + 1]; + int pipefd[2]; + char *data, *str; +- size_t data_len = 0; ++ size_t i, count, start, data_len = 0; + + vec[0] = KERNELDOC; + vec[1] = LIST; +@@ -424,21 +424,21 @@ static void find_all_symbols(char *filename) + + count = 0; + /* poor man's strtok, but with counting */ +- for (i = 0; i < (int)data_len; i++) { ++ for (i = 0; i < data_len; i++) { + if (data[i] == '\n') { + count++; + data[i] = '\0'; + } + } + start = all_list_len; +- all_list_len += (unsigned int)count; ++ all_list_len += count; + all_list = realloc(all_list, sizeof(char *) * all_list_len); + if (!all_list) { + perror("realloc"); + exit(1); + } + str = data; +- for (i = 0; i < (int)data_len && start != all_list_len; i++) { ++ for (i = 0; i < data_len && start != all_list_len; i++) { + if (data[i] == '\0') { + all_list[start] = str; + str = data + i + 1; diff --git a/002-libkcapi-1.3.0-s390-types.patch b/002-libkcapi-1.3.0-s390-types.patch new file mode 100644 index 0000000..552de91 --- /dev/null +++ b/002-libkcapi-1.3.0-s390-types.patch @@ -0,0 +1,47 @@ +From 00603fbe01de879eb1bd49a4475b0e619f4bb3b0 Mon Sep 17 00:00:00 2001 +From: Ondrej Mosnacek +Date: Tue, 18 May 2021 15:03:17 +0200 +Subject: [PATCH] Fix bad types in _kcapi_common_send_meta() + +The types for 'type' and 'assoclen' variables need to match the kernel +ABI, so they can't be changed to size_t. On most arches it is by chance +still working, but on s390x usign size_t here makes almost all tests +fail. Change the variables back to uint32_t pointers to fix this. + +Signed-off-by: Ondrej Mosnacek +Signed-off-by: Stephan Mueller +--- + lib/kcapi-kernel-if.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/lib/kcapi-kernel-if.c b/lib/kcapi-kernel-if.c +index a92e2f7..4968a8a 100644 +--- a/lib/kcapi-kernel-if.c ++++ b/lib/kcapi-kernel-if.c +@@ -125,7 +125,7 @@ ssize_t _kcapi_common_send_meta(struct kcapi_handle *handle, + + /* plaintext / ciphertext data */ + struct cmsghdr *header = NULL; +- size_t *type = NULL; ++ uint32_t *type = NULL; + struct msghdr msg; + + /* IV data */ +@@ -135,7 +135,7 @@ ssize_t _kcapi_common_send_meta(struct kcapi_handle *handle, + 0; + + /* AEAD data */ +- size_t *assoclen = NULL; ++ uint32_t *assoclen = NULL; + size_t assoc_msg_size = handle->aead.assoclen ? + CMSG_SPACE(sizeof(*assoclen)) : 0; + +@@ -205,7 +205,7 @@ ssize_t _kcapi_common_send_meta(struct kcapi_handle *handle, + header->cmsg_type = ALG_SET_AEAD_ASSOCLEN; + header->cmsg_len = CMSG_LEN(sizeof(*assoclen)); + assoclen = (void*)CMSG_DATA(header); +- *assoclen = handle->aead.assoclen; ++ *assoclen = (uint32_t)handle->aead.assoclen; + } + + ret = sendmsg(*_kcapi_get_opfd(handle), &msg, (int)flags); diff --git a/libkcapi.spec b/libkcapi.spec index cc7f59e..f90a46f 100644 --- a/libkcapi.spec +++ b/libkcapi.spec @@ -1,7 +1,7 @@ # Shared object version of libkcapi. %global vmajor 1 -%global vminor 2 -%global vpatch 1 +%global vminor 3 +%global vpatch 0 # Do we build the replacements packages? %bcond_with replace_coreutils @@ -125,7 +125,7 @@ done \ Name: libkcapi Version: %{vmajor}.%{vminor}.%{vpatch} -Release: 3%{?dist} +Release: 1%{?dist} Summary: User space interface to the Linux Kernel Crypto API License: BSD or GPLv2 @@ -135,7 +135,9 @@ Source1: https://www.chronox.de/%{name}/%{name}-%{version}.tar.xz.asc Source2: sha512hmac-openssl.sh Source3: fipshmac-openssl.sh -Patch001: %{giturl}/pull/110.patch#/001-fix-fuzz-test.patch +Patch1: 001-libkcapi-1.3.0-32bit-werror.patch +Patch2: 002-libkcapi-1.3.0-s390-types.patch + BuildRequires: bash BuildRequires: coreutils @@ -512,6 +514,9 @@ popd %changelog +* Mon Jul 12 2021 Simo Sorce - 1.3.0-1 +- Update to new upstream release 1.3.0 + * Tue Jun 22 2021 Mohan Boddu - 1.2.1-3 - Rebuilt for RHEL 9 BETA for openssl 3.0 Related: rhbz#1971065 diff --git a/sources b/sources index 8e514ec..613d2f6 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (libkcapi-1.2.1.tar.xz) = bfe5e4fa4368973cfcadbde3b2a278e31bc5c36a6afba9fc92fdd5903e4e8050d09000a195c764c981753896ef543635add98bbb930dbe52a56d2f6318bc1241 -SHA512 (libkcapi-1.2.1.tar.xz.asc) = f2823add4528e16c45ccb59e2124da29007b0285faed5194fe5969f4928411faa63b3b6586bd103085b666a4dfb977cfdf0d20db6588d426ab92e29e360a37e7 +SHA512 (libkcapi-1.3.0.tar.xz) = 3b6fbf9b6651dec870c9181709c8e7d7882d4967fe1c4d53a59cc428fcf83e2ec1f56f09406d8918f145beb417dffbfdf4719c2c61631d8008bb049970323ed0 +SHA512 (libkcapi-1.3.0.tar.xz.asc) = 9b89ea6743e43727bc9e003bb617970f4ab389b3d740a16105ca6eeff2a3485a56664aecf957c5e30fb54f5dfa44fc0cc015dd4e9b518b16db2fad55e8cba69c