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

605b02
From 51ae4f94a4955d9f06955ccd5a8b396b01c80d48 Mon Sep 17 00:00:00 2001
605b02
From: Sergio Arroutbi <sarroutb@redhat.com>
605b02
Date: Tue, 2 Aug 2022 11:07:00 -0300
605b02
Subject: [PATCH] Improve boot performance by removing key check
605b02
605b02
---
605b02
 src/luks/clevis-luks-common-functions | 9 +++++++--
605b02
 1 file changed, 7 insertions(+), 2 deletions(-)
605b02
605b02
diff --git a/src/luks/clevis-luks-common-functions b/src/luks/clevis-luks-common-functions
605b02
index 038cc37..950f217 100644
605b02
--- a/src/luks/clevis-luks-common-functions
605b02
+++ b/src/luks/clevis-luks-common-functions
605b02
@@ -328,6 +328,7 @@ clevis_luks_check_valid_key_or_keyfile() {
605b02
 clevis_luks_unlock_device_by_slot() {
605b02
     local DEV="${1}"
605b02
     local SLT="${2}"
605b02
+    local SKIP_CHECK="${3}"
605b02
 
605b02
     [ -z "${DEV}" ] && return 1
605b02
     [ -z "${SLT}" ] && return 1
605b02
@@ -343,7 +344,9 @@ clevis_luks_unlock_device_by_slot() {
605b02
         return 1
605b02
     fi
605b02
 
605b02
-    clevis_luks_check_valid_key_or_keyfile "${DEV}" "${passphrase}" || return 1
605b02
+    if [ -z "${SKIP_CHECK}" ]; then
605b02
+        clevis_luks_check_valid_key_or_keyfile "${DEV}" "${passphrase}" || return 1
605b02
+    fi
605b02
     printf '%s' "${passphrase}"
605b02
 }
605b02
 
605b02
@@ -351,6 +354,8 @@ clevis_luks_unlock_device_by_slot() {
605b02
 # parameter and returns the decoded passphrase.
605b02
 clevis_luks_unlock_device() {
605b02
     local DEV="${1}"
605b02
+    local SKIP_CHECK="YES"
605b02
+
605b02
     [ -z "${DEV}" ] && return 1
605b02
 
605b02
     local used_slots
605b02
@@ -361,7 +366,7 @@ clevis_luks_unlock_device() {
605b02
 
605b02
     local slt pt
605b02
     for slt in ${used_slots}; do
605b02
-        if ! pt=$(clevis_luks_unlock_device_by_slot "${DEV}" "${slt}") \
605b02
+        if ! pt=$(clevis_luks_unlock_device_by_slot "${DEV}" "${slt}" "${SKIP_CHECK}") \
605b02
                   || [ -z "${pt}" ]; then
605b02
              continue
605b02
         fi
605b02
-- 
605b02
2.35.1
605b02