Blame SOURCES/0008-Improve-boot-performance-by-removing-key-check.patch

e40c2b
From da988dee93fd3171d41248fe884c627cdafa563e Mon Sep 17 00:00:00 2001
e40c2b
From: Sergio Arroutbi <sarroutb@redhat.com>
e40c2b
Date: Tue, 2 Aug 2022 09:25:54 -0300
e40c2b
Subject: [PATCH] Improve boot performance by removing key check
e40c2b
e40c2b
---
e40c2b
 src/luks/clevis-luks-common-functions.in | 10 +++++++---
e40c2b
 1 file changed, 7 insertions(+), 3 deletions(-)
e40c2b
e40c2b
diff --git a/src/luks/clevis-luks-common-functions.in b/src/luks/clevis-luks-common-functions.in
e40c2b
index f018340..d059aae 100644
e40c2b
--- a/src/luks/clevis-luks-common-functions.in
e40c2b
+++ b/src/luks/clevis-luks-common-functions.in
e40c2b
@@ -313,6 +313,7 @@ clevis_luks_check_valid_key_or_keyfile() {
e40c2b
 clevis_luks_unlock_device_by_slot() {
e40c2b
     local DEV="${1}"
e40c2b
     local SLT="${2}"
e40c2b
+    local SKIP_CHECK="${3}"
e40c2b
 
e40c2b
     [ -z "${DEV}" ] && return 1
e40c2b
     [ -z "${SLT}" ] && return 1
e40c2b
@@ -327,8 +328,9 @@ clevis_luks_unlock_device_by_slot() {
e40c2b
                        || [ -z "${passphrase}" ]; then
e40c2b
         return 1
e40c2b
     fi
e40c2b
-
e40c2b
-    clevis_luks_check_valid_key_or_keyfile "${DEV}" "${passphrase}" || return 1
e40c2b
+    if [ -z "${SKIP_CHECK}" ]; then
e40c2b
+        clevis_luks_check_valid_key_or_keyfile "${DEV}" "${passphrase}" || return 1
e40c2b
+    fi
e40c2b
     printf '%s' "${passphrase}"
e40c2b
 }
e40c2b
 
e40c2b
@@ -336,6 +338,8 @@ clevis_luks_unlock_device_by_slot() {
e40c2b
 # parameter and returns the decoded passphrase.
e40c2b
 clevis_luks_unlock_device() {
e40c2b
     local DEV="${1}"
e40c2b
+    local SKIP_CHECK="YES"
e40c2b
+
e40c2b
     [ -z "${DEV}" ] && return 1
e40c2b
 
e40c2b
     local used_slots
e40c2b
@@ -346,7 +350,7 @@ clevis_luks_unlock_device() {
e40c2b
 
e40c2b
     local slt pt
e40c2b
     for slt in ${used_slots}; do
e40c2b
-        if ! pt=$(clevis_luks_unlock_device_by_slot "${DEV}" "${slt}") \
e40c2b
+        if ! pt=$(clevis_luks_unlock_device_by_slot "${DEV}" "${slt}" "${SKIP_CHECK}") \
e40c2b
                   || [ -z "${pt}" ]; then
e40c2b
              continue
e40c2b
         fi
e40c2b
-- 
e40c2b
2.35.1
e40c2b