Skip to content

Commit

Permalink
Hook up crypto_cpu_caps_init()
Browse files Browse the repository at this point in the history
  • Loading branch information
botovq committed Oct 18, 2024
1 parent 697cb11 commit 696c490
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 17 deletions.
12 changes: 4 additions & 8 deletions crypto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ if(HOST_ASM_ELF_X86_64)
sha/sha1-elf-x86_64.S
sha/sha256-elf-x86_64.S
sha/sha512-elf-x86_64.S
cpuid-elf-x86_64.S

bn/arch/amd64/bignum_add.S
bn/arch/amd64/bignum_cmadd.S
Expand Down Expand Up @@ -66,7 +65,6 @@ if(HOST_ASM_ELF_X86_64)
add_definitions(-DSHA256_ASM)
add_definitions(-DSHA512_ASM)
add_definitions(-DWHIRLPOOL_ASM)
add_definitions(-DOPENSSL_CPUID_OBJ)
set(CRYPTO_SRC ${CRYPTO_SRC} ${ASM_X86_64_ELF_SRC})
endif()

Expand All @@ -86,7 +84,6 @@ if(HOST_ASM_MACOSX_X86_64)
sha/sha1-macosx-x86_64.S
sha/sha256-macosx-x86_64.S
sha/sha512-macosx-x86_64.S
cpuid-macosx-x86_64.S

bn/arch/amd64/bignum_add.S
bn/arch/amd64/bignum_cmadd.S
Expand Down Expand Up @@ -114,7 +111,6 @@ if(HOST_ASM_MACOSX_X86_64)
add_definitions(-DSHA256_ASM)
add_definitions(-DSHA512_ASM)
add_definitions(-DWHIRLPOOL_ASM)
add_definitions(-DOPENSSL_CPUID_OBJ)
set(CRYPTO_SRC ${CRYPTO_SRC} ${ASM_X86_64_MACOSX_SRC})
set_property(SOURCE ${ASM_X86_64_MACOSX_SRC} PROPERTY XCODE_EXPLICIT_FILE_TYPE "sourcecode.asm")
endif()
Expand All @@ -135,7 +131,6 @@ if(HOST_ASM_MASM_X86_64)
sha/sha1-masm-x86_64.S
sha/sha256-masm-x86_64.S
sha/sha512-masm-x86_64.S
cpuid-masm-x86_64.S
)
add_definitions(-Dendbr64=)
add_definitions(-DAES_ASM)
Expand All @@ -151,7 +146,6 @@ if(HOST_ASM_MASM_X86_64)
add_definitions(-DSHA256_ASM)
add_definitions(-DSHA512_ASM)
add_definitions(-DWHIRLPOOL_ASM)
add_definitions(-DOPENSSL_CPUID_OBJ)
set(CRYPTO_SRC ${CRYPTO_SRC} ${ASM_X86_64_MASM_SRC})
set_property(SOURCE ${ASM_X86_64_MASM_SRC} PROPERTY LANGUAGE ASM_MASM)
endif()
Expand All @@ -172,7 +166,6 @@ if(HOST_ASM_MINGW64_X86_64)
sha/sha1-mingw64-x86_64.S
sha/sha256-mingw64-x86_64.S
sha/sha512-mingw64-x86_64.S
cpuid-mingw64-x86_64.S
)
add_definitions(-Dendbr32=endbr64)
add_definitions(-DAES_ASM)
Expand All @@ -188,10 +181,13 @@ if(HOST_ASM_MINGW64_X86_64)
add_definitions(-DSHA256_ASM)
add_definitions(-DSHA512_ASM)
add_definitions(-DWHIRLPOOL_ASM)
add_definitions(-DOPENSSL_CPUID_OBJ)
set(CRYPTO_SRC ${CRYPTO_SRC} ${ASM_X86_64_MINGW64_SRC})
endif()

if(HOST_X86_64)
set(CRYPTO_SRC ${CRYPTO_SRC} arch/amd64/crypto_cpu_caps.c)
endif()

