2017-04-04 22:21:43 +01:00
|
|
|
include_directories(../../include)
|
|
|
|
|
2018-08-10 16:30:55 +01:00
|
|
|
if(${ARCH} STREQUAL "x86_64")
|
2017-04-04 22:21:43 +01:00
|
|
|
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()
|
|
|
|
|
2018-08-10 16:30:55 +01:00
|
|
|
if(${ARCH} STREQUAL "x86")
|
2017-04-04 22:21:43 +01:00
|
|
|
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()
|
|
|
|
|
2018-08-10 16:30:55 +01:00
|
|
|
if(${ARCH} STREQUAL "arm")
|
2017-04-04 22:21:43 +01:00
|
|
|
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()
|
|
|
|
|
2018-08-10 16:30:55 +01:00
|
|
|
if(${ARCH} STREQUAL "aarch64")
|
2017-04-04 22:21:43 +01:00
|
|
|
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()
|
|
|
|
|
2018-08-10 16:30:55 +01:00
|
|
|
if(${ARCH} STREQUAL "ppc64le")
|
2017-04-13 19:00:24 +01:00
|
|
|
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
|
|
|
|
)
|
|
|
|
|
Support symbol prefixes
- In base.h, if BORINGSSL_PREFIX is defined, include
boringssl_prefix_symbols.h
- In all .S files, if BORINGSSL_PREFIX is defined, include
boringssl_prefix_symbols_asm.h
- In base.h, BSSL_NAMESPACE_BEGIN and BSSL_NAMESPACE_END are
defined with appropriate values depending on whether
BORINGSSL_PREFIX is defined; these macros are used in place
of 'namespace bssl {' and '}'
- Add util/make_prefix_headers.go, which takes a list of symbols
and auto-generates the header files mentioned above
- In CMakeLists.txt, if BORINGSSL_PREFIX and BORINGSSL_PREFIX_SYMBOLS
are defined, run util/make_prefix_headers.go to generate header
files
- In various CMakeLists.txt files, add "global_target" that all
targets depend on to give us a place to hook logic that must run
before all other targets (in particular, the header file generation
logic)
- Document this in BUILDING.md, including the fact that it is
the caller's responsibility to provide the symbol list and keep it
up to date
- Note that this scheme has not been tested on Windows, and likely
does not work on it; Windows support will need to be added in a
future commit
Change-Id: If66a7157f46b5b66230ef91e15826b910cf979a2
Reviewed-on: https://boringssl-review.googlesource.com/31364
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
Reviewed-by: David Benjamin <davidben@google.com>
2018-08-27 02:53:36 +01:00
|
|
|
add_dependencies(bcm_c_generated_asm global_target)
|
|
|
|
|
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
|
|
|
|
)
|
|
|
|
|
Support symbol prefixes
- In base.h, if BORINGSSL_PREFIX is defined, include
boringssl_prefix_symbols.h
- In all .S files, if BORINGSSL_PREFIX is defined, include
boringssl_prefix_symbols_asm.h
- In base.h, BSSL_NAMESPACE_BEGIN and BSSL_NAMESPACE_END are
defined with appropriate values depending on whether
BORINGSSL_PREFIX is defined; these macros are used in place
of 'namespace bssl {' and '}'
- Add util/make_prefix_headers.go, which takes a list of symbols
and auto-generates the header files mentioned above
- In CMakeLists.txt, if BORINGSSL_PREFIX and BORINGSSL_PREFIX_SYMBOLS
are defined, run util/make_prefix_headers.go to generate header
files
- In various CMakeLists.txt files, add "global_target" that all
targets depend on to give us a place to hook logic that must run
before all other targets (in particular, the header file generation
logic)
- Document this in BUILDING.md, including the fact that it is
the caller's responsibility to provide the symbol list and keep it
up to date
- Note that this scheme has not been tested on Windows, and likely
does not work on it; Windows support will need to be added in a
future commit
Change-Id: If66a7157f46b5b66230ef91e15826b910cf979a2
Reviewed-on: https://boringssl-review.googlesource.com/31364
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
Reviewed-by: David Benjamin <davidben@google.com>
2018-08-27 02:53:36 +01:00
|
|
|
add_dependencies(bcm_hashunset global_target)
|
|
|
|
|
2017-04-04 22:21:43 +01:00
|
|
|
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
|
|
|
|
)
|
|
|
|
|
Support symbol prefixes
- In base.h, if BORINGSSL_PREFIX is defined, include
boringssl_prefix_symbols.h
- In all .S files, if BORINGSSL_PREFIX is defined, include
boringssl_prefix_symbols_asm.h
- In base.h, BSSL_NAMESPACE_BEGIN and BSSL_NAMESPACE_END are
defined with appropriate values depending on whether
BORINGSSL_PREFIX is defined; these macros are used in place
of 'namespace bssl {' and '}'
- Add util/make_prefix_headers.go, which takes a list of symbols
and auto-generates the header files mentioned above
- In CMakeLists.txt, if BORINGSSL_PREFIX and BORINGSSL_PREFIX_SYMBOLS
are defined, run util/make_prefix_headers.go to generate header
files
- In various CMakeLists.txt files, add "global_target" that all
targets depend on to give us a place to hook logic that must run
before all other targets (in particular, the header file generation
logic)
- Document this in BUILDING.md, including the fact that it is
the caller's responsibility to provide the symbol list and keep it
up to date
- Note that this scheme has not been tested on Windows, and likely
does not work on it; Windows support will need to be added in a
future commit
Change-Id: If66a7157f46b5b66230ef91e15826b910cf979a2
Reviewed-on: https://boringssl-review.googlesource.com/31364
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
Reviewed-by: David Benjamin <davidben@google.com>
2018-08-27 02:53:36 +01:00
|
|
|
add_dependencies(fipsmodule global_target)
|
|
|
|
|
2017-04-04 22:21:43 +01:00
|
|
|
set_target_properties(fipsmodule PROPERTIES LINKER_LANGUAGE C)
|
|
|
|
else()
|
|
|
|
add_library(
|
|
|
|
fipsmodule
|
|
|
|
|
|
|
|
OBJECT
|
|
|
|
|
|
|
|
bcm.c
|
|
|
|
is_fips.c
|
|
|
|
|
|
|
|
${BCM_ASM_SOURCES}
|
|
|
|
)
|
Support symbol prefixes
- In base.h, if BORINGSSL_PREFIX is defined, include
boringssl_prefix_symbols.h
- In all .S files, if BORINGSSL_PREFIX is defined, include
boringssl_prefix_symbols_asm.h
- In base.h, BSSL_NAMESPACE_BEGIN and BSSL_NAMESPACE_END are
defined with appropriate values depending on whether
BORINGSSL_PREFIX is defined; these macros are used in place
of 'namespace bssl {' and '}'
- Add util/make_prefix_headers.go, which takes a list of symbols
and auto-generates the header files mentioned above
- In CMakeLists.txt, if BORINGSSL_PREFIX and BORINGSSL_PREFIX_SYMBOLS
are defined, run util/make_prefix_headers.go to generate header
files
- In various CMakeLists.txt files, add "global_target" that all
targets depend on to give us a place to hook logic that must run
before all other targets (in particular, the header file generation
logic)
- Document this in BUILDING.md, including the fact that it is
the caller's responsibility to provide the symbol list and keep it
up to date
- Note that this scheme has not been tested on Windows, and likely
does not work on it; Windows support will need to be added in a
future commit
Change-Id: If66a7157f46b5b66230ef91e15826b910cf979a2
Reviewed-on: https://boringssl-review.googlesource.com/31364
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
Reviewed-by: David Benjamin <davidben@google.com>
2018-08-27 02:53:36 +01:00
|
|
|
|
|
|
|
add_dependencies(fipsmodule global_target)
|
2017-04-04 22:21:43 +01:00
|
|
|
endif()
|