diff --git a/CMakeLists.txt b/CMakeLists.txt index f7976e8c..18bed6aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,7 +58,7 @@ if(NOT SwiftASN1_FOUND) message("-- Vending swift-asn1") FetchContent_Declare(ASN1 GIT_REPOSITORY https://github.com/apple/swift-asn1 - GIT_TAG 1.1.0) + GIT_TAG 1.3.1) FetchContent_MakeAvailable(ASN1) endif() diff --git a/Package.swift b/Package.swift index 5b8bbd30..be039f59 100644 --- a/Package.swift +++ b/Package.swift @@ -22,6 +22,7 @@ // // BoringSSL Commit: aefa5d24da34ef77ac797bdbe684734e5bd870f4 +import class Foundation.ProcessInfo import PackageDescription // To develop this on Apple platforms, set this to true @@ -94,7 +95,7 @@ let package = Package( MANGLE_END */ ], dependencies: [ - .package(url: "https://github.com/apple/swift-asn1.git", from: "1.2.0") + // Dependencies are added below so that they can be switched between local and absolute URLs ], targets: [ .target( @@ -201,6 +202,17 @@ let package = Package( cxxLanguageStandard: .cxx14 ) +// Switch between local and remote dependencies depending on an environment variable +if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil { + package.dependencies += [ + .package(url: "https://github.com/apple/swift-asn1.git", from: "1.2.0"), + ] +} else { + package.dependencies += [ + .package(path: "../swift-asn1"), + ] +} + // --- STANDARD CROSS-REPO SETTINGS DO NOT EDIT --- // for target in package.targets { if target.type != .plugin { diff --git a/Sources/CCryptoBoringSSL/CMakeLists.txt b/Sources/CCryptoBoringSSL/CMakeLists.txt index 84dc11d4..58cc6f6d 100644 --- a/Sources/CCryptoBoringSSL/CMakeLists.txt +++ b/Sources/CCryptoBoringSSL/CMakeLists.txt @@ -123,7 +123,6 @@ add_library(CCryptoBoringSSL STATIC "crypto/fipsmodule/bcm.cc" "crypto/fipsmodule/fips_shared_support.cc" "crypto/hpke/hpke.cc" - "crypto/hrss/asm/poly_rq_mul.S" "crypto/hrss/hrss.cc" "crypto/kyber/kyber.cc" "crypto/lhash/lhash.cc" @@ -255,10 +254,11 @@ add_library(CCryptoBoringSSL STATIC "crypto/x509/x_x509.cc" "crypto/x509/x_x509a.cc" "gen/crypto/err_data.cc" - "third_party/fiat/asm/fiat_curve25519_adx_mul.S" - "third_party/fiat/asm/fiat_curve25519_adx_square.S" - "third_party/fiat/asm/fiat_p256_adx_mul.S" - "third_party/fiat/asm/fiat_p256_adx_sqr.S") + "$<$>:crypto/hrss/asm/poly_rq_mul.S>" + "$<$>:third_party/fiat/asm/fiat_curve25519_adx_mul.S>" + "$<$>:third_party/fiat/asm/fiat_curve25519_adx_square.S>" + "$<$>:third_party/fiat/asm/fiat_p256_adx_mul.S>" + "$<$>:third_party/fiat/asm/fiat_p256_adx_sqr.S>") if(CMAKE_SYSTEM_NAME STREQUAL Darwin AND CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64") target_sources(CCryptoBoringSSL PRIVATE @@ -346,8 +346,6 @@ target_link_libraries(CCryptoBoringSSL PUBLIC $<$>:Foundation> SwiftASN1) set_target_properties(CCryptoBoringSSL PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/include;${CMAKE_Swift_MODULE_DIRECTORY}" - // Workaround for missing MultiThreadedDLL for this ASM compiler on Windows - $<$:MSVC_RUNTIME_LIBRARY "MultiThreaded">) + INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/include;${CMAKE_Swift_MODULE_DIRECTORY}") set_property(GLOBAL APPEND PROPERTY SWIFT_CRYPTO_EXPORTS CCryptoBoringSSL) diff --git a/Sources/CCryptoBoringSSLShims/CMakeLists.txt b/Sources/CCryptoBoringSSLShims/CMakeLists.txt index 79b4fb6d..73d5e085 100644 --- a/Sources/CCryptoBoringSSLShims/CMakeLists.txt +++ b/Sources/CCryptoBoringSSLShims/CMakeLists.txt @@ -13,7 +13,8 @@ ##===----------------------------------------------------------------------===## add_library(CCryptoBoringSSLShims STATIC - "shims.c") + "shims.c" +) target_include_directories(CCryptoBoringSSLShims PUBLIC include diff --git a/Sources/Crypto/CMakeLists.txt b/Sources/Crypto/CMakeLists.txt index 3bc8e1bb..ae0f045a 100644 --- a/Sources/Crypto/CMakeLists.txt +++ b/Sources/Crypto/CMakeLists.txt @@ -91,7 +91,8 @@ add_library(Crypto "Util/PrettyBytes.swift" "Util/SafeCompare.swift" "Util/SecureBytes.swift" - "Util/Zeroization.swift") + "Util/Zeroization.swift" +) target_compile_definitions(Crypto PRIVATE "$<$:CRYPTO_IN_SWIFTPM>") diff --git a/Sources/CryptoBoringWrapper/CMakeLists.txt b/Sources/CryptoBoringWrapper/CMakeLists.txt index 33cc096e..980f33c4 100644 --- a/Sources/CryptoBoringWrapper/CMakeLists.txt +++ b/Sources/CryptoBoringWrapper/CMakeLists.txt @@ -19,7 +19,8 @@ add_library(CryptoBoringWrapper STATIC "EC/EllipticCurvePoint.swift" "Util/ArbitraryPrecisionInteger.swift" "Util/FiniteFieldArithmeticContext.swift" - "Util/RandomBytes.swift") + "Util/RandomBytes.swift" +) target_include_directories(CryptoBoringWrapper PUBLIC $ diff --git a/Sources/_CryptoExtras/CMakeLists.txt b/Sources/_CryptoExtras/CMakeLists.txt index 52bcb44c..8004a11e 100644 --- a/Sources/_CryptoExtras/CMakeLists.txt +++ b/Sources/_CryptoExtras/CMakeLists.txt @@ -62,7 +62,8 @@ add_library(_CryptoExtras "ZKPs/DLEQ.swift" "ZKPs/Prover.swift" "ZKPs/Verifier.swift" - "ZKPs/ZKPToolbox.swift") + "ZKPs/ZKPToolbox.swift" +) target_compile_options(_CryptoExtras PRIVATE -DCRYPTO_IN_SWIFTPM) diff --git a/scripts/update-cmake-lists.sh b/scripts/update-cmake-lists.sh index 3a4d65fe..7cec1c28 100755 --- a/scripts/update-cmake-lists.sh +++ b/scripts/update-cmake-lists.sh @@ -32,7 +32,7 @@ function update_cmakelists_source() { src_exts=("*.c" "*.swift" "*.cc") num_exts=${#src_exts[@]} - echo "Finding source files (" "${src_exts[@]}" ") platform independent assembly files under $src_root" + echo "Finding source files (" "${src_exts[@]}" ") and platform independent assembly files under $src_root" # Build file extensions argument for `find` declare -a exts_arg @@ -56,7 +56,10 @@ function update_cmakelists_source() { fi # Wrap quotes around each filename since it might contain spaces - srcs=$($find -L "${src_root}" -type f \( \( "${exts_arg[@]}" \) -o \( -name "*.S" -a ! -name "*x86_64*" -a ! -name "*arm*" -a ! -name "*apple*" -a ! -name "*linux*" \) \) -printf ' "%P"\n' | LC_ALL=POSIX sort) + srcs=$($find -L "${src_root}" -type f \( "${exts_arg[@]}" \) -printf ' "%P"\n' | LC_ALL=POSIX sort) + asm_srcs=$($find -L "${src_root}" -type f \( \( -name "*.S" -a ! -name "*x86_64*" -a ! -name "*arm*" -a ! -name "*apple*" -a ! -name "*linux*" \) \) -printf ' "$<$>:%P>"\n' | LC_ALL=POSIX sort) + + srcs="$srcs"$'\n'"$asm_srcs" echo "$srcs" # Update list of source files in CMakeLists.txt