mirror of
https://github.com/apple/swift-crypto
synced 2026-11-28 05:04:21 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80a6e3edc1 | ||
|
|
a1b800581e | ||
|
|
935c74be2f |
No files matched your search
+26
-2
@@ -3,7 +3,7 @@
|
|||||||
//
|
//
|
||||||
// This source file is part of the SwiftCrypto open source project
|
// This source file is part of the SwiftCrypto open source project
|
||||||
//
|
//
|
||||||
// Copyright (c) 2019 Apple Inc. and the SwiftCrypto project authors
|
// Copyright (c) 2019-2023 Apple Inc. and the SwiftCrypto project authors
|
||||||
// Licensed under Apache License v2.0
|
// Licensed under Apache License v2.0
|
||||||
//
|
//
|
||||||
// See LICENSE.txt for license information
|
// See LICENSE.txt for license information
|
||||||
@@ -47,6 +47,7 @@ if development {
|
|||||||
Platform.linux,
|
Platform.linux,
|
||||||
Platform.android,
|
Platform.android,
|
||||||
Platform.windows,
|
Platform.windows,
|
||||||
|
Platform.wasi,
|
||||||
]
|
]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
.target(name: "CCryptoBoringSSL", condition: .when(platforms: platforms)),
|
.target(name: "CCryptoBoringSSL", condition: .when(platforms: platforms)),
|
||||||
@@ -78,6 +79,13 @@ let package = Package(
|
|||||||
"hash.txt",
|
"hash.txt",
|
||||||
"include/boringssl_prefix_symbols_nasm.inc",
|
"include/boringssl_prefix_symbols_nasm.inc",
|
||||||
"CMakeLists.txt",
|
"CMakeLists.txt",
|
||||||
|
/*
|
||||||
|
* These files are excluded to support WASI libc which doesn't provide <netdb.h>.
|
||||||
|
* This is safe for all platforms as we do not rely on networking features.
|
||||||
|
*/
|
||||||
|
"crypto/bio/connect.c",
|
||||||
|
"crypto/bio/socket_helper.c",
|
||||||
|
"crypto/bio/socket.c"
|
||||||
],
|
],
|
||||||
cSettings: [
|
cSettings: [
|
||||||
/*
|
/*
|
||||||
@@ -86,6 +94,11 @@ let package = Package(
|
|||||||
* only. Unconditionally define it instead.
|
* only. Unconditionally define it instead.
|
||||||
*/
|
*/
|
||||||
.define("WIN32_LEAN_AND_MEAN"),
|
.define("WIN32_LEAN_AND_MEAN"),
|
||||||
|
/*
|
||||||
|
* These defines are required on Wasm/WASI, to disable use of pthread.
|
||||||
|
*/
|
||||||
|
.define("OPENSSL_NO_THREADS_CORRUPT_MEMORY_AND_LEAK_SECRETS_IF_THREADED", .when(platforms: [Platform.wasi])),
|
||||||
|
.define("OPENSSL_NO_ASM", .when(platforms: [Platform.wasi])),
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
.target(
|
.target(
|
||||||
@@ -107,7 +120,18 @@ let package = Package(
|
|||||||
],
|
],
|
||||||
swiftSettings: swiftSettings
|
swiftSettings: swiftSettings
|
||||||
),
|
),
|
||||||
.target(name: "_CryptoExtras", dependencies: ["CCryptoBoringSSL", "CCryptoBoringSSLShims", "CryptoBoringWrapper", "Crypto"]),
|
.target(
|
||||||
|
name: "_CryptoExtras",
|
||||||
|
dependencies: [
|
||||||
|
"CCryptoBoringSSL",
|
||||||
|
"CCryptoBoringSSLShims",
|
||||||
|
"CryptoBoringWrapper",
|
||||||
|
"Crypto"
|
||||||
|
],
|
||||||
|
exclude: [
|
||||||
|
"CMakeLists.txt",
|
||||||
|
]
|
||||||
|
),
|
||||||
.target(
|
.target(
|
||||||
name: "CryptoBoringWrapper",
|
name: "CryptoBoringWrapper",
|
||||||
dependencies: [
|
dependencies: [
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
##
|
##
|
||||||
## This source file is part of the SwiftCrypto open source project
|
## This source file is part of the SwiftCrypto open source project
|
||||||
##
|
##
|
||||||
## Copyright (c) 2021 Apple Inc. and the SwiftCrypto project authors
|
## Copyright (c) 2021-2023 Apple Inc. and the SwiftCrypto project authors
|
||||||
## Licensed under Apache License v2.0
|
## Licensed under Apache License v2.0
|
||||||
##
|
##
|
||||||
## See LICENSE.txt for license information
|
## See LICENSE.txt for license information
|
||||||
@@ -16,3 +16,4 @@ add_subdirectory(CCryptoBoringSSL)
|
|||||||
add_subdirectory(CCryptoBoringSSLShims)
|
add_subdirectory(CCryptoBoringSSLShims)
|
||||||
add_subdirectory(CryptoBoringWrapper)
|
add_subdirectory(CryptoBoringWrapper)
|
||||||
add_subdirectory(Crypto)
|
add_subdirectory(Crypto)
|
||||||
|
add_subdirectory(_CryptoExtras)
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
##===----------------------------------------------------------------------===##
|
||||||
|
##
|
||||||
|
## This source file is part of the SwiftCrypto open source project
|
||||||
|
##
|
||||||
|
## Copyright (c) 2023 Apple Inc. and the SwiftCrypto project authors
|
||||||
|
## Licensed under Apache License v2.0
|
||||||
|
##
|
||||||
|
## See LICENSE.txt for license information
|
||||||
|
## See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||||
|
##
|
||||||
|
## SPDX-License-Identifier: Apache-2.0
|
||||||
|
##
|
||||||
|
##===----------------------------------------------------------------------===##
|
||||||
|
|
||||||
|
add_library(_CryptoExtras
|
||||||
|
"AES/AES_GCM_SIV.swift"
|
||||||
|
"AES/Block Function.swift"
|
||||||
|
"AES/BoringSSL/AES_GCM_SIV_boring.swift"
|
||||||
|
"RSA/RSA.swift"
|
||||||
|
"RSA/RSA_boring.swift"
|
||||||
|
"RSA/RSA_security.swift"
|
||||||
|
"Util/BoringSSLHelpers.swift"
|
||||||
|
"Util/CryptoKitErrors_boring.swift"
|
||||||
|
"Util/DigestType.swift"
|
||||||
|
"Util/Error.swift"
|
||||||
|
"Util/PEMDocument.swift"
|
||||||
|
"Util/RandomBytes.swift")
|
||||||
|
|
||||||
|
target_include_directories(_CryptoExtras PRIVATE
|
||||||
|
$<TARGET_PROPERTY:CCryptoBoringSSL,INCLUDE_DIRECTORIES>
|
||||||
|
$<TARGET_PROPERTY:CCryptoBoringSSLShims,INCLUDE_DIRECTORIES>)
|
||||||
|
|
||||||
|
target_link_libraries(_CryptoExtras PUBLIC
|
||||||
|
$<$<NOT:$<PLATFORM_ID:Darwin>>:Foundation>
|
||||||
|
Crypto
|
||||||
|
CryptoBoringWrapper
|
||||||
|
CCryptoBoringSSL
|
||||||
|
CCryptoBoringSSLShims)
|
||||||
|
|
||||||
|
target_link_options(_CryptoExtras PRIVATE
|
||||||
|
"$<$<PLATFORM_ID:Darwin>:SHELL:-Xlinker -framework -Xlinker Security>")
|
||||||
|
|
||||||
|
set_target_properties(_CryptoExtras PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
|
||||||
|
|
||||||
|
set_property(GLOBAL APPEND PROPERTY SWIFT_CRYPTO_EXPORTS _CryptoExtras)
|
||||||
@@ -22,10 +22,12 @@
|
|||||||
function(get_swift_host_arch result_var_name)
|
function(get_swift_host_arch result_var_name)
|
||||||
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
|
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
|
||||||
set("${result_var_name}" "x86_64" PARENT_SCOPE)
|
set("${result_var_name}" "x86_64" PARENT_SCOPE)
|
||||||
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
|
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "AArch64|aarch64|arm64|ARM64")
|
||||||
set("${result_var_name}" "aarch64" PARENT_SCOPE)
|
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
||||||
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64")
|
set("${result_var_name}" "arm64" PARENT_SCOPE)
|
||||||
set("${result_var_name}" "aarch64" PARENT_SCOPE)
|
else()
|
||||||
|
set("${result_var_name}" "aarch64" PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "ppc64")
|
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "ppc64")
|
||||||
set("${result_var_name}" "powerpc64" PARENT_SCOPE)
|
set("${result_var_name}" "powerpc64" PARENT_SCOPE)
|
||||||
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "ppc64le")
|
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "ppc64le")
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
##
|
##
|
||||||
## This source file is part of the SwiftCrypto open source project
|
## This source file is part of the SwiftCrypto open source project
|
||||||
##
|
##
|
||||||
## Copyright (c) 2019-2021 Apple Inc. and the SwiftCrypto project authors
|
## Copyright (c) 2019-2023 Apple Inc. and the SwiftCrypto project authors
|
||||||
## Licensed under Apache License v2.0
|
## Licensed under Apache License v2.0
|
||||||
##
|
##
|
||||||
## See LICENSE.txt for license information
|
## See LICENSE.txt for license information
|
||||||
@@ -17,7 +17,7 @@ set -eu
|
|||||||
here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
function replace_acceptable_years() {
|
function replace_acceptable_years() {
|
||||||
# this needs to replace all acceptable forms with 'YEARS'
|
# this needs to replace all acceptable forms with 'YEARS'
|
||||||
sed -e 's/20[12][890]-20[12][1290]/YEARS/' -e 's/20[12][90123]/YEARS/'
|
sed -e 's/20[12][8901]-20[12][90123]/YEARS/' -e 's/20[12][90123]/YEARS/'
|
||||||
}
|
}
|
||||||
|
|
||||||
printf "=> Checking for unacceptable language... "
|
printf "=> Checking for unacceptable language... "
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
##
|
##
|
||||||
## This source file is part of the SwiftCrypto open source project
|
## This source file is part of the SwiftCrypto open source project
|
||||||
##
|
##
|
||||||
## Copyright (c) 2021 Apple Inc. and the SwiftCrypto project authors
|
## Copyright (c) 2021-2023 Apple Inc. and the SwiftCrypto project authors
|
||||||
## Licensed under Apache License v2.0
|
## Licensed under Apache License v2.0
|
||||||
##
|
##
|
||||||
## See LICENSE.txt for license information
|
## See LICENSE.txt for license information
|
||||||
@@ -80,6 +80,8 @@ function update_cmakelists_assembly() {
|
|||||||
|
|
||||||
update_cmakelists_source "CCryptoBoringSSL" "*.c"
|
update_cmakelists_source "CCryptoBoringSSL" "*.c"
|
||||||
update_cmakelists_source "CCryptoBoringSSLShims" "*.c"
|
update_cmakelists_source "CCryptoBoringSSLShims" "*.c"
|
||||||
|
update_cmakelists_source "CryptoBoringWrapper" "*.swift"
|
||||||
update_cmakelists_source "Crypto" "*.swift"
|
update_cmakelists_source "Crypto" "*.swift"
|
||||||
|
update_cmakelists_source "_CryptoExtras" "*.swift"
|
||||||
|
|
||||||
update_cmakelists_assembly "CCryptoBoringSSL"
|
update_cmakelists_assembly "CCryptoBoringSSL"
|
||||||
Reference in new issue
Block a user