public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Boshi Wang <wangboshi@huawei.com>
Cc: linux-integrity@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] keys, trusted: fix missing support for TPM 2.0 in trusted_update()
Date: Mon, 16 Oct 2017 14:47:02 +0300	[thread overview]
Message-ID: <20171016114702.axfsnfxdrleofibu@linux.intel.com> (raw)
In-Reply-To: <683216c3-d61a-1b24-c38c-b3f4348ce876@huawei.com>

On Mon, Oct 16, 2017 at 10:53:13AM +0800, Boshi Wang wrote:
> 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
> 
> 
> 

Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

The sealing code for TPM 1.2 should be moved to driver/char/tpm (has
been in my backlog for couple of years now).

/Jarkko

      reply	other threads:[~2017-10-16 11:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 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=20171016114702.axfsnfxdrleofibu@linux.intel.com \
    --to=jarkko.sakkinen@linux.intel.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=wangboshi@huawei.com \
    /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