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

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