- fix selfcheck in FIPS mode (RHEL-9918)

This commit is contained in:
Dan Horák 2023-10-27 11:17:19 +02:00
parent ac04dc4497
commit aa229d4a2d
2 changed files with 41 additions and 0 deletions

35
libica-4.2.3-fips.patch Normal file
View File

@ -0,0 +1,35 @@
From ee365a11a4acc667c7a726fbdc3447ba550309b6 Mon Sep 17 00:00:00 2001
From: Joerg Schmidbauer <jschmidb@de.ibm.com>
Date: Tue, 10 Oct 2023 14:10:22 +0200
Subject: [PATCH] fips: use openssl lib context in compute_file_hmac
Before calling any openssl EVP function, libica's own openssl lib ctx
must be made the current one. This was missing in compute_file_hmac.
Suggested-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Joerg Schmidbauer <jschmidb@de.ibm.com>
---
src/fips.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/fips.c b/src/fips.c
index f09dc77..3bbc325 100644
--- a/src/fips.c
+++ b/src/fips.c
@@ -400,6 +400,8 @@ static int compute_file_hmac(const char *path, void **buf, size_t *hmaclen)
void *fdata = NULL;
struct stat fdata_stat;
+ BEGIN_OPENSSL_LIBCTX(openssl_libctx, rc);
+
pkey = get_pkey();
if (!pkey)
goto end;
@@ -438,6 +440,7 @@ static int compute_file_hmac(const char *path, void **buf, size_t *hmaclen)
EVP_MD_CTX_destroy(mdctx);
OPENSSL_cleanse(tmp, sizeof(tmp));
+ END_OPENSSL_LIBCTX(rc);
return rc;
}

View File

@ -11,6 +11,9 @@ Source0: https://github.com/opencryptoki/%{name}/archive/v%{version}/%{name}-%{v
# https://bugzilla.redhat.com/show_bug.cgi?id=1630582
# https://github.com/opencryptoki/libica/pull/24
Patch0: %{name}-4.0.0-annotate.patch
# https://issues.redhat.com/browse/RHEL-9918
# https//github.com/opencryptoki/libica/commit/ee365a11a4acc667c7a726fbdc3447ba550309b6
Patch1: %{name}-4.2.3-fips.patch
BuildRequires: gcc
BuildRequires: openssl-devel
BuildRequires: openssl
@ -107,6 +110,9 @@ fi
%changelog
* Fri Oct 27 2023 Dan Horák <dan[at]danny.cz> - 4.2.3-2
- fix selfcheck in FIPS mode (RHEL-9918)
* Thu Sep 21 2023 Dan Horák <dan[at]danny.cz> - 4.2.3-1
- updated to 4.2.3