set(
CRYPTO_SRC
${CRYPTO_SRC}
Expand Down
4 changes: 4 additions & 0 deletions crypto/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ endif
endif
endif

if HOST_X86_64
libcrypto_la_SOURCES += arch/amd64/crypto_cpu_caps.c
endif

libcrypto_la_SOURCES += cpt_err.c
libcrypto_la_SOURCES += cryptlib.c
libcrypto_la_SOURCES += crypto_ex_data.c
Expand Down
2 changes: 0 additions & 2 deletions crypto/Makefile.am.elf-x86_64
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ ASM_X86_64_ELF += rc4/rc4-elf-x86_64.S
ASM_X86_64_ELF += sha/sha1-elf-x86_64.S
ASM_X86_64_ELF += sha/sha256-elf-x86_64.S
ASM_X86_64_ELF += sha/sha512-elf-x86_64.S
ASM_X86_64_ELF += cpuid-elf-x86_64.S

ASM_X86_64_ELF += bn/arch/amd64/bignum_add.S
ASM_X86_64_ELF += bn/arch/amd64/bignum_cmadd.S
Expand Down Expand Up @@ -43,6 +42,5 @@ libcrypto_la_CPPFLAGS += -DSHA1_ASM
libcrypto_la_CPPFLAGS += -DSHA256_ASM
libcrypto_la_CPPFLAGS += -DSHA512_ASM
libcrypto_la_CPPFLAGS += -DWHIRLPOOL_ASM
libcrypto_la_CPPFLAGS += -DOPENSSL_CPUID_OBJ
libcrypto_la_SOURCES += $(ASM_X86_64_ELF)
endif
2 changes: 0 additions & 2 deletions crypto/Makefile.am.macosx-x86_64
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ ASM_X86_64_MACOSX += rc4/rc4-macosx-x86_64.S
ASM_X86_64_MACOSX += sha/sha1-macosx-x86_64.S
ASM_X86_64_MACOSX += sha/sha256-macosx-x86_64.S
ASM_X86_64_MACOSX += sha/sha512-macosx-x86_64.S
ASM_X86_64_MACOSX += cpuid-macosx-x86_64.S

ASM_X86_64_MACOSX += bn/arch/amd64/bignum_add.S
ASM_X86_64_MACOSX += bn/arch/amd64/bignum_cmadd.S
Expand Down Expand Up @@ -43,6 +42,5 @@ libcrypto_la_CPPFLAGS += -DSHA1_ASM
libcrypto_la_CPPFLAGS += -DSHA256_ASM
libcrypto_la_CPPFLAGS += -DSHA512_ASM
libcrypto_la_CPPFLAGS += -DWHIRLPOOL_ASM
libcrypto_la_CPPFLAGS += -DOPENSSL_CPUID_OBJ
libcrypto_la_SOURCES += $(ASM_X86_64_MACOSX)
endif
2 changes: 0 additions & 2 deletions crypto/Makefile.am.masm-x86_64
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ ASM_X86_64_MASM += rc4/rc4-masm-x86_64.S
ASM_X86_64_MASM += sha/sha1-masm-x86_64.S
ASM_X86_64_MASM += sha/sha256-masm-x86_64.S
ASM_X86_64_MASM += sha/sha512-masm-x86_64.S
ASM_X86_64_MASM += cpuid-masm-x86_64.S

EXTRA_DIST += $(ASM_X86_64_MASM)

Expand All @@ -30,6 +29,5 @@ libcrypto_la_CPPFLAGS += -DSHA1_ASM
libcrypto_la_CPPFLAGS += -DSHA256_ASM
libcrypto_la_CPPFLAGS += -DSHA512_ASM
libcrypto_la_CPPFLAGS += -DWHIRLPOOL_ASM
libcrypto_la_CPPFLAGS += -DOPENSSL_CPUID_OBJ
libcrypto_la_SOURCES += $(ASM_X86_64_MASM)
endif
2 changes: 0 additions & 2 deletions crypto/Makefile.am.mingw64-x86_64
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ ASM_X86_64_MINGW64 += rc4/rc4-mingw64-x86_64.S
ASM_X86_64_MINGW64 += sha/sha1-mingw64-x86_64.S
ASM_X86_64_MINGW64 += sha/sha256-mingw64-x86_64.S
ASM_X86_64_MINGW64 += sha/sha512-mingw64-x86_64.S
ASM_X86_64_MINGW64 += cpuid-mingw64-x86_64.S

EXTRA_DIST += $(ASM_X86_64_MINGW64)

Expand All @@ -31,6 +30,5 @@ libcrypto_la_CPPFLAGS += -DSHA1_ASM
libcrypto_la_CPPFLAGS += -DSHA256_ASM
libcrypto_la_CPPFLAGS += -DSHA512_ASM
libcrypto_la_CPPFLAGS += -DWHIRLPOOL_ASM
libcrypto_la_CPPFLAGS += -DOPENSSL_CPUID_OBJ
libcrypto_la_SOURCES += $(ASM_X86_64_MINGW64)
endif
5 changes: 4 additions & 1 deletion update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ for i in $libcrypto_src/arch/*; do
$CP $libcrypto_src/arch/$arch/opensslconf.h include/arch/$arch/
mkdir -p crypto/arch/$arch
$CP $libcrypto_src/arch/$arch/crypto_arch.h crypto/arch/$arch/
crypto_cpu_caps=$libcrypto_src/arch/$arch/crypto_cpu_caps.c
if [ -f "$crypto_cpu_caps" ]; then
$CP "$crypto_cpu_caps" crypto/arch/$arch/
fi
done

for i in $libcrypto_src/bn/arch/*; do
Expand Down Expand Up @@ -282,7 +286,6 @@ for abi in elf macosx masm mingw64; do
gen_asm_stdout $abi sha/asm/sha1-x86_64.pl sha/sha1-$abi-x86_64.S
gen_asm $abi sha/asm/sha512-x86_64.pl sha/sha256-$abi-x86_64.S
gen_asm $abi sha/asm/sha512-x86_64.pl sha/sha512-$abi-x86_64.S
gen_asm $abi x86_64cpuid.pl cpuid-$abi-x86_64.S
done

# copy libtls source
Expand Down

0 comments on commit 696c490

Please sign in to comment.