!34 fix caps parameter cannot be parsed

From: @godvi 
Reviewed-by: @HuaxinLuGitee 
Signed-off-by: @HuaxinLuGitee
This commit is contained in:
openeuler-ci-bot 2022-08-19 13:55:36 +00:00 committed by Gitee
commit e9825b6808
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 38 additions and 1 deletions

View File

@ -0,0 +1,33 @@
From 40602a7926ec13819a5926d4ac451becb44b7d98 Mon Sep 17 00:00:00 2001
From: shenxiangwei <shenxiangwei1@huawei.com>
Date: Fri, 19 Aug 2022 12:05:11 +0800
Subject: [PATCH] fix caps parameter cannot be parsed
Signed-off-by: shenxiangwei <shenxiangwei1@huawei.com>
---
src/evmctl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/evmctl.c b/src/evmctl.c
index 28f4b8d..6ef2f68 100644
--- a/src/evmctl.c
+++ b/src/evmctl.c
@@ -440,13 +440,13 @@ static int calc_evm_hash(const char *file, unsigned char *hash)
} else if (!strcmp(*xattrname, XATTR_NAME_CAPS) && (hmac_flags & HMAC_FLAG_CAPS_SET)) {
if (!caps_str)
continue;
- err = strlen(caps_str);
+ hex2bin(xattr_value, caps_str, strlen(caps_str) >> 1);
+ err = strlen(caps_str) >> 1;
if (err >= sizeof(xattr_value)) {
log_err("caps[%u] value is too long to fit into xattr[%zu]\n",
err + 1, sizeof(xattr_value));
return -1;
}
- strcpy(xattr_value, caps_str);
} else {
err = lgetxattr(file, *xattrname, xattr_value, sizeof(xattr_value));
if (err < 0) {
--
2.27.0

View File

@ -1,6 +1,6 @@
Name: ima-evm-utils
Version: 1.3.2
Release: 4
Release: 5
Summary: IMA/EVM control utilities
License: GPLv2
URL: http://linux-ima.sourceforge.net/
@ -10,6 +10,7 @@ Patch6000: ima-evm-utils-Support-SM2-3-algorithm-for-sign-and-v.patch
Patch6001: ima-evm-utils-Fix-incorrect-algorithm-name-in-hash_i.patch
Patch9000: add-save-command-to-support-digest-list-building.patch
Patch9001: fix-caps-parameter-cannot-be-parsed.patch
BuildRequires: autoconf automake libtool asciidoc vim-common
BuildRequires: libxslt openssl openssl-devel keyutils-libs-devel tpm2-tss-devel
@ -75,6 +76,9 @@ make check
%doc %{_mandir}/*/*
%changelog
* Fri Aug 19 2022 shenxiangwei <shenxiangwei1@huawei.com> - 1.3.2-5
- Fix caps parameter cannot be parsed
* Thu Jun 30 2022 luhuaxin <luhuaxin1@huawei.com> - 1.3.2-4
- Support SM signature