[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <46c6f4c1ccab14d914837aa1e4b4ab5674ecc93c.camel@linux.ibm.com>
Date: Fri, 11 Sep 2020 15:22:50 -0400
From: Mimi Zohar <zohar@...ux.ibm.com>
To: Tianjia Zhang <tianjia.zhang@...ux.alibaba.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>,
David Howells <dhowells@...hat.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Alexandre Torgue <alexandre.torgue@...com>,
James Morris <jmorris@...ei.org>,
"Serge E. Hallyn" <serge@...lyn.com>,
Stephan Mueller <smueller@...onox.de>,
Marcelo Henrique Cerri <marcelo.cerri@...onical.com>,
"Steven Rostedt (VMware)" <rostedt@...dmis.org>,
Masahiro Yamada <masahiroy@...nel.org>,
Brendan Higgins <brendanhiggins@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Johannes Weiner <hannes@...xchg.org>,
Waiman Long <longman@...hat.com>,
Lakshmi Ramasubramanian <nramas@...ux.microsoft.com>,
Colin Ian King <colin.king@...onical.com>,
Tushar Sugandhi <tusharsu@...ux.microsoft.com>,
Vitaly Chikunov <vt@...linux.org>,
Gilad Ben-Yossef <gilad@...yossef.com>,
Pascal van Leeuwen <pvanleeuwen@...bus.com>,
linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
keyrings@...r.kernel.org, linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org,
linux-security-module@...r.kernel.org
Cc: Xufeng Zhang <yunbo.xufeng@...ux.alibaba.com>,
Jia Zhang <zhang.jia@...ux.alibaba.com>
Subject: Re: [PATCH v6 8/8] integrity: Asymmetric digsig supports
SM2-with-SM3 algorithm
On Thu, 2020-09-03 at 21:12 +0800, Tianjia Zhang wrote:
> Asymmetric digsig supports SM2-with-SM3 algorithm combination,
> so that IMA can also verify SM2's signature data.
>
> Signed-off-by: Tianjia Zhang <tianjia.zhang@...ux.alibaba.com>
> Tested-by: Xufeng Zhang <yunbo.xufeng@...ux.alibaba.com>
Reviewed-by: Mimi Zohar <zohar@...ux.ibm.com> (coding, not crypto
perspective)
> ---
> security/integrity/digsig_asymmetric.c | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/security/integrity/digsig_asymmetric.c b/security/integrity/digsig_asymmetric.c
> index cfa4127d0518..b86a4a8f61ab 100644
> --- a/security/integrity/digsig_asymmetric.c
> +++ b/security/integrity/digsig_asymmetric.c
> @@ -99,14 +99,22 @@ int asymmetric_verify(struct key *keyring, const char *sig,
> memset(&pks, 0, sizeof(pks));
>
> pks.hash_algo = hash_algo_name[hdr->hash_algo];
> - if (hdr->hash_algo == HASH_ALGO_STREEBOG_256 ||
> - hdr->hash_algo == HASH_ALGO_STREEBOG_512) {
> + switch (hdr->hash_algo) {
> + case HASH_ALGO_STREEBOG_256:
> + case HASH_ALGO_STREEBOG_512:
> /* EC-RDSA and Streebog should go together. */
> pks.pkey_algo = "ecrdsa";
> pks.encoding = "raw";
> - } else {
> + break;
> + case HASH_ALGO_SM3_256:
> + /* SM2 and SM3 should go together. */
> + pks.pkey_algo = "sm2";
> + pks.encoding = "raw";
> + break;
> + default:
> pks.pkey_algo = "rsa";
> pks.encoding = "pkcs1";
> + break;
> }
> pks.digest = (u8 *)data;
> pks.digest_size = datalen;
Powered by blists - more mailing lists