Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp473146imu; Tue, 27 Nov 2018 15:37:10 -0800 (PST) X-Google-Smtp-Source: AFSGD/UqoX1Fk3gSjYHcZBK5ZxzLLmk0uNDaBcDmKU6TV47W9MuW8q4GNYZzyqAaSqE0khVxohEl X-Received: by 2002:a62:1e45:: with SMTP id e66mr19359193pfe.152.1543361830778; Tue, 27 Nov 2018 15:37:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543361830; cv=none; d=google.com; s=arc-20160816; b=fsqPGNnnJ2V3/GGbUNpnG3Ous/V4FAOfuHIdLpBYVjNG9RjtYAVhRKm1AAMlDqJMF3 ZRe+jUk8eQN7t9DhyfGASfNiLAC3Vb+6VVD+zaBxPXTpl5/+GqjX+n9UlsNfS7COGUcl gMJx094HM4UlQKa5kFbi41VXYpsTGerRN5Pod+FLp3CdCmvDddNNPRu5o1CVhNIateXM C/w5r7rfxyc0TGpcFf0pKEvtdfOitb7aQJdLL7D0NQEfqVaAVw2ip64/FqnkceX6srUh 2AFEYInFHfr3dl5dWlluSaW9+dIaAhMqB/xcn9EUQQTE4KzTOYYOsGR3MlSBUn8w6iTn AJJQ== 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=FKAXyx/x2ohCryPhOs7/NfR7KOd7Q+Cn2GUoN9CZMZM=; b=d6eiYu6nPgIfV4XqSu9FWWyIiJwQndD+rdvCdHY/YINTNEhgjQ616MS2tdZkGpd9Dq teMue+PTvKbXLTD4PMUsYDA2tDWxseGkgg0URTQIC5Q5Jg0LKCQRTsJghQZhn/YvSv0D QOGoqST6FofHur07JV0ghiQTAo3J0SdvoJbxL4rPVSQNy+d7mS4buUI0qVdvBcqsZMRI CSbuRJZO73qeO80OtJ6gt5DFAaV8aDr0nqmow0bbrZsevXDctWL9U8yURbOSb7rfYspp 8LNLnmll2MyFuvsptgOOdIPW8ISST0WbN+cjhTIJOx6vdUry454TwH2GROBSSRjZ2esW z0GQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 be9si5411628plb.143.2018.11.27.15.36.55; Tue, 27 Nov 2018 15:37:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1726924AbeK1Kfv (ORCPT + 99 others); Wed, 28 Nov 2018 05:35:51 -0500 Received: from mga07.intel.com ([134.134.136.100]:20131 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726312AbeK1Kfu (ORCPT ); Wed, 28 Nov 2018 05:35:50 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Nov 2018 15:36:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,288,1539673200"; d="scan'208";a="102043492" Received: from jsakkine-mobl1.jf.intel.com (HELO localhost) ([10.24.8.96]) by FMSMGA003.fm.intel.com with ESMTP; 27 Nov 2018 15:36:17 -0800 Date: Tue, 27 Nov 2018 15:36:17 -0800 From: Jarkko Sakkinen To: Tadeusz Struk Cc: jgg@ziepe.ca, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v6] tpm: add support for partial reads Message-ID: <20181127233617.GA1304@linux.intel.com> References: <154281183700.2093.10559851516194502797.stgit@tstruk-mobl1.jf.intel.com> <20181121151838.GB16564@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181121151838.GB16564@linux.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 21, 2018 at 05:18:38PM +0200, Jarkko Sakkinen wrote: > On Wed, Nov 21, 2018 at 06:50:37AM -0800, Tadeusz Struk wrote: > > Currently to read a response from the TPM device an application needs > > provide big enough buffer for the whole response and read it in one go. > > The application doesn't know how big the response it beforehand so it > > always needs to maintain a 4K buffer and read the max (4K). > > In case if the user of the TSS library doesn't provide big enough > > buffer the TCTI spec says that the library should set the required > > size and return TSS2_TCTI_RC_INSUFFICIENT_BUFFER error code so that the > > application could allocate a bigger buffer and call receive again. > > To make it possible in the TSS library, this requires being able to do > > partial reads from the driver. > > The library would read the 10 bytes header first to get the actual size > > of the response from the header, and then read the rest of the response. > > > > This patch adds support for partial reads, i.e. the user can read the > > response in one or multiple reads, until the whole response is consumed. > > The user can also read only part of the response and ignore > > the rest by issuing a new write to send a new command. > > > > Signed-off-by: Tadeusz Struk > > Reviewed-by: Jarkko Sakkinen Tested-by: Jarkko Sakkinen Pushed. /Jarkko