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


Groups > linux.kernel > #1652792 > unrolled thread

Re: [Linux-ima-devel] [PATCH v2 4/5] keys, trusted: modify arguments of tpm_pcr_extend()

Started byMimi Zohar <zohar@linux.vnet.ibm.com>
First post2017-05-30 05:40 +0200
Last post2017-05-30 15:50 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [Linux-ima-devel] [PATCH v2 4/5] keys,     trusted: modify  arguments of tpm_pcr_extend() Mimi Zohar <zohar@linux.vnet.ibm.com> - 2017-05-30 05:40 +0200
    Re: [Linux-ima-devel] [PATCH v2 4/5] keys, trusted: modify arguments  of tpm_pcr_extend() Roberto Sassu <roberto.sassu@huawei.com> - 2017-05-30 09:40 +0200
      Re: [Linux-ima-devel] [PATCH v2 4/5] keys, trusted: modify  arguments of tpm_pcr_extend() Mimi Zohar <zohar@linux.vnet.ibm.com> - 2017-05-30 14:10 +0200
        Re: [Linux-ima-devel] [PATCH v2 4/5] keys, trusted: modify arguments  of tpm_pcr_extend() Roberto Sassu <roberto.sassu@huawei.com> - 2017-05-30 15:50 +0200

#1652792 — Re: [Linux-ima-devel] [PATCH v2 4/5] keys, trusted: modify arguments of tpm_pcr_extend()

FromMimi Zohar <zohar@linux.vnet.ibm.com>
Date2017-05-30 05:40 +0200
SubjectRe: [Linux-ima-devel] [PATCH v2 4/5] keys, trusted: modify arguments of tpm_pcr_extend()
Message-ID<tMGaJ-1y5-1@gated-at.bofh.it>
On Fri, 2017-05-05 at 16:21 +0200, Roberto Sassu wrote:
> pcrlock() has been modified to pass the correct arguments
> to tpm_pcr_extend(): the pointer of a tpm2_digest structure containing
> a random value generated by tpm_get_random() and the size of the array (1).

If the number of arguments is wrong, that means the patch that
introduced the change is not bi-sect safe.  (This comment is
applicable to patch 5/5 too.)

Mimi

> Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
> ---
>  security/keys/trusted.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/security/keys/trusted.c b/security/keys/trusted.c
> index 2ae31c5..3eb89e6 100644
> --- a/security/keys/trusted.c
> +++ b/security/keys/trusted.c
> @@ -377,15 +377,15 @@ static int trusted_tpm_send(const u32 chip_num, unsigned char *cmd,
>   */
>  static int pcrlock(const int pcrnum)
>  {
> -	unsigned char hash[SHA1_DIGEST_SIZE];
> +	struct tpm2_digest digestarg = {.alg_id = TPM2_ALG_SHA1};
>  	int ret;
> 
>  	if (!capable(CAP_SYS_ADMIN))
>  		return -EPERM;
> -	ret = tpm_get_random(TPM_ANY_NUM, hash, SHA1_DIGEST_SIZE);
> +	ret = tpm_get_random(TPM_ANY_NUM, digestarg.digest, SHA1_DIGEST_SIZE);
>  	if (ret != SHA1_DIGEST_SIZE)
>  		return ret;
> -	return tpm_pcr_extend(TPM_ANY_NUM, pcrnum, hash) ? -EINVAL : 0;
> +	return tpm_pcr_extend(TPM_ANY_NUM, pcrnum, 1, &digestarg) ? -EINVAL : 0;
>  }
> 
>  /*

[toc] | [next] | [standalone]


#1652902 — Re: [Linux-ima-devel] [PATCH v2 4/5] keys, trusted: modify arguments of tpm_pcr_extend()

FromRoberto Sassu <roberto.sassu@huawei.com>
Date2017-05-30 09:40 +0200
SubjectRe: [Linux-ima-devel] [PATCH v2 4/5] keys, trusted: modify arguments of tpm_pcr_extend()
Message-ID<tMJV0-4hz-35@gated-at.bofh.it>
In reply to#1652792
On 5/30/2017 5:35 AM, Mimi Zohar wrote:
> On Fri, 2017-05-05 at 16:21 +0200, Roberto Sassu wrote:
>> pcrlock() has been modified to pass the correct arguments
>> to tpm_pcr_extend(): the pointer of a tpm2_digest structure containing
>> a random value generated by tpm_get_random() and the size of the array (1).
>
> If the number of arguments is wrong, that means the patch that
> introduced the change is not bi-sect safe.  (This comment is
> applicable to patch 5/5 too.)

Jarkko (the TPM driver maintainer) asked me to not introduce
a new function to pass multiple digests, but to modify
the parameters of tpm_pcr_extend().

Roberto


>
> Mimi
>
>> Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
>> ---
>>  security/keys/trusted.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/security/keys/trusted.c b/security/keys/trusted.c
>> index 2ae31c5..3eb89e6 100644
>> --- a/security/keys/trusted.c
>> +++ b/security/keys/trusted.c
>> @@ -377,15 +377,15 @@ static int trusted_tpm_send(const u32 chip_num, unsigned char *cmd,
>>   */
>>  static int pcrlock(const int pcrnum)
>>  {
>> -	unsigned char hash[SHA1_DIGEST_SIZE];
>> +	struct tpm2_digest digestarg = {.alg_id = TPM2_ALG_SHA1};
>>  	int ret;
>>
>>  	if (!capable(CAP_SYS_ADMIN))
>>  		return -EPERM;
>> -	ret = tpm_get_random(TPM_ANY_NUM, hash, SHA1_DIGEST_SIZE);
>> +	ret = tpm_get_random(TPM_ANY_NUM, digestarg.digest, SHA1_DIGEST_SIZE);
>>  	if (ret != SHA1_DIGEST_SIZE)
>>  		return ret;
>> -	return tpm_pcr_extend(TPM_ANY_NUM, pcrnum, hash) ? -EINVAL : 0;
>> +	return tpm_pcr_extend(TPM_ANY_NUM, pcrnum, 1, &digestarg) ? -EINVAL : 0;
>>  }
>>
>>  /*
>

[toc] | [prev] | [next] | [standalone]


#1653169 — Re: [Linux-ima-devel] [PATCH v2 4/5] keys, trusted: modify arguments of tpm_pcr_extend()

FromMimi Zohar <zohar@linux.vnet.ibm.com>
Date2017-05-30 14:10 +0200
SubjectRe: [Linux-ima-devel] [PATCH v2 4/5] keys, trusted: modify arguments of tpm_pcr_extend()
Message-ID<tMO8i-7b8-21@gated-at.bofh.it>
In reply to#1652902
On Tue, 2017-05-30 at 09:36 +0200, Roberto Sassu wrote:
> On 5/30/2017 5:35 AM, Mimi Zohar wrote:
> > On Fri, 2017-05-05 at 16:21 +0200, Roberto Sassu wrote:
> >> pcrlock() has been modified to pass the correct arguments
> >> to tpm_pcr_extend(): the pointer of a tpm2_digest structure containing
> >> a random value generated by tpm_get_random() and the size of the array (1).
> >
> > If the number of arguments is wrong, that means the patch that
> > introduced the change is not bi-sect safe.  (This comment is
> > applicable to patch 5/5 too.)
> 
> Jarkko (the TPM driver maintainer) asked me to not introduce
> a new function to pass multiple digests, but to modify
> the parameters of tpm_pcr_extend().

Since struct tpm2_digest is a static size, shouldn't we be able to
compute the number of digests?

Mimi

[toc] | [prev] | [next] | [standalone]


#1653245 — Re: [Linux-ima-devel] [PATCH v2 4/5] keys, trusted: modify arguments of tpm_pcr_extend()

FromRoberto Sassu <roberto.sassu@huawei.com>
Date2017-05-30 15:50 +0200
SubjectRe: [Linux-ima-devel] [PATCH v2 4/5] keys, trusted: modify arguments of tpm_pcr_extend()
Message-ID<tMPH4-82d-15@gated-at.bofh.it>
In reply to#1653169
On 5/30/2017 2:06 PM, Mimi Zohar wrote:
> On Tue, 2017-05-30 at 09:36 +0200, Roberto Sassu wrote:
>> On 5/30/2017 5:35 AM, Mimi Zohar wrote:
>>> On Fri, 2017-05-05 at 16:21 +0200, Roberto Sassu wrote:
>>>> pcrlock() has been modified to pass the correct arguments
>>>> to tpm_pcr_extend(): the pointer of a tpm2_digest structure containing
>>>> a random value generated by tpm_get_random() and the size of the array (1).
>>>
>>> If the number of arguments is wrong, that means the patch that
>>> introduced the change is not bi-sect safe.  (This comment is
>>> applicable to patch 5/5 too.)
>>
>> Jarkko (the TPM driver maintainer) asked me to not introduce
>> a new function to pass multiple digests, but to modify
>> the parameters of tpm_pcr_extend().
>
> Since struct tpm2_digest is a static size, shouldn't we be able to
> compute the number of digests?

The length of 'hash' is not passed to tpm_pcr_extend().

The only way to avoid changing the number of parameters would
be to pass a buffer whose format is the same of the event log
format defined by TCG:

<algo count> <algo1 ID> <digest1> ... <algoN ID> <digestN>

Roberto

-- 
HUAWEI TECHNOLOGIES Duesseldorf GmbH, HRB 56063
Managing Director: Bo PENG, Qiuen PENG, Shengli WANG

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web