Blame SOURCES/0005-luks-Disable-filter-with-old-GnuTLS-in-Debian-10.patch

3cdd4c
From 66daae1a7daf680e06f884e9af6a14830263c932 Mon Sep 17 00:00:00 2001
3cdd4c
From: "Richard W.M. Jones" <rjones@redhat.com>
3cdd4c
Date: Sun, 8 May 2022 12:13:39 +0100
3cdd4c
Subject: [PATCH] luks: Disable filter with old GnuTLS in Debian 10
3cdd4c
MIME-Version: 1.0
3cdd4c
Content-Type: text/plain; charset=UTF-8
3cdd4c
Content-Transfer-Encoding: 8bit
3cdd4c
3cdd4c
On Debian 10:
3cdd4c
3cdd4c
luks.c: In function ‘parse_cipher_strings’:
3cdd4c
luks.c:574:26: error: ‘GNUTLS_CIPHER_AES_128_XTS’ undeclared (first use in this function); did you mean ‘GNUTLS_CIPHER_AES_128_CCM’?
3cdd4c
       h->gnutls_cipher = GNUTLS_CIPHER_AES_128_XTS;
3cdd4c
                          ^~~~~~~~~~~~~~~~~~~~~~~~~
3cdd4c
                          GNUTLS_CIPHER_AES_128_CCM
3cdd4c
luks.c:574:26: note: each undeclared identifier is reported only once for each function it appears in
3cdd4c
luks.c:577:26: error: ‘GNUTLS_CIPHER_AES_256_XTS’ undeclared (first use in this function); did you mean ‘GNUTLS_CIPHER_AES_256_CCM’?
3cdd4c
       h->gnutls_cipher = GNUTLS_CIPHER_AES_256_XTS;
3cdd4c
                          ^~~~~~~~~~~~~~~~~~~~~~~~~
3cdd4c
                          GNUTLS_CIPHER_AES_256_CCM
3cdd4c
luks.c: In function ‘try_passphrase_in_keyslot’:
3cdd4c
luks.c:728:7: error: implicit declaration of function ‘gnutls_pbkdf2’; did you mean ‘gnutls_prf’? [-Werror=implicit-function-declaration]
3cdd4c
   r = gnutls_pbkdf2 (h->hash_alg, &key, &salt, ks->password_iterations,
3cdd4c
       ^~~~~~~~~~~~~
3cdd4c
       gnutls_prf
3cdd4c
3cdd4c
Because gnutls_pbkdf2 is missing there's no chance of making this
3cdd4c
filter work on this platform so it's best to compile it out.
3cdd4c
3cdd4c
Fixes: commit 468919dce6c5eb57503eacac0f67e5dd87c58e6c
3cdd4c
(cherry picked from commit f9f67e483f4aad19ad6101163d32562f13504ca7)
3cdd4c
---
3cdd4c
 configure.ac             | 5 ++++-
3cdd4c
 filters/luks/Makefile.am | 2 +-
3cdd4c
 tests/Makefile.am        | 2 +-
3cdd4c
 3 files changed, 6 insertions(+), 3 deletions(-)
3cdd4c
3cdd4c
diff --git a/configure.ac b/configure.ac
3cdd4c
index de85b4da..1d209f67 100644
3cdd4c
--- a/configure.ac
3cdd4c
+++ b/configure.ac
3cdd4c
@@ -636,12 +636,15 @@ AS_IF([test "x$GNUTLS_LIBS" != "x"],[
3cdd4c
         gnutls_certificate_set_known_dh_params \
3cdd4c
         gnutls_group_get \
3cdd4c
         gnutls_group_get_name \
3cdd4c
+        gnutls_pbkdf2 \
3cdd4c
         gnutls_session_set_verify_cert \
3cdd4c
         gnutls_srp_server_get_username \
3cdd4c
         gnutls_transport_is_ktls_enabled \
3cdd4c
     ])
3cdd4c
     LIBS="$old_LIBS"
3cdd4c
 ])
3cdd4c
+AM_CONDITIONAL([HAVE_GNUTLS_PBKDF2],
3cdd4c
+    [test "x$GNUTLS_LIBS" != "x" && test "x$ac_cv_func_gnutls_pbkdf2" = xyes])
3cdd4c
 
3cdd4c
 AC_ARG_ENABLE([linuxdisk],
3cdd4c
     [AS_HELP_STRING([--disable-linuxdisk],
3cdd4c
@@ -1484,7 +1487,7 @@ echo "Optional filters:"
3cdd4c
 echo
3cdd4c
 feature "ext2"                test "x$HAVE_EXT2_TRUE" = "x"
3cdd4c
 feature "gzip"                test "x$HAVE_ZLIB_TRUE" = "x"
3cdd4c
-feature "LUKS"                test "x$HAVE_GNUTLS_TRUE" != "x"
3cdd4c
+feature "luks"                test "x$HAVE_GNUTLS_PBKDF2_TRUE" = "x"
3cdd4c
 feature "xz"                  test "x$HAVE_LIBLZMA_TRUE" = "x"
3cdd4c
 
3cdd4c
 echo
3cdd4c
diff --git a/filters/luks/Makefile.am b/filters/luks/Makefile.am
3cdd4c
index 30089621..622e5c3d 100644
3cdd4c
--- a/filters/luks/Makefile.am
3cdd4c
+++ b/filters/luks/Makefile.am
3cdd4c
@@ -33,7 +33,7 @@ include $(top_srcdir)/common-rules.mk
3cdd4c
 
3cdd4c
 EXTRA_DIST = nbdkit-luks-filter.pod
3cdd4c
 
3cdd4c
-if HAVE_GNUTLS
3cdd4c
+if HAVE_GNUTLS_PBKDF2
3cdd4c
 
3cdd4c
 filter_LTLIBRARIES = nbdkit-luks-filter.la
3cdd4c
 
3cdd4c
diff --git a/tests/Makefile.am b/tests/Makefile.am
3cdd4c
index c29453ba..5585b3b7 100644
3cdd4c
--- a/tests/Makefile.am
3cdd4c
+++ b/tests/Makefile.am
3cdd4c
@@ -1597,7 +1597,7 @@ EXTRA_DIST += \
3cdd4c
 	$(NULL)
3cdd4c
 
3cdd4c
 # luks filter test.
3cdd4c
-if HAVE_GNUTLS
3cdd4c
+if HAVE_GNUTLS_PBKDF2
3cdd4c
 TESTS += \
3cdd4c
 	test-luks-info.sh \
3cdd4c
 	test-luks-copy.sh \
3cdd4c
-- 
3cdd4c
2.31.1
3cdd4c