From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752899AbdAZL1d (ORCPT ); Thu, 26 Jan 2017 06:27:33 -0500 Received: from mga03.intel.com ([134.134.136.65]:35941 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752586AbdAZL1a (ORCPT ); Thu, 26 Jan 2017 06:27:30 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,288,1477983600"; d="scan'208";a="58422674" Date: Thu, 26 Jan 2017 13:27:14 +0200 From: Jarkko Sakkinen To: Jason Gunthorpe Cc: tpmdd-devel@lists.sourceforge.net, linux-security-module@vger.kernel.org, Peter Huewe , Marcel Selhorst , open list Subject: Re: [PATCH] tpm: fix RC value check in tpm2_seal_trusted Message-ID: <20170126112714.xvvvb72dybmfgitw@intel.com> References: <20170125210348.13790-1-jarkko.sakkinen@linux.intel.com> <20170125221245.GB713@obsidianresearch.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170125221245.GB713@obsidianresearch.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.6.2-neo (2016-08-21) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 25, 2017 at 03:12:45PM -0700, Jason Gunthorpe wrote: > On Wed, Jan 25, 2017 at 11:03:48PM +0200, Jarkko Sakkinen wrote: > > Fixes: 5ca4c20cfd37 ("keys, trusted: select hash algorithm for TPM2 chips") > > Signed-off-by: Jarkko Sakkinen > > I think you need a commit message for this.. Is this following the > spec? Yes. Format one commands the upper bits contain either handle, session or parameter index. Bit 7 tells whether it the error code is format zero or one. Format zero errors do not require masking. They do not have any data in addition to value. The reason why this bug was repeated in TPM space code was that I originally melded that code form my trusted keys code (copy pasted and edited message construction). "The error code handling is bogus as any error code that has the bits set that TPM_RC_HASH could pass. Implemented tpm2_rc_value() helper to parse the error value from FMT0 and FMT1 error codes to use to check the error so that these types of mistakes is prevented in the future." Is that suitable or do you want me to add something? Jarkko