Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1641743

Re: [PATCH v2 2/5] tpm: introduce tpm_pcr_algo_to_crypto() and tpm_pcr_algo_from_crypto()

Path csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Roberto Sassu <roberto.sassu@huawei.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 2/5] tpm: introduce tpm_pcr_algo_to_crypto() and tpm_pcr_algo_from_crypto()
Date Mon, 15 May 2017 16:30:02 +0200
Message-ID <tHpay-Ra-21@gated-at.bofh.it> (permalink)
References <tDMp3-2VD-3@gated-at.bofh.it> <tDMp4-2VD-11@gated-at.bofh.it> <tHmcG-7ob-21@gated-at.bofh.it>
X-Original-To Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1
MIME-Version 1.0
Content-Type text/plain; charset="windows-1252"; format=flowed
Content-Transfer-Encoding 7bit
X-Originating-IP [10.220.96.113]
X-Cfilter-Loop Reflected
X-Mirapoint-Virus-Rapid-Raw score=unknown(0), refid=str=0001.0A090206.5919B9A3.00C8,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32
X-Mirapoint-Loop-ID e3d1171f4ee034d76a840b19db760024
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 52
Organization linux.* mail to news gateway
X-Original-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>
X-Original-Date Mon, 15 May 2017 16:22:22 +0200
X-Original-Message-ID <0deed9be-d0c3-3a69-d510-1c8aa3513ba8@huawei.com>
X-Original-References <20170505142152.29795-1-roberto.sassu@huawei.com> <20170505142152.29795-3-roberto.sassu@huawei.com> <20170515111629.urjvbhqzohv4vakc@intel.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1641743

Show key headers only | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v2 2/5] tpm: introduce tpm_pcr_algo_to_crypto() and  tpm_pcr_algo_from_crypto() Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-05-15 13:20 +0200
  Re: [PATCH v2 2/5] tpm: introduce tpm_pcr_algo_to_crypto() and  tpm_pcr_algo_from_crypto() Roberto Sassu <roberto.sassu@huawei.com> - 2017-05-15 16:30 +0200
    Re: [PATCH v2 2/5] tpm: introduce tpm_pcr_algo_to_crypto() and  tpm_pcr_algo_from_crypto() Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-05-20 15:30 +0200
      Re: [PATCH v2 2/5] tpm: introduce tpm_pcr_algo_to_crypto() and  tpm_pcr_algo_from_crypto() Roberto Sassu <roberto.sassu@huawei.com> - 2017-05-22 09:30 +0200
        Re: [PATCH v2 2/5] tpm: introduce tpm_pcr_algo_to_crypto() and  tpm_pcr_algo_from_crypto() Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-05-24 19:40 +0200
          Re: [PATCH v2 2/5] tpm: introduce tpm_pcr_algo_to_crypto() and  tpm_pcr_algo_from_crypto() Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-05-24 22:30 +0200

csiph-web