tpmdd-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Roberto Sassu <roberto.sassu@huawei.com>
Cc: tpmdd-devel@lists.sourceforge.net,
	linux-ima-devel@lists.sourceforge.net,
	linux-security-module@vger.kernel.org, keyrings@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/5] tpm: introduce tpm_pcr_algo_to_crypto() and tpm_pcr_algo_from_crypto()
Date: Wed, 31 May 2017 14:40:41 +0300	[thread overview]
Message-ID: <20170531114040.p3wwkc3soomweyd5@intel.com> (raw)
In-Reply-To: <c484dc54-7d19-9d60-bd17-4ac47f1bc218@huawei.com>

On Tue, May 30, 2017 at 12:24:21PM +0200, Roberto Sassu wrote:
> On 5/24/2017 10:25 PM, Jarkko Sakkinen wrote:
> > On Wed, May 24, 2017 at 10:33:54AM -0700, Jarkko Sakkinen wrote:
> > > On Mon, May 22, 2017 at 09:21:28AM +0200, Roberto Sassu wrote:
> > > > On 5/20/2017 3:22 PM, Jarkko Sakkinen wrote:
> > > > > On Mon, May 15, 2017 at 04:22:22PM +0200, Roberto Sassu wrote:
> > > > > > On 5/15/2017 1:16 PM, Jarkko Sakkinen wrote:
> > > > > > > On Fri, May 05, 2017 at 04:21:49PM +0200, Roberto Sassu wrote:
> > > > > > > > tpm_pcr_algorithms() returns to its callers the IDs of the hash algorithms
> > > > > > > > supported by the TPM. This patch introduces tpm_pcr_algo_to_crypto(),
> > > > > > > > so that the callers can use the crypto subsystem to calculate the digest
> > > > > > > > to be passed to tpm_pcr_extend().
> > > > > > > > 
> > > > > > > > tpm_pcr_algo_from_crypto(), implemented for completeness, is instead used
> > > > > > > 
> > > > > > > What do you mean by completeness? Please, never add unused stuff.
> > > > > > > 
> > > > > > > > by tpm2_seal_trusted() to perform the opposite conversion.
> > > > > > > > 
> > > > > > > > Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
> > > > > > > > ---
> > > > > > > > v2
> > > > > > > > 
> > > > > > > > - fixed return values of tpm2_pcr_algo_to_crypto() and
> > > > > > > >   tpm2_pcr_algo_from_crypto() if TPM support is disabled in the kernel
> > > > > > > 
> > > > > > > Change Log only to the cover letter.
> > > > > > > 
> > > > > > > >  drivers/char/tpm/tpm-interface.c | 51 ++++++++++++++++++++++++++++++++++++++++
> > > > > > > >  drivers/char/tpm/tpm2-cmd.c      | 42 +++++++++------------------------
> > > > > > > >  include/linux/tpm.h              | 13 ++++++++++
> > > > > > > >  3 files changed, 75 insertions(+), 31 deletions(-)
> > > > > > > 
> > > > > > > This commit is just deadly wrong in so many ways.
> > > > > > > 
> > > > > > > I would suggest to make extend always just take crypto ID in so you
> > > > > > > don't have to add these bizarre conversion functions.
> > > > > > 
> > > > > > The reason of this choice (as I explained in the cover letter)
> > > > > > is that TPM users might want to produce an event log with
> > > > > > the TCG format (which includes the TPM algorithm ID). Also,
> > > > > > TPM IDs should be preferred because, with them, TPM users
> > > > > > can calculate a digest directly with the TPM.
> > > > > > 
> > > > > > Taking crypto IDs means relying on the fact that there
> > > > > > is always a mapping between TPM IDs and crypto IDs.
> > > > > > Otherwise, tpm_pcr_algorithms() cannot return the algorithms
> > > > > > to its callers and PCRs cannot be extended. If TPM IDs are used,
> > > > > > TPM users have two alternatives: calculate the digest with
> > > > > > the TPM, or pass a SHA1 digest to tpm_pcr_extend(), so that
> > > > > > it can be padded to extend remanining PCR banks.
> > > > > > 
> > > > > > However, this second option will work only when the TPM driver
> > > > > > determines the size of an algorithm without relying on the crypto
> > > > > > subsystem. At the moment, if a TPM ID is not mapped to a crypto ID,
> > > > > > tpm2_pcr_extend() ignores the digest.
> > > > > > 
> > > > > > Roberto
> > > > > 
> > > > > What if tpm_pcr_algorithms would convert TPM IDs to crypto IDs?
> > > > > 
> > > > > Externally other subsystems would have to then deal with only crypto
> > > > > IDs.
> > > > 
> > > > Then, other subsystems cannot:
> > > > 
> > > > - use the TPM to calculate a digest
> > > > - create an event log with the TCG format
> > > > 
> > > > Roberto
> > > 
> > > Can you open this up a bit? What is the use case that you canno
> > > implement?
> > > 
> > > /Jarkko
> > 
> > The most important question is: are this used *right now*. If not, it is
> > a definitive NAK. We don't want any future-proof code to the kernel.
> > Always do the lowest common denominator in terms of generality and we
> > will refactor from there when need arises.
> 
> This is still being discussed.
> 
> If we use crypto IDs, as you suggested, what it should be passed
> to tpm_pcr_extend()? Or, probably to a new function (Mimi said that
> changing the parameters of an existing function is not bisect-safe).
> 
> Roberto
> 
> -- 
> HUAWEI TECHNOLOGIES Duesseldorf GmbH, HRB 56063
> Managing Director: Bo PENG, Qiuen PENG, Shengli WANG

Parameters should be changed when it makes sense to do so. It makes
sense in this case.

/Jarkko

  reply	other threads:[~2017-05-31 11:40 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
     [not found]     ` <20170515103623.sumyo2vyldezual2-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-05-15 13:18       ` Roberto Sassu
     [not found]         ` <d2974dd2-e30d-e8f0-a60a-2147f3290670-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2017-05-17  8:42           ` Roberto Sassu
2017-05-20 13:18             ` Jarkko Sakkinen
     [not found]               ` <20170520131846.e3niqiknlrttbdf4-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-05-22  9:07                 ` Roberto Sassu
2017-05-24 17:35                   ` Jarkko Sakkinen
     [not found]                     ` <20170524173521.yiiohct7brkcozyk-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-05-30  8:44                       ` Roberto Sassu
     [not found]                         ` <1cf4fbb1-5683-ceb4-2d5b-8ade25a91e83-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
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
     [not found]   ` <20170505142152.29795-3-roberto.sassu-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2017-05-15 11:16     ` Jarkko Sakkinen
     [not found]       ` <20170515111629.urjvbhqzohv4vakc-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-05-15 14:22         ` Roberto Sassu
2017-05-20 13:22           ` Jarkko Sakkinen
     [not found]             ` <20170520132217.t7n7l2pjn7i63hbm-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
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 [this message]
2017-05-05 14:21 ` [PATCH v2 3/5] tpm: pass multiple digests to tpm_pcr_extend() Roberto Sassu
     [not found]   ` <20170505142152.29795-4-roberto.sassu-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2017-05-30  3:29     ` [Linux-ima-devel] " Mimi Zohar
2017-05-30  7:28       ` Roberto Sassu
2017-05-30 11:25         ` Mimi Zohar
     [not found]           ` <1496143547.3841.517.camel-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
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
     [not found]     ` <1496115337.3841.485.camel-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2017-05-30  7:36       ` Roberto Sassu
2017-05-30 12:06         ` Mimi Zohar
     [not found]           ` <1496145961.3841.537.camel-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2017-05-30 13:41             ` Roberto Sassu
2017-05-05 14:21 ` [PATCH v2 5/5] ima: " Roberto Sassu

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=20170531114040.p3wwkc3soomweyd5@intel.com \
    --to=jarkko.sakkinen@linux.intel.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=roberto.sassu@huawei.com \
    --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).