Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1807943ybn; Thu, 26 Sep 2019 02:31:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqwnHCFEJbNQOnZoj9CIRLpqTuvRuS5QZZ4RyHTC4iKo5rCPy5BYq2N5DHM3FGno3fgFSD9r X-Received: by 2002:a17:906:20c7:: with SMTP id c7mr2118414ejc.248.1569490261341; Thu, 26 Sep 2019 02:31:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569490261; cv=none; d=google.com; s=arc-20160816; b=h0Qk/VHh295yG88yeX7jrY3TyWW73qU1yDPXokJe9LAZwH9iVAbaA/zQOAMgwbEo5k 8UGQonsr0KXjwoeqcV7dey4Xo9ZQVNBqivl6IQg+Nbp1er+C83d518tFioYieLHvCAy+ NJzDvup2p5dKpv1Vc6BSwhqa8Ax7daL3rRb3iymp8x25wM+IgKmQ99Y+QWZDUXs/9YjR iiuLXs+lO3YFu6lj7jok4bt+QyGRmXXw5IYLGF8hVdYpYQRDUub0a6EpUYFesWDLrfU3 oyrGdslhW42MlndwQm6m8h/Qe2HKQS6LfwiX4epjeRxT0oxLJaXcwF9cZ1Fp5TJsgf9R Nrkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=cNn8OXfr7jVNMPstRzxXMoViNYGDb11cWkqf3vEjbSo=; b=E9xZC4h6W17FRmf7K0Tpb/HITby6n/1fxcvXpWkuFquf2PzDFKXnPJr1wq+J38l6PL SZgqwgH8o4w7eNRbP5nFJeHZuGd3Q4NSUIsfR+rPzYu66+YhPLSSmXfgav5DN9rsFQyX z5S+xEvNR6cHO7bFYr09w5QRngg9m7xp3RrCIMlSq0KXWNve8AtB4Wo43ahHhFTCaAvI z1WFb76e3kMg+y7NORQFIb/f75A4lSH7XGPVGAbBGe21zCvtmNOyr3bA4QcuWSHfSfIA Fgy//VB52UrNbc5ANnUB6xobM6wszNVNDLgM8/QZiZG1ZhxZR5sPM8ul9lAN6ScVd4aT m03w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e43si949700eda.296.2019.09.26.02.30.36; Thu, 26 Sep 2019 02:31:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729739AbfIYMeG (ORCPT + 99 others); Wed, 25 Sep 2019 08:34:06 -0400 Received: from mga01.intel.com ([192.55.52.88]:51738 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726369AbfIYMeG (ORCPT ); Wed, 25 Sep 2019 08:34:06 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Sep 2019 05:34:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,548,1559545200"; d="scan'208";a="364310624" Received: from kmakows-mobl.ger.corp.intel.com (HELO localhost) ([10.249.39.225]) by orsmga005.jf.intel.com with ESMTP; 25 Sep 2019 05:34:02 -0700 Date: Wed, 25 Sep 2019 15:34:01 +0300 From: Jarkko Sakkinen To: James Bottomley Cc: linux-integrity@vger.kernel.org, linux-crypto@vger.kernel.org, linux-security-module@vger.kernel.org Subject: Re: [PATCH v6 02/12] tpm-buf: add handling for TPM2B types Message-ID: <20190925123401.GA24028@linux.intel.com> References: <1568031408.6613.29.camel@HansenPartnership.com> <1568031515.6613.31.camel@HansenPartnership.com> <20190920141826.GC9578@linux.intel.com> <1569323560.24519.6.camel@HansenPartnership.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1569323560.24519.6.camel@HansenPartnership.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Tue, Sep 24, 2019 at 07:12:40AM -0400, James Bottomley wrote: > I thought about that. The main problem is that most of the > construct/append functions use the header, and these are the functions > most useful to the TPM2B operation. > > The other thing that argues against this is that the TPM2B case would > save nothing if we eliminated the header, because we allocate a page > for all the data regardless. It would be way more clean. There is absolutely nothing TPM2B specific. > > and also it makes sense to have a separate length field in the > > struct to keep the code sane given that sometimes the buffer does not > > store the length. > > I'm really not sure about that one. The header length has to be filled > in for the non-TPM2B case but right at the moment we have no finish > function for the buf where it could be, so we'd end up having to > maintain two lengths in every update operation on non-TPM2B buffers. > That seems inefficient and the only slight efficiency we get in the > TPM2B case is not having to do the big endian conversion from the > header which doesn't seem to be worth the added complexity. It would be way more clean and an insignificant concern when it comes to performance. I don't see any problem updating two lengths. /Jarkko