AVX2-Optimized SM4 Cipher Implementation Queued Ahead Of Linux 5.15
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.