AVX2-Optimized SM4 Cipher Implementation Queued Ahead Of Linux 5.15

Written by Michael Larabel in Intel on 27 August 2021 at 09:10 AM EDT. 2 Comments
INTEL
The Linux kernel has already sported SM4 cipher algorithm implementation optimized for AES-NI and AVX while now an Alibaba engineer has contributed an AVX2 optimized variant for even greater performance.

Tianjia Zhang of Alibaba has submitted and now queued in crypto-next an AES-NI/AVX2 optimized implementation for the SM4 cipher algorithms. The SM4 cipher is backed by China and used for their WLAN WAPI standard and other purposes. Alibaba previously worked on speeding up the SM4 AVX/AES-NI code while now they are providing this alternative implementation for AVX2 with AES-NI.
SM4 cipher algorithms (OSCCA GB/T 32907-2016) (x86_64/AES-NI/AVX2).

SM4 (GBT.32907-2016) is a cryptographic standard issued by the Organization of State Commercial Administration of China (OSCCA) as an authorized cryptographic algorithms for the use within China.

This is SM4 optimized implementation using AES-NI/AVX2/x86_64 instruction set for block cipher. Through two affine transforms, we can use the AES S-Box to simulate the SM4 S-Box to achieve the effect of instruction acceleration.

This optimized code is seeing great speed-up as a result, "the performance achieved by AVX2 has increased by about 70%, it is also 7.7 times of the pure software implementation of sm4-generic." The code is in the "cryptodev" branch ahead of the Linux 5.15 merge window.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week