Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB04FC433F5 for ; Fri, 7 Jan 2022 12:07:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238033AbiAGMHG (ORCPT ); Fri, 7 Jan 2022 07:07:06 -0500 Received: from out30-43.freemail.mail.aliyun.com ([115.124.30.43]:59062 "EHLO out30-43.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237988AbiAGMHG (ORCPT ); Fri, 7 Jan 2022 07:07:06 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R201e4;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=20;SR=0;TI=SMTPD_---0V1AdPfV_1641557221; Received: from localhost(mailfrom:tianjia.zhang@linux.alibaba.com fp:SMTPD_---0V1AdPfV_1641557221) by smtp.aliyun-inc.com(127.0.0.1); Fri, 07 Jan 2022 20:07:02 +0800 From: Tianjia Zhang To: Herbert Xu , "David S. Miller" , Vitaly Chikunov , Eric Biggers , Eric Biggers , Gilad Ben-Yossef , Ard Biesheuvel , Jussi Kivilinna , Catalin Marinas , Will Deacon , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , linux-crypto@vger.kernel.org, x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Tianjia Zhang Subject: [PATCH v4 0/6] Introduce x86 assembly accelerated implementation for SM3 algorithm Date: Fri, 7 Jan 2022 20:06:54 +0800 Message-Id: <20220107120700.730-1-tianjia.zhang@linux.alibaba.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org This series of patches creates an stand-alone library for SM3 hash algorithm in the lib/crypto directory, and makes the implementations that originally depended on sm3-generic depend on the stand-alone SM3 library, which also includes sm3-generic itself. On this basis, the AVX assembly acceleration implementation of SM3 algorithm is introduced, the main algorithm implementation based on SM3 AES/BMI2 accelerated work by libgcrypt at: https://gnupg.org/software/libgcrypt/index.html From the performance benchmark data, the performance improvement of SM3 algorithm after AVX optimization can reach up to 38%. --- v4 changes: - Rebase on latest cryptodev-2.6/master - Fix the compilation error of arm64/sm3 v3 changes: - update git commit message for patch 01 v2 changes: - x86/sm3: Change K macros to signed decimal and use LEA and 32-bit offset Tianjia Zhang (6): crypto: sm3 - create SM3 stand-alone library crypto: arm64/sm3-ce - make dependent on sm3 library crypto: sm2 - make dependent on sm3 library crypto: sm3 - make dependent on sm3 library crypto: x86/sm3 - add AVX assembly implementation crypto: tcrypt - add asynchronous speed test for SM3 arch/arm64/crypto/Kconfig | 2 +- arch/arm64/crypto/sm3-ce-glue.c | 28 +- arch/x86/crypto/Makefile | 3 + arch/x86/crypto/sm3-avx-asm_64.S | 517 +++++++++++++++++++++++++++++++ arch/x86/crypto/sm3_avx_glue.c | 134 ++++++++ crypto/Kconfig | 16 +- crypto/sm2.c | 38 +-- crypto/sm3_generic.c | 142 +-------- crypto/tcrypt.c | 14 +- include/crypto/sm3.h | 34 +- lib/crypto/Kconfig | 3 + lib/crypto/Makefile | 3 + lib/crypto/sm3.c | 246 +++++++++++++++ 13 files changed, 1013 insertions(+), 167 deletions(-) create mode 100644 arch/x86/crypto/sm3-avx-asm_64.S create mode 100644 arch/x86/crypto/sm3_avx_glue.c create mode 100644 lib/crypto/sm3.c -- 2.34.1