diff --git a/Package.swift b/Package.swift index f83a623c..4992797b 100644 --- a/Package.swift +++ b/Package.swift @@ -40,15 +40,16 @@ if development { "CryptoBoringWrapper" ] } else { - swiftSettings = [ - .define("CRYPTO_IN_SWIFTPM"), - ] let platforms: [Platform] = [ Platform.linux, Platform.android, Platform.windows, Platform.wasi, ] + swiftSettings = [ + .define("CRYPTO_IN_SWIFTPM"), + .define("CRYPTO_IN_SWIFTPM_FORCE_BUILD_API", .when(platforms: platforms)), + ] dependencies = [ .target(name: "CCryptoBoringSSL", condition: .when(platforms: platforms)), .target(name: "CCryptoBoringSSLShims", condition: .when(platforms: platforms)), diff --git a/Sources/Crypto/AEADs/AES/GCM/AES-GCM.swift b/Sources/Crypto/AEADs/AES/GCM/AES-GCM.swift index 30e1da07..d122556e 100644 --- a/Sources/Crypto/AEADs/AES/GCM/AES-GCM.swift +++ b/Sources/Crypto/AEADs/AES/GCM/AES-GCM.swift @@ -11,10 +11,10 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API typealias AESGCMImpl = CoreCryptoGCMImpl import Security #else diff --git a/Sources/Crypto/AEADs/AES/GCM/BoringSSL/AES-GCM_boring.swift b/Sources/Crypto/AEADs/AES/GCM/BoringSSL/AES-GCM_boring.swift index 92fc0202..c85ac49e 100644 --- a/Sources/Crypto/AEADs/AES/GCM/BoringSSL/AES-GCM_boring.swift +++ b/Sources/Crypto/AEADs/AES/GCM/BoringSSL/AES-GCM_boring.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else @_implementationOnly import CCryptoBoringSSL @@ -63,4 +63,4 @@ enum OpenSSLAESGCMImpl { } } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#endif // CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API diff --git a/Sources/Crypto/AEADs/ChachaPoly/BoringSSL/ChaChaPoly_boring.swift b/Sources/Crypto/AEADs/ChachaPoly/BoringSSL/ChaChaPoly_boring.swift index e7eea009..c4698aa1 100644 --- a/Sources/Crypto/AEADs/ChachaPoly/BoringSSL/ChaChaPoly_boring.swift +++ b/Sources/Crypto/AEADs/ChachaPoly/BoringSSL/ChaChaPoly_boring.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else @_implementationOnly import CCryptoBoringSSL @@ -71,4 +71,4 @@ enum OpenSSLChaChaPolyImpl { } } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#endif // CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API diff --git a/Sources/Crypto/AEADs/ChachaPoly/ChaChaPoly.swift b/Sources/Crypto/AEADs/ChachaPoly/ChaChaPoly.swift index a34d61c1..5b180f60 100644 --- a/Sources/Crypto/AEADs/ChachaPoly/ChaChaPoly.swift +++ b/Sources/Crypto/AEADs/ChachaPoly/ChaChaPoly.swift @@ -11,10 +11,10 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API typealias ChaChaPolyImpl = CoreCryptoChaChaPolyImpl import Security #else diff --git a/Sources/Crypto/AEADs/Cipher.swift b/Sources/Crypto/AEADs/Cipher.swift index 612952ab..62cf4639 100644 --- a/Sources/Crypto/AEADs/Cipher.swift +++ b/Sources/Crypto/AEADs/Cipher.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/AEADs/Nonces.swift b/Sources/Crypto/AEADs/Nonces.swift index 3ebcc420..9837275e 100644 --- a/Sources/Crypto/AEADs/Nonces.swift +++ b/Sources/Crypto/AEADs/Nonces.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/AEADs/Nonces.swift.gyb b/Sources/Crypto/AEADs/Nonces.swift.gyb index d891f973..91dd918a 100644 --- a/Sources/Crypto/AEADs/Nonces.swift.gyb +++ b/Sources/Crypto/AEADs/Nonces.swift.gyb @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/ASN1/ASN1.swift b/Sources/Crypto/ASN1/ASN1.swift index 755d01c2..2f946ec3 100644 --- a/Sources/Crypto/ASN1/ASN1.swift +++ b/Sources/Crypto/ASN1/ASN1.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Any.swift b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Any.swift index 2228f246..e43a0185 100644 --- a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Any.swift +++ b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Any.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1BitString.swift b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1BitString.swift index 80e694df..3bca15ab 100644 --- a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1BitString.swift +++ b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1BitString.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Boolean.swift b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Boolean.swift index 3fd156fc..02a005bf 100644 --- a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Boolean.swift +++ b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Boolean.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Identifier.swift b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Identifier.swift index a350846a..90cfeb3f 100644 --- a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Identifier.swift +++ b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Identifier.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Integer.swift b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Integer.swift index 513c96fa..47e329ac 100644 --- a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Integer.swift +++ b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Integer.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Null.swift b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Null.swift index 0dcb7888..53259ea0 100644 --- a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Null.swift +++ b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Null.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1OctetString.swift b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1OctetString.swift index d1a6d490..e3f889cf 100644 --- a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1OctetString.swift +++ b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1OctetString.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Strings.swift b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Strings.swift index c57dc2e6..d2a9517b 100644 --- a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Strings.swift +++ b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Strings.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/ASN1/Basic ASN1 Types/ArraySliceBigint.swift b/Sources/Crypto/ASN1/Basic ASN1 Types/ArraySliceBigint.swift index 22cab286..b472489f 100644 --- a/Sources/Crypto/ASN1/Basic ASN1 Types/ArraySliceBigint.swift +++ b/Sources/Crypto/ASN1/Basic ASN1 Types/ArraySliceBigint.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else diff --git a/Sources/Crypto/ASN1/Basic ASN1 Types/GeneralizedTime.swift b/Sources/Crypto/ASN1/Basic ASN1 Types/GeneralizedTime.swift index cb423a49..63d73874 100644 --- a/Sources/Crypto/ASN1/Basic ASN1 Types/GeneralizedTime.swift +++ b/Sources/Crypto/ASN1/Basic ASN1 Types/GeneralizedTime.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/ASN1/Basic ASN1 Types/ObjectIdentifier.swift b/Sources/Crypto/ASN1/Basic ASN1 Types/ObjectIdentifier.swift index 6160098e..a7dd5ce5 100644 --- a/Sources/Crypto/ASN1/Basic ASN1 Types/ObjectIdentifier.swift +++ b/Sources/Crypto/ASN1/Basic ASN1 Types/ObjectIdentifier.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/ASN1/ECDSASignature.swift b/Sources/Crypto/ASN1/ECDSASignature.swift index a89f40d7..85686409 100644 --- a/Sources/Crypto/ASN1/ECDSASignature.swift +++ b/Sources/Crypto/ASN1/ECDSASignature.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/ASN1/PEMDocument.swift b/Sources/Crypto/ASN1/PEMDocument.swift index f2f8d7e5..98ba079d 100644 --- a/Sources/Crypto/ASN1/PEMDocument.swift +++ b/Sources/Crypto/ASN1/PEMDocument.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/ASN1/PKCS8PrivateKey.swift b/Sources/Crypto/ASN1/PKCS8PrivateKey.swift index c35f7624..8df9dec1 100644 --- a/Sources/Crypto/ASN1/PKCS8PrivateKey.swift +++ b/Sources/Crypto/ASN1/PKCS8PrivateKey.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/ASN1/SEC1PrivateKey.swift b/Sources/Crypto/ASN1/SEC1PrivateKey.swift index 28f65cbb..dd347123 100644 --- a/Sources/Crypto/ASN1/SEC1PrivateKey.swift +++ b/Sources/Crypto/ASN1/SEC1PrivateKey.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/ASN1/SubjectPublicKeyInfo.swift b/Sources/Crypto/ASN1/SubjectPublicKeyInfo.swift index c82f6ec0..31f6b45b 100644 --- a/Sources/Crypto/ASN1/SubjectPublicKeyInfo.swift +++ b/Sources/Crypto/ASN1/SubjectPublicKeyInfo.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/CMakeLists.txt b/Sources/Crypto/CMakeLists.txt index 6fd22e7b..89041043 100644 --- a/Sources/Crypto/CMakeLists.txt +++ b/Sources/Crypto/CMakeLists.txt @@ -99,6 +99,12 @@ add_library(Crypto target_compile_definitions(Crypto PRIVATE "$<$:CRYPTO_IN_SWIFTPM>") + +if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "Android" OR CMAKE_SYSTEM_NAME STREQUAL "WASI") + target_compile_definitions(Crypto PRIVATE + "$<$:CRYPTO_IN_SWIFTPM_FORCE_BUILD_API>") +endif() + target_include_directories(Crypto PRIVATE $ $ diff --git a/Sources/Crypto/CryptoKitErrors.swift b/Sources/Crypto/CryptoKitErrors.swift index 96495333..315ae995 100644 --- a/Sources/Crypto/CryptoKitErrors.swift +++ b/Sources/Crypto/CryptoKitErrors.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else /// General cryptography errors used by CryptoKit. diff --git a/Sources/Crypto/Digests/BoringSSL/Digest_boring.swift b/Sources/Crypto/Digests/BoringSSL/Digest_boring.swift index 0e1eecc1..20a7a2c7 100644 --- a/Sources/Crypto/Digests/BoringSSL/Digest_boring.swift +++ b/Sources/Crypto/Digests/BoringSSL/Digest_boring.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else @_implementationOnly import CCryptoBoringSSL @@ -144,4 +144,4 @@ extension DigestContext { static let sha512 = DigestType(CCryptoBoringSSL_EVP_sha512()) } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#endif // CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API diff --git a/Sources/Crypto/Digests/Digest.swift b/Sources/Crypto/Digests/Digest.swift index b4443f91..653a026a 100644 --- a/Sources/Crypto/Digests/Digest.swift +++ b/Sources/Crypto/Digests/Digest.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/Digests/Digests.swift b/Sources/Crypto/Digests/Digests.swift index 989da9c5..ff08b436 100644 --- a/Sources/Crypto/Digests/Digests.swift +++ b/Sources/Crypto/Digests/Digests.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else // MARK: - Generated file, do NOT edit diff --git a/Sources/Crypto/Digests/Digests.swift.gyb b/Sources/Crypto/Digests/Digests.swift.gyb index d50f45ab..401e576c 100644 --- a/Sources/Crypto/Digests/Digests.swift.gyb +++ b/Sources/Crypto/Digests/Digests.swift.gyb @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else // MARK: - Generated file, do NOT edit diff --git a/Sources/Crypto/Digests/HashFunctions.swift b/Sources/Crypto/Digests/HashFunctions.swift index 0aab831d..20280e06 100644 --- a/Sources/Crypto/Digests/HashFunctions.swift +++ b/Sources/Crypto/Digests/HashFunctions.swift @@ -11,10 +11,10 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API typealias DigestImpl = CoreCryptoDigestImpl #else typealias DigestImpl = OpenSSLDigestImpl @@ -43,7 +43,7 @@ import Foundation public protocol HashFunction { /// The number of bytes that represents the hash function’s internal state. static var blockByteCount: Int { get } - #if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API + #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API /// The type of the digest returned by the hash function. associatedtype Digest: CryptoKit.Digest #else diff --git a/Sources/Crypto/Digests/HashFunctions_SHA2.swift b/Sources/Crypto/Digests/HashFunctions_SHA2.swift index 3aaa7b64..d14b9c04 100644 --- a/Sources/Crypto/Digests/HashFunctions_SHA2.swift +++ b/Sources/Crypto/Digests/HashFunctions_SHA2.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else /// An implementation of Secure Hashing Algorithm 2 (SHA-2) hashing with a diff --git a/Sources/Crypto/HPKE/Ciphersuite/HPKE-AEAD.swift b/Sources/Crypto/HPKE/Ciphersuite/HPKE-AEAD.swift index 11dd4399..19248974 100644 --- a/Sources/Crypto/HPKE/Ciphersuite/HPKE-AEAD.swift +++ b/Sources/Crypto/HPKE/Ciphersuite/HPKE-AEAD.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/HPKE/Ciphersuite/HPKE-Ciphersuite.swift b/Sources/Crypto/HPKE/Ciphersuite/HPKE-Ciphersuite.swift index 60bb1a89..25e5b08c 100644 --- a/Sources/Crypto/HPKE/Ciphersuite/HPKE-Ciphersuite.swift +++ b/Sources/Crypto/HPKE/Ciphersuite/HPKE-Ciphersuite.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/HPKE/Ciphersuite/HPKE-KDF.swift b/Sources/Crypto/HPKE/Ciphersuite/HPKE-KDF.swift index d3911530..1d596f12 100644 --- a/Sources/Crypto/HPKE/Ciphersuite/HPKE-KDF.swift +++ b/Sources/Crypto/HPKE/Ciphersuite/HPKE-KDF.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/HPKE/Ciphersuite/HPKE-KexKeyDerivation.swift b/Sources/Crypto/HPKE/Ciphersuite/HPKE-KexKeyDerivation.swift index 2ad6594d..4bbfbcb9 100644 --- a/Sources/Crypto/HPKE/Ciphersuite/HPKE-KexKeyDerivation.swift +++ b/Sources/Crypto/HPKE/Ciphersuite/HPKE-KexKeyDerivation.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/HPKE/Ciphersuite/HPKE-LabeledExtract.swift b/Sources/Crypto/HPKE/Ciphersuite/HPKE-LabeledExtract.swift index 9949c499..d7dc077a 100644 --- a/Sources/Crypto/HPKE/Ciphersuite/HPKE-LabeledExtract.swift +++ b/Sources/Crypto/HPKE/Ciphersuite/HPKE-LabeledExtract.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/HPKE/Ciphersuite/HPKE-Utils.swift b/Sources/Crypto/HPKE/Ciphersuite/HPKE-Utils.swift index bf40862a..92c9657f 100644 --- a/Sources/Crypto/HPKE/Ciphersuite/HPKE-Utils.swift +++ b/Sources/Crypto/HPKE/Ciphersuite/HPKE-Utils.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/HPKE/Ciphersuite/KEM/Conformances/DHKEM.swift b/Sources/Crypto/HPKE/Ciphersuite/KEM/Conformances/DHKEM.swift index b8224a9f..6b99517b 100644 --- a/Sources/Crypto/HPKE/Ciphersuite/KEM/Conformances/DHKEM.swift +++ b/Sources/Crypto/HPKE/Ciphersuite/KEM/Conformances/DHKEM.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/HPKE/Ciphersuite/KEM/Conformances/HPKE-KEM-Curve25519.swift b/Sources/Crypto/HPKE/Ciphersuite/KEM/Conformances/HPKE-KEM-Curve25519.swift index 2fbd8949..e846526e 100644 --- a/Sources/Crypto/HPKE/Ciphersuite/KEM/Conformances/HPKE-KEM-Curve25519.swift +++ b/Sources/Crypto/HPKE/Ciphersuite/KEM/Conformances/HPKE-KEM-Curve25519.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/HPKE/Ciphersuite/KEM/Conformances/HPKE-NIST-EC-KEMs.swift b/Sources/Crypto/HPKE/Ciphersuite/KEM/Conformances/HPKE-NIST-EC-KEMs.swift index ecf47362..1b921297 100644 --- a/Sources/Crypto/HPKE/Ciphersuite/KEM/Conformances/HPKE-NIST-EC-KEMs.swift +++ b/Sources/Crypto/HPKE/Ciphersuite/KEM/Conformances/HPKE-NIST-EC-KEMs.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/HPKE/Ciphersuite/KEM/HPKE-KEM.swift b/Sources/Crypto/HPKE/Ciphersuite/KEM/HPKE-KEM.swift index eeb7b832..c9c9ad96 100644 --- a/Sources/Crypto/HPKE/Ciphersuite/KEM/HPKE-KEM.swift +++ b/Sources/Crypto/HPKE/Ciphersuite/KEM/HPKE-KEM.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/HPKE/HPKE-Errors.swift b/Sources/Crypto/HPKE/HPKE-Errors.swift index bcd150af..ffc621a6 100644 --- a/Sources/Crypto/HPKE/HPKE-Errors.swift +++ b/Sources/Crypto/HPKE/HPKE-Errors.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/HPKE/HPKE.swift b/Sources/Crypto/HPKE/HPKE.swift index 5b43261f..e49569e5 100644 --- a/Sources/Crypto/HPKE/HPKE.swift +++ b/Sources/Crypto/HPKE/HPKE.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/HPKE/Key Schedule/HPKE-Context.swift b/Sources/Crypto/HPKE/Key Schedule/HPKE-Context.swift index 20cbfc05..e63c81b8 100644 --- a/Sources/Crypto/HPKE/Key Schedule/HPKE-Context.swift +++ b/Sources/Crypto/HPKE/Key Schedule/HPKE-Context.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/HPKE/Key Schedule/HPKE-KeySchedule.swift b/Sources/Crypto/HPKE/Key Schedule/HPKE-KeySchedule.swift index 5ce9cff4..02960a31 100644 --- a/Sources/Crypto/HPKE/Key Schedule/HPKE-KeySchedule.swift +++ b/Sources/Crypto/HPKE/Key Schedule/HPKE-KeySchedule.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/HPKE/Modes/HPKE-Modes.swift b/Sources/Crypto/HPKE/Modes/HPKE-Modes.swift index 464bb95c..f0a3d5f6 100644 --- a/Sources/Crypto/HPKE/Modes/HPKE-Modes.swift +++ b/Sources/Crypto/HPKE/Modes/HPKE-Modes.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else diff --git a/Sources/Crypto/Insecure/Insecure.swift b/Sources/Crypto/Insecure/Insecure.swift index b2bc7b6f..1fe53ee1 100644 --- a/Sources/Crypto/Insecure/Insecure.swift +++ b/Sources/Crypto/Insecure/Insecure.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else /// A container for older, cryptographically insecure algorithms. diff --git a/Sources/Crypto/Insecure/Insecure_HashFunctions.swift b/Sources/Crypto/Insecure/Insecure_HashFunctions.swift index 6c39eb8f..5352e6d8 100644 --- a/Sources/Crypto/Insecure/Insecure_HashFunctions.swift +++ b/Sources/Crypto/Insecure/Insecure_HashFunctions.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else extension Insecure { diff --git a/Sources/Crypto/KEM/KEM.swift b/Sources/Crypto/KEM/KEM.swift index db3f5044..80bd46ae 100644 --- a/Sources/Crypto/KEM/KEM.swift +++ b/Sources/Crypto/KEM/KEM.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/Key Agreement/BoringSSL/ECDH_boring.swift b/Sources/Crypto/Key Agreement/BoringSSL/ECDH_boring.swift index 5041bb0d..98bf29ae 100644 --- a/Sources/Crypto/Key Agreement/BoringSSL/ECDH_boring.swift +++ b/Sources/Crypto/Key Agreement/BoringSSL/ECDH_boring.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else @_implementationOnly import CCryptoBoringSSL @@ -36,4 +36,4 @@ extension P521.KeyAgreement.PrivateKey { return SharedSecret(ss: key) } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#endif // CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API diff --git a/Sources/Crypto/Key Agreement/DH.swift b/Sources/Crypto/Key Agreement/DH.swift index 27e788b2..42326b49 100644 --- a/Sources/Crypto/Key Agreement/DH.swift +++ b/Sources/Crypto/Key Agreement/DH.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/Key Agreement/ECDH.swift b/Sources/Crypto/Key Agreement/ECDH.swift index a93126e1..941fc61b 100644 --- a/Sources/Crypto/Key Agreement/ECDH.swift +++ b/Sources/Crypto/Key Agreement/ECDH.swift @@ -11,10 +11,10 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API typealias NISTCurvePublicKeyImpl = CoreCryptoNISTCurvePublicKeyImpl typealias NISTCurvePrivateKeyImpl = CoreCryptoNISTCurvePrivateKeyImpl #else @@ -1325,7 +1325,7 @@ extension P256.KeyAgreement.PrivateKey: DiffieHellmanKeyAgreement { /// key from this user to create the shared secret. /// - Returns: The computed shared secret. public func sharedSecretFromKeyAgreement(with publicKeyShare: P256.KeyAgreement.PublicKey) throws -> SharedSecret { - #if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API + #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API return try self.coreCryptoSharedSecretFromKeyAgreement(with: publicKeyShare) #else return try self.openSSLSharedSecretFromKeyAgreement(with: publicKeyShare) @@ -1341,7 +1341,7 @@ extension P384.KeyAgreement.PrivateKey: DiffieHellmanKeyAgreement { /// key from this user to create the shared secret. /// - Returns: The computed shared secret. public func sharedSecretFromKeyAgreement(with publicKeyShare: P384.KeyAgreement.PublicKey) throws -> SharedSecret { - #if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API + #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API return try self.coreCryptoSharedSecretFromKeyAgreement(with: publicKeyShare) #else return try self.openSSLSharedSecretFromKeyAgreement(with: publicKeyShare) @@ -1357,7 +1357,7 @@ extension P521.KeyAgreement.PrivateKey: DiffieHellmanKeyAgreement { /// key from this user to create the shared secret. /// - Returns: The computed shared secret. public func sharedSecretFromKeyAgreement(with publicKeyShare: P521.KeyAgreement.PublicKey) throws -> SharedSecret { - #if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API + #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API return try self.coreCryptoSharedSecretFromKeyAgreement(with: publicKeyShare) #else return try self.openSSLSharedSecretFromKeyAgreement(with: publicKeyShare) diff --git a/Sources/Crypto/Key Agreement/ECDH.swift.gyb b/Sources/Crypto/Key Agreement/ECDH.swift.gyb index 7dd4d437..5c738f0c 100644 --- a/Sources/Crypto/Key Agreement/ECDH.swift.gyb +++ b/Sources/Crypto/Key Agreement/ECDH.swift.gyb @@ -11,10 +11,10 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API typealias NISTCurvePublicKeyImpl = CoreCryptoNISTCurvePublicKeyImpl typealias NISTCurvePrivateKeyImpl = CoreCryptoNISTCurvePrivateKeyImpl #else @@ -278,7 +278,7 @@ extension ${CURVE}.KeyAgreement.PrivateKey: DiffieHellmanKeyAgreement { /// key from this user to create the shared secret. /// - Returns: The computed shared secret. public func sharedSecretFromKeyAgreement(with publicKeyShare: ${CURVE}.KeyAgreement.PublicKey) throws -> SharedSecret { - #if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API + #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API return try self.coreCryptoSharedSecretFromKeyAgreement(with: publicKeyShare) #else return try self.openSSLSharedSecretFromKeyAgreement(with: publicKeyShare) diff --git a/Sources/Crypto/Key Derivation/HKDF.swift b/Sources/Crypto/Key Derivation/HKDF.swift index 0ab35197..5f47c2fb 100644 --- a/Sources/Crypto/Key Derivation/HKDF.swift +++ b/Sources/Crypto/Key Derivation/HKDF.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/Key Wrapping/AESWrap.swift b/Sources/Crypto/Key Wrapping/AESWrap.swift index b6b721fe..50519d63 100644 --- a/Sources/Crypto/Key Wrapping/AESWrap.swift +++ b/Sources/Crypto/Key Wrapping/AESWrap.swift @@ -11,12 +11,12 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API typealias AESWRAPImpl = CoreCryptoAESWRAPImpl #else typealias AESWRAPImpl = BoringSSLAESWRAPImpl diff --git a/Sources/Crypto/Key Wrapping/BoringSSL/AESWrap_boring.swift b/Sources/Crypto/Key Wrapping/BoringSSL/AESWrap_boring.swift index 333bcb70..bb96bf87 100644 --- a/Sources/Crypto/Key Wrapping/BoringSSL/AESWrap_boring.swift +++ b/Sources/Crypto/Key Wrapping/BoringSSL/AESWrap_boring.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else @_implementationOnly import CCryptoBoringSSL @@ -116,4 +116,4 @@ extension SymmetricKey { } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#endif // CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API diff --git a/Sources/Crypto/Keys/EC/BoringSSL/Ed25519_boring.swift b/Sources/Crypto/Keys/EC/BoringSSL/Ed25519_boring.swift index c70d4953..17a4233b 100644 --- a/Sources/Crypto/Keys/EC/BoringSSL/Ed25519_boring.swift +++ b/Sources/Crypto/Keys/EC/BoringSSL/Ed25519_boring.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else @_implementationOnly import CCryptoBoringSSL @@ -105,4 +105,4 @@ extension Curve25519.Signing { } } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#endif // CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API diff --git a/Sources/Crypto/Keys/EC/BoringSSL/EllipticCurvePoint_boring.swift b/Sources/Crypto/Keys/EC/BoringSSL/EllipticCurvePoint_boring.swift index f32ce2ec..84283ddf 100644 --- a/Sources/Crypto/Keys/EC/BoringSSL/EllipticCurvePoint_boring.swift +++ b/Sources/Crypto/Keys/EC/BoringSSL/EllipticCurvePoint_boring.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else @_implementationOnly import CCryptoBoringSSL @@ -79,4 +79,4 @@ extension EllipticCurvePoint { return (x: x, y: y) } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#endif // CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API diff --git a/Sources/Crypto/Keys/EC/BoringSSL/EllipticCurve_boring.swift b/Sources/Crypto/Keys/EC/BoringSSL/EllipticCurve_boring.swift index 0d3acbfc..3bfc6f2a 100644 --- a/Sources/Crypto/Keys/EC/BoringSSL/EllipticCurve_boring.swift +++ b/Sources/Crypto/Keys/EC/BoringSSL/EllipticCurve_boring.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else @_implementationOnly import CCryptoBoringSSL @@ -120,4 +120,4 @@ extension BoringSSLEllipticCurveGroup.CurveName { } } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#endif // CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API diff --git a/Sources/Crypto/Keys/EC/BoringSSL/NISTCurvesKeys_boring.swift b/Sources/Crypto/Keys/EC/BoringSSL/NISTCurvesKeys_boring.swift index 21955249..d7439b99 100644 --- a/Sources/Crypto/Keys/EC/BoringSSL/NISTCurvesKeys_boring.swift +++ b/Sources/Crypto/Keys/EC/BoringSSL/NISTCurvesKeys_boring.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else @_implementationOnly import CCryptoBoringSSL @@ -629,4 +629,4 @@ func _isCompactRepresentable(group: BoringSSLEllipticCurveGroup, publicKeyPoint: // The point is compact representable if y is less than or equal to newY. return y <= newY } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#endif // CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API diff --git a/Sources/Crypto/Keys/EC/BoringSSL/X25519Keys_boring.swift b/Sources/Crypto/Keys/EC/BoringSSL/X25519Keys_boring.swift index 61705b8f..51cbeced 100644 --- a/Sources/Crypto/Keys/EC/BoringSSL/X25519Keys_boring.swift +++ b/Sources/Crypto/Keys/EC/BoringSSL/X25519Keys_boring.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else @_implementationOnly import CCryptoBoringSSL @@ -133,4 +133,4 @@ extension Curve25519.KeyAgreement { } } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#endif // CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API diff --git a/Sources/Crypto/Keys/EC/Curve25519.swift b/Sources/Crypto/Keys/EC/Curve25519.swift index 08773140..87c91302 100644 --- a/Sources/Crypto/Keys/EC/Curve25519.swift +++ b/Sources/Crypto/Keys/EC/Curve25519.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else /// An elliptic curve that enables X25519 key agreement and Ed25519 signatures. diff --git a/Sources/Crypto/Keys/EC/Ed25519Keys.swift b/Sources/Crypto/Keys/EC/Ed25519Keys.swift index cffa5ec1..71e8ba45 100644 --- a/Sources/Crypto/Keys/EC/Ed25519Keys.swift +++ b/Sources/Crypto/Keys/EC/Ed25519Keys.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation @@ -26,7 +26,7 @@ extension Curve25519 { /// A mechanism used to create or verify a cryptographic signature using /// Ed25519. public enum Signing { - #if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API + #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API typealias Curve25519PrivateKeyImpl = Curve25519.Signing.CoreCryptoCurve25519PrivateKeyImpl typealias Curve25519PublicKeyImpl = Curve25519.Signing.CoreCryptoCurve25519PublicKeyImpl #else diff --git a/Sources/Crypto/Keys/EC/NISTCurvesKeys.swift b/Sources/Crypto/Keys/EC/NISTCurvesKeys.swift index e6129404..fe0541e9 100644 --- a/Sources/Crypto/Keys/EC/NISTCurvesKeys.swift +++ b/Sources/Crypto/Keys/EC/NISTCurvesKeys.swift @@ -13,10 +13,10 @@ //===----------------------------------------------------------------------===// import Foundation -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API typealias SupportedCurveDetailsImpl = CorecryptoSupportedNISTCurve #else typealias SupportedCurveDetailsImpl = OpenSSLSupportedNISTCurve diff --git a/Sources/Crypto/Keys/EC/X25519Keys.swift b/Sources/Crypto/Keys/EC/X25519Keys.swift index bbe585bd..acb04e9e 100644 --- a/Sources/Crypto/Keys/EC/X25519Keys.swift +++ b/Sources/Crypto/Keys/EC/X25519Keys.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation @@ -26,7 +26,7 @@ extension Curve25519 { /// A mechanism used to create a shared secret between two users by /// performing X25519 key agreement. public enum KeyAgreement { - #if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API + #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API typealias Curve25519PrivateKeyImpl = Curve25519.KeyAgreement.CoreCryptoCurve25519PrivateKeyImpl typealias Curve25519PublicKeyImpl = Curve25519.KeyAgreement.CoreCryptoCurve25519PublicKeyImpl #else diff --git a/Sources/Crypto/Keys/Symmetric/SymmetricKeys.swift b/Sources/Crypto/Keys/Symmetric/SymmetricKeys.swift index 5a0e243c..1696436d 100644 --- a/Sources/Crypto/Keys/Symmetric/SymmetricKeys.swift +++ b/Sources/Crypto/Keys/Symmetric/SymmetricKeys.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/Message Authentication Codes/HMAC/HMAC.swift b/Sources/Crypto/Message Authentication Codes/HMAC/HMAC.swift index b62d5858..53b1f15a 100644 --- a/Sources/Crypto/Message Authentication Codes/HMAC/HMAC.swift +++ b/Sources/Crypto/Message Authentication Codes/HMAC/HMAC.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/Message Authentication Codes/MACFunctions.swift b/Sources/Crypto/Message Authentication Codes/MACFunctions.swift index dc39f3a3..012423dd 100644 --- a/Sources/Crypto/Message Authentication Codes/MACFunctions.swift +++ b/Sources/Crypto/Message Authentication Codes/MACFunctions.swift @@ -11,14 +11,14 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation protocol MACAlgorithm { associatedtype Key - #if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API + #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API associatedtype MAC: CryptoKit.MessageAuthenticationCode #else associatedtype MAC: Crypto.MessageAuthenticationCode diff --git a/Sources/Crypto/Message Authentication Codes/MessageAuthenticationCode.swift b/Sources/Crypto/Message Authentication Codes/MessageAuthenticationCode.swift index e049c274..10b6e12c 100644 --- a/Sources/Crypto/Message Authentication Codes/MessageAuthenticationCode.swift +++ b/Sources/Crypto/Message Authentication Codes/MessageAuthenticationCode.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/PRF/AES.swift b/Sources/Crypto/PRF/AES.swift index 4a395355..7b045109 100644 --- a/Sources/Crypto/PRF/AES.swift +++ b/Sources/Crypto/PRF/AES.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else /// A container for Advanced Encryption Standard (AES) ciphers. diff --git a/Sources/Crypto/Signatures/BoringSSL/ECDSASignature_boring.swift b/Sources/Crypto/Signatures/BoringSSL/ECDSASignature_boring.swift index 798b007f..87a9a31c 100644 --- a/Sources/Crypto/Signatures/BoringSSL/ECDSASignature_boring.swift +++ b/Sources/Crypto/Signatures/BoringSSL/ECDSASignature_boring.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else @_implementationOnly import CCryptoBoringSSL @@ -104,4 +104,4 @@ class ECDSASignature { try body(self._baseSig) } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#endif // CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API diff --git a/Sources/Crypto/Signatures/BoringSSL/ECDSA_boring.swift b/Sources/Crypto/Signatures/BoringSSL/ECDSA_boring.swift index f3597207..7b0a79bf 100644 --- a/Sources/Crypto/Signatures/BoringSSL/ECDSA_boring.swift +++ b/Sources/Crypto/Signatures/BoringSSL/ECDSA_boring.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else @_implementationOnly import CCryptoBoringSSL @@ -132,4 +132,4 @@ extension P521.Signing.PublicKey { return self.impl.key.isValidSignature(baseSignature, for: digest) } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#endif // CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API diff --git a/Sources/Crypto/Signatures/BoringSSL/EdDSA_boring.swift b/Sources/Crypto/Signatures/BoringSSL/EdDSA_boring.swift index cef1f2d0..5fd65e44 100644 --- a/Sources/Crypto/Signatures/BoringSSL/EdDSA_boring.swift +++ b/Sources/Crypto/Signatures/BoringSSL/EdDSA_boring.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else @_implementationOnly import CCryptoBoringSSL @@ -108,4 +108,4 @@ extension Curve25519.Signing.PrivateKey { return signature } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#endif // CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API diff --git a/Sources/Crypto/Signatures/ECDSA.swift b/Sources/Crypto/Signatures/ECDSA.swift index f5e6bda3..a609aed3 100644 --- a/Sources/Crypto/Signatures/ECDSA.swift +++ b/Sources/Crypto/Signatures/ECDSA.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation @@ -140,7 +140,7 @@ extension P256.Signing.PrivateKey: DigestSigner { /// algorithm employs randomization to generate a different signature on /// every call, even for the same data and key. public func signature(for digest: D) throws -> P256.Signing.ECDSASignature { - #if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API + #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API return try self.coreCryptoSignature(for: digest) #else return try self.openSSLSignature(for: digest) @@ -173,7 +173,7 @@ extension P256.Signing.PublicKey: DigestValidator { /// - Returns: A Boolean value that’s `true` if the signature is valid for /// the given digest; otherwise, `false`. public func isValidSignature(_ signature: P256.Signing.ECDSASignature, for digest: D) -> Bool { - #if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API + #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API return self.coreCryptoIsValidSignature(signature, for: digest) #else return self.openSSLIsValidSignature(signature, for: digest) @@ -303,7 +303,7 @@ extension P384.Signing.PrivateKey: DigestSigner { /// algorithm employs randomization to generate a different signature on /// every call, even for the same data and key. public func signature(for digest: D) throws -> P384.Signing.ECDSASignature { - #if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API + #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API return try self.coreCryptoSignature(for: digest) #else return try self.openSSLSignature(for: digest) @@ -336,7 +336,7 @@ extension P384.Signing.PublicKey: DigestValidator { /// - Returns: A Boolean value that’s `true` if the signature is valid for /// the given digest; otherwise, `false`. public func isValidSignature(_ signature: P384.Signing.ECDSASignature, for digest: D) -> Bool { - #if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API + #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API return self.coreCryptoIsValidSignature(signature, for: digest) #else return self.openSSLIsValidSignature(signature, for: digest) @@ -466,7 +466,7 @@ extension P521.Signing.PrivateKey: DigestSigner { /// algorithm employs randomization to generate a different signature on /// every call, even for the same data and key. public func signature(for digest: D) throws -> P521.Signing.ECDSASignature { - #if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API + #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API return try self.coreCryptoSignature(for: digest) #else return try self.openSSLSignature(for: digest) @@ -499,7 +499,7 @@ extension P521.Signing.PublicKey: DigestValidator { /// - Returns: A Boolean value that’s `true` if the signature is valid for /// the given digest; otherwise, `false`. public func isValidSignature(_ signature: P521.Signing.ECDSASignature, for digest: D) -> Bool { - #if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API + #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API return self.coreCryptoIsValidSignature(signature, for: digest) #else return self.openSSLIsValidSignature(signature, for: digest) diff --git a/Sources/Crypto/Signatures/ECDSA.swift.gyb b/Sources/Crypto/Signatures/ECDSA.swift.gyb index 588480ba..56bceed8 100644 --- a/Sources/Crypto/Signatures/ECDSA.swift.gyb +++ b/Sources/Crypto/Signatures/ECDSA.swift.gyb @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation @@ -150,7 +150,7 @@ extension ${CURVE}.Signing.PrivateKey: DigestSigner { /// algorithm employs randomization to generate a different signature on /// every call, even for the same data and key. public func signature(for digest: D) throws -> ${CURVE}.Signing.ECDSASignature { - #if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API + #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API return try self.coreCryptoSignature(for: digest) #else return try self.openSSLSignature(for: digest) @@ -183,7 +183,7 @@ extension ${CURVE}.Signing.PublicKey: DigestValidator { /// - Returns: A Boolean value that’s `true` if the signature is valid for /// the given digest; otherwise, `false`. public func isValidSignature(_ signature: ${CURVE}.Signing.ECDSASignature, for digest: D) -> Bool { - #if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API + #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API return self.coreCryptoIsValidSignature(signature, for: digest) #else return self.openSSLIsValidSignature(signature, for: digest) diff --git a/Sources/Crypto/Signatures/Ed25519.swift b/Sources/Crypto/Signatures/Ed25519.swift index 11ba3f70..a5151361 100644 --- a/Sources/Crypto/Signatures/Ed25519.swift +++ b/Sources/Crypto/Signatures/Ed25519.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation @@ -44,7 +44,7 @@ extension Curve25519.Signing.PublicKey: DataValidator { /// - Returns: A Boolean value that’s `true` when the signature is valid for /// the given data. public func isValidSignature(_ signature: S, for data: D) -> Bool { - #if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API + #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API return self.coreCryptoIsValidSignature(signature, for: data) #else return self.openSSLIsValidSignature(signature, for: data) @@ -65,7 +65,7 @@ extension Curve25519.Signing.PrivateKey: Signer { /// different signature on every call, even for the same data and key, to /// guard against side-channel attacks. public func signature(for data: D) throws -> Data { - #if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API + #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API return try self.coreCryptoSignature(for: data) #else return try self.openSSLSignature(for: data) diff --git a/Sources/Crypto/Signatures/Signature.swift b/Sources/Crypto/Signatures/Signature.swift index b9357af7..9aa952a6 100644 --- a/Sources/Crypto/Signatures/Signature.swift +++ b/Sources/Crypto/Signatures/Signature.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/Util/BoringSSL/ArbitraryPrecisionInteger_boring.swift b/Sources/Crypto/Util/BoringSSL/ArbitraryPrecisionInteger_boring.swift index 9f4e4b76..e55c78ff 100644 --- a/Sources/Crypto/Util/BoringSSL/ArbitraryPrecisionInteger_boring.swift +++ b/Sources/Crypto/Util/BoringSSL/ArbitraryPrecisionInteger_boring.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else @_implementationOnly import CCryptoBoringSSL @@ -442,4 +442,4 @@ extension ArbitraryPrecisionInteger: CustomDebugStringConvertible { return String(decoding: UnsafeBufferPointer(start: stringPointer, count: length), as: Unicode.UTF8.self) } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#endif // CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API diff --git a/Sources/Crypto/Util/BoringSSL/CryptoKitErrors_boring.swift b/Sources/Crypto/Util/BoringSSL/CryptoKitErrors_boring.swift index 4b6b93f7..62d3910b 100644 --- a/Sources/Crypto/Util/BoringSSL/CryptoKitErrors_boring.swift +++ b/Sources/Crypto/Util/BoringSSL/CryptoKitErrors_boring.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else @_implementationOnly import CCryptoBoringSSL @@ -23,4 +23,4 @@ extension CryptoKitError { .underlyingCoreCryptoError(error: Int32(bitPattern: CCryptoBoringSSL_ERR_get_error())) } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#endif // CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API diff --git a/Sources/Crypto/Util/BoringSSL/FiniteFieldArithmeticContext_boring.swift b/Sources/Crypto/Util/BoringSSL/FiniteFieldArithmeticContext_boring.swift index 418de11d..4041add5 100644 --- a/Sources/Crypto/Util/BoringSSL/FiniteFieldArithmeticContext_boring.swift +++ b/Sources/Crypto/Util/BoringSSL/FiniteFieldArithmeticContext_boring.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else @_implementationOnly import CCryptoBoringSSL @@ -156,4 +156,4 @@ extension FiniteFieldArithmeticContext { return try ArbitraryPrecisionInteger(copying: actualOutputPointer) } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#endif // CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API diff --git a/Sources/Crypto/Util/BoringSSL/RNG_boring.swift b/Sources/Crypto/Util/BoringSSL/RNG_boring.swift index 2183f4b9..cb1e113b 100644 --- a/Sources/Crypto/Util/BoringSSL/RNG_boring.swift +++ b/Sources/Crypto/Util/BoringSSL/RNG_boring.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else @@ -42,4 +42,4 @@ extension UnsafeMutableRawBufferPointer { } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#endif // CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API diff --git a/Sources/Crypto/Util/BoringSSL/Zeroization_boring.swift b/Sources/Crypto/Util/BoringSSL/Zeroization_boring.swift index 746c5742..a4e1ecea 100644 --- a/Sources/Crypto/Util/BoringSSL/Zeroization_boring.swift +++ b/Sources/Crypto/Util/BoringSSL/Zeroization_boring.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if !(os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) +#if !canImport(Darwin) @_implementationOnly import CCryptoBoringSSL typealias errno_t = CInt diff --git a/Sources/Crypto/Util/SafeCompare.swift b/Sources/Crypto/Util/SafeCompare.swift index 7bf6b7b8..97c80d1c 100644 --- a/Sources/Crypto/Util/SafeCompare.swift +++ b/Sources/Crypto/Util/SafeCompare.swift @@ -11,13 +11,13 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation internal func safeCompare(_ lhs: LHS, _ rhs: RHS) -> Bool { - #if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API + #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API return coreCryptoSafeCompare(lhs, rhs) #else return openSSLSafeCompare(lhs, rhs) diff --git a/Sources/Crypto/Util/SecureBytes.swift b/Sources/Crypto/Util/SecureBytes.swift index 5c0805bc..782527a8 100644 --- a/Sources/Crypto/Util/SecureBytes.swift +++ b/Sources/Crypto/Util/SecureBytes.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Sources/Crypto/Util/Zeroization.swift b/Sources/Crypto/Util/Zeroization.swift index 645175e7..bb3f6d11 100644 --- a/Sources/Crypto/Util/Zeroization.swift +++ b/Sources/Crypto/Util/Zeroization.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else import Foundation diff --git a/Tests/CryptoTests/ASN1/ASN1Tests.swift b/Tests/CryptoTests/ASN1/ASN1Tests.swift index ec3af588..d1599416 100644 --- a/Tests/CryptoTests/ASN1/ASN1Tests.swift +++ b/Tests/CryptoTests/ASN1/ASN1Tests.swift @@ -13,10 +13,10 @@ //===----------------------------------------------------------------------===// import XCTest -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API // Skip tests that require @testable imports of CryptoKit. #else -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @testable import CryptoKit #else @testable import Crypto diff --git a/Tests/CryptoTests/ASN1/GeneralizedTimeTests.swift b/Tests/CryptoTests/ASN1/GeneralizedTimeTests.swift index 462bfc37..63270131 100644 --- a/Tests/CryptoTests/ASN1/GeneralizedTimeTests.swift +++ b/Tests/CryptoTests/ASN1/GeneralizedTimeTests.swift @@ -13,10 +13,10 @@ //===----------------------------------------------------------------------===// import XCTest -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API // Skip tests that require @testable imports of CryptoKit. #else -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @testable import CryptoKit #else @testable import Crypto diff --git a/Tests/CryptoTests/Authenticated Encryption/AES-GCM-Runner.swift b/Tests/CryptoTests/Authenticated Encryption/AES-GCM-Runner.swift index bf5358a1..062bea53 100644 --- a/Tests/CryptoTests/Authenticated Encryption/AES-GCM-Runner.swift +++ b/Tests/CryptoTests/Authenticated Encryption/AES-GCM-Runner.swift @@ -14,9 +14,9 @@ import Foundation import XCTest -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API import Crypto -#elseif (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#elseif !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API import CryptoKit #else import Crypto diff --git a/Tests/CryptoTests/Authenticated Encryption/ChaChaPoly-Runner.swift b/Tests/CryptoTests/Authenticated Encryption/ChaChaPoly-Runner.swift index 737bf066..316e44c9 100644 --- a/Tests/CryptoTests/Authenticated Encryption/ChaChaPoly-Runner.swift +++ b/Tests/CryptoTests/Authenticated Encryption/ChaChaPoly-Runner.swift @@ -14,9 +14,9 @@ import Foundation import XCTest -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API import Crypto -#elseif (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#elseif !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API import CryptoKit #else import Crypto diff --git a/Tests/CryptoTests/BoringSSL/ArbitraryPrecisionIntegerTests.swift b/Tests/CryptoTests/BoringSSL/ArbitraryPrecisionIntegerTests.swift index b3acb7d5..bf50dfa3 100644 --- a/Tests/CryptoTests/BoringSSL/ArbitraryPrecisionIntegerTests.swift +++ b/Tests/CryptoTests/BoringSSL/ArbitraryPrecisionIntegerTests.swift @@ -11,7 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API #else @testable import Crypto import XCTest @@ -112,4 +112,4 @@ final class ArbitraryPrecisionIntegerTests: XCTestCase { XCTAssertTrue(two >= two) } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#endif // CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API diff --git a/Tests/CryptoTests/Digests/DigestsTests.swift b/Tests/CryptoTests/Digests/DigestsTests.swift index 672518ae..7eb02cf7 100644 --- a/Tests/CryptoTests/Digests/DigestsTests.swift +++ b/Tests/CryptoTests/Digests/DigestsTests.swift @@ -13,9 +13,9 @@ //===----------------------------------------------------------------------===// import XCTest -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API import Crypto -#elseif (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#elseif !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API import CryptoKit #else import Crypto diff --git a/Tests/CryptoTests/ECDH/BoringSSL/ASN1.swift b/Tests/CryptoTests/ECDH/BoringSSL/ASN1.swift index 927933b7..a9c6ab2c 100644 --- a/Tests/CryptoTests/ECDH/BoringSSL/ASN1.swift +++ b/Tests/CryptoTests/ECDH/BoringSSL/ASN1.swift @@ -14,10 +14,10 @@ import Foundation import XCTest -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API // Skip tests that require @testable imports of CryptoKit. #else -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @testable import CryptoKit #else @_implementationOnly import CCryptoBoringSSL @@ -337,4 +337,4 @@ extension UInt { } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM +#endif // CRYPTO_IN_SWIFTPM diff --git a/Tests/CryptoTests/ECDH/BoringSSL/secpECDH_Runner_boring.swift b/Tests/CryptoTests/ECDH/BoringSSL/secpECDH_Runner_boring.swift index ad604dfe..df7751b9 100644 --- a/Tests/CryptoTests/ECDH/BoringSSL/secpECDH_Runner_boring.swift +++ b/Tests/CryptoTests/ECDH/BoringSSL/secpECDH_Runner_boring.swift @@ -14,10 +14,10 @@ import Foundation import XCTest -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API // Skip tests that require @testable imports of CryptoKit. #else -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @testable import CryptoKit #else @_implementationOnly import CCryptoBoringSSL @@ -138,4 +138,4 @@ extension NISTECPublicKey { } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM +#endif // CRYPTO_IN_SWIFTPM diff --git a/Tests/CryptoTests/ECDH/X25519-Runner.swift b/Tests/CryptoTests/ECDH/X25519-Runner.swift index e5f2369d..0ef86707 100644 --- a/Tests/CryptoTests/ECDH/X25519-Runner.swift +++ b/Tests/CryptoTests/ECDH/X25519-Runner.swift @@ -14,10 +14,10 @@ import Foundation import XCTest -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API // Skip tests that require @testable imports of CryptoKit. #else -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @testable import CryptoKit #else @testable import Crypto @@ -202,4 +202,4 @@ class X25519Tests: XCTestCase { } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM +#endif // CRYPTO_IN_SWIFTPM diff --git a/Tests/CryptoTests/ECDH/secpECDH_Runner.swift b/Tests/CryptoTests/ECDH/secpECDH_Runner.swift index b0aa6dff..12596db6 100644 --- a/Tests/CryptoTests/ECDH/secpECDH_Runner.swift +++ b/Tests/CryptoTests/ECDH/secpECDH_Runner.swift @@ -14,10 +14,10 @@ import Foundation import XCTest -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API // Skip tests that require @testable imports of CryptoKit. #else -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @testable import CryptoKit #else @testable import Crypto @@ -109,7 +109,7 @@ class NISTECDHTests: XCTestCase { } func testGroup(group: ECDHTestGroup, privateKeys: PrivKey.Type, onCurve curve: Curve.Type) { - #if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API + #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API self.testGroupCC(group: group, privateKeys: privateKeys, onCurve: curve) #else self.testGroupOpenSSL(group: group, privateKeys: privateKeys, onCurve: curve) @@ -117,11 +117,11 @@ class NISTECDHTests: XCTestCase { } func testGroupPoint(group: ECDHTestGroup, privateKeys: PrivKey.Type, onCurve curve: Curve.Type) { - #if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API + #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API self.testGroupPointCC(group: group, privateKeys: privateKeys, onCurve: curve) #else self.testGroupPointOpenSSL(group: group, privateKeys: privateKeys, onCurve: curve) #endif } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM +#endif // CRYPTO_IN_SWIFTPM diff --git a/Tests/CryptoTests/Encodings/BoringSSL/DERTests_boring.swift b/Tests/CryptoTests/Encodings/BoringSSL/DERTests_boring.swift index 1780422d..e4e03882 100644 --- a/Tests/CryptoTests/Encodings/BoringSSL/DERTests_boring.swift +++ b/Tests/CryptoTests/Encodings/BoringSSL/DERTests_boring.swift @@ -13,10 +13,10 @@ //===----------------------------------------------------------------------===// import XCTest -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API // Skip tests that require @testable imports of CryptoKit. #else -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @testable import CryptoKit #else @testable import Crypto @@ -28,4 +28,4 @@ extension DERTests { } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM +#endif // CRYPTO_IN_SWIFTPM diff --git a/Tests/CryptoTests/Encodings/DERTests.swift b/Tests/CryptoTests/Encodings/DERTests.swift index 34f4c62e..7c7537d7 100644 --- a/Tests/CryptoTests/Encodings/DERTests.swift +++ b/Tests/CryptoTests/Encodings/DERTests.swift @@ -13,10 +13,10 @@ //===----------------------------------------------------------------------===// import XCTest -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API // Skip tests that require @testable imports of CryptoKit. #else -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @testable import CryptoKit #else @testable import Crypto @@ -41,7 +41,7 @@ class DERTests: XCTestCase { } func coordinateSizeForCurve(_ curve: Curve.Type) -> Int { - #if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API + #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API return self.coreCryptoCoordinateSizeForCurve(curve) #else return self.openSSLCoordinateSizeForCurve(curve) @@ -49,7 +49,7 @@ class DERTests: XCTestCase { } func randomBytes(count: Int) -> [UInt8] { - #if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) || os(Linux) || os(Android) || os(Windows) + #if canImport(Darwin) || os(Linux) || os(Android) || os(Windows) var rng = SystemRandomNumberGenerator() return (0.. HPKE.AEAD? { return aeadValues.first } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM +#endif // CRYPTO_IN_SWIFTPM diff --git a/Tests/CryptoTests/HPKE/HPKETests.swift b/Tests/CryptoTests/HPKE/HPKETests.swift index ec68dca7..721fd154 100644 --- a/Tests/CryptoTests/HPKE/HPKETests.swift +++ b/Tests/CryptoTests/HPKE/HPKETests.swift @@ -14,10 +14,10 @@ import Foundation import XCTest -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API // Skip tests that require @testable imports of CryptoKit. #else -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @testable import CryptoKit #else @testable import Crypto @@ -105,4 +105,4 @@ class HPKETests: XCTestCase { } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM +#endif // CRYPTO_IN_SWIFTPM diff --git a/Tests/CryptoTests/Key Derivation/ECprivateKeysFromSeeds.swift b/Tests/CryptoTests/Key Derivation/ECprivateKeysFromSeeds.swift index 6e8e8f07..a818b3f5 100644 --- a/Tests/CryptoTests/Key Derivation/ECprivateKeysFromSeeds.swift +++ b/Tests/CryptoTests/Key Derivation/ECprivateKeysFromSeeds.swift @@ -14,10 +14,10 @@ import Foundation import XCTest -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API // Skip tests that require @testable imports of CryptoKit. #else -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @testable import CryptoKit #else @testable import Crypto diff --git a/Tests/CryptoTests/Key Derivation/HKDFTests.swift b/Tests/CryptoTests/Key Derivation/HKDFTests.swift index 8ad2bb82..8dbaee03 100644 --- a/Tests/CryptoTests/Key Derivation/HKDFTests.swift +++ b/Tests/CryptoTests/Key Derivation/HKDFTests.swift @@ -13,10 +13,10 @@ //===----------------------------------------------------------------------===// import XCTest -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API // Skip tests that require @testable imports of CryptoKit. #else -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @testable import CryptoKit #else @testable import Crypto @@ -144,4 +144,4 @@ class HKDFTests: XCTestCase { } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM +#endif // CRYPTO_IN_SWIFTPM diff --git a/Tests/CryptoTests/Key Derivation/SharedSecretTests.swift b/Tests/CryptoTests/Key Derivation/SharedSecretTests.swift index 82678136..df8c364f 100644 --- a/Tests/CryptoTests/Key Derivation/SharedSecretTests.swift +++ b/Tests/CryptoTests/Key Derivation/SharedSecretTests.swift @@ -13,10 +13,10 @@ //===----------------------------------------------------------------------===// import XCTest -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API // Skip tests that require @testable imports of CryptoKit. #else -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @testable import CryptoKit #else @testable import Crypto @@ -34,4 +34,4 @@ class SharedSecretTests: XCTestCase { } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM +#endif // CRYPTO_IN_SWIFTPM diff --git a/Tests/CryptoTests/Key Derivation/X963KDFTests.swift b/Tests/CryptoTests/Key Derivation/X963KDFTests.swift index 7f075abf..d22936fe 100644 --- a/Tests/CryptoTests/Key Derivation/X963KDFTests.swift +++ b/Tests/CryptoTests/Key Derivation/X963KDFTests.swift @@ -13,10 +13,10 @@ //===----------------------------------------------------------------------===// import XCTest -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API // Skip tests that require @testable imports of CryptoKit. #else -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @testable import CryptoKit #else @testable import Crypto @@ -91,4 +91,4 @@ class X963KDFTests: XCTestCase { } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM +#endif // CRYPTO_IN_SWIFTPM diff --git a/Tests/CryptoTests/Key Wrapping/KeyWrapping.swift b/Tests/CryptoTests/Key Wrapping/KeyWrapping.swift index 4457da6e..c2e167b3 100644 --- a/Tests/CryptoTests/Key Wrapping/KeyWrapping.swift +++ b/Tests/CryptoTests/Key Wrapping/KeyWrapping.swift @@ -13,10 +13,10 @@ //===----------------------------------------------------------------------===// import XCTest -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API // Skip tests that require @testable imports of CryptoKit. #else -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @testable import CryptoKit #else @testable import Crypto @@ -95,4 +95,4 @@ class KeyWrappingTests: XCTestCase { } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM +#endif // CRYPTO_IN_SWIFTPM diff --git a/Tests/CryptoTests/MAC/HMACTests.swift b/Tests/CryptoTests/MAC/HMACTests.swift index 219488b1..2663a518 100644 --- a/Tests/CryptoTests/MAC/HMACTests.swift +++ b/Tests/CryptoTests/MAC/HMACTests.swift @@ -13,10 +13,10 @@ //===----------------------------------------------------------------------===// import XCTest -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API // Skip tests that require @testable imports of CryptoKit. #else -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @testable import CryptoKit #else @testable import Crypto @@ -233,4 +233,4 @@ class HMACTests: XCTestCase { XCTAssertFalse(mac == DispatchData.empty) } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM +#endif // CRYPTO_IN_SWIFTPM diff --git a/Tests/CryptoTests/SecureBytes/SecureBytesTests.swift b/Tests/CryptoTests/SecureBytes/SecureBytesTests.swift index 923bac5c..031bc1ce 100644 --- a/Tests/CryptoTests/SecureBytes/SecureBytesTests.swift +++ b/Tests/CryptoTests/SecureBytes/SecureBytesTests.swift @@ -13,10 +13,10 @@ //===----------------------------------------------------------------------===// import XCTest -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API // Skip tests that require @testable imports of CryptoKit. #else -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @testable import CryptoKit #else @testable import Crypto @@ -225,4 +225,4 @@ final class SecureBytesTests: XCTestCase { } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM +#endif // CRYPTO_IN_SWIFTPM diff --git a/Tests/CryptoTests/Signatures/ECDSA/ECDSASignatureTests.swift b/Tests/CryptoTests/Signatures/ECDSA/ECDSASignatureTests.swift index 4a6c8cb6..6dbb64ef 100644 --- a/Tests/CryptoTests/Signatures/ECDSA/ECDSASignatureTests.swift +++ b/Tests/CryptoTests/Signatures/ECDSA/ECDSASignatureTests.swift @@ -14,10 +14,10 @@ import Foundation import XCTest -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API // Skip tests that require @testable imports of CryptoKit. #else -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @testable import CryptoKit #else @testable import Crypto @@ -400,4 +400,4 @@ class SignatureTests: XCTestCase { } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM +#endif // CRYPTO_IN_SWIFTPM diff --git a/Tests/CryptoTests/Signatures/ECDSA/RawECDSASignaturesTests.swift b/Tests/CryptoTests/Signatures/ECDSA/RawECDSASignaturesTests.swift index ee7fcb80..bed863de 100644 --- a/Tests/CryptoTests/Signatures/ECDSA/RawECDSASignaturesTests.swift +++ b/Tests/CryptoTests/Signatures/ECDSA/RawECDSASignaturesTests.swift @@ -13,10 +13,10 @@ //===----------------------------------------------------------------------===// import XCTest -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API // Skip tests that require @testable imports of CryptoKit. #else -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @testable import CryptoKit #else @testable import Crypto @@ -86,4 +86,4 @@ class RawECDSASignaturesTests: XCTestCase { try orFail { try testForCurve(curve: P521.Signing.self) } } } -#endif // (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM +#endif // CRYPTO_IN_SWIFTPM diff --git a/Tests/CryptoTests/Signatures/EdDSA/Ed25519-Runner.swift b/Tests/CryptoTests/Signatures/EdDSA/Ed25519-Runner.swift index 0eaeab11..dc33f013 100644 --- a/Tests/CryptoTests/Signatures/EdDSA/Ed25519-Runner.swift +++ b/Tests/CryptoTests/Signatures/EdDSA/Ed25519-Runner.swift @@ -13,9 +13,9 @@ //===----------------------------------------------------------------------===// import XCTest -#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API import Crypto -#elseif (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API +#elseif !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API import CryptoKit #else import Crypto @@ -57,7 +57,7 @@ class Ed25519Tests: XCTestCase { let signatureOnContiguous = try orFail { try privateKey.signature(for: someContiguousData) } let signatureOnDiscontiguous = try orFail { try privateKey.signature(for: someDiscontiguousData) } - #if !(os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) + #if !(canImport(Darwin)) XCTAssertEqual(signatureOnContiguous, signatureOnDiscontiguous) #endif