openssl/crypto
Min Zhou 9a41a3c6a4 LoongArch64 assembly pack: add ChaCha20 modules
This assembly implementation for ChaCha20 includes three code paths:
scalar path, 128-bit LSX path and 256-bit LASX path. We prefer the
LASX path or LSX path if the hardware and system support these
extensions.

There are 32 vector registers avaialable in the LSX and LASX
extensions. So, we can load the 16 initial states and the 16
intermediate states of ChaCha into the 32 vector registers for
calculating in the implementation. The test results on the 3A5000
and 3A6000 show that this assembly implementation significantly
improves the performance of ChaCha20 on LoongArch based machines.
The detailed test results are as following.

Test with:
$ openssl speed -evp chacha20

3A5000
type               16 bytes     64 bytes    256 bytes    1024 bytes    8192 bytes   16384 bytes
C code           178484.53k   282789.93k   311793.70k    322234.99k    324405.93k    324659.88k
assembly code    223152.28k   407863.65k   989520.55k   2049192.96k   2127248.70k   2131749.55k
                   +25%         +44%         +217%        +536%         +556%         +557%

3A6000
type               16 bytes     64 bytes     256 bytes    1024 bytes    8192 bytes   16384 bytes
C code           214945.33k   310041.75k    340724.22k    349949.27k    352925.01k    353140.74k
assembly code    299151.34k   492766.34k   2070166.02k   4300909.91k   4473978.88k   4499084.63k
                   +39%         +59%         +508%         +1129%        +1168%        +1174%

Signed-off-by: Min Zhou <zhoumin@loongson.cn>

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21998)
2023-09-11 08:49:09 +10:00
..
aes Copyright year updates 2023-09-07 09:59:15 +01:00
aria
asn1 Copyright year updates 2023-09-07 09:59:15 +01:00
async
bf
bio Copyright year updates 2023-09-07 09:59:15 +01:00
bn Copyright year updates 2023-09-07 09:59:15 +01:00
buffer
camellia
cast Copyright year updates 2023-09-07 09:59:15 +01:00
chacha LoongArch64 assembly pack: add ChaCha20 modules 2023-09-11 08:49:09 +10:00
cmac Copyright year updates 2023-09-07 09:59:15 +01:00
cmp Copyright year updates 2023-09-07 09:59:15 +01:00
cms Check error return from cms_sd_asn1_ctrl() correctly. 2023-09-08 16:31:47 +10:00
comp Copyright year updates 2023-09-07 09:59:15 +01:00
conf Copyright year updates 2023-09-07 09:59:15 +01:00
crmf Copyright year updates 2023-09-07 09:59:15 +01:00
ct
des Copyright year updates 2023-09-07 09:59:15 +01:00
dh Copyright year updates 2023-09-07 09:59:15 +01:00
dsa Copyright year updates 2023-09-07 09:59:15 +01:00
dso Copyright year updates 2023-09-07 09:59:15 +01:00
ec Copyright year updates 2023-09-07 09:59:15 +01:00
encode_decode Copyright year updates 2023-09-07 09:59:15 +01:00
engine Copyright year updates 2023-09-07 09:59:15 +01:00
err Copyright year updates 2023-09-07 09:59:15 +01:00
ess
evp Copyright year updates 2023-09-07 09:59:15 +01:00
ffc Copyright year updates 2023-09-07 09:59:15 +01:00
hmac
hpke Copyright year updates 2023-09-07 09:59:15 +01:00
http Copyright year updates 2023-09-07 09:59:15 +01:00
idea
kdf
lhash
md2
md4
md5 Copyright year updates 2023-09-07 09:59:15 +01:00
mdc2
modes Copyright year updates 2023-09-07 09:59:15 +01:00
objects Copyright year updates 2023-09-07 09:59:15 +01:00
ocsp Copyright year updates 2023-09-07 09:59:15 +01:00
pem Copyright year updates 2023-09-07 09:59:15 +01:00
perlasm Copyright year updates 2023-09-07 09:59:15 +01:00
pkcs7 Copyright year updates 2023-09-07 09:59:15 +01:00
pkcs12 Copyright year updates 2023-09-07 09:59:15 +01:00
poly1305 Copyright year updates 2023-09-07 09:59:15 +01:00
property Copyright year updates 2023-09-07 09:59:15 +01:00
rand Copyright year updates 2023-09-07 09:59:15 +01:00
rc2 Copyright year updates 2023-09-07 09:59:15 +01:00
rc4 Copyright year updates 2023-09-07 09:59:15 +01:00
rc5 Copyright year updates 2023-09-07 09:59:15 +01:00
ripemd
rsa Copyright year updates 2023-09-07 09:59:15 +01:00
seed
sha Copyright year updates 2023-09-07 09:59:15 +01:00
siphash
sm2 Copyright year updates 2023-09-07 09:59:15 +01:00
sm3 Copyright year updates 2023-09-07 09:59:15 +01:00
sm4 Copyright year updates 2023-09-07 09:59:15 +01:00
srp Fix a possible memleak in SRP_VBASE_new 2023-09-08 09:20:23 +02:00
stack Copyright year updates 2023-09-07 09:59:15 +01:00
store OSSL_STORE: Fix error flag clearing and setting (provider path only) 2023-09-08 08:32:58 +02:00
thread Copyright year updates 2023-09-07 09:59:15 +01:00
ts Copyright year updates 2023-09-07 09:59:15 +01:00
txt_db Copyright year updates 2023-09-07 09:59:15 +01:00
ui Copyright year updates 2023-09-07 09:59:15 +01:00
whrlpool Copyright year updates 2023-09-07 09:59:15 +01:00
x509 Copyright year updates 2023-09-07 09:59:15 +01:00
alphacpuid.pl
arm64cpuid.pl
arm_arch.h Copyright year updates 2023-09-07 09:59:15 +01:00
armcap.c Update with ARMV8_HAVE_SHA3_AND_WORTH_USING 2023-07-21 10:19:19 +10:00
armv4cpuid.pl Copyright year updates 2023-09-07 09:59:15 +01:00
asn1_dsa.c
bsearch.c
build.info params: provide a faster TRIE based param lookup. 2023-06-02 15:13:20 +10:00
c64xpluscpuid.pl
context.c Copyright year updates 2023-09-07 09:59:15 +01:00
core_algorithm.c
core_fetch.c
core_namemap.c Copyright year updates 2023-09-07 09:59:15 +01:00
cpt_err.c
cpuid.c
cryptlib.c Copyright year updates 2023-09-07 09:59:15 +01:00
ctype.c Copyright year updates 2023-09-07 09:59:15 +01:00
cversion.c
der_writer.c
deterministic_nonce.c Copyright year updates 2023-09-07 09:59:15 +01:00
dllmain.c
ebcdic.c
ex_data.c Copyright year updates 2023-09-07 09:59:15 +01:00
getenv.c
ia64cpuid.S
info.c Copyright year updates 2023-09-07 09:59:15 +01:00
init.c Copyright year updates 2023-09-07 09:59:15 +01:00
initthread.c
loongarch64cpuid.pl
loongarch_arch.h Copyright year updates 2023-09-07 09:59:15 +01:00
loongarchcap.c Copyright year updates 2023-09-07 09:59:15 +01:00
LPdir_nyi.c
LPdir_unix.c Copyright year updates 2023-09-07 09:59:15 +01:00
LPdir_vms.c
LPdir_win32.c
LPdir_win.c
LPdir_wince.c
mem_clr.c
mem_sec.c Copyright year updates 2023-09-07 09:59:15 +01:00
mem.c Copyright year updates 2023-09-07 09:59:15 +01:00
mips_arch.h
o_dir.c
o_fopen.c
o_init.c
o_str.c
o_time.c
packet.c Copyright year updates 2023-09-07 09:59:15 +01:00
param_build_set.c
param_build.c Copyright year updates 2023-09-07 09:59:15 +01:00
params_dup.c
params_from_text.c
params_idx.c.in params: provide a faster TRIE based param lookup. 2023-06-02 15:13:20 +10:00
params.c Copyright year updates 2023-09-07 09:59:15 +01:00
pariscid.pl
passphrase.c
ppccap.c
ppccpuid.pl
provider_child.c Copyright year updates 2023-09-07 09:59:15 +01:00
provider_conf.c Copyright year updates 2023-09-07 09:59:15 +01:00
provider_core.c Copyright year updates 2023-09-07 09:59:15 +01:00
provider_local.h
provider_predefined.c
provider.c Copyright year updates 2023-09-07 09:59:15 +01:00
punycode.c Copyright year updates 2023-09-07 09:59:15 +01:00
quic_vlint.c
README-sparse_array.md
riscv32cpuid.pl
riscv64cpuid.pl
riscvcap.c
s390x_arch.h Copyright year updates 2023-09-07 09:59:15 +01:00
s390xcap.c Copyright year updates 2023-09-07 09:59:15 +01:00
s390xcpuid.pl
self_test_core.c
sleep.c Copyright year updates 2023-09-07 09:59:15 +01:00
sparccpuid.S
sparcv9cap.c
sparse_array.c
threads_lib.c
threads_none.c Copyright year updates 2023-09-07 09:59:15 +01:00
threads_pthread.c Copyright year updates 2023-09-07 09:59:15 +01:00
threads_win.c Copyright year updates 2023-09-07 09:59:15 +01:00
time.c Copyright year updates 2023-09-07 09:59:15 +01:00
trace.c Copyright year updates 2023-09-07 09:59:15 +01:00
uid.c Copyright year updates 2023-09-07 09:59:15 +01:00
vms_rms.h
x86_64cpuid.pl
x86cpuid.pl