From 32adcc5038e8afa90a63bbef43b55c0c9969b067 Mon Sep 17 00:00:00 2001 From: Si Beaumont Date: Tue, 3 Nov 2026 18:08:15 +0000 Subject: [PATCH] Update conditional compilation blocks to use compiler version instead of language mode (#499) --- Sources/Crypto/AEADs/AES/GCM/AES-GCM.swift | 4 ++-- .../Crypto/AEADs/AES/GCM/BoringSSL/AES-GCM_boring.swift | 4 ++-- .../AEADs/ChachaPoly/BoringSSL/ChaChaPoly_boring.swift | 8 ++++---- Sources/Crypto/AEADs/ChachaPoly/ChaChaPoly.swift | 4 ++-- Sources/Crypto/Key Derivation/HKDF.swift | 4 ++-- Sources/Crypto/Util/ArraySpanHelpers.swift | 4 ++-- Sources/Crypto/Util/BoringSSL/RNG_boring.swift | 4 ++-- Sources/CryptoBoringWrapper/AEAD/BoringSSLAEAD.swift | 4 ++-- Sources/CryptoBoringWrapper/Util/RandomBytes.swift | 2 +- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Sources/Crypto/AEADs/AES/GCM/AES-GCM.swift b/Sources/Crypto/AEADs/AES/GCM/AES-GCM.swift index fd5526ad..ba851bd2 100644 --- a/Sources/Crypto/AEADs/AES/GCM/AES-GCM.swift +++ b/Sources/Crypto/AEADs/AES/GCM/AES-GCM.swift @@ -72,7 +72,7 @@ extension AES { /// - nonce: The nonce the sealing process requires. /// - authenticatedData: Additional data to be authenticated, if provided. /// - tag: receives the 16-byte authentication tag - #if swift(<6.3) + #if compiler(<6.3) @_lifetime(message: copy message) #endif public static func seal( @@ -127,7 +127,7 @@ extension AES { /// - authenticatedData: Additional data that was authenticated. /// /// The call throws an error if decryption or authentication fail. - #if swift(<6.3) + #if compiler(<6.3) @_lifetime(message: copy message) #endif public static func open( 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 b697571e..0cc04184 100644 --- a/Sources/Crypto/AEADs/AES/GCM/BoringSSL/AES-GCM_boring.swift +++ b/Sources/Crypto/AEADs/AES/GCM/BoringSSL/AES-GCM_boring.swift @@ -59,7 +59,7 @@ enum OpenSSLAESGCMImpl { return AES.GCM.SealedBox(combined: combined, nonceByteCount: nonce.count) } - #if swift(<6.3) + #if compiler(<6.3) @_lifetime(message: copy message) #endif @inlinable @@ -119,7 +119,7 @@ enum OpenSSLAESGCMImpl { } /// Open a given message in place. - #if swift(<6.3) + #if compiler(<6.3) @_lifetime(message: copy message) #endif @inlinable diff --git a/Sources/Crypto/AEADs/ChachaPoly/BoringSSL/ChaChaPoly_boring.swift b/Sources/Crypto/AEADs/ChachaPoly/BoringSSL/ChaChaPoly_boring.swift index 3e27bb1a..7e2476e1 100644 --- a/Sources/Crypto/AEADs/ChachaPoly/BoringSSL/ChaChaPoly_boring.swift +++ b/Sources/Crypto/AEADs/ChachaPoly/BoringSSL/ChaChaPoly_boring.swift @@ -48,7 +48,7 @@ extension BoringSSLAEAD { } /// Seal a given message in place - #if swift(<6.3) + #if compiler(<6.3) @_lifetime(message: copy message) #endif func seal( @@ -93,7 +93,7 @@ extension BoringSSLAEAD { } /// Open a given message in place. - #if swift(<6.3) + #if compiler(<6.3) @_lifetime(message: copy message) #endif public func open( @@ -150,7 +150,7 @@ enum OpenSSLChaChaPolyImpl { return ChaChaPoly.SealedBox(combined: combined, nonceByteCount: nonce.count) } - #if swift(<6.3) + #if compiler(<6.3) @_lifetime(message: copy message) #endif static func encrypt( @@ -211,7 +211,7 @@ enum OpenSSLChaChaPolyImpl { } } - #if swift(<6.3) + #if compiler(<6.3) @_lifetime(message: copy message) #endif static func decrypt( diff --git a/Sources/Crypto/AEADs/ChachaPoly/ChaChaPoly.swift b/Sources/Crypto/AEADs/ChachaPoly/ChaChaPoly.swift index b1661e5b..2cdbb5e5 100644 --- a/Sources/Crypto/AEADs/ChachaPoly/ChaChaPoly.swift +++ b/Sources/Crypto/AEADs/ChachaPoly/ChaChaPoly.swift @@ -70,7 +70,7 @@ public enum ChaChaPoly: Cipher, Sendable { /// - nonce: The nonce the sealing process requires. /// - authenticatedData: Additional data to be authenticated. /// - tag: Will be updated with the 16-byte authentication tag. - #if swift(<6.3) + #if compiler(<6.3) @_lifetime(message: copy message) #endif public static func seal( @@ -124,7 +124,7 @@ public enum ChaChaPoly: Cipher, Sendable { /// - authenticatedData: Additional data that was authenticated. /// /// The call throws an error if decryption or authentication fail. - #if swift(<6.3) + #if compiler(<6.3) @_lifetime(message: copy message) #endif public static func open( diff --git a/Sources/Crypto/Key Derivation/HKDF.swift b/Sources/Crypto/Key Derivation/HKDF.swift index 5b09d42d..9aea4c30 100644 --- a/Sources/Crypto/Key Derivation/HKDF.swift +++ b/Sources/Crypto/Key Derivation/HKDF.swift @@ -48,7 +48,7 @@ public struct HKDF: Sendable { /// - info: The shared information to use for key derivation. /// - outputKey: An output span that will be populated with the derived /// symmetric key. - #if swift(<6.3) + #if compiler(<6.3) @_lifetime(outputKey: copy outputKey) #endif public static func deriveKey(inputKeyMaterial: SymmetricKey, @@ -258,7 +258,7 @@ public struct HKDF: Sendable { /// - outputByteCount: The length in bytes of the resulting symmetric key. /// /// - Returns: The derived symmetric key. - #if swift(<6.3) + #if compiler(<6.3) @_lifetime(output: copy output) #endif public static func expand(pseudoRandomKey prk: RawSpan, info: RawSpan?, into output: inout OutputRawSpan) { diff --git a/Sources/Crypto/Util/ArraySpanHelpers.swift b/Sources/Crypto/Util/ArraySpanHelpers.swift index 548fcb6d..7138ed76 100644 --- a/Sources/Crypto/Util/ArraySpanHelpers.swift +++ b/Sources/Crypto/Util/ArraySpanHelpers.swift @@ -57,7 +57,7 @@ extension ContiguousArray where Element == UInt8 { extension OutputRawSpan { /// Append the contents of the given raw span to this output span. - #if swift(<6.3) + #if compiler(<6.3) @_lifetime(self: copy self) #endif mutating func append(contentsOf bytes: RawSpan) { @@ -69,7 +69,7 @@ extension OutputRawSpan { extension OutputSpan { /// Append the contents of the given raw span to this output span. - #if swift(<6.3) + #if compiler(<6.3) @_lifetime(self: copy self) #endif mutating func append(contentsOf bytes: RawSpan) { diff --git a/Sources/Crypto/Util/BoringSSL/RNG_boring.swift b/Sources/Crypto/Util/BoringSSL/RNG_boring.swift index 3a4b7373..1435440e 100644 --- a/Sources/Crypto/Util/BoringSSL/RNG_boring.swift +++ b/Sources/Crypto/Util/BoringSSL/RNG_boring.swift @@ -45,7 +45,7 @@ extension UnsafeMutableRawBufferPointer { @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension MutableRawSpan { - #if swift(<6.3) + #if compiler(<6.3) @_lifetime(self: copy self) #endif mutating func initializeWithRandomBytes(count: Int) { @@ -55,7 +55,7 @@ extension MutableRawSpan { @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension OutputRawSpan { - #if swift(<6.3) + #if compiler(<6.3) @_lifetime(self: copy self) #endif mutating func appendingRandomBytes(count: Int) { diff --git a/Sources/CryptoBoringWrapper/AEAD/BoringSSLAEAD.swift b/Sources/CryptoBoringWrapper/AEAD/BoringSSLAEAD.swift index 92a29a27..ce866626 100644 --- a/Sources/CryptoBoringWrapper/AEAD/BoringSSLAEAD.swift +++ b/Sources/CryptoBoringWrapper/AEAD/BoringSSLAEAD.swift @@ -153,7 +153,7 @@ extension BoringSSLAEAD.AEADContext { /// Lowest level seal operation that calls into BoringSSL directly and /// operates on already-allocated memory. - #if swift(<6.3) + #if compiler(<6.3) @_lifetime(tag: copy tag) #endif public func seal( @@ -303,7 +303,7 @@ extension BoringSSLAEAD.AEADContext { } /// Lowest level call into BoringSSL that decrypts in place. - #if swift(<6.3) + #if compiler(<6.3) @_lifetime(message: copy message) #endif public func open( diff --git a/Sources/CryptoBoringWrapper/Util/RandomBytes.swift b/Sources/CryptoBoringWrapper/Util/RandomBytes.swift index 516e316d..782f4fdf 100644 --- a/Sources/CryptoBoringWrapper/Util/RandomBytes.swift +++ b/Sources/CryptoBoringWrapper/Util/RandomBytes.swift @@ -47,7 +47,7 @@ extension UnsafeMutableRawBufferPointer { @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension OutputRawSpan { - #if swift(<6.3) + #if compiler(<6.3) @_lifetime(self: copy self) #endif package mutating func appendingRandomBytes(count: Int) {