2017-04-04 22:21:43 +01:00
|
|
|
include_directories(../../include)
|
|
|
|
|
|
|
|
if (${ARCH} STREQUAL "x86_64")
|
|
|
|
set(
|
|
|
|
BCM_ASM_SOURCES
|
|
|
|
|
2017-04-15 00:19:16 +01:00
|
|
|
aesni-gcm-x86_64.${ASM_EXT}
|
|
|
|
aesni-x86_64.${ASM_EXT}
|
|
|
|
aes-x86_64.${ASM_EXT}
|
|
|
|
bsaes-x86_64.${ASM_EXT}
|
|
|
|
ghash-x86_64.${ASM_EXT}
|
2017-04-04 22:21:43 +01:00
|
|
|
md5-x86_64.${ASM_EXT}
|
2017-05-02 22:25:39 +01:00
|
|
|
p256-x86_64-asm.${ASM_EXT}
|
2017-04-15 00:19:16 +01:00
|
|
|
rdrand-x86_64.${ASM_EXT}
|
2017-04-28 22:47:06 +01:00
|
|
|
rsaz-avx2.${ASM_EXT}
|
2017-04-04 22:21:43 +01:00
|
|
|
sha1-x86_64.${ASM_EXT}
|
|
|
|
sha256-x86_64.${ASM_EXT}
|
|
|
|
sha512-x86_64.${ASM_EXT}
|
2017-04-13 19:00:24 +01:00
|
|
|
vpaes-x86_64.${ASM_EXT}
|
2017-04-28 22:47:06 +01:00
|
|
|
x86_64-mont5.${ASM_EXT}
|
|
|
|
x86_64-mont.${ASM_EXT}
|
2017-04-04 22:21:43 +01:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (${ARCH} STREQUAL "x86")
|
|
|
|
set(
|
|
|
|
BCM_ASM_SOURCES
|
|
|
|
|
2017-04-15 00:19:16 +01:00
|
|
|
aes-586.${ASM_EXT}
|
|
|
|
aesni-x86.${ASM_EXT}
|
2017-04-28 22:47:06 +01:00
|
|
|
bn-586.${ASM_EXT}
|
|
|
|
co-586.${ASM_EXT}
|
2017-04-15 00:19:16 +01:00
|
|
|
ghash-x86.${ASM_EXT}
|
2017-04-04 22:21:43 +01:00
|
|
|
md5-586.${ASM_EXT}
|
|
|
|
sha1-586.${ASM_EXT}
|
|
|
|
sha256-586.${ASM_EXT}
|
|
|
|
sha512-586.${ASM_EXT}
|
2017-04-13 19:00:24 +01:00
|
|
|
vpaes-x86.${ASM_EXT}
|
2017-04-28 22:47:06 +01:00
|
|
|
x86-mont.${ASM_EXT}
|
2017-04-04 22:21:43 +01:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (${ARCH} STREQUAL "arm")
|
|
|
|
set(
|
|
|
|
BCM_ASM_SOURCES
|
|
|
|
|
2017-04-13 19:00:24 +01:00
|
|
|
aes-armv4.${ASM_EXT}
|
|
|
|
aesv8-armx.${ASM_EXT}
|
2017-04-28 22:47:06 +01:00
|
|
|
armv4-mont.${ASM_EXT}
|
2017-04-15 00:19:16 +01:00
|
|
|
bsaes-armv7.${ASM_EXT}
|
2017-04-13 19:38:40 +01:00
|
|
|
ghash-armv4.${ASM_EXT}
|
|
|
|
ghashv8-armx.${ASM_EXT}
|
2017-04-15 00:19:16 +01:00
|
|
|
sha1-armv4-large.${ASM_EXT}
|
|
|
|
sha256-armv4.${ASM_EXT}
|
|
|
|
sha512-armv4.${ASM_EXT}
|
2017-04-04 22:21:43 +01:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (${ARCH} STREQUAL "aarch64")
|
|
|
|
set(
|
|
|
|
BCM_ASM_SOURCES
|
|
|
|
|
2017-04-15 00:19:16 +01:00
|
|
|
aesv8-armx.${ASM_EXT}
|
2017-04-28 22:47:06 +01:00
|
|
|
armv8-mont.${ASM_EXT}
|
2017-04-15 00:19:16 +01:00
|
|
|
ghashv8-armx.${ASM_EXT}
|
2017-04-04 22:21:43 +01:00
|
|
|
sha1-armv8.${ASM_EXT}
|
|
|
|
sha256-armv8.${ASM_EXT}
|
|
|
|
sha512-armv8.${ASM_EXT}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2017-04-13 19:00:24 +01:00
|
|
|
if (${ARCH} STREQUAL "ppc64le")
|
|
|
|
set(
|
2017-05-26 01:07:29 +01:00
|
|
|
BCM_ASM_SOURCES
|
2017-04-13 19:00:24 +01:00
|
|
|
|
|
|
|
aesp8-ppc.${ASM_EXT}
|
2017-04-13 19:38:40 +01:00
|
|
|
ghashp8-ppc.${ASM_EXT}
|
2017-04-13 19:00:24 +01:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
perlasm(aes-586.${ASM_EXT} aes/asm/aes-586.pl)
|
|
|
|
perlasm(aes-armv4.${ASM_EXT} aes/asm/aes-armv4.pl)
|
2017-04-13 19:38:40 +01:00
|
|
|
perlasm(aesni-gcm-x86_64.${ASM_EXT} modes/asm/aesni-gcm-x86_64.pl)
|
2017-04-13 19:00:24 +01:00
|
|
|
perlasm(aesni-x86_64.${ASM_EXT} aes/asm/aesni-x86_64.pl)
|
|
|
|
perlasm(aesni-x86.${ASM_EXT} aes/asm/aesni-x86.pl)
|
|
|
|
perlasm(aesp8-ppc.${ASM_EXT} aes/asm/aesp8-ppc.pl)
|
|
|
|
perlasm(aesv8-armx.${ASM_EXT} aes/asm/aesv8-armx.pl)
|
|
|
|
perlasm(aes-x86_64.${ASM_EXT} aes/asm/aes-x86_64.pl)
|
2017-04-28 22:47:06 +01:00
|
|
|
perlasm(armv4-mont.${ASM_EXT} bn/asm/armv4-mont.pl)
|
|
|
|
perlasm(armv8-mont.${ASM_EXT} bn/asm/armv8-mont.pl)
|
|
|
|
perlasm(bn-586.${ASM_EXT} bn/asm/bn-586.pl)
|
2017-04-13 19:00:24 +01:00
|
|
|
perlasm(bsaes-armv7.${ASM_EXT} aes/asm/bsaes-armv7.pl)
|
|
|
|
perlasm(bsaes-x86_64.${ASM_EXT} aes/asm/bsaes-x86_64.pl)
|
2017-04-28 22:47:06 +01:00
|
|
|
perlasm(co-586.${ASM_EXT} bn/asm/co-586.pl)
|
2017-04-13 19:38:40 +01:00
|
|
|
perlasm(ghash-armv4.${ASM_EXT} modes/asm/ghash-armv4.pl)
|
|
|
|
perlasm(ghashp8-ppc.${ASM_EXT} modes/asm/ghashp8-ppc.pl)
|
|
|
|
perlasm(ghashv8-armx.${ASM_EXT} modes/asm/ghashv8-armx.pl)
|
|
|
|
perlasm(ghash-x86_64.${ASM_EXT} modes/asm/ghash-x86_64.pl)
|
|
|
|
perlasm(ghash-x86.${ASM_EXT} modes/asm/ghash-x86.pl)
|
2017-04-04 22:21:43 +01:00
|
|
|
perlasm(md5-586.${ASM_EXT} md5/asm/md5-586.pl)
|
|
|
|
perlasm(md5-x86_64.${ASM_EXT} md5/asm/md5-x86_64.pl)
|
2017-05-02 22:25:39 +01:00
|
|
|
perlasm(p256-x86_64-asm.${ASM_EXT} ec/asm/p256-x86_64-asm.pl)
|
2017-04-14 19:16:20 +01:00
|
|
|
perlasm(rdrand-x86_64.${ASM_EXT} rand/asm/rdrand-x86_64.pl)
|
2017-04-28 22:47:06 +01:00
|
|
|
perlasm(rsaz-avx2.${ASM_EXT} bn/asm/rsaz-avx2.pl)
|
2017-04-04 22:21:43 +01:00
|
|
|
perlasm(sha1-586.${ASM_EXT} sha/asm/sha1-586.pl)
|
|
|
|
perlasm(sha1-armv4-large.${ASM_EXT} sha/asm/sha1-armv4-large.pl)
|
|
|
|
perlasm(sha1-armv8.${ASM_EXT} sha/asm/sha1-armv8.pl)
|
|
|
|
perlasm(sha1-x86_64.${ASM_EXT} sha/asm/sha1-x86_64.pl)
|
|
|
|
perlasm(sha256-586.${ASM_EXT} sha/asm/sha256-586.pl)
|
|
|
|
perlasm(sha256-armv4.${ASM_EXT} sha/asm/sha256-armv4.pl)
|
|
|
|
perlasm(sha256-armv8.${ASM_EXT} sha/asm/sha512-armv8.pl)
|
|
|
|
perlasm(sha256-x86_64.${ASM_EXT} sha/asm/sha512-x86_64.pl)
|
|
|
|
perlasm(sha512-586.${ASM_EXT} sha/asm/sha512-586.pl)
|
|
|
|
perlasm(sha512-armv4.${ASM_EXT} sha/asm/sha512-armv4.pl)
|
|
|
|
perlasm(sha512-armv8.${ASM_EXT} sha/asm/sha512-armv8.pl)
|
|
|
|
perlasm(sha512-x86_64.${ASM_EXT} sha/asm/sha512-x86_64.pl)
|
2017-04-13 19:00:24 +01:00
|
|
|
perlasm(vpaes-x86_64.${ASM_EXT} aes/asm/vpaes-x86_64.pl)
|
|
|
|
perlasm(vpaes-x86.${ASM_EXT} aes/asm/vpaes-x86.pl)
|
2017-04-28 22:47:06 +01:00
|
|
|
perlasm(x86_64-mont5.${ASM_EXT} bn/asm/x86_64-mont5.pl)
|
|
|
|
perlasm(x86_64-mont.${ASM_EXT} bn/asm/x86_64-mont.pl)
|
|
|
|
perlasm(x86-mont.${ASM_EXT} bn/asm/x86-mont.pl)
|
2017-04-04 22:21:43 +01:00
|
|
|
|
2017-05-17 21:05:50 +01:00
|
|
|
if(FIPS_DELOCATE)
|
2018-07-19 18:03:56 +01:00
|
|
|
if(OPENSSL_NO_ASM)
|
|
|
|
# If OPENSSL_NO_ASM was defined then ASM will not have been enabled, but in
|
|
|
|
# FIPS mode we have to have it because the module build requires going via
|
|
|
|
# textual assembly.
|
|
|
|
enable_language(ASM)
|
|
|
|
endif()
|
|
|
|
|
2017-04-04 22:21:43 +01:00
|
|
|
add_library(
|
|
|
|
bcm_c_generated_asm
|
|
|
|
|
|
|
|
STATIC
|
|
|
|
|
|
|
|
bcm.c
|
|
|
|
)
|
|
|
|
|
2017-04-26 23:04:48 +01:00
|
|
|
set_target_properties(bcm_c_generated_asm PROPERTIES COMPILE_OPTIONS "-S")
|
|
|
|
set_target_properties(bcm_c_generated_asm PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
|
|
|
|
|
|
|
function(prepend_path values prefix output)
|
|
|
|
set(result)
|
|
|
|
foreach(value ${values})
|
|
|
|
list(APPEND result "${prefix}/${value}")
|
|
|
|
endforeach(value)
|
|
|
|
set(${output} ${result} PARENT_SCOPE)
|
2017-04-04 22:21:43 +01:00
|
|
|
endfunction()
|
|
|
|
|
2017-04-26 23:04:48 +01:00
|
|
|
prepend_path("${BCM_ASM_SOURCES}" "${CMAKE_CURRENT_BINARY_DIR}" DELOCATE_ASM_ARGS)
|
2017-04-04 22:21:43 +01:00
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT bcm-delocated.S
|
2017-05-17 21:05:50 +01:00
|
|
|
COMMAND ${GO_EXECUTABLE} run util/fipstools/delocate.go util/fipstools/delocate.peg.go util/fipstools/ar.go util/fipstools/const.go -a $<TARGET_FILE:bcm_c_generated_asm> -o ${CMAKE_CURRENT_BINARY_DIR}/bcm-delocated.S ${DELOCATE_ASM_ARGS}
|
|
|
|
DEPENDS bcm_c_generated_asm ${BCM_ASM_SOURCES} ${CMAKE_SOURCE_DIR}/util/fipstools/delocate.go ${CMAKE_SOURCE_DIR}/util/fipstools/delocate.peg.go ${CMAKE_SOURCE_DIR}/util/fipstools/ar.go ${CMAKE_SOURCE_DIR}/util/fipstools/const.go
|
2017-04-04 22:21:43 +01:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
)
|
|
|
|
|
|
|
|
add_library(
|
|
|
|
bcm_hashunset
|
|
|
|
|
|
|
|
STATIC
|
|
|
|
|
|
|
|
bcm-delocated.S
|
|
|
|
)
|
|
|
|
|
|
|
|
set_target_properties(bcm_hashunset PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
|
|
|
set_target_properties(bcm_hashunset PROPERTIES LINKER_LANGUAGE C)
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT bcm.o
|
2017-04-14 20:41:55 +01:00
|
|
|
COMMAND ${GO_EXECUTABLE} run util/fipstools/inject-hash.go util/fipstools/ar.go util/fipstools/const.go -o ${CMAKE_CURRENT_BINARY_DIR}/bcm.o -in-archive $<TARGET_FILE:bcm_hashunset>
|
|
|
|
DEPENDS bcm_hashunset ${CMAKE_SOURCE_DIR}/util/fipstools/inject-hash.go ${CMAKE_SOURCE_DIR}/util/fipstools/ar.go ${CMAKE_SOURCE_DIR}/util/fipstools/const.go
|
2017-04-04 22:21:43 +01:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
)
|
|
|
|
|
|
|
|
# The outputs of add_custom_command cannot be referenced outside of the
|
|
|
|
# CMakeLists.txt that defines it. Thus we have to wrap bcm.o in a custom target
|
|
|
|
# so that crypto can depend on it.
|
|
|
|
add_custom_target(bcm_o_target DEPENDS bcm.o)
|
|
|
|
|
|
|
|
add_library(
|
|
|
|
fipsmodule
|
|
|
|
|
|
|
|
OBJECT
|
|
|
|
|
|
|
|
is_fips.c
|
|
|
|
)
|
|
|
|
|
|
|
|
set_target_properties(fipsmodule PROPERTIES LINKER_LANGUAGE C)
|
|
|
|
else()
|
|
|
|
add_library(
|
|
|
|
fipsmodule
|
|
|
|
|
|
|
|
OBJECT
|
|
|
|
|
|
|
|
bcm.c
|
|
|
|
is_fips.c
|
|
|
|
|
|
|
|
${BCM_ASM_SOURCES}
|
|
|
|
)
|
|
|
|
endif()
|