From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751030AbdE3Dgl (ORCPT ); Mon, 29 May 2017 23:36:41 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:57661 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750758AbdE3Dgj (ORCPT ); Mon, 29 May 2017 23:36:39 -0400 Subject: Re: [Linux-ima-devel] [PATCH v2 4/5] keys, trusted: modify arguments of tpm_pcr_extend() From: Mimi Zohar To: Roberto Sassu , tpmdd-devel@lists.sourceforge.net Cc: linux-ima-devel@lists.sourceforge.net, linux-security-module@vger.kernel.org, keyrings@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 29 May 2017 23:35:37 -0400 In-Reply-To: <20170505142152.29795-5-roberto.sassu@huawei.com> References: <20170505142152.29795-1-roberto.sassu@huawei.com> <20170505142152.29795-5-roberto.sassu@huawei.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-MML: disable x-cbid: 17053003-0008-0000-0000-00000133F374 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17053003-0009-0000-0000-0000096302C7 Message-Id: <1496115337.3841.485.camel@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-05-29_17:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705300067 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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; > } > > /*