public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] keys, trusted: fix missing support for TPM 2.0 in trusted_update()
@ 2017-10-16  2:53 Boshi Wang
  2017-10-16 11:47 ` Jarkko Sakkinen
  0 siblings, 1 reply; 2+ messages in thread
From: Boshi Wang @ 2017-10-16  2:53 UTC (permalink / raw)
  To: linux-integrity; +Cc: linux-security-module, linux-kernel

Call tpm_seal_trusted() in trusted_update() for TPM 2.0 chips.

Signed-off-by: Boshi Wang <wangboshi@huawei.com>
---
  security/keys/trusted.c | 10 +++++++++-
  1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/security/keys/trusted.c b/security/keys/trusted.c
index ddfaebf..563fe5f 100644
--- a/security/keys/trusted.c
+++ b/security/keys/trusted.c
@@ -1065,6 +1065,11 @@ static int trusted_update(struct key *key, struct key_preparsed_payload *prep)
      size_t datalen = prep->datalen;
      char *datablob;
      int ret = 0;
+    int tpm2;
+
+    tpm2 = tpm_is_tpm2(TPM_ANY_NUM);
+    if (tpm2 < 0)
+        return tpm2;

      if (test_bit(KEY_FLAG_NEGATIVE, &key->flags))
          return -ENOKEY;
@@ -1110,7 +1115,10 @@ static int trusted_update(struct key *key, struct key_preparsed_payload *prep)
      dump_payload(p);
      dump_payload(new_p);

-    ret = key_seal(new_p, new_o);
+    if (tpm2)
+        ret = tpm_seal_trusted(TPM_ANY_NUM, new_p, new_o);
+    else
+        ret = key_seal(new_p, new_o);
      if (ret < 0) {
          pr_info("trusted_key: key_seal failed (%d)\n", ret);
          kzfree(new_p);
-- 
2.10.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-16 11:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-16  2:53 [PATCH] keys, trusted: fix missing support for TPM 2.0 in trusted_update() Boshi Wang
2017-10-16 11:47 ` Jarkko Sakkinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox