5c6c2a
From 744afe75315b975a7eb431d0a52f6056353bf8f1 Mon Sep 17 00:00:00 2001
5c6c2a
From: Harald Hoyer <harald@redhat.com>
5c6c2a
Date: Thu, 29 Jun 2017 10:38:09 +0200
5c6c2a
Subject: [PATCH] Try BOOT_IMAGE and fallback to vmlinuz-${KERNEL}
5c6c2a
5c6c2a
On s390 BOOT_IMAGE only denotes the number of the boot record that
5c6c2a
was selected in the bootloader and not the path to the kernel image.
5c6c2a
5c6c2a
Also only bail out, if the kernel hmac checking relies on that path.
5c6c2a
5c6c2a
Cherry-picked from: 3d875f77f3d1c5e4161794ca59025bc6bcd77eaa
5c6c2a
Resolves: #1415032
5c6c2a
---
5c6c2a
 modules.d/01fips/fips.sh | 13 +++++++------
5c6c2a
 1 file changed, 7 insertions(+), 6 deletions(-)
5c6c2a
5c6c2a
diff --git a/modules.d/01fips/fips.sh b/modules.d/01fips/fips.sh
5c6c2a
index e9ed00b5..ecd711c2 100755
5c6c2a
--- a/modules.d/01fips/fips.sh
5c6c2a
+++ b/modules.d/01fips/fips.sh
5c6c2a
@@ -79,12 +79,6 @@ do_fips()
5c6c2a
     local _module
5c6c2a
 
5c6c2a
     KERNEL=$(uname -r)
5c6c2a
-    BOOT_IMAGE="$(getarg BOOT_IMAGE)"
5c6c2a
-    BOOT_IMAGE="${BOOT_IMAGE:-/vmlinuz-${KERNEL}}"
5c6c2a
-    if ! [ -e "/boot/.${BOOT_IMAGE}.hmac" ] && ! [ -e "/boot/.vmlinuz-${KERNEL}.hmac" ]; then
5c6c2a
-        warn "/boot/.${BOOT_IMAGE}.hmac does not exist"
5c6c2a
-        return 1
5c6c2a
-    fi
5c6c2a
 
5c6c2a
     FIPSMODULES=$(cat /etc/fipsmodules)
5c6c2a
 
5c6c2a
@@ -117,6 +111,13 @@ do_fips()
5c6c2a
     elif [ -e "/run/initramfs/live/isolinux/vmlinuz0" ]; then
5c6c2a
         do_rhevh_check /run/initramfs/live/isolinux/vmlinuz0 || return 1
5c6c2a
     else
5c6c2a
+        BOOT_IMAGE="$(getarg BOOT_IMAGE)"
5c6c2a
+        [ -e "/boot/.${BOOT_IMAGE}.hmac" ] || BOOT_IMAGE="vmlinuz-${KERNEL}"
5c6c2a
+
5c6c2a
+        if ! [ -e "/boot/.${BOOT_IMAGE}.hmac" ]; then
5c6c2a
+            warn "/boot/.${BOOT_IMAGE}.hmac does not exist"
5c6c2a
+            return 1
5c6c2a
+        fi
5c6c2a
         sha512hmac -c "/boot/.${BOOT_IMAGE}.hmac" || return 1
5c6c2a
     fi
5c6c2a