add boringssl and xquic (#832)
* add boringssl * update go * fix boringssl * add xquic * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.luapull/834/head
parent
c6fad93dbc
commit
f2d4d4d811
4 changed files with 332 additions and 0 deletions
@ -0,0 +1,231 @@ |
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 6c70b55f9..22878365c 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -557,92 +557,5 @@ if(USE_CUSTOM_LIBCXX)
|
||||
target_link_libraries(libcxx libcxxabi)
|
||||
endif()
|
||||
|
||||
-# Add minimal googletest targets. The provided one has many side-effects, and
|
||||
-# googletest has a very straightforward build.
|
||||
-add_library(boringssl_gtest third_party/googletest/src/gtest-all.cc)
|
||||
-target_include_directories(boringssl_gtest PRIVATE third_party/googletest)
|
||||
-
|
||||
-include_directories(third_party/googletest/include)
|
||||
-
|
||||
-# Declare a dummy target to build all unit tests. Test targets should inject
|
||||
-# themselves as dependencies next to the target definition.
|
||||
-add_custom_target(all_tests)
|
||||
-
|
||||
-# On Windows, CRYPTO_TEST_DATA is too long to fit in command-line limits.
|
||||
-# TODO(davidben): CMake 3.12 has a list(JOIN) command. Use that when we've
|
||||
-# updated the minimum version.
|
||||
-set(EMBED_TEST_DATA_ARGS "")
|
||||
-foreach(arg ${CRYPTO_TEST_DATA})
|
||||
- set(EMBED_TEST_DATA_ARGS "${EMBED_TEST_DATA_ARGS}${arg}\n")
|
||||
-endforeach()
|
||||
-file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/embed_test_data_args.txt"
|
||||
- "${EMBED_TEST_DATA_ARGS}")
|
||||
-
|
||||
-add_custom_command(
|
||||
- OUTPUT crypto_test_data.cc
|
||||
- COMMAND ${GO_EXECUTABLE} run util/embed_test_data.go -file-list
|
||||
- "${CMAKE_CURRENT_BINARY_DIR}/embed_test_data_args.txt" >
|
||||
- "${CMAKE_CURRENT_BINARY_DIR}/crypto_test_data.cc"
|
||||
- DEPENDS util/embed_test_data.go ${CRYPTO_TEST_DATA}
|
||||
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
-
|
||||
-add_library(crypto_test_data OBJECT crypto_test_data.cc)
|
||||
-
|
||||
add_subdirectory(crypto)
|
||||
add_subdirectory(ssl)
|
||||
-add_subdirectory(ssl/test)
|
||||
-add_subdirectory(tool)
|
||||
-add_subdirectory(util/fipstools/cavp)
|
||||
-add_subdirectory(util/fipstools/acvp/modulewrapper)
|
||||
-add_subdirectory(decrepit)
|
||||
-
|
||||
-if(FUZZ)
|
||||
- if(LIBFUZZER_FROM_DEPS)
|
||||
- file(GLOB LIBFUZZER_SOURCES "util/bot/libFuzzer/*.cpp")
|
||||
- add_library(Fuzzer STATIC ${LIBFUZZER_SOURCES})
|
||||
- # libFuzzer does not pass our aggressive warnings. It also must be built
|
||||
- # without -fsanitize-coverage options or clang crashes.
|
||||
- set_target_properties(Fuzzer PROPERTIES COMPILE_FLAGS "-Wno-shadow -Wno-format-nonliteral -Wno-missing-prototypes -fsanitize-coverage=0")
|
||||
- endif()
|
||||
-
|
||||
- add_subdirectory(fuzz)
|
||||
-endif()
|
||||
-
|
||||
-if(UNIX AND NOT APPLE AND NOT ANDROID)
|
||||
- set(HANDSHAKER_ARGS "-handshaker-path" $<TARGET_FILE:handshaker>)
|
||||
-endif()
|
||||
-
|
||||
-if(FIPS)
|
||||
- add_custom_target(
|
||||
- acvp_tests
|
||||
- COMMAND ${GO_EXECUTABLE} build -o ${CMAKE_BINARY_DIR}/acvptool
|
||||
- boringssl.googlesource.com/boringssl/util/fipstools/acvp/acvptool
|
||||
- COMMAND ${GO_EXECUTABLE} build -o ${CMAKE_BINARY_DIR}/testmodulewrapper
|
||||
- boringssl.googlesource.com/boringssl/util/fipstools/acvp/acvptool/testmodulewrapper
|
||||
- COMMAND cd util/fipstools/acvp/acvptool/test &&
|
||||
- ${GO_EXECUTABLE} run check_expected.go
|
||||
- -tool ${CMAKE_BINARY_DIR}/acvptool
|
||||
- -module-wrappers modulewrapper:$<TARGET_FILE:modulewrapper>,testmodulewrapper:${CMAKE_BINARY_DIR}/testmodulewrapper
|
||||
- -tests tests.json
|
||||
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
- DEPENDS modulewrapper
|
||||
- USES_TERMINAL)
|
||||
-
|
||||
- add_custom_target(
|
||||
- fips_specific_tests_if_any
|
||||
- DEPENDS acvp_tests
|
||||
- )
|
||||
-else()
|
||||
- add_custom_target(fips_specific_tests_if_any)
|
||||
-endif()
|
||||
-
|
||||
-add_custom_target(
|
||||
- run_tests
|
||||
- COMMAND ${GO_EXECUTABLE} run util/all_tests.go -build-dir
|
||||
- ${CMAKE_BINARY_DIR}
|
||||
- COMMAND cd ssl/test/runner &&
|
||||
- ${GO_EXECUTABLE} test -shim-path $<TARGET_FILE:bssl_shim>
|
||||
- ${HANDSHAKER_ARGS} ${RUNNER_ARGS}
|
||||
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
- DEPENDS all_tests bssl_shim handshaker fips_specific_tests_if_any
|
||||
- USES_TERMINAL)
|
||||
diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt
|
||||
index d9cfa5c51..1dc878597 100644
|
||||
--- a/crypto/CMakeLists.txt
|
||||
+++ b/crypto/CMakeLists.txt
|
||||
@@ -91,7 +91,6 @@ function(perlasm dest src)
|
||||
endfunction()
|
||||
|
||||
add_subdirectory(fipsmodule)
|
||||
-add_subdirectory(test)
|
||||
|
||||
if(FIPS_DELOCATE OR FIPS_SHARED)
|
||||
SET_SOURCE_FILES_PROPERTIES(fipsmodule/bcm.o PROPERTIES EXTERNAL_OBJECT true)
|
||||
@@ -472,96 +471,3 @@ endif()
|
||||
if(USE_CUSTOM_LIBCXX)
|
||||
target_link_libraries(crypto libcxx)
|
||||
endif()
|
||||
-
|
||||
-# urandom_test is a separate binary because it needs to be able to observe the
|
||||
-# PRNG initialisation, which means that it can't have other tests running before
|
||||
-# it does.
|
||||
-add_executable(
|
||||
- urandom_test
|
||||
-
|
||||
- fipsmodule/rand/urandom_test.cc
|
||||
-)
|
||||
-
|
||||
-target_link_libraries(urandom_test test_support_lib boringssl_gtest crypto)
|
||||
-
|
||||
-add_dependencies(urandom_test global_target)
|
||||
-add_dependencies(all_tests urandom_test)
|
||||
-
|
||||
-add_executable(
|
||||
- crypto_test
|
||||
-
|
||||
- abi_self_test.cc
|
||||
- asn1/asn1_test.cc
|
||||
- base64/base64_test.cc
|
||||
- bio/bio_test.cc
|
||||
- blake2/blake2_test.cc
|
||||
- buf/buf_test.cc
|
||||
- bytestring/bytestring_test.cc
|
||||
- chacha/chacha_test.cc
|
||||
- cipher_extra/aead_test.cc
|
||||
- cipher_extra/cipher_test.cc
|
||||
- cmac/cmac_test.cc
|
||||
- compiler_test.cc
|
||||
- conf/conf_test.cc
|
||||
- constant_time_test.cc
|
||||
- cpu_arm_linux_test.cc
|
||||
- crypto_test.cc
|
||||
- curve25519/ed25519_test.cc
|
||||
- curve25519/spake25519_test.cc
|
||||
- curve25519/x25519_test.cc
|
||||
- ecdh_extra/ecdh_test.cc
|
||||
- dh_extra/dh_test.cc
|
||||
- digest_extra/digest_test.cc
|
||||
- dsa/dsa_test.cc
|
||||
- err/err_test.cc
|
||||
- evp/evp_extra_test.cc
|
||||
- evp/evp_test.cc
|
||||
- evp/pbkdf_test.cc
|
||||
- evp/scrypt_test.cc
|
||||
- fipsmodule/aes/aes_test.cc
|
||||
- fipsmodule/bn/bn_test.cc
|
||||
- fipsmodule/ec/ec_test.cc
|
||||
- fipsmodule/ec/p256-x86_64_test.cc
|
||||
- fipsmodule/ecdsa/ecdsa_test.cc
|
||||
- fipsmodule/md5/md5_test.cc
|
||||
- fipsmodule/modes/gcm_test.cc
|
||||
- fipsmodule/rand/ctrdrbg_test.cc
|
||||
- fipsmodule/rand/fork_detect_test.cc
|
||||
- fipsmodule/sha/sha_test.cc
|
||||
- hkdf/hkdf_test.cc
|
||||
- hpke/hpke_test.cc
|
||||
- hmac_extra/hmac_test.cc
|
||||
- hrss/hrss_test.cc
|
||||
- impl_dispatch_test.cc
|
||||
- lhash/lhash_test.cc
|
||||
- obj/obj_test.cc
|
||||
- pem/pem_test.cc
|
||||
- pkcs7/pkcs7_test.cc
|
||||
- pkcs8/pkcs8_test.cc
|
||||
- pkcs8/pkcs12_test.cc
|
||||
- poly1305/poly1305_test.cc
|
||||
- pool/pool_test.cc
|
||||
- rand_extra/rand_test.cc
|
||||
- refcount_test.cc
|
||||
- rsa_extra/rsa_test.cc
|
||||
- self_test.cc
|
||||
- stack/stack_test.cc
|
||||
- siphash/siphash_test.cc
|
||||
- test/file_test_gtest.cc
|
||||
- thread_test.cc
|
||||
- trust_token/trust_token_test.cc
|
||||
- x509/x509_test.cc
|
||||
- x509/x509_time_test.cc
|
||||
- x509v3/tab_test.cc
|
||||
-
|
||||
- $<TARGET_OBJECTS:crypto_test_data>
|
||||
- $<TARGET_OBJECTS:boringssl_gtest_main>
|
||||
-)
|
||||
-
|
||||
-add_dependencies(crypto_test global_target)
|
||||
-
|
||||
-target_link_libraries(crypto_test test_support_lib boringssl_gtest crypto)
|
||||
-if(WIN32)
|
||||
- target_link_libraries(crypto_test ws2_32)
|
||||
-endif()
|
||||
-add_dependencies(all_tests crypto_test)
|
||||
diff --git a/ssl/CMakeLists.txt b/ssl/CMakeLists.txt
|
||||
index 4f4abf8a4..2ee9b88fc 100644
|
||||
--- a/ssl/CMakeLists.txt
|
||||
+++ b/ssl/CMakeLists.txt
|
||||
@@ -46,20 +46,3 @@ add_dependencies(ssl global_target)
|
||||
|
||||
target_link_libraries(ssl crypto)
|
||||
|
||||
-add_executable(
|
||||
- ssl_test
|
||||
-
|
||||
- span_test.cc
|
||||
- ssl_test.cc
|
||||
- ssl_c_test.c
|
||||
-
|
||||
- $<TARGET_OBJECTS:boringssl_gtest_main>
|
||||
-)
|
||||
-
|
||||
-add_dependencies(ssl_test global_target)
|
||||
-
|
||||
-target_link_libraries(ssl_test test_support_lib boringssl_gtest ssl crypto)
|
||||
-if(WIN32)
|
||||
- target_link_libraries(ssl_test ws2_32)
|
||||
-endif()
|
||||
-add_dependencies(all_tests ssl_test)
|
@ -0,0 +1,63 @@ |
||||
package("boringssl") |
||||
set_homepage("https://boringssl.googlesource.com/boringssl") |
||||
set_description("A fork of OpenSSL that is designed to meet Google's needs.") |
||||
|
||||
add_urls("https://github.com/google/boringssl.git") |
||||
add_versions("2021.12.29", "d80f17d5c94b21c4fb2e82ee527bfe001b3553f2") |
||||
|
||||
add_patches("2021.12.29", path.join(os.scriptdir(), "patches", "2021.12.29", "cmake.patch"), "d8bb6312b87b8aad434ea3f9f4275f769af3cdbaab78adf400e8e3907443b505") |
||||
|
||||
add_deps("cmake", "go") |
||||
|
||||
if is_plat("linux") then |
||||
add_syslinks("pthread", "dl", "m") |
||||
elseif is_plat("windows") then |
||||
add_syslinks("advapi32") |
||||
add_deps("nasm") |
||||
end |
||||
add_links("ssl", "crypto") |
||||
|
||||
on_install("linux", "macosx", "windows", function (package) |
||||
import("net.fasturl") |
||||
local configs = {} |
||||
local proxyurls = {"https://goproxy.cn", "https://proxy.golang.org"} |
||||
fasturl.add(proxyurls) |
||||
proxyurls = fasturl.sort(proxyurls) |
||||
if #proxyurls > 0 then |
||||
os.setenv("GOPROXY", proxyurls[1]) |
||||
end |
||||
-- we need suppress "hidden symbol ... is referenced by DSO" |
||||
local cxflags |
||||
if not package:config("shared") and package:is_plat("linux") then |
||||
cxflags = "-DBORINGSSL_SHARED_LIBRARY" |
||||
end |
||||
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) |
||||
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) |
||||
io.replace("CMakeLists.txt", "-WX", "", {plain = true}) |
||||
import("package.tools.cmake").install(package, configs, {cxflags = cxflags, buildir = "build"}) |
||||
os.cp("include", package:installdir()) |
||||
if package:config("shared") then |
||||
if package:is_plat("windows") then |
||||
os.cp("build/ssl/*/ssl.dll", package:installdir("bin")) |
||||
os.cp("build/ssl/*/ssl.lib", package:installdir("lib")) |
||||
os.cp("build/crypto/*/crypto.dll", package:installdir("bin")) |
||||
os.cp("build/crypto/*/crypto.lib", package:installdir("lib")) |
||||
elseif package:is_plat("macosx") then |
||||
os.cp("build/ssl/libssl.dylib", package:installdir("lib")) |
||||
os.cp("build/crypto/libcrypto.dylib", package:installdir("lib")) |
||||
else |
||||
os.cp("build/ssl/libssl.so", package:installdir("lib")) |
||||
os.cp("build/crypto/libcrypto.so", package:installdir("lib")) |
||||
end |
||||
elseif package:is_plat("windows") then |
||||
os.cp("build/ssl/*/ssl.lib", package:installdir("lib")) |
||||
os.cp("build/crypto/*/crypto.lib", package:installdir("lib")) |
||||
else |
||||
os.cp("build/ssl/libssl.a", package:installdir("lib")) |
||||
os.cp("build/crypto/libcrypto.a", package:installdir("lib")) |
||||
end |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:has_cfuncs("SSL_new", {includes = "openssl/ssl.h"})) |
||||
end) |
@ -0,0 +1,37 @@ |
||||
package("xquic") |
||||
set_homepage("https://github.com/alibaba/xquic") |
||||
set_description("A client and server implementation of QUIC and HTTP/3 as specified by the IETF") |
||||
set_license("Apache-2.0") |
||||
|
||||
add_urls("https://github.com/alibaba/xquic.git") |
||||
add_versions("2022.01.08", "837c493d51952cd842b815f7d60c88efbad3b9eb") |
||||
|
||||
add_deps("cmake", "boringssl") |
||||
|
||||
on_install("linux", "macosx", function (package) |
||||
local configs = {"-DSSL_TYPE=boringssl"} |
||||
if package:is_plat("macosx") then |
||||
table.insert(configs, "-DPLATFORM=mac") |
||||
end |
||||
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) |
||||
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) |
||||
io.replace("CMakeLists.txt", "${SSL_LIB_PATH}", "", {plain = true}) |
||||
io.replace("CMakeLists.txt", "-Werror", "", {plain = true}) |
||||
io.replace("CMakeLists.txt", "include_directories(${SSL_INC_PATH})", "", {plain = true}) |
||||
import("package.tools.cmake").install(package, configs, {buildir = "build", packagedeps = "boringssl"}) |
||||
os.cp("include", package:installdir()) |
||||
if package:config("shared") then |
||||
if package:is_plat("macosx") then |
||||
os.cp("build/*.dylib", package:installdir("lib")) |
||||
else |
||||
os.cp("build/*.so", package:installdir("lib")) |
||||
end |
||||
else |
||||
os.cp("build/*.a", package:installdir("lib")) |
||||
end |
||||
|
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:has_cfuncs("xqc_engine_main_logic", {includes = "xquic/xquic.h"})) |
||||
end) |
Loading…
Reference in new issue