]> git.ipfire.org Git - thirdparty/openssl.git/commit
SM4 optimization for ARM by ASIMD
authorDaniel Hu <Daniel.Hu@arm.com>
Mon, 14 Feb 2022 14:36:34 +0000 (14:36 +0000)
committerTomas Mraz <tomas@openssl.org>
Tue, 12 Apr 2022 08:37:42 +0000 (10:37 +0200)
commit4908787f21f4f5fa24b721ed3ebbc4d3e93ef70c
treeff233074dbc689698d6c458f9475edca6cdec723
parent40fb5a4ce3e90c9e8702aad0fcf43eb9f6edf419
SM4 optimization for ARM by ASIMD

This patch optimizes SM4 for ARM processor using ASIMD instruction

It will improve performance if both of following conditions are met:
1) Input data equal to or more than 4 blocks
2) Cipher mode allows parallelism, including ECB,CTR,GCM or CBC decryption

This patch implements SM4 SBOX lookup in vector registers, with the
benefit of constant processing time over existing C implementation.

It is only enabled for micro-architecture N1/V1. In the ideal scenario,
performance can reach up to 2.7X

When either of above two conditions is not met, e.g. single block input
or CFB/OFB mode, CBC encryption, performance could drop about 50%.

The assembly code has been reviewed internally by ARM engineer
Fangming.Fang@arm.com

Signed-off-by: Daniel Hu <Daniel.Hu@arm.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17951)
crypto/evp/e_sm4.c
crypto/sm4/asm/vpsm4-armv8.pl [new file with mode: 0755]
crypto/sm4/build.info
include/crypto/sm4_platform.h
providers/implementations/ciphers/cipher_sm4_gcm_hw.c
providers/implementations/ciphers/cipher_sm4_hw.c