1755ca
From 17092b128ce6900e0600dbdaf4ac9c777af0db2e Mon Sep 17 00:00:00 2001
1755ca
From: Harald Hoyer <harald@redhat.com>
1755ca
Date: Mon, 30 Jan 2017 09:20:55 +0100
1755ca
Subject: [PATCH] fips: honor $BOOT_IMAGE variable for HMAC check of the kernel
1755ca
1755ca
https://bugzilla.redhat.com/show_bug.cgi?id=1415032
1755ca
1755ca
Cherry-picked from: 4693daa5fa7dddc6b35825831f35657cb66bd531
1755ca
Resolves: #1415032
1755ca
---
1755ca
 modules.d/01fips/fips.sh | 9 +++++----
1755ca
 1 file changed, 5 insertions(+), 4 deletions(-)
1755ca
1755ca
diff --git a/modules.d/01fips/fips.sh b/modules.d/01fips/fips.sh
1755ca
index 0b69a823..e9ed00b5 100755
1755ca
--- a/modules.d/01fips/fips.sh
1755ca
+++ b/modules.d/01fips/fips.sh
1755ca
@@ -79,9 +79,10 @@ do_fips()
1755ca
     local _module
1755ca
 
1755ca
     KERNEL=$(uname -r)
1755ca
-
1755ca
-    if ! [ -e "/boot/.vmlinuz-${KERNEL}.hmac" ]; then
1755ca
-        warn "/boot/.vmlinuz-${KERNEL}.hmac does not exist"
1755ca
+    BOOT_IMAGE="$(getarg BOOT_IMAGE)"
1755ca
+    BOOT_IMAGE="${BOOT_IMAGE:-/vmlinuz-${KERNEL}}"
1755ca
+    if ! [ -e "/boot/.${BOOT_IMAGE}.hmac" ] && ! [ -e "/boot/.vmlinuz-${KERNEL}.hmac" ]; then
1755ca
+        warn "/boot/.${BOOT_IMAGE}.hmac does not exist"
1755ca
         return 1
1755ca
     fi
1755ca
 
1755ca
@@ -116,7 +117,7 @@ do_fips()
1755ca
     elif [ -e "/run/initramfs/live/isolinux/vmlinuz0" ]; then
1755ca
         do_rhevh_check /run/initramfs/live/isolinux/vmlinuz0 || return 1
1755ca
     else
1755ca
-        sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1
1755ca
+        sha512hmac -c "/boot/.${BOOT_IMAGE}.hmac" || return 1
1755ca
     fi
1755ca
 
1755ca
     info "All initrd crypto checks done"