From 75aa55632528284718759295dd75a4df02f86b1a Mon Sep 17 00:00:00 2001 From: shenxiangwei Date: Tue, 10 Jan 2023 15:15:24 +0800 Subject: [PATCH] Fix reading of sigfile --- ...ima-evm-utils-Fix-reading-of-sigfile.patch | 35 +++++++++++++++++++ ima-evm-utils.spec | 8 +++-- 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 backport-ima-evm-utils-Fix-reading-of-sigfile.patch diff --git a/backport-ima-evm-utils-Fix-reading-of-sigfile.patch b/backport-ima-evm-utils-Fix-reading-of-sigfile.patch new file mode 100644 index 0000000..1716aa9 --- /dev/null +++ b/backport-ima-evm-utils-Fix-reading-of-sigfile.patch @@ -0,0 +1,35 @@ +From 210d1e02786302118661b6f4c9969b13112b100c Mon Sep 17 00:00:00 2001 +From: Vitaly Chikunov +Date: Sat, 12 Sep 2020 22:36:13 +0300 +Subject: [PATCH] ima-evm-utils: Fix reading of sigfile + +Fix reading of detached IMA signature (--sigfile). Error message: + + Reading to sha1.txt.sig + Failed to fread 147 bytes: sha1.txt.sig + Failed reading: sha1.txt + +Reported-by: Mimi Zohar +Fixes: 08a51e7460fd ("ima-evm-utils: Fix file2bin stat and fopen relations") + +Signed-off-by: Vitaly Chikunov +--- + src/evmctl.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/evmctl.c b/src/evmctl.c +index d92f2d0..4962040 100644 +--- a/src/evmctl.c ++++ b/src/evmctl.c +@@ -235,7 +235,7 @@ static unsigned char *file2bin(const char *file, const char *ext, int *size) + fclose(fp); + return NULL; + } +- if (fread(data, len, 1, fp) != len) { ++ if (fread(data, len, 1, fp) != 1) { + log_err("Failed to fread %zu bytes: %s\n", len, name); + fclose(fp); + free(data); +-- +2.27.0 + diff --git a/ima-evm-utils.spec b/ima-evm-utils.spec index d5e7ba0..380ed28 100644 --- a/ima-evm-utils.spec +++ b/ima-evm-utils.spec @@ -1,6 +1,6 @@ Name: ima-evm-utils Version: 1.3.1 -Release: 9 +Release: 10 Summary: IMA/EVM control utilities Group: System/Libraries License: GPLv2 @@ -9,7 +9,8 @@ Source0: http://sourceforge.net/projects/linux-ima/files/ima-evm-utils/%{na Patch9000: add-save-command-and-support-IMA-digest-list.patch Patch9001: fix-caps-parameter-cannot-be-parsed.patch -Patch9003: skip-test-error-in-docker.patch +Patch9002: skip-test-error-in-docker.patch +Patch9003: backport-ima-evm-utils-Fix-reading-of-sigfile.patch BuildRequires: autoconf automake libtool m4 asciidoc libxslt openssl-devel BuildRequires: keyutils-libs-devel git vim-common @@ -82,6 +83,9 @@ make check %doc %{_mandir}/*/* %changelog +* Tue Jan 10 2023 shenxiangwei - 1.3.1-10 +- Fix reading of sigfile + * Thu Nov 3 2022 shenxiangwei - 1.3.1-9 - fix dependency problems