tpmdd-devel.lists.sourceforge.net archive mirror
 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-integrity@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Roberto Sassu <roberto.sassu@huawei.com>
Subject: [PATCH 3/3] tpm: add the crypto algorithm identifier to active_bank_info
Date: Mon, 25 Sep 2017 13:19:50 +0200	[thread overview]
Message-ID: <20170925111950.21511-4-roberto.sassu@huawei.com> (raw)
In-Reply-To: <20170925111950.21511-1-roberto.sassu@huawei.com>

In preparation for the patch introducing a function to pass supported TPM
algorithms and digest sizes to TPM users, the crypto algorithm identifier
is added to the active_bank_info structure.

All members of active_bank_info are necessary: TPM algorithm identifiers
will be used to create an event log (they are included in the Crypto Agile
format defined by TCG); crypto identifiers will be used to calculate
digests using the crypto subsystem; digest sizes will be used to truncate
digests calculated with different algorithms.

Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
---
 drivers/char/tpm/tpm2-cmd.c | 2 ++
 include/linux/tpm.h         | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
index b1356be..8c58f6e 100644
--- a/drivers/char/tpm/tpm2-cmd.c
+++ b/drivers/char/tpm/tpm2-cmd.c
@@ -946,6 +946,7 @@ static int tpm2_init_active_bank_info(struct tpm_chip *chip, u16 alg_id,
 	int rc, i;
 
 	active_bank->alg_id = alg_id;
+	active_bank->crypto_id = HASH_ALGO__LAST;
 
 	for (i = 0; i < ARRAY_SIZE(tpm2_hash_map); i++) {
 		enum hash_algo crypto_algo = tpm2_hash_map[i].crypto_id;
@@ -954,6 +955,7 @@ static int tpm2_init_active_bank_info(struct tpm_chip *chip, u16 alg_id,
 			continue;
 
 		active_bank->digest_size = hash_digest_size[crypto_algo];
+		active_bank->crypto_id = crypto_algo;
 		return 0;
 	}
 
diff --git a/include/linux/tpm.h b/include/linux/tpm.h
index 3ecce21..fc927f3 100644
--- a/include/linux/tpm.h
+++ b/include/linux/tpm.h
@@ -54,6 +54,7 @@ struct tpm_class_ops {
 
 struct active_bank_info {
 	u16 alg_id;
+	u16 crypto_id;
 	u16 digest_size;
 };
 
-- 
2.9.3


  parent reply	other threads:[~2017-09-25 11:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-25 11:19 [PATCH 0/3] tpm: retrieve digest size of unknown algorithms from TPM Roberto Sassu
2017-09-25 11:19 ` [PATCH 1/3] tpm: move PCR read code to static function tpm2_pcr_read_common() Roberto Sassu
2017-10-04 10:45   ` Jarkko Sakkinen
2017-09-25 11:19 ` [PATCH 2/3] tpm: retrieve digest size of unknown algorithms with PCR read Roberto Sassu
2017-10-04 11:12   ` Jarkko Sakkinen
2017-09-25 11:19 ` Roberto Sassu [this message]
2017-10-04 11:22   ` [PATCH 3/3] tpm: add the crypto algorithm identifier to active_bank_info Jarkko Sakkinen
2017-10-04  7:32 ` [PATCH 0/3] tpm: retrieve digest size of unknown algorithms from TPM Jarkko Sakkinen

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=20170925111950.21511-4-roberto.sassu@huawei.com \
    --to=roberto.sassu@huawei.com \
    --cc=linux-ima-devel@lists.sourceforge.net \
    --cc=linux-integrity@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).