[PATCH v3 0/6] Introduce x86 assembly accelerated implementation for SM3 algorithm

Tianjia Zhang posted 6 patches 4 years, 6 months ago
There is a newer version of this series
arch/arm64/crypto/Kconfig        |   2 +-
arch/arm64/crypto/sm3-ce-glue.c  |  20 +-
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, 1007 insertions(+), 165 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
[PATCH v3 0/6] Introduce x86 assembly accelerated implementation for SM3 algorithm
Posted by Tianjia Zhang 4 years, 6 months ago
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%.

---
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  |  20 +-
 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, 1007 insertions(+), 165 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.32.0

Re: [PATCH v3 0/6] Introduce x86 assembly accelerated implementation for SM3 algorithm
Posted by Borislav Petkov 4 years, 6 months ago
On Thu, Dec 23, 2021 at 12:35:41PM +0800, Tianjia Zhang wrote:
> 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%.
> 
> ---
> 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

So you sent v2 yesterday. One day later, you're spamming again.

So we have those process rules for a reason - use the time to read them
before sending again a day later please.

Documentation/process/submitting-patches.rst:

"Don't get discouraged - or impatient
------------------------------------

After you have submitted your change, be patient and wait.  Reviewers are
busy people and may not get to your patch right away.

Once upon a time, patches used to disappear into the void without comment,
but the development process works more smoothly than that now.  You should
receive comments within a week or so; if that does not happen, make sure
that you have sent your patches to the right place.  Wait for a minimum of
one week before resubmitting or pinging reviewers - possibly longer during
busy times like merge windows."

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
Re: [PATCH v3 0/6] Introduce x86 assembly accelerated implementation for SM3 algorithm
Posted by Tianjia Zhang 4 years, 6 months ago
Hi Borislav,

On 12/23/21 6:28 PM, Borislav Petkov wrote:
> On Thu, Dec 23, 2021 at 12:35:41PM +0800, Tianjia Zhang wrote:
>> 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%.
>>
>> ---
>> 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
> 
> So you sent v2 yesterday. One day later, you're spamming again.
> 
> So we have those process rules for a reason - use the time to read them
> before sending again a day later please.
> 
> Documentation/process/submitting-patches.rst:
> 
> "Don't get discouraged - or impatient
> ------------------------------------
> 
> After you have submitted your change, be patient and wait.  Reviewers are
> busy people and may not get to your patch right away.
> 
> Once upon a time, patches used to disappear into the void without comment,
> but the development process works more smoothly than that now.  You should
> receive comments within a week or so; if that does not happen, make sure
> that you have sent your patches to the right place.  Wait for a minimum of
> one week before resubmitting or pinging reviewers - possibly longer during
> busy times like merge windows."
> 

I'm sorry for the trouble to the community and reviews. Thanks for your 
reminder. I will control the time interval when sending patches in the 
future.

Merry Christmas Eve.

Tianjia
Re: [PATCH v3 0/6] Introduce x86 assembly accelerated implementation for SM3 algorithm
Posted by Borislav Petkov 4 years, 6 months ago
On Fri, Dec 24, 2021 at 06:01:44PM +0800, Tianjia Zhang wrote:
> I'm sorry for the trouble to the community and reviews. Thanks for your
> reminder. I will control the time interval when sending patches in the
> future.

Thanks and please peruse that file - it has a wealth of good suggestions
in it.

> Merry Christmas Eve.

Happy holidays to you too!

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette