From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751461AbdEBMcT (ORCPT ); Tue, 2 May 2017 08:32:19 -0400 Received: from lhrrgout.huawei.com ([194.213.3.17]:25479 "EHLO lhrrgout.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751399AbdEBMcN (ORCPT ); Tue, 2 May 2017 08:32:13 -0400 From: Roberto Sassu To: CC: , , , Roberto Sassu Subject: [PATCH 0/3] tpm_pcr_extend() code split Date: Tue, 2 May 2017 14:31:48 +0200 Message-ID: <20170502123151.24354-1-roberto.sassu@huawei.com> X-Mailer: git-send-email 2.9.3 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.204.66.1] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020202.59087C4B.0157,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 1b1cec878a86e08d7a67925151349109 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch set moves TPM 1.2 specific code to a new function called tpm1_pcr_extend(). The purpose of splitting is to isolate TPM 2.0 code, so that it can be more easily modified to handle multiple digests. With TPM 2.0, a Platform Configuration Register (PCR) could have multiple values, stored in locations called banks. Each bank stores the values of PCRs extended with the same hash algorithm. Currently, the TPM kernel driver does not take advantage of stronger algorithms because PCRs are always extended with a SHA1 digest, padded with zeros to match the length of the input for the hash algorithm being used. Shortly after these patches, a new patch set will be provided to allow callers of tpm_pcr_extend() to pass a digest for each algorithm supported by the TPM. In this patch set, TPM 1.2 specific code will prepare the command buffer with tpm_buf_init() which, in respect to the previous method, offers protection against buffer overflow. Moreover, CPU native to big-endian conversion has been removed from tags and ordinals definition, as it is already done by tpm_buf_init(). Roberto Sassu (3): tpm: use CPU native value for TPM_TAG_RQU_COMMAND tpm: move ordinals definition to include/linux/tpm_command.h tpm: move TPM 1.2 code of tpm_pcr_extend() to tpm1_pcr_extend() drivers/char/tpm/tpm-interface.c | 76 +++++++++++++++++++--------------------- drivers/char/tpm/tpm-sysfs.c | 6 ++-- drivers/char/tpm/tpm.h | 2 -- include/linux/tpm_command.h | 7 ++++ 4 files changed, 46 insertions(+), 45 deletions(-) -- 2.9.3