Blame SOURCES/0004-luks-explicitly-specify-pbkdf-iterations-to-cryptset.patch

46b693
From 76ad9b21b61627a728bc9499821cf8e09446725d Mon Sep 17 00:00:00 2001
46b693
From: =?UTF-8?q?Renaud=20M=C3=A9trich?= <rmetrich@redhat.com>
46b693
Date: Thu, 21 Oct 2021 13:58:52 +0200
46b693
Subject: [PATCH 4/4] luks: explicitly specify pbkdf iterations to cryptsetup
46b693
46b693
This fixes an Out of memory error when the system has not much memory,
46b693
such as a VM configured with 2GB currently being installed through the
46b693
network (hence having ~1GB free memory only).
46b693
See RHBZ #1979256 (https://bugzilla.redhat.com/show_bug.cgi?id=1979256).
46b693
---
46b693
 src/luks/clevis-luks-common-functions.in | 7 ++++++-
46b693
 1 file changed, 6 insertions(+), 1 deletion(-)
46b693
46b693
diff --git a/src/luks/clevis-luks-common-functions.in b/src/luks/clevis-luks-common-functions.in
46b693
index d53d2ab..360eb7e 100644
46b693
--- a/src/luks/clevis-luks-common-functions.in
46b693
+++ b/src/luks/clevis-luks-common-functions.in
46b693
@@ -760,10 +760,12 @@ clevis_luks_add_key() {
46b693
         extra_args="$(printf -- '--key-file %s' "${KEYFILE}")"
46b693
         input="$(printf '%s' "${NEWKEY}")"
46b693
     fi
46b693
+    local pbkdf_args="--pbkdf pbkdf2 --pbkdf-force-iterations 1000"
46b693
 
46b693
     printf '%s' "${input}" | cryptsetup luksAddKey --batch-mode \
46b693
                                          --key-slot "${SLT}" \
46b693
                                          "${DEV}" \
46b693
+                                         ${pbkdf_args} \
46b693
                                          ${extra_args}
46b693
 }
46b693
 
46b693
@@ -792,11 +794,14 @@ clevis_luks_update_key() {
46b693
         extra_args="$(printf -- '--key-file %s' "${KEYFILE}")"
46b693
         input="$(printf '%s' "${NEWKEY}")"
46b693
     fi
46b693
+    local pbkdf_args="--pbkdf pbkdf2 --pbkdf-force-iterations 1000"
46b693
 
46b693
     if [ -n "${in_place}" ]; then
46b693
         printf '%s' "${input}" | cryptsetup luksChangeKey "${DEV}" \
46b693
                                             --key-slot "${SLT}" \
46b693
-                                            --batch-mode ${extra_args}
46b693
+                                            --batch-mode \
46b693
+                                            ${pbkdf_args} \
46b693
+                                            ${extra_args}
46b693
         return
46b693
     fi
46b693
 
46b693
-- 
46b693
2.33.1
46b693