Blame SOURCES/0001-libimaevm-make-SHA-256-the-default-hash-algorithm.patch

96bd04
From 916a0f97fd244a48fde429a63ddc04ed1ed94f8b Mon Sep 17 00:00:00 2001
96bd04
From: Bruno Meneguele <bmeneg@redhat.com>
96bd04
Date: Mon, 16 Aug 2021 17:58:35 -0300
96bd04
Subject: [PATCH] libimaevm: make SHA-256 the default hash algorithm
96bd04
96bd04
The SHA-1 algorithm is considered a weak hash algorithm and there has been
96bd04
some movement within certain distros to drop its support completely or at
96bd04
least drop it from the default behavior. ima-evm-utils uses it as the
96bd04
default algorithm in case the user doesn't explicitly ask for another
96bd04
through the --hashalgo/-a option. With that, make SHA-256 the default hash
96bd04
algorithm instead.
96bd04
96bd04
Signed-off-by: Bruno Meneguele <bmeneg@redhat.com>
96bd04
---
96bd04
 README          | 2 +-
96bd04
 src/evmctl.c    | 2 +-
96bd04
 src/libimaevm.c | 2 +-
96bd04
 3 files changed, 3 insertions(+), 3 deletions(-)
96bd04
96bd04
diff --git a/README b/README
96bd04
index 87cd3b5cd7da..0dc02f551673 100644
96bd04
--- a/README
96bd04
+++ b/README
96bd04
@@ -41,7 +41,7 @@ COMMANDS
96bd04
 OPTIONS
96bd04
 -------
96bd04
 
96bd04
-  -a, --hashalgo     sha1 (default), sha224, sha256, sha384, sha512
96bd04
+  -a, --hashalgo     sha1, sha224, sha256 (default), sha384, sha512
96bd04
   -s, --imasig       make IMA signature
96bd04
   -d, --imahash      make IMA hash
96bd04
   -f, --sigfile      store IMA signature in .sig file instead of xattr
96bd04
diff --git a/src/evmctl.c b/src/evmctl.c
96bd04
index a8065bbe124a..e0e55bc0b122 100644
96bd04
--- a/src/evmctl.c
96bd04
+++ b/src/evmctl.c
96bd04
@@ -2496,7 +2496,7 @@ static void usage(void)
96bd04
 
96bd04
 	printf(
96bd04
 		"\n"
96bd04
-		"  -a, --hashalgo     sha1 (default), sha224, sha256, sha384, sha512, streebog256, streebog512\n"
96bd04
+		"  -a, --hashalgo     sha1, sha224, sha256 (default), sha384, sha512, streebog256, streebog512\n"
96bd04
 		"  -s, --imasig       make IMA signature\n"
96bd04
 		"  -d, --imahash      make IMA hash\n"
96bd04
 		"  -f, --sigfile      store IMA signature in .sig file instead of xattr\n"
96bd04
diff --git a/src/libimaevm.c b/src/libimaevm.c
96bd04
index 8e9615796153..f6c72b878d88 100644
96bd04
--- a/src/libimaevm.c
96bd04
+++ b/src/libimaevm.c
96bd04
@@ -88,7 +88,7 @@ static const char *const pkey_hash_algo_kern[PKEY_HASH__LAST] = {
96bd04
 struct libimaevm_params imaevm_params = {
96bd04
 	.verbose = LOG_INFO,
96bd04
 	.x509 = 1,
96bd04
-	.hash_algo = "sha1",
96bd04
+	.hash_algo = "sha256",
96bd04
 };
96bd04
 
96bd04
 static void __attribute__ ((constructor)) libinit(void);
96bd04
-- 
96bd04
2.31.1
96bd04