Adds patches fixing the pinned thread keyring issue. Reinstate skipped gating tests due to missing crypto-check test utility. - Resolves: RHEL-193162
97 lines
2.7 KiB
Diff
97 lines
2.7 KiB
Diff
diff -rupN cryptsetup-2.8.6.old/tests/crypto-check.c cryptsetup-2.8.6/tests/crypto-check.c
|
|
--- cryptsetup-2.8.6.old/tests/crypto-check.c 2026-07-31 11:20:10.870518467 +0200
|
|
+++ cryptsetup-2.8.6/tests/crypto-check.c 2026-07-31 11:24:10.808822709 +0200
|
|
@@ -6,10 +6,31 @@
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
+#include <stdbool.h>
|
|
#include <stdlib.h>
|
|
+#include <string.h>
|
|
#include <unistd.h>
|
|
#include <fcntl.h>
|
|
|
|
+static bool fips_mode(void)
|
|
+{
|
|
+ int fd;
|
|
+ char buf = 0;
|
|
+
|
|
+ fd = open("/proc/sys/crypto/fips_enabled", O_RDONLY);
|
|
+
|
|
+ if (fd < 0)
|
|
+ return false;
|
|
+
|
|
+ if (read(fd, &buf, 1) != 1)
|
|
+ buf = '0';
|
|
+
|
|
+ close(fd);
|
|
+
|
|
+ return (buf == '1');
|
|
+}
|
|
+
|
|
+#ifndef NO_CRYPT_BACKEND
|
|
#include "crypto_backend/crypto_backend.h"
|
|
|
|
static bool fips_mode(void)
|
|
@@ -64,6 +85,33 @@ static int check_hash(const char *hash)
|
|
crypt_hash_destroy(h);
|
|
return EXIT_SUCCESS;
|
|
}
|
|
+#else /* NO_CRYPT_BACKEND */
|
|
+static int crypt_backend_init(bool fips_mode __attribute__((unused))) { return 0; };
|
|
+static void crypt_backend_destroy(void) {};
|
|
+static const char *crypt_backend_version(void) { return "none"; };
|
|
+
|
|
+static int check_cipher(const char *alg, const char *mode, unsigned long key_bits)
|
|
+{
|
|
+ if (strcmp(alg, "aes"))
|
|
+ return EXIT_FAILURE;
|
|
+
|
|
+ if (!strcmp(mode, "cbc") && (key_bits == 128 || key_bits == 256))
|
|
+ return EXIT_SUCCESS;
|
|
+
|
|
+ if (!strcmp(mode, "xts") && (key_bits == 256 || key_bits == 512))
|
|
+ return EXIT_SUCCESS;
|
|
+
|
|
+ return EXIT_FAILURE;
|
|
+}
|
|
+
|
|
+static int check_hash(const char *hash)
|
|
+{
|
|
+ if (!strcmp(hash, "sha512") || !strcmp(hash, "sha256") || !strcmp(hash, "sha1"))
|
|
+ return EXIT_SUCCESS;
|
|
+
|
|
+ return EXIT_FAILURE;
|
|
+}
|
|
+#endif
|
|
|
|
static void __attribute__((noreturn)) exit_help(bool destroy_backend)
|
|
{
|
|
diff -rupN cryptsetup-2.8.6.old/tests/Makefile.localtest cryptsetup-2.8.6/tests/Makefile.localtest
|
|
--- cryptsetup-2.8.6.old/tests/Makefile.localtest 2026-07-31 11:20:10.844518216 +0200
|
|
+++ cryptsetup-2.8.6/tests/Makefile.localtest 2026-07-31 11:20:37.834945118 +0200
|
|
@@ -4,11 +4,11 @@
|
|
# (append TESTSUITE_NOSKIP=y to avoid treating skipped tests as success)
|
|
#
|
|
CPPFLAGS=-I../lib/ -I../lib/luks1 -DHAVE_DECL_DM_TASK_RETRY_REMOVE -DKERNEL_KEYRING \
|
|
- -DHAVE_SYS_SYSMACROS_H -DNO_CRYPTSETUP_PATH
|
|
+ -DHAVE_SYS_SYSMACROS_H -DNO_CRYPTSETUP_PATH -DNO_CRYPT_BACKEND
|
|
CFLAGS=-O2 -g -Wall -D_GNU_SOURCE
|
|
LDLIBS=-lcryptsetup -ldevmapper
|
|
TESTS=$(wildcard *-test *-test2) api-test api-test-2 all-symbols-test unit-utils-crypt-test
|
|
-TESTS_UTILS=differ unit-utils-io unit-wipe
|
|
+TESTS_UTILS=differ unit-utils-io unit-wipe crypto-check
|
|
|
|
ifneq ($(RUN_SSH_PLUGIN_TEST),)
|
|
TESTS += ssh-test-plugin
|
|
@@ -24,6 +24,9 @@ check-programs: $(TESTS_UTILS) $(TESTS)
|
|
differ: differ.o
|
|
$(CC) -o $@ $^
|
|
|
|
+crypto-check: crypto-check.o
|
|
+ $(CC) -o $@ $^
|
|
+
|
|
api-test: api-test.o test_utils.o
|
|
$(CC) -o $@ $^ $(LDLIBS)
|
|
|