From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15DBFC33CB2 for ; Wed, 29 Jan 2020 08:39:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E6FE22071E for ; Wed, 29 Jan 2020 08:39:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726091AbgA2IjL (ORCPT ); Wed, 29 Jan 2020 03:39:11 -0500 Received: from mx2.suse.de ([195.135.220.15]:44528 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726068AbgA2IjL (ORCPT ); Wed, 29 Jan 2020 03:39:11 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 05C5AAFB7; Wed, 29 Jan 2020 08:39:08 +0000 (UTC) Date: Wed, 29 Jan 2020 09:39:05 +0100 From: Petr Vorel To: Roberto Sassu Cc: zohar@linux.ibm.com, jarkko.sakkinen@linux.intel.com, james.bottomley@hansenpartnership.com, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, silviu.vlasceanu@huawei.com Subject: Re: [PATCH 1/8] tpm: initialize crypto_id of allocated_banks to HASH_ALGO__LAST Message-ID: <20200129083905.GB387@dell5510> Reply-To: Petr Vorel References: <20200127170443.21538-1-roberto.sassu@huawei.com> <20200127170443.21538-2-roberto.sassu@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200127170443.21538-2-roberto.sassu@huawei.com> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: Hi Roberto, > chip->allocated_banks contains the list of TPM algorithm IDs of allocated > PCR banks. It also contains the corresponding ID of the crypto subsystem, > so that users of the TPM driver can calculate a digest for a PCR extend > operation. > However, if there is no mapping between TPM algorithm ID and crypto ID, the > crypto_id field in chip->allocated_banks remains set to zero (the array is > allocated and initialized with kcalloc() in tpm2_get_pcr_allocation()). > Zero should not be used as value for unknown mappings, as it is a valid > crypto ID (HASH_ALGO_MD4). > This patch initializes crypto_id to HASH_ALGO__LAST. Make sense. Reviewed-by: Petr Vorel Kind regards, Petr