Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp2871213rdb; Wed, 15 Nov 2023 13:06:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IH2x3w9elmWfBKeJIj/PBu44XElb94fwtY1gx2Q7BbiPZco1nEjVn8m1NlI3XCTDVd1Ps+o X-Received: by 2002:a05:6870:2890:b0:1ef:9d46:5c7a with SMTP id gy16-20020a056870289000b001ef9d465c7amr17234828oab.0.1700082401111; Wed, 15 Nov 2023 13:06:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700082401; cv=none; d=google.com; s=arc-20160816; b=0q7h4lQK7YNIhzC4VApk+PKIqZxz9uJNoBVT30HIUg3tRSIjN9pPb1KSwnEnasxl2i cKiRNe2ylePujlgWRDCOmYQm79fBFBC9womeJxVhQ8/XzB8G3ungYW83jww6kC/R+FMv h6MTzJBclRHXj8+4XFLF2FxdKgBUJmdylbnTc+wM3zu+xjR8p2Tlp5B3vIXUKOyFrie2 o9UG+4fC9W9U/gHTmVAu3lxpaU36fGiscUKJGqYV3x/kjG1GWq127029OfI+mGwNGEqO nd4kfLAWPevywj1LdXIaip5zCqWS/rGtj81ws73cH12r9vq1xrcHr930piG09MKLV7SM JRsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:references:to:from:subject:cc :message-id:date:content-transfer-encoding:mime-version :dkim-signature; bh=K9TXBzo+5yMrt+ASe9IHCHL2pSLgiv94jBr23pTPv4I=; fh=wsq/GdEWD18NwMSJnW6ug0FcgLLhmbkc8JcAbPuI4xI=; b=h35wbWPaIzVaTe/NTkoM5Ovplv8NWSUC6YGxocrF+c8qP8wKsFLvdsNp+SYf5DBUGE f7AMqM9DPqPOwVGeOhZn06ktyYt5ItPnPThpsN2Xy+Bonecu0lokJ7bwmMpuPH00aG2p 3T7h41tP4dluCpFAR//OEfMvUoP7kKr9KzPQAPAAIJ3nVHL5vlhFO4RpeS6II7BlLR1y SDPhf+VS0NPK4vRW4lnBV+Rig31Gt5ph7aKxdkVKEoBciy5SGqDa0VegpJCR1Ak7MwmX 0a6s398HdlK/k08ATBPNOm3RUyS0bkDc3FtaG/JrmmNam7gd7ZdzOHoSVRD/9wDf7Ir8 dQvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PGHyJ667; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id u18-20020a05622a14d200b0041cba17e38fsi9576670qtx.276.2023.11.15.13.06.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 13:06:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PGHyJ667; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id E1E8780990DD; Wed, 15 Nov 2023 13:06:31 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235726AbjKOVFB (ORCPT + 99 others); Wed, 15 Nov 2023 16:05:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235721AbjKOVEp (ORCPT ); Wed, 15 Nov 2023 16:04:45 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB0403262; Wed, 15 Nov 2023 13:04:07 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F10ECC433CD; Wed, 15 Nov 2023 21:04:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700082247; bh=RLgv+/x8PezTzgTf5EKWZ+43AZJwvZAtVguxZqC4KQI=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=PGHyJ667Xq042YZ3Mse9gMLBm31ojzt3yYgoEdCkeYyEzrdVgSR4yLYqsUH/x6MSa IWFFKhlnrW3i6/x89VtXDbCMTqc4vgNTDVrDq3CBdDq+jlhGaZ5sX9/SyOBmHpA/jK HRVGe5feDnWSB5jYML/2/SF4zDw2kAp8Qtrusj7YewDuNbVRWvlfjALOS7/TO0jK95 vGyPjEydMBUJBHTg79d2D+6+5B+QGzoXuosTN9mSFrZ4bDYEadxoUQlmWvKklK5mCB nDXKoJ5vC7FCiTjTEwTo66ymkPtjcj5HJpKI8yTaum1zq1PglOkEcGLzkYox16yhXu YPoZDlWQKFVDw== Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 15 Nov 2023 23:04:02 +0200 Message-Id: Cc: , , "James Bottomley" , "William Roberts" , "Stefan Berger" , "David Howells" , "Jason Gunthorpe" , "Mimi Zohar" , "Peter Huewe" , "James Bottomley" , "Paul Moore" , "James Morris" , "Serge E. Hallyn" , "Julien Gomes" , "Mario Limonciello" , "open list" , "open list:SECURITY SUBSYSTEM" Subject: Re: [PATCH v3 2/6] tpm: Store TPM buffer length From: "Jarkko Sakkinen" To: "Jerry Snitselaar" X-Mailer: aerc 0.15.2 References: <20231024011531.442587-1-jarkko@kernel.org> <20231024011531.442587-3-jarkko@kernel.org> <4gyb46g6makecsv7mq67qdp5hilytpymvdbffz5q64tday5dva@wjg3achi5rrv> In-Reply-To: <4gyb46g6makecsv7mq67qdp5hilytpymvdbffz5q64tday5dva@wjg3achi5rrv> X-Spam-Status: No, score=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 15 Nov 2023 13:06:32 -0800 (PST) On Mon Nov 6, 2023 at 9:36 PM EET, Jerry Snitselaar wrote: > On Tue, Oct 24, 2023 at 04:15:20AM +0300, Jarkko Sakkinen wrote: > > Both TPM commands and sized buffers (TPM2B) have a fixed size header, w= hich > > is followed by the body. Store TPM buffer length to a new field in the > > struct tpm_buf. > >=20 > > The invariant here is that the length field must always contain the tot= al > > length of the buffer, i.e. the sum header and body length. The value mu= st > > then be mapped to the length representation of the buffer type, and thi= s > > correspondence must be maintained. > >=20 > > Signed-off-by: Jarkko Sakkinen > > --- > > drivers/char/tpm/tpm-buf.c | 36 ++++++++++++++++------- > > drivers/char/tpm/tpm-interface.c | 18 +++++++++--- > > include/linux/tpm.h | 10 +++---- > > security/keys/trusted-keys/trusted_tpm1.c | 8 ++--- > > 4 files changed, 49 insertions(+), 23 deletions(-) > >=20 > > diff --git a/drivers/char/tpm/tpm-buf.c b/drivers/char/tpm/tpm-buf.c > > index 88ce1a5402de..8dc6b9db006b 100644 > > --- a/drivers/char/tpm/tpm-buf.c > > +++ b/drivers/char/tpm/tpm-buf.c > > @@ -18,6 +18,12 @@ int tpm_buf_init(struct tpm_buf *buf, u16 tag, u32 o= rdinal) > > } > > EXPORT_SYMBOL_GPL(tpm_buf_init); > > =20 > > +/** > > + * tpm_buf_reset() - Initialize a TPM command > > + * @buf: A @tpm_buf > > One minor thing I meant to mention, did you intend this to be &tpm_buf li= ke it > is for tpm_buf_append? Yep, thanks. I'll change it to &tpm_buf. BR, Jarkko