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