From: LeoLiu-oc <leoliu-oc@zhaoxin.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: <davem@davemloft.net>, <tglx@linutronix.de>, <mingo@redhat.com>,
<bp@alien8.de>, <dave.hansen@linux.intel.com>, <x86@kernel.org>,
<hpa@zytor.com>, <seanjc@google.com>, <kim.phillips@amd.com>,
<pbonzini@redhat.com>, <babu.moger@amd.com>,
<jiaxi.chen@linux.intel.com>, <jmattson@google.com>,
<pawan.kumar.gupta@linux.intel.com>,
<linux-crypto@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<CobeChen@zhaoxin.com>, <TonyWWang@zhaoxin.com>,
<YunShen@zhaoxin.com>, <Leoliu@zhaoxin.com>
Subject: Re: [PATCH v3] crypto: x86/sm2 -add Zhaoxin SM2 algorithm implementation
Date: Tue, 5 Dec 2023 15:26:02 +0800 [thread overview]
Message-ID: <96fe2155-5ba2-4b6b-9cf7-433a8d1d9e38@zhaoxin.com> (raw)
In-Reply-To: <ZWmnAPlJrkaNE4QF@gondor.apana.org.au>
在 2023/12/1 17:27, Herbert Xu 写道:
> On Wed, Nov 22, 2023 at 02:43:55PM +0800, LeoLiu-oc wrote:
>> From: LeoLiuoc <LeoLiu-oc@zhaoxin.com>
>>
>> Add support for SM2 (ShangMi 2) public key algorithm by Zhaoxin GMI
>> Instruction. The purpose of this driver is to ensure that the application
>> has both high performance and high security.
>>
>> ---
>>
>> v1 -> v2:
>> 1. The assembly code is modified to be embedded in the .c file.
>> 2. Optimize code style and details.
>>
>> v2 -> v3:
>> 1. Increase compatibility with i386 architecture.
>> 2. Optimize variable and return value types in some functions..
>>
>> Signed-off-by: LeoLiuoc <LeoLiu-oc@zhaoxin.com>
>> ---
>> arch/x86/crypto/Kconfig | 11 ++
>> arch/x86/crypto/Makefile | 2 +
>> arch/x86/crypto/sm2-zhaoxin-gmi_glue.c | 158 +++++++++++++++++++++++++
>> arch/x86/include/asm/cpufeatures.h | 2 +
>> 4 files changed, 173 insertions(+)
>> create mode 100644 arch/x86/crypto/sm2-zhaoxin-gmi_glue.c
>>
>> diff --git a/arch/x86/crypto/Kconfig b/arch/x86/crypto/Kconfig
>> index 9bbfd01cfa2f..974d4c3806ff 100644
>> --- a/arch/x86/crypto/Kconfig
>> +++ b/arch/x86/crypto/Kconfig
>> @@ -519,4 +519,15 @@ config CRYPTO_CRCT10DIF_PCLMUL
>> Architecture: x86_64 using:
>> - PCLMULQDQ (carry-less multiplication)
>>
>> +config CRYPTO_SM2_ZHAOXIN_GMI
>> + tristate "SM2 Cipher algorithm (Zhaoxin GMI Instruction)"
>> + depends on X86 && (CPU_SUP_CENTAUR || CPU_SUP_ZHAOXIN)
>> + select CRYPTO_AKCIPHER
>> + select CRYPTO_MANAGER
>
> Why does this depend on CRYPTO_MANAGER?
>
Yes, this is redundant and will be removed in the next version.
>> +static int zhaoxin_sm2_verify(struct akcipher_request *req)
>> +{
>> + struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req);
>> + struct sm2_cipher_data *ec = akcipher_tfm_ctx(tfm);
>> + unsigned char *buffer;
>> + int ret, buf_len;
>> +
>> + buf_len = req->src_len + req->dst_len;
>
> What if this overflows? I know you copied this from the generic sm2
> code, but that's still broken and both should be fixed up.
>
> Thanks,
Yes, you are right. Thank you for your advice. The variable types will
be adjusted according to the actual needs of the code in the next version.
Sincerely,
LeoLiu-oc
next prev parent reply other threads:[~2023-12-05 7:26 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-09 9:47 [PATCH] " LeoLiu-oc
2023-11-09 15:00 ` Dave Hansen
2023-11-15 2:05 ` LeoLiu-oc
2023-11-10 14:27 ` kernel test robot
2023-11-15 7:17 ` [PATCH v2] " LeoLiu-oc
2023-11-15 16:58 ` kernel test robot
2023-11-15 19:21 ` Dave Hansen
2023-11-21 8:04 ` LeoLiu-oc
2023-11-22 6:43 ` [PATCH v3] " LeoLiu-oc
2023-11-22 14:26 ` Dave Hansen
2023-11-29 7:24 ` LeoLiu-oc
2023-11-29 8:04 ` LeoLiu-oc
2023-12-01 9:27 ` Herbert Xu
2023-12-05 7:26 ` LeoLiu-oc [this message]
2023-12-21 6:21 ` [PATCH v4] " LeoLiu-oc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=96fe2155-5ba2-4b6b-9cf7-433a8d1d9e38@zhaoxin.com \
--to=leoliu-oc@zhaoxin.com \
--cc=CobeChen@zhaoxin.com \
--cc=Leoliu@zhaoxin.com \
--cc=TonyWWang@zhaoxin.com \
--cc=YunShen@zhaoxin.com \
--cc=babu.moger@amd.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=hpa@zytor.com \
--cc=jiaxi.chen@linux.intel.com \
--cc=jmattson@google.com \
--cc=kim.phillips@amd.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pawan.kumar.gupta@linux.intel.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®