mirror of
https://github.com/openssl/openssl.git
synced 2024-12-03 05:41:46 +08:00
3d68e2937e
This change can improve md5 performance by using a hand-optimized assembly implementation of the inner loop of md5 calculation. This implementation refered to md5-x86_64.pl and made more effort to reorder instructions for separating data dependencies as much as possible. Test with: $ openssl speed md5 3A5000 type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes 16384 bytes md5 45061.04k 130440.75k 291105.28k 421101.23k 484639.27k 488320.43k md5-modified 47179.95k 139015.57k 308836.69k 445963.26k 512540.67k 518215.00k +5% +7% +6% +6% +6% +6% 3A6000 type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes 16384 bytes md5 60070.06k 161822.76k 325817.60k 438017.02k 486864.21k 492243.31k md5-modified 62827.74k 170294.04k 343795.03k 463324.50k 515831.13k 520060.93k +5% +5% +6% +6% +6% +6% Signed-off-by: Min Zhou <zhoumin@loongson.cn> Co-authored-by: Xi Ruoyao <xry111@xry111.site> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21704)
48 lines
1.6 KiB
Plaintext
48 lines
1.6 KiB
Plaintext
LIBS=../../libcrypto
|
|
|
|
$MD5ASM=
|
|
IF[{- !$disabled{asm} -}]
|
|
$MD5ASM_x86=md5-586.S
|
|
$MD5ASM_x86_64=md5-x86_64.s
|
|
$MD5ASM_aarch64=md5-aarch64.S
|
|
$MD5ASM_loongarch64=md5-loongarch64.S
|
|
$MD5ASM_sparcv9=md5-sparcv9.S
|
|
|
|
# Now that we have defined all the arch specific variables, use the
|
|
# appropriate one, and define the appropriate macros
|
|
IF[$MD5ASM_{- $target{asm_arch} -}]
|
|
$MD5ASM=$MD5ASM_{- $target{asm_arch} -}
|
|
$MD5DEF=MD5_ASM
|
|
ENDIF
|
|
ENDIF
|
|
|
|
$COMMON=md5_dgst.c md5_one.c md5_sha1.c $MD5ASM
|
|
SOURCE[../../libcrypto]=$COMMON
|
|
|
|
# A no-deprecated no-shared build ends up with double function definitions
|
|
# without conditioning this on dso. The issue is MD5 which is needed in the
|
|
# legacy provider for one of the spliced algorithms, however it resides in the
|
|
# default provider. A no-deprecated build removes the external definition from
|
|
# libcrypto and this means that the code needs to be in liblegacy. However,
|
|
# when building without 'dso', liblegacy is included in libcrypto.
|
|
IF[{- !$disabled{module} && !$disabled{shared} -}]
|
|
SOURCE[../../providers/liblegacy.a]=$COMMON
|
|
ENDIF
|
|
|
|
# Implementations are now spread across several libraries, so the defines
|
|
# need to be applied to all affected libraries and modules.
|
|
DEFINE[../../libcrypto]=$MD5DEF
|
|
DEFINE[../../providers/liblegacy.a]=$MD5DEF
|
|
|
|
GENERATE[md5-586.S]=asm/md5-586.pl
|
|
|
|
GENERATE[md5-x86_64.s]=asm/md5-x86_64.pl
|
|
GENERATE[md5-aarch64.S]=asm/md5-aarch64.pl
|
|
INCLUDE[md5-aarch64.o]=..
|
|
|
|
GENERATE[md5-loongarch64.S]=asm/md5-loongarch64.pl
|
|
INCLUDE[md5-loongarch64.o]=..
|
|
|
|
GENERATE[md5-sparcv9.S]=asm/md5-sparcv9.pl
|
|
INCLUDE[md5-sparcv9.o]=..
|