Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1636423

[PATCH v2 5/5] ima: modify arguments of tpm_pcr_extend()

From Roberto Sassu <roberto.sassu@huawei.com>
Newsgroups linux.kernel
Subject [PATCH v2 5/5] ima: modify arguments of tpm_pcr_extend()
Date 2017-05-05 16:30 +0200
Message-ID <tDMp4-2VD-9@gated-at.bofh.it> (permalink)
References <tDMp3-2VD-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


ima_pcr_extend() has been modified to pass the correct arguments
to tpm_pcr_extend(): the pointer of a tpm2_digest structure containing
the template digest and the size of the array (1).

Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
---
 security/integrity/ima/ima_queue.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/security/integrity/ima/ima_queue.c b/security/integrity/ima/ima_queue.c
index d9aa5ab..f628968 100644
--- a/security/integrity/ima/ima_queue.c
+++ b/security/integrity/ima/ima_queue.c
@@ -140,12 +140,14 @@ unsigned long ima_get_binary_runtime_size(void)
 
 static int ima_pcr_extend(const u8 *hash, int pcr)
 {
+	struct tpm2_digest digestarg = {.alg_id = TPM2_ALG_SHA1};
 	int result = 0;
 
 	if (!ima_used_chip)
 		return result;
 
-	result = tpm_pcr_extend(TPM_ANY_NUM, pcr, hash);
+	memcpy(digestarg.digest, hash, IMA_DIGEST_SIZE);
+	result = tpm_pcr_extend(TPM_ANY_NUM, pcr, 1, &digestarg);
 	if (result != 0)
 		pr_err("Error Communicating to TPM chip, result: %d\n", result);
 	return result;
-- 
2.9.3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/5] Updated API for TPM 2.0 PCR extend Roberto Sassu <roberto.sassu@huawei.com> - 2017-05-05 16:30 +0200
  [PATCH v2 5/5] ima: modify arguments of tpm_pcr_extend() Roberto Sassu <roberto.sassu@huawei.com> - 2017-05-05 16:30 +0200
  [PATCH v2 2/5] tpm: introduce tpm_pcr_algo_to_crypto() and tpm_pcr_algo_from_crypto() Roberto Sassu <roberto.sassu@huawei.com> - 2017-05-05 16:30 +0200

csiph-web