Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2338231imu; Wed, 21 Nov 2018 10:03:25 -0800 (PST) X-Google-Smtp-Source: AFSGD/VjoRIN48G30FV7yYqIJiUsgYeGJQRyegB+nzkoGuTyaN6oWf4G+6VPnwfw1GXDFAVQ1AHp X-Received: by 2002:a63:94:: with SMTP id 142mr6778236pga.74.1542823405507; Wed, 21 Nov 2018 10:03:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542823405; cv=none; d=google.com; s=arc-20160816; b=GQ6yfyvtRlJzRuSIOI5RurM+bfRzu35fSDgh7RKvIXlipREh98CuZwy0tcc2MiA5II 5WbSa8343i6cZqliQuxqAh7Iv5rCfd2t5lPRV37up7ZGV0Ln9P4GHzvU3/bbTrsBATDc zjdHtyQZa7gFiKlKsxJ1L93HctDTk47HY7W7rG1VAkDrposUgZZTMsPPEHP8ELe++j81 t9vO2tXc72SkV2k5RQAIB7LDRgiZA5ArDfMjSSu6KjnqlTyr7vFM9SNWlXMkM6+Na77H RnxdesJ5laU794LWYNhMWpNYCaIPBo8uSkIHQREP2iyMfWmAxDfNMyWNSuNMrBltQVrL B+sQ== 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=Dg8XwNov6oua9aK3gS6QaLDk+RBdRmhh6GIA9CQ4tVQ=; b=qThDCe3cpGbHN/d2aW+jw5lblavyZmLc6+402zJNIT7/iGsXfzj5xbIlBuM/me62qU 4kzZLIuZ5l6MckG0z+soulYMZpaS5orbCm6kuf6DR318Bgz4DozvmTP20rIfsiCCKa+A jCrQAAijP4cZNtt6KXfzQ0mR72KvI3+c5aIZwg4NyM3dInJRaHK7v6wk9OL34r+nC5qv EABysBI0V+IuSR2AuRwRexW39PS5ECdaXNteCbQDM1CoYJ49ybIbX7AjPY+KmwwCDy6z e68gAao36KtBCFMfEQ0PGYE08skiyfSYj8hVoMmiF+z2wHMoXOeLcwmNHSwNLKYq6em2 hJCg== 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 o12si16884656pgn.145.2018.11.21.10.03.03; Wed, 21 Nov 2018 10:03:25 -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 S1731144AbeKVBxc (ORCPT + 99 others); Wed, 21 Nov 2018 20:53:32 -0500 Received: from mga04.intel.com ([192.55.52.120]:53715 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726849AbeKVBxc (ORCPT ); Wed, 21 Nov 2018 20:53:32 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Nov 2018 07:18:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,261,1539673200"; d="scan'208";a="88161142" Received: from jsakkine-mobl1.tm.intel.com (HELO localhost) ([10.237.50.177]) by fmsmga008.fm.intel.com with ESMTP; 21 Nov 2018 07:18:39 -0800 Date: Wed, 21 Nov 2018 17:18:38 +0200 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: <20181121151838.GB16564@linux.intel.com> References: <154281183700.2093.10559851516194502797.stgit@tstruk-mobl1.jf.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <154281183700.2093.10559851516194502797.stgit@tstruk-mobl1.jf.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 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 /Jarkko