5f04b6bc3a
This change contains a C implementation of SHA-1 for POWER using AltiVec. It is almost as fast as the scalar-only assembly implementation for POWER/POWERPC family in OpenSSL but it is easier to maintain and it allows error checking with tools like ASAN. This is tested only for ppc64le. It may nor may not work for other platforms in the POWER/POWERPC familiy. Before: SHA-1 @ 16 bytes: ~30 MB/s SHA-1 @ 8K: ~140 MB/s After: SHA-1 @ 16 bytes: ~70 MB/s SHA-1 @ 8K: ~480 MB/s Change-Id: I790352e86d9c0cc4e1e57d11c5a0aa5b0780ca6b Reviewed-on: https://boringssl-review.googlesource.com/12203 Reviewed-by: Adam Langley <agl@google.com> Commit-Queue: Adam Langley <agl@google.com> CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
68 lines
1.4 KiB
CMake
68 lines
1.4 KiB
CMake
include_directories(../../include)
|
|
|
|
if (${ARCH} STREQUAL "x86_64")
|
|
set(
|
|
SHA_ARCH_SOURCES
|
|
|
|
sha1-x86_64.${ASM_EXT}
|
|
sha256-x86_64.${ASM_EXT}
|
|
sha512-x86_64.${ASM_EXT}
|
|
)
|
|
endif()
|
|
|
|
if (${ARCH} STREQUAL "x86")
|
|
set(
|
|
SHA_ARCH_SOURCES
|
|
|
|
sha1-586.${ASM_EXT}
|
|
sha256-586.${ASM_EXT}
|
|
sha512-586.${ASM_EXT}
|
|
)
|
|
endif()
|
|
|
|
if (${ARCH} STREQUAL "arm")
|
|
set(
|
|
SHA_ARCH_SOURCES
|
|
|
|
sha1-armv4-large.${ASM_EXT}
|
|
sha256-armv4.${ASM_EXT}
|
|
sha512-armv4.${ASM_EXT}
|
|
)
|
|
endif()
|
|
|
|
if (${ARCH} STREQUAL "aarch64")
|
|
set(
|
|
SHA_ARCH_SOURCES
|
|
|
|
sha1-armv8.${ASM_EXT}
|
|
sha256-armv8.${ASM_EXT}
|
|
sha512-armv8.${ASM_EXT}
|
|
)
|
|
endif()
|
|
|
|
add_library(
|
|
sha
|
|
|
|
OBJECT
|
|
|
|
sha1-altivec.c
|
|
sha1.c
|
|
sha256.c
|
|
sha512.c
|
|
|
|
${SHA_ARCH_SOURCES}
|
|
)
|
|
|
|
perlasm(sha1-x86_64.${ASM_EXT} asm/sha1-x86_64.pl)
|
|
perlasm(sha256-x86_64.${ASM_EXT} asm/sha512-x86_64.pl)
|
|
perlasm(sha512-x86_64.${ASM_EXT} asm/sha512-x86_64.pl)
|
|
perlasm(sha1-586.${ASM_EXT} asm/sha1-586.pl)
|
|
perlasm(sha256-586.${ASM_EXT} asm/sha256-586.pl)
|
|
perlasm(sha512-586.${ASM_EXT} asm/sha512-586.pl)
|
|
perlasm(sha1-armv4-large.${ASM_EXT} asm/sha1-armv4-large.pl)
|
|
perlasm(sha256-armv4.${ASM_EXT} asm/sha256-armv4.pl)
|
|
perlasm(sha512-armv4.${ASM_EXT} asm/sha512-armv4.pl)
|
|
perlasm(sha1-armv8.${ASM_EXT} asm/sha1-armv8.pl)
|
|
perlasm(sha256-armv8.${ASM_EXT} asm/sha512-armv8.pl)
|
|
perlasm(sha512-armv8.${ASM_EXT} asm/sha512-armv8.pl)
|