Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Bruno Meneguele
cd6657b7b2 Fix hash algorithm parameter not being used
Resolves: BZ#2119829
Signed-off-by: Bruno Meneguele <bmeneguele@gmail.com>
2022-09-27 13:45:06 -03:00
2 changed files with 51 additions and 1 deletions

View file

@ -0,0 +1,45 @@
From 309d3369bb52179cbdb11760c0b006932a42b52f Mon Sep 17 00:00:00 2001
From: Stefan Berger <stefanb@linux.ibm.com>
Date: Mon, 19 Apr 2021 11:01:51 -0400
Subject: [PATCH] libimaevm: Use function parameter algo for name of hash
Instead of using the global variable imaevm_params.hash_algo as the
hash algo to use, use the algo parameter passed into the function.
Existing code in this function already uses 'algo' for writing the
hash into the header:
hdr->hash_algo = imaevm_get_hash_algo(algo);
Fixes: 07e623b60848 ("ima-evm-utils: Convert sign_hash_v2 to EVP_PKEY API").
Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
---
src/libimaevm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/libimaevm.c b/src/libimaevm.c
index 06f10634a39e..28562701eefc 100644
--- a/src/libimaevm.c
+++ b/src/libimaevm.c
@@ -913,7 +913,7 @@ static int sign_hash_v2(const char *algo, const unsigned char *hash,
return -1;
}
- log_info("hash(%s): ", imaevm_params.hash_algo);
+ log_info("hash(%s): ", algo);
log_dump(hash, size);
pkey = read_priv_pkey(keyfile, imaevm_params.keypass);
@@ -939,7 +939,7 @@ static int sign_hash_v2(const char *algo, const unsigned char *hash,
if (!EVP_PKEY_sign_init(ctx))
goto err;
st = "EVP_get_digestbyname";
- if (!(md = EVP_get_digestbyname(imaevm_params.hash_algo)))
+ if (!(md = EVP_get_digestbyname(algo)))
goto err;
st = "EVP_PKEY_CTX_set_signature_md";
if (!EVP_PKEY_CTX_set_signature_md(ctx, md))
--
2.36.1

View file

@ -1,11 +1,13 @@
Name: ima-evm-utils
Version: 1.3.2
Release: 3%{?dist}
Release: 4%{?dist}
Summary: IMA/EVM support utilities
License: GPLv2
Url: http://linux-ima.sourceforge.net/
Source: http://sourceforge.net/projects/linux-ima/files/ima-evm-utils/%{name}-%{version}.tar.gz
Patch0: 0001-libimaevm-Use-function-parameter-algo-for-name-of-ha.patch
BuildRequires: asciidoc
BuildRequires: autoconf
BuildRequires: automake
@ -61,6 +63,9 @@ find %{buildroot}%{_libdir} -type f -name "*.la" -print -delete
%{_libdir}/libimaevm.so
%changelog
* Tue Aug 30 2022 Bruno Meneguele <bmeneguele@gmail.com> - 1.3.2-4
- Fix hash algorithm parameter not being used (rhbz#2119829)
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild