From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934309AbdEOLQf (ORCPT ); Mon, 15 May 2017 07:16:35 -0400 Received: from mga06.intel.com ([134.134.136.31]:63302 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934212AbdEOLQd (ORCPT ); Mon, 15 May 2017 07:16:33 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,344,1491289200"; d="scan'208";a="968500487" Date: Mon, 15 May 2017 14:16:29 +0300 From: Jarkko Sakkinen To: Roberto Sassu Cc: tpmdd-devel@lists.sourceforge.net, linux-ima-devel@lists.sourceforge.net, linux-security-module@vger.kernel.org, keyrings@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/5] tpm: introduce tpm_pcr_algo_to_crypto() and tpm_pcr_algo_from_crypto() Message-ID: <20170515111629.urjvbhqzohv4vakc@intel.com> References: <20170505142152.29795-1-roberto.sassu@huawei.com> <20170505142152.29795-3-roberto.sassu@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170505142152.29795-3-roberto.sassu@huawei.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 05, 2017 at 04:21:49PM +0200, Roberto Sassu wrote: > tpm_pcr_algorithms() returns to its callers the IDs of the hash algorithms > supported by the TPM. This patch introduces tpm_pcr_algo_to_crypto(), > so that the callers can use the crypto subsystem to calculate the digest > to be passed to tpm_pcr_extend(). > > tpm_pcr_algo_from_crypto(), implemented for completeness, is instead used What do you mean by completeness? Please, never add unused stuff. > by tpm2_seal_trusted() to perform the opposite conversion. > > Signed-off-by: Roberto Sassu > --- > v2 > > - fixed return values of tpm2_pcr_algo_to_crypto() and > tpm2_pcr_algo_from_crypto() if TPM support is disabled in the kernel Change Log only to the cover letter. > drivers/char/tpm/tpm-interface.c | 51 ++++++++++++++++++++++++++++++++++++++++ > drivers/char/tpm/tpm2-cmd.c | 42 +++++++++------------------------ > include/linux/tpm.h | 13 ++++++++++ > 3 files changed, 75 insertions(+), 31 deletions(-) This commit is just deadly wrong in so many ways. I would suggest to make extend always just take crypto ID in so you don't have to add these bizarre conversion functions. This probably covers all the patches but just "unsigned int" as type for parameters and local variables. I think I'll pass rest of the patches for now because just reviewing the two first took too much time and wait for an updated version. /Jarkko