Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp294111pxb; Tue, 19 Oct 2021 03:05:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJ7wRiFOgbOQtTDz6kJqDR8wLHwHoO/bP7629Vwv8SX4QHG+zL9hmNrQ5Hky0OJcj5zU/k X-Received: by 2002:a05:6a00:1a46:b0:44d:c9de:9911 with SMTP id h6-20020a056a001a4600b0044dc9de9911mr13230697pfv.63.1634637928650; Tue, 19 Oct 2021 03:05:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634637928; cv=none; d=google.com; s=arc-20160816; b=hn1jzrZeccfNKm7C+1PF5seTsZDBN5hXvf1lXzY857vIfdl8tsBLbcVndQPSnerLPz ic3fZxlAPaSQw25E6Kga1dj5wLhwv90s56jtyLhz1YCEYNBqw95UOweU6ieSD1xUJ6XI 9P5GiHQds8fSYyk3r8Dk8Ui5PEzEcTsCd0manv4HkKktjQnKkehSLGpA2Jd7vdyGO7IO u7iVbiB51KEbGFTcpZEOmh9NCdk3/9fK8Imyte+lYKrJ+yMSCKrVmKR5VNn47qfTruXs elkvBTzWUpvsxCvs3U8NNqJzNSC1VOx1evDjTkifl+roaRPSDoQaKUs/wx0HBrFf4ypy u/+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=GwgBKeMghgUap0mgtiSJMAOYQxXewTZubiU2XIag60M=; b=v0LPeYaATBapMQ9T9jnALGDQ2lWk6EaJFnFN0DKHLsHLF9OR0dH/GlDuwWYAG1wSuh cyfd/5OUlX9/wiDB3mEhkrin5BO36bBfz5kCqNiKo2fN3F+BYbgZfHep7yla3Pi5FvkD mZGwUP8vPqe399d8R26D14GeYXZu4HmBZ020+cW1Ut4I9QErbTpMh8+xWdBl6malJYCS kEQxjx2/6uVZ3kEsrq/TCqH0Ec0LvFEL9+2dpXrvvmYK3Btinh7h0rwDj4xeh3lrk3MX vPj+CjxauI17C2IG9gKy0gakI9yCcwmJs6VPrLRDwoC1IymbE35EYBOimk0a74DsBCbZ woIQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z2si27373679pgu.168.2021.10.19.03.04.55; Tue, 19 Oct 2021 03:05:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235201AbhJSKGq (ORCPT + 99 others); Tue, 19 Oct 2021 06:06:46 -0400 Received: from out30-133.freemail.mail.aliyun.com ([115.124.30.133]:40000 "EHLO out30-133.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235176AbhJSKGo (ORCPT ); Tue, 19 Oct 2021 06:06:44 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R531e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04400;MF=tianjia.zhang@linux.alibaba.com;NM=1;PH=DS;RN=19;SR=0;TI=SMTPD_---0UsvUYYX_1634637865; Received: from localhost(mailfrom:tianjia.zhang@linux.alibaba.com fp:SMTPD_---0UsvUYYX_1634637865) by smtp.aliyun-inc.com(127.0.0.1); Tue, 19 Oct 2021 18:04:26 +0800 From: Tianjia Zhang To: James Bottomley , Jarkko Sakkinen , Mimi Zohar , Jonathan Corbet , Herbert Xu , "David S. Miller" , Peter Huewe , Jason Gunthorpe , David Howells , James Morris , "Serge E. Hallyn" , Jerry Snitselaar , linux-integrity@vger.kernel.org, keyrings@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, linux-security-module@vger.kernel.org Cc: Tianjia Zhang Subject: [PATCH v2 2/2] tpm: use SM3 instead of SM3_256 Date: Tue, 19 Oct 2021 18:04:23 +0800 Message-Id: <20211019100423.43615-3-tianjia.zhang@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.3.ge56e4f7 In-Reply-To: <20211019100423.43615-1-tianjia.zhang@linux.alibaba.com> References: <20211019100423.43615-1-tianjia.zhang@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org According to https://tools.ietf.org/id/draft-oscca-cfrg-sm3-01.html, SM3 always produces a 256-bit hash value and there are no plans for other length development, so there is no ambiguity in the name of sm3. Signed-off-by: Tianjia Zhang --- drivers/char/tpm/tpm-sysfs.c | 4 ++-- drivers/char/tpm/tpm2-cmd.c | 2 +- include/linux/tpm.h | 2 +- security/keys/trusted-keys/trusted_tpm2.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/char/tpm/tpm-sysfs.c b/drivers/char/tpm/tpm-sysfs.c index 63f03cfb8e6a..fe6c785dc84a 100644 --- a/drivers/char/tpm/tpm-sysfs.c +++ b/drivers/char/tpm/tpm-sysfs.c @@ -471,7 +471,7 @@ PCR_ATTR_BUILD(TPM_ALG_SHA1, sha1); PCR_ATTR_BUILD(TPM_ALG_SHA256, sha256); PCR_ATTR_BUILD(TPM_ALG_SHA384, sha384); PCR_ATTR_BUILD(TPM_ALG_SHA512, sha512); -PCR_ATTR_BUILD(TPM_ALG_SM3_256, sm3); +PCR_ATTR_BUILD(TPM_ALG_SM3, sm3); void tpm_sysfs_add_device(struct tpm_chip *chip) @@ -500,7 +500,7 @@ void tpm_sysfs_add_device(struct tpm_chip *chip) case TPM_ALG_SHA512: chip->groups[chip->groups_cnt++] = &pcr_group_sha512; break; - case TPM_ALG_SM3_256: + case TPM_ALG_SM3: chip->groups[chip->groups_cnt++] = &pcr_group_sm3; break; default: diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c index 20f55de9d87b..d5a9410d2273 100644 --- a/drivers/char/tpm/tpm2-cmd.c +++ b/drivers/char/tpm/tpm2-cmd.c @@ -19,7 +19,7 @@ static struct tpm2_hash tpm2_hash_map[] = { {HASH_ALGO_SHA256, TPM_ALG_SHA256}, {HASH_ALGO_SHA384, TPM_ALG_SHA384}, {HASH_ALGO_SHA512, TPM_ALG_SHA512}, - {HASH_ALGO_SM3, TPM_ALG_SM3_256}, + {HASH_ALGO_SM3, TPM_ALG_SM3}, }; int tpm2_get_timeouts(struct tpm_chip *chip) diff --git a/include/linux/tpm.h b/include/linux/tpm.h index aa11fe323c56..56a79fee1250 100644 --- a/include/linux/tpm.h +++ b/include/linux/tpm.h @@ -40,7 +40,7 @@ enum tpm_algorithms { TPM_ALG_SHA384 = 0x000C, TPM_ALG_SHA512 = 0x000D, TPM_ALG_NULL = 0x0010, - TPM_ALG_SM3_256 = 0x0012, + TPM_ALG_SM3 = 0x0012, }; /* diff --git a/security/keys/trusted-keys/trusted_tpm2.c b/security/keys/trusted-keys/trusted_tpm2.c index 52a696035176..b15a9961213d 100644 --- a/security/keys/trusted-keys/trusted_tpm2.c +++ b/security/keys/trusted-keys/trusted_tpm2.c @@ -23,7 +23,7 @@ static struct tpm2_hash tpm2_hash_map[] = { {HASH_ALGO_SHA256, TPM_ALG_SHA256}, {HASH_ALGO_SHA384, TPM_ALG_SHA384}, {HASH_ALGO_SHA512, TPM_ALG_SHA512}, - {HASH_ALGO_SM3, TPM_ALG_SM3_256}, + {HASH_ALGO_SM3, TPM_ALG_SM3}, }; static u32 tpm2key_oid[] = { 2, 23, 133, 10, 1, 5 }; -- 2.19.1.3.ge56e4f7