Add patch to fix AEAD fuzz test for BE arches

This commit is contained in:
Ondrej Mosnacek 2018-07-27 11:53:06 +02:00
parent e55cfcddec
commit e542872a71
2 changed files with 45 additions and 1 deletions

View File

@ -0,0 +1,42 @@
From def2282fd28390f4a8afd0f43be6c3b3b1586f41 Mon Sep 17 00:00:00 2001
From: Ondrej Mosnacek <omosnace@redhat.com>
Date: Fri, 27 Jul 2018 10:53:00 +0200
Subject: [PATCH] test: Fix AEAD fuzz test for big-endian archs
The stupid authenc() key format contains fields that need to be in the
machine's endianity. Right now, they are hard-coded in the LE format.
This patch makes them always be in the right format.
---
test/kcapi-main.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/test/kcapi-main.c b/test/kcapi-main.c
index e24956c..d62c91a 100644
--- a/test/kcapi-main.c
+++ b/test/kcapi-main.c
@@ -451,14 +451,17 @@ static int fuzz_aead(struct kcapi_cavs *cavs_test, unsigned long flags,
if (kcapi_aead_setkey(handle, key, 16)) {
if (!strncmp(cavs_test->cipher, "authenc", 7)) {
- uint8_t *k = (uint8_t *)
- "\x08\x00\x01\x00\x00\x00\x00\x10"
- "\x00\x00\x00\x00\x00\x00\x00\x00"
- "\x00\x00\x00\x00\x00\x00\x00\x00"
- "\x00\x00\x00\x00\x06\xa9\x21\x40"
- "\x36\xb8\xa1\x5b\x51\x2e\x03\xd5"
- "\x34\x12\x00\x06";
- if (kcapi_aead_setkey(handle, k, 44)) {
+ uint8_t k[44];
+ memcpy(k, "\x00\x00\x00\x00\x00\x00\x00\x10"
+ "\x00\x00\x00\x00\x00\x00\x00\x00"
+ "\x00\x00\x00\x00\x00\x00\x00\x00"
+ "\x00\x00\x00\x00\x06\xa9\x21\x40"
+ "\x36\xb8\xa1\x5b\x51\x2e\x03\xd5"
+ "\x34\x12\x00\x06", sizeof(k));
+ /* These need to be in machine's endianity: */
+ *(uint16_t *)(k + 0) = 8;
+ *(uint16_t *)(k + 2) = 1;
+ if (kcapi_aead_setkey(handle, k, sizeof(k))) {
printf("AEAD setkey failed\n");
goto out;
}

View File

@ -92,7 +92,7 @@ bin/kcapi-hasher -n fipshmac -d "$lib_path"/fipscheck \\\
Name: libkcapi Name: libkcapi
Version: %{vmajor}.%{vminor}.%{vpatch} Version: %{vmajor}.%{vminor}.%{vpatch}
Release: 8%{?dist} Release: 8.fuzztestfix%{?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
@ -107,6 +107,7 @@ Patch3: %{giturl}/commit/3e388ac4eba63b466bf6b14b2088ea44c8a2bfe4.patch#
Patch4: %{giturl}/commit/a10e5ff7f8f69e1ed5cd4151f3e71f4783c40c68.patch#/%{name}-1.1.1-test_Be_sure_to_terminate_strncpy_copied_string.patch Patch4: %{giturl}/commit/a10e5ff7f8f69e1ed5cd4151f3e71f4783c40c68.patch#/%{name}-1.1.1-test_Be_sure_to_terminate_strncpy_copied_string.patch
Patch5: %{giturl}/compare/decf850ab9bb...ec9c36216623.patch#/%{name}-1.1.1-Fix_various_issues_reported_by_Coverity.patch Patch5: %{giturl}/compare/decf850ab9bb...ec9c36216623.patch#/%{name}-1.1.1-Fix_various_issues_reported_by_Coverity.patch
Patch6: %{giturl}/compare/4a1a30f75e70...c9ed6b2c0702.patch#/%{name}-1.1.1-Coverity_PR_follow-up.patch Patch6: %{giturl}/compare/4a1a30f75e70...c9ed6b2c0702.patch#/%{name}-1.1.1-Coverity_PR_follow-up.patch
Patch7: %{giturl}/pull/68.patch#/%{name}-1.1.1-test_Fix_AEAD_fuzz_test_for_big-endian_archs.patch
# Workaround for failing builds on rawhide (F29). # Workaround for failing builds on rawhide (F29).
# To be removed when this issue is patched in the kernel: # To be removed when this issue is patched in the kernel:
@ -427,6 +428,7 @@ popd
%changelog %changelog
* Fri Jul 27 2018 Ondrej Mosnáček <omosnace@redhat.com> - 1.1.1-8 * Fri Jul 27 2018 Ondrej Mosnáček <omosnace@redhat.com> - 1.1.1-8
- Add more Coverity fixes from upstream - Add more Coverity fixes from upstream
- Add patch to fix AEAD fuzz test for BE arches
* Mon Jul 23 2018 Ondrej Mosnáček <omosnace@redhat.com> - 1.1.1-7 * Mon Jul 23 2018 Ondrej Mosnáček <omosnace@redhat.com> - 1.1.1-7
- Add various fixes from upstream - Add various fixes from upstream