diff --git a/Package.swift b/Package.swift index 85fc553..2b0c50e 100644 --- a/Package.swift +++ b/Package.swift @@ -45,11 +45,6 @@ let settings: [SwiftSetting] = [ .define("EXPORT_SWIFTTLS"), .define("IMPORT_CRYPTO"), .define("SWIFTTLS_CERTIFICATE_VERIFICATION"), - // To support back to macOS 26, provide a shim on top of crypto APIs - // that allows passing spans. This is a less performant path, so for - // performance-sensitive cases, remove this define and require at least - // macOS 27. - .define("SHIM_CRYPTO_SPAN_APIS", .when(platforms: allApplePlatforms)), .unsafeFlags(["-Xfrontend", "-experimental-spi-only-imports"]), .enableExperimentalFeature("Lifetimes"), .enableExperimentalFeature("AnyAppleOSAvailability"), @@ -90,6 +85,13 @@ let package = Package( name: "SignpostOutput", description: "Enables `OSSignposter` output from the QUIC implementation." ), + // To support back to macOS 26, provide a shim on top of crypto APIs + // that allows passing spans is provided. This is a less performant path, so for + // performance-sensitive cases, pass in this trait to disable this shim. + .trait( + name: "DISABLE_SHIM_CRYPTO_SPAN_APIS", + description: "Disable backwards compatible crypto shim for performance sensitive cases" + ), .default(enabledTraits: []), ], dependencies: [ diff --git a/Sources/SwiftNetwork/Utilities/CryptoWrappers.swift b/Sources/SwiftNetwork/Utilities/CryptoWrappers.swift index 05ae29c..a357870 100644 --- a/Sources/SwiftNetwork/Utilities/CryptoWrappers.swift +++ b/Sources/SwiftNetwork/Utilities/CryptoWrappers.swift @@ -15,7 +15,7 @@ // Wrappers over older Crypto functions when span-based APIs are not available. // This path exists for compatibility, but is significantly less efficient. -#if SHIM_CRYPTO_SPAN_APIS +#if !DISABLE_SHIM_CRYPTO_SPAN_APIS #if canImport(Foundation) import Foundation #elseif canImport(SwiftSystem)