From patchwork Mon Sep 25 11:19:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roberto Sassu X-Patchwork-Id: 9969761 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 17A2A60365 for ; Mon, 25 Sep 2017 11:23:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C8FE28836 for ; Mon, 25 Sep 2017 11:23:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 015B92899F; Mon, 25 Sep 2017 11:23:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9842128836 for ; Mon, 25 Sep 2017 11:23:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753875AbdIYLWi (ORCPT ); Mon, 25 Sep 2017 07:22:38 -0400 Received: from lhrrgout.huawei.com ([194.213.3.17]:36475 "EHLO lhrrgout.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751880AbdIYLWh (ORCPT ); Mon, 25 Sep 2017 07:22:37 -0400 Received: from 172.18.7.190 (EHLO LHREML711-CAH.china.huawei.com) ([172.18.7.190]) by lhrrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DWE29850; Mon, 25 Sep 2017 11:22:33 +0000 (GMT) Received: from roberto-HP-EliteDesk-800-G2-DM-65W.huawei.com (10.204.65.254) by smtpsuk.huawei.com (10.201.108.34) with Microsoft SMTP Server (TLS) id 14.3.301.0; Mon, 25 Sep 2017 12:22:22 +0100 From: Roberto Sassu To: CC: , , , , Roberto Sassu Subject: [PATCH 3/3] tpm: add the crypto algorithm identifier to active_bank_info Date: Mon, 25 Sep 2017 13:19:50 +0200 Message-ID: <20170925111950.21511-4-roberto.sassu@huawei.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170925111950.21511-1-roberto.sassu@huawei.com> References: <20170925111950.21511-1-roberto.sassu@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.204.65.254] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020202.59C8E6FB.0108, 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: c6c8b1d5d6e8d5c21d3479c6a354f607 Sender: linux-integrity-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In preparation for the patch introducing a function to pass supported TPM algorithms and digest sizes to TPM users, the crypto algorithm identifier is added to the active_bank_info structure. All members of active_bank_info are necessary: TPM algorithm identifiers will be used to create an event log (they are included in the Crypto Agile format defined by TCG); crypto identifiers will be used to calculate digests using the crypto subsystem; digest sizes will be used to truncate digests calculated with different algorithms. Signed-off-by: Roberto Sassu --- drivers/char/tpm/tpm2-cmd.c | 2 ++ include/linux/tpm.h | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c index b1356be..8c58f6e 100644 --- a/drivers/char/tpm/tpm2-cmd.c +++ b/drivers/char/tpm/tpm2-cmd.c @@ -946,6 +946,7 @@ static int tpm2_init_active_bank_info(struct tpm_chip *chip, u16 alg_id, int rc, i; active_bank->alg_id = alg_id; + active_bank->crypto_id = HASH_ALGO__LAST; for (i = 0; i < ARRAY_SIZE(tpm2_hash_map); i++) { enum hash_algo crypto_algo = tpm2_hash_map[i].crypto_id; @@ -954,6 +955,7 @@ static int tpm2_init_active_bank_info(struct tpm_chip *chip, u16 alg_id, continue; active_bank->digest_size = hash_digest_size[crypto_algo]; + active_bank->crypto_id = crypto_algo; return 0; } diff --git a/include/linux/tpm.h b/include/linux/tpm.h index 3ecce21..fc927f3 100644 --- a/include/linux/tpm.h +++ b/include/linux/tpm.h @@ -54,6 +54,7 @@ struct tpm_class_ops { struct active_bank_info { u16 alg_id; + u16 crypto_id; u16 digest_size; };