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

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