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

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