mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roberto Sassu <roberto.sassu@huawei.com>
To: <tpmdd-devel@lists.sourceforge.net>
Cc: <linux-ima-devel@lists.sourceforge.net>,
	<linux-security-module@vger.kernel.org>,
	<keyrings@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Roberto Sassu <roberto.sassu@huawei.com>
Subject: [PATCH v2 5/5] ima: modify arguments of tpm_pcr_extend()
Date: Fri, 5 May 2017 16:21:52 +0200	[thread overview]
Message-ID: <20170505142152.29795-6-roberto.sassu@huawei.com> (raw)
In-Reply-To: <20170505142152.29795-1-roberto.sassu@huawei.com>

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

      parent reply	other threads:[~2017-05-05 14:25 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-05 14:21 [PATCH v2 0/5] Updated API for TPM 2.0 PCR extend Roberto Sassu
2017-05-05 14:21 ` [PATCH v2 1/5] tpm: introduce tpm_pcr_algorithms() Roberto Sassu
2017-05-15 10:36   ` Jarkko Sakkinen
2017-05-15 13:18     ` Roberto Sassu
2017-05-17  8:42       ` Roberto Sassu
2017-05-20 13:18         ` Jarkko Sakkinen
2017-05-22  9:07           ` Roberto Sassu
2017-05-24 17:35             ` Jarkko Sakkinen
2017-05-30  8:44               ` Roberto Sassu
2017-05-31 11:39                 ` Jarkko Sakkinen
2017-05-20 13:00       ` Jarkko Sakkinen
2017-05-05 14:21 ` [PATCH v2 2/5] tpm: introduce tpm_pcr_algo_to_crypto() and tpm_pcr_algo_from_crypto() Roberto Sassu
2017-05-15 11:16   ` Jarkko Sakkinen
2017-05-15 14:22     ` Roberto Sassu
2017-05-20 13:22       ` Jarkko Sakkinen
2017-05-22  7:21         ` Roberto Sassu
2017-05-24 17:33           ` Jarkko Sakkinen
2017-05-24 20:25             ` Jarkko Sakkinen
2017-05-30 10:24               ` Roberto Sassu
2017-05-31 11:40                 ` Jarkko Sakkinen
2017-05-05 14:21 ` [PATCH v2 3/5] tpm: pass multiple digests to tpm_pcr_extend() Roberto Sassu
2017-05-30  3:29   ` [Linux-ima-devel] " Mimi Zohar
2017-05-30  7:28     ` Roberto Sassu
2017-05-30 11:25       ` Mimi Zohar
2017-05-30 13:25         ` Roberto Sassu
2017-05-05 14:21 ` [PATCH v2 4/5] keys, trusted: modify arguments of tpm_pcr_extend() Roberto Sassu
2017-05-30  3:35   ` [Linux-ima-devel] " Mimi Zohar
2017-05-30  7:36     ` Roberto Sassu
2017-05-30 12:06       ` Mimi Zohar
2017-05-30 13:41         ` Roberto Sassu
2017-05-05 14:21 ` Roberto Sassu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170505142152.29795-6-roberto.sassu@huawei.com \
    --to=roberto.sassu@huawei.com \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-ima-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=tpmdd-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®