diff --git a/Sources/Crypto/AEADs/AES/GCM/AES-GCM.swift b/Sources/Crypto/AEADs/AES/GCM/AES-GCM.swift index c246f1b4..f91fa950 100644 --- a/Sources/Crypto/AEADs/AES/GCM/AES-GCM.swift +++ b/Sources/Crypto/AEADs/AES/GCM/AES-GCM.swift @@ -15,21 +15,21 @@ @_exported import CryptoKit #else #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) typealias AESGCMImpl = CoreCryptoGCMImpl import Security #else -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) typealias AESGCMImpl = OpenSSLAESGCMImpl #endif import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension AES { /// The Advanced Encryption Standard (AES) Galois Counter Mode (GCM) cipher /// suite. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum GCM: Cipher { static let tagByteCount = 16 static let defaultNonceByteCount = 12 @@ -95,7 +95,7 @@ extension AES { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension AES.GCM { /// A secure container for your data that you can access using a cipher. /// @@ -111,7 +111,7 @@ extension AES.GCM { /// /// The receiver uses another instance of the same cipher, like the /// ``open(_:using:)`` method, to open the box. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct SealedBox: AEADSealedBox { private let combinedRepresentation: Data private let nonceByteCount: Int 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 ca1ae8ef..666442b0 100644 --- a/Sources/Crypto/AEADs/AES/GCM/BoringSSL/AES-GCM_boring.swift +++ b/Sources/Crypto/AEADs/AES/GCM/BoringSSL/AES-GCM_boring.swift @@ -18,7 +18,7 @@ import CryptoBoringWrapper import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) enum OpenSSLAESGCMImpl { @inlinable static func seal( diff --git a/Sources/Crypto/AEADs/ChachaPoly/BoringSSL/ChaChaPoly_boring.swift b/Sources/Crypto/AEADs/ChachaPoly/BoringSSL/ChaChaPoly_boring.swift index 6857bedd..0d393396 100644 --- a/Sources/Crypto/AEADs/ChachaPoly/BoringSSL/ChaChaPoly_boring.swift +++ b/Sources/Crypto/AEADs/ChachaPoly/BoringSSL/ChaChaPoly_boring.swift @@ -19,7 +19,7 @@ import CryptoBoringWrapper import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension BoringSSLAEAD { /// Seal a given message. func seal( @@ -62,7 +62,7 @@ extension BoringSSLAEAD { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) enum OpenSSLChaChaPolyImpl { static func encrypt( key: SymmetricKey, diff --git a/Sources/Crypto/AEADs/ChachaPoly/ChaChaPoly.swift b/Sources/Crypto/AEADs/ChachaPoly/ChaChaPoly.swift index 8a3ddc00..b1aee7cb 100644 --- a/Sources/Crypto/AEADs/ChachaPoly/ChaChaPoly.swift +++ b/Sources/Crypto/AEADs/ChachaPoly/ChaChaPoly.swift @@ -15,18 +15,18 @@ @_exported import CryptoKit #else #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) typealias ChaChaPolyImpl = CoreCryptoChaChaPolyImpl import Security #else -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) typealias ChaChaPolyImpl = OpenSSLChaChaPolyImpl #endif import Foundation /// An implementation of the ChaCha20-Poly1305 cipher. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum ChaChaPoly: Cipher { static let tagByteCount = 16 static let keyBitsCount = 256 @@ -93,7 +93,7 @@ public enum ChaChaPoly: Cipher { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ChaChaPoly { /// A secure container for your data that you access using a cipher. /// @@ -110,7 +110,7 @@ extension ChaChaPoly { /// The receiver uses another instance of the same cipher, like the /// ``open(_:using:)`` method, to open the box. @frozen - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct SealedBox: AEADSealedBox { /// A combined element composed of the tag, the nonce, and the /// ciphertext. diff --git a/Sources/Crypto/AEADs/Cipher.swift b/Sources/Crypto/AEADs/Cipher.swift index f1e985ba..9d6293f8 100644 --- a/Sources/Crypto/AEADs/Cipher.swift +++ b/Sources/Crypto/AEADs/Cipher.swift @@ -16,7 +16,7 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol AEADSealedBox { associatedtype Nonce: Sequence /// The authentication tag @@ -36,7 +36,7 @@ protocol AEADSealedBox { } /// A type representing authenticated encryption with associated data. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol Cipher { associatedtype Key associatedtype SealedBox: AEADSealedBox diff --git a/Sources/Crypto/AEADs/Nonces.swift b/Sources/Crypto/AEADs/Nonces.swift index 2ee932ce..fb03ebe7 100644 --- a/Sources/Crypto/AEADs/Nonces.swift +++ b/Sources/Crypto/AEADs/Nonces.swift @@ -20,14 +20,14 @@ import Foundation // see section `gyb` in `README` for details. // MARK: - AES.GCM + Nonce -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension AES.GCM { /// A value used once during a cryptographic operation and then discarded. /// /// Don’t reuse the same nonce for multiple calls to encryption APIs. It’s critical /// that nonces are unique per call to encryption APIs in order to protect the /// integrity of the encryption. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct Nonce: ContiguousBytes, Sequence { let bytes: Data @@ -84,14 +84,14 @@ extension AES.GCM { } // MARK: - ChaChaPoly + Nonce -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ChaChaPoly { /// A value used once during a cryptographic operation and then discarded. /// /// Don’t reuse the same nonce for multiple calls to encryption APIs. It’s critical /// that nonces are unique per call to encryption APIs in order to protect the /// integrity of the encryption. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct Nonce: ContiguousBytes, Sequence { let bytes: Data diff --git a/Sources/Crypto/ASN1/ASN1.swift b/Sources/Crypto/ASN1/ASN1.swift index 27c0dec0..dc189d9e 100644 --- a/Sources/Crypto/ASN1/ASN1.swift +++ b/Sources/Crypto/ASN1/ASN1.swift @@ -103,18 +103,18 @@ import Foundation // generally: that is, we don't hard-code special knowledge of these formats as part of the parsing process. Instead we have written a // parser that can divide the world of ASN.1 into parseable chunks, and then we try to decode specific formats from those chunks. This // allows us to extend things in the future without too much pain. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal enum ASN1 { } // MARK: - Parser Node -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1 { /// An `ASN1ParserNode` is a representation of a parsed ASN.1 TLV section. An `ASN1ParserNode` may be primitive, or may be composed of other `ASN1ParserNode`s. /// In our representation, we keep track of this by storing a node "depth", which allows rapid forward and backward scans to hop over sections /// we're uninterested in. /// /// This type is not exposed to users of the API: it is only used internally for implementation of the user-level API. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) fileprivate struct ASN1ParserNode { /// The identifier. var identifier: ASN1Identifier @@ -127,10 +127,10 @@ extension ASN1 { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1.ASN1ParserNode: Hashable { } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1.ASN1ParserNode: CustomStringConvertible { var description: String { return "ASN1.ASN1ParserNode(identifier: \(self.identifier), depth: \(self.depth), dataBytes: \(self.dataBytes?.count ?? 0))" @@ -138,7 +138,7 @@ extension ASN1.ASN1ParserNode: CustomStringConvertible { } // MARK: - Sequence, SequenceOf, and Set -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1 { /// Parse the node as an ASN.1 sequence. internal static func sequence(_ node: ASN1Node, identifier: ASN1.ASN1Identifier, _ builder: (inout ASN1.ASN1NodeCollection.Iterator) throws -> T) throws -> T { @@ -182,7 +182,7 @@ extension ASN1 { } // MARK: - Optional explicitly tagged -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1 { /// Parses an optional explicitly tagged element. Throws on a tag mismatch, returns nil if the element simply isn't there. /// @@ -220,7 +220,7 @@ extension ASN1 { } // MARK: - DEFAULT -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1 { /// Parses a value that is encoded with a DEFAULT. Such a value is optional, and if absent will /// be replaced with its default. @@ -269,10 +269,10 @@ extension ASN1 { } // MARK: - Parsing -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1 { /// A parsed representation of ASN.1. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) fileprivate struct ASN1ParseResult { private static let maximumNodeDepth = 10 @@ -336,10 +336,10 @@ extension ASN1 { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1.ASN1ParseResult: Hashable { } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1 { static func parse(_ data: [UInt8]) throws -> ASN1Node { return try parse(data[...]) @@ -368,13 +368,13 @@ extension ASN1 { } // MARK: - ASN1NodeCollection -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1 { /// Represents a collection of ASN.1 nodes contained in a constructed ASN.1 node. /// /// Constructed ASN.1 nodes are made up of multiple child nodes. This object represents the collection of those child nodes. /// It allows us to lazily construct the child nodes, potentially skipping over them when we don't care about them. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal struct ASN1NodeCollection { private var nodes: ArraySlice @@ -392,9 +392,9 @@ extension ASN1 { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1.ASN1NodeCollection: Sequence { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct Iterator: IteratorProtocol { private var nodes: ArraySlice private var depth: Int @@ -428,7 +428,7 @@ extension ASN1.ASN1NodeCollection: Sequence { } // MARK: - ASN1Node -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1 { /// An `ASN1Node` is a single entry in the ASN.1 representation of a data structure. /// @@ -438,7 +438,7 @@ extension ASN1 { /// /// In this way, ASN.1 objects tend to form a "tree", where each object is represented by a single top-level constructed /// node that contains other objects and primitives, eventually reaching the bottom which is made up of primitive objects. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal struct ASN1Node { internal var identifier: ASN1Identifier @@ -447,10 +447,10 @@ extension ASN1 { } // MARK: - ASN1Node.Content -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1.ASN1Node { /// The content of a single ASN1Node. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) enum Content { case constructed(ASN1.ASN1NodeCollection) case primitive(ArraySlice) @@ -458,9 +458,9 @@ extension ASN1.ASN1Node { } // MARK: - Serializing -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1 { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct Serializer { var serializedBytes: [UInt8] @@ -568,12 +568,12 @@ extension ASN1 { } // MARK: - Helpers -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal protocol ASN1Parseable { init(asn1Encoded: ASN1.ASN1Node) throws } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1Parseable { internal init(asn1Encoded sequenceNodeIterator: inout ASN1.ASN1NodeCollection.Iterator) throws { guard let node = sequenceNodeIterator.next() else { @@ -592,13 +592,13 @@ extension ASN1Parseable { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal protocol ASN1Serializable { func serialize(into coder: inout ASN1.Serializer) throws } /// Covers ASN.1 types that may be implicitly tagged. Not all nodes can be! -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal protocol ASN1ImplicitlyTaggable: ASN1Parseable, ASN1Serializable { /// The tag that the first node will use "by default" if the grammar omits /// any more specific tag definition. @@ -609,7 +609,7 @@ internal protocol ASN1ImplicitlyTaggable: ASN1Parseable, ASN1Serializable { func serialize(into coder: inout ASN1.Serializer, withIdentifier identifier: ASN1.ASN1Identifier) throws } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1ImplicitlyTaggable { internal init(asn1Encoded sequenceNodeIterator: inout ASN1.ASN1NodeCollection.Iterator, withIdentifier identifier: ASN1.ASN1Identifier = Self.defaultIdentifier) throws { @@ -637,7 +637,7 @@ extension ASN1ImplicitlyTaggable { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ArraySlice where Element == UInt8 { fileprivate mutating func readASN1Length() throws -> UInt? { guard let firstByte = self.popFirst() else { @@ -686,7 +686,7 @@ extension ArraySlice where Element == UInt8 { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension FixedWidthInteger { internal init(bigEndianBytes bytes: Bytes) throws where Bytes.Element == UInt8 { guard bytes.count <= (Self.bitWidth / 8) else { @@ -704,7 +704,7 @@ extension FixedWidthInteger { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Array where Element == UInt8 { fileprivate mutating func writeIdentifier(_ identifier: ASN1.ASN1Identifier) { self.append(identifier.baseTag) @@ -730,7 +730,7 @@ extension Array where Element == UInt8 { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Int { fileprivate var bytesNeededToEncode: Int { // ASN.1 lengths are in two forms. If we can store the length in 7 bits, we should: @@ -748,7 +748,7 @@ extension Int { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension FixedWidthInteger { // Bytes needed to store a given integer. internal var neededBytes: Int { diff --git a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Any.swift b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Any.swift index 7666c06e..c4148099 100644 --- a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Any.swift +++ b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Any.swift @@ -16,7 +16,7 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1 { /// An ASN1 ANY represents...well, anything. /// @@ -25,7 +25,7 @@ extension ASN1 { /// /// The only things we allow users to do with ASN.1 ANYs is to try to decode them as something else, /// to create them from something else, or to serialize them. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct ASN1Any: ASN1Parseable, ASN1Serializable, Hashable { fileprivate var serializedBytes: ArraySlice @@ -57,14 +57,14 @@ extension ASN1 { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1Parseable { init(asn1Any: ASN1.ASN1Any) throws { try self.init(asn1Encoded: asn1Any.serializedBytes) } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1ImplicitlyTaggable { init(asn1Any: ASN1.ASN1Any, withIdentifier identifier: ASN1.ASN1Identifier) throws { try self.init(asn1Encoded: asn1Any.serializedBytes, withIdentifier: identifier) diff --git a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1BitString.swift b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1BitString.swift index 10c1dcb5..5ef69530 100644 --- a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1BitString.swift +++ b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1BitString.swift @@ -16,10 +16,10 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1 { /// A bitstring is a representation of...well...some bits. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct ASN1BitString: ASN1ImplicitlyTaggable { static var defaultIdentifier: ASN1.ASN1Identifier { .primitiveBitString @@ -58,10 +58,10 @@ extension ASN1 { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1.ASN1BitString: Hashable { } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1.ASN1BitString: ContiguousBytes { func withUnsafeBytes(_ body: (UnsafeRawBufferPointer) throws -> R) rethrows -> R { return try self.bytes.withUnsafeBytes(body) diff --git a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Boolean.swift b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Boolean.swift index 521dbd60..1786aa5d 100644 --- a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Boolean.swift +++ b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Boolean.swift @@ -16,7 +16,7 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Bool: ASN1ImplicitlyTaggable { static var defaultIdentifier: ASN1.ASN1Identifier { .boolean diff --git a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Identifier.swift b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Identifier.swift index a6922916..0e41f8ca 100644 --- a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Identifier.swift +++ b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Identifier.swift @@ -16,11 +16,11 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1 { /// An `ASN1Identifier` is a representation of the abstract notion of an ASN.1 identifier. Identifiers have a number of properties that relate to both the specific /// tag number as well as the properties of the identifier in the stream. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal struct ASN1Identifier { /// The base tag. In a general ASN.1 implementation we'd need an arbitrary precision integer here as the tag number can be arbitrarily large, but /// we don't need the full generality here. @@ -113,7 +113,7 @@ extension ASN1 { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1.ASN1Identifier { internal static let objectIdentifier = try! ASN1.ASN1Identifier(rawIdentifier: 0x06) internal static let primitiveBitString = try! ASN1.ASN1Identifier(rawIdentifier: 0x03) @@ -138,10 +138,10 @@ extension ASN1.ASN1Identifier { internal static let generalizedTime = try! ASN1.ASN1Identifier(rawIdentifier: 0x18) } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1.ASN1Identifier: Hashable { } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1.ASN1Identifier: CustomStringConvertible { var description: String { return "ASN1Identifier(\(self.baseTag))" diff --git a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Integer.swift b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Integer.swift index 121de7de..8c4c4e9f 100644 --- a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Integer.swift +++ b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Integer.swift @@ -22,7 +22,7 @@ import Foundation /// This is not a very good solution for a fully-fledged ASN.1 library: we'd rather have a better numerics /// protocol that could both initialize from and serialize to either bytes or words. However, no such /// protocol exists today. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol ASN1IntegerRepresentable: ASN1ImplicitlyTaggable { associatedtype IntegerBytes: RandomAccessCollection where IntegerBytes.Element == UInt8 @@ -35,7 +35,7 @@ protocol ASN1IntegerRepresentable: ASN1ImplicitlyTaggable { func withBigEndianIntegerBytes(_ body: (IntegerBytes) throws -> ReturnType) rethrows -> ReturnType } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1IntegerRepresentable { static var defaultIdentifier: ASN1.ASN1Identifier { .integer @@ -104,7 +104,7 @@ extension ASN1IntegerRepresentable { } // MARK: - Auto-conformance for FixedWidthInteger with fixed width magnitude. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1IntegerRepresentable where Self: FixedWidthInteger { init(asn1IntegerBytes bytes: ArraySlice) throws { // Defer to the FixedWidthInteger constructor. @@ -125,7 +125,7 @@ extension ASN1IntegerRepresentable where Self: FixedWidthInteger { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct IntegerBytesCollection { private var integer: Integer @@ -134,9 +134,9 @@ struct IntegerBytesCollection { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension IntegerBytesCollection: RandomAccessCollection { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct Index { fileprivate var byteNumber: Int @@ -170,10 +170,10 @@ extension IntegerBytesCollection: RandomAccessCollection { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension IntegerBytesCollection.Index: Equatable { } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension IntegerBytesCollection.Index: Comparable { // Comparable here is backwards to the original ordering. static func <(lhs: Self, rhs: Self) -> Bool { @@ -193,7 +193,7 @@ extension IntegerBytesCollection.Index: Comparable { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension IntegerBytesCollection.Index: Strideable { func advanced(by n: Int) -> IntegerBytesCollection.Index { return IntegerBytesCollection.Index(byteNumber: self.byteNumber - n) @@ -225,7 +225,7 @@ extension Int: ASN1IntegerRepresentable { } extension UInt: ASN1IntegerRepresentable { } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension RandomAccessCollection where Element == UInt8 { fileprivate func trimLeadingExcessBytes() -> SubSequence { var slice = self[...] @@ -273,7 +273,7 @@ extension RandomAccessCollection where Element == UInt8 { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension UInt8 { fileprivate var topBitSet: Bool { return (self & 0x80) != 0 diff --git a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Null.swift b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Null.swift index 2e661216..f95b8a7b 100644 --- a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Null.swift +++ b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Null.swift @@ -16,10 +16,10 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1 { /// An ASN1 NULL represents nothing. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct ASN1Null: ASN1ImplicitlyTaggable, Hashable { static var defaultIdentifier: ASN1.ASN1Identifier { .null diff --git a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1OctetString.swift b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1OctetString.swift index a09da49d..a2f5d007 100644 --- a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1OctetString.swift +++ b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1OctetString.swift @@ -16,10 +16,10 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1 { /// An octet string is a representation of a string of octets. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct ASN1OctetString: ASN1ImplicitlyTaggable { static var defaultIdentifier: ASN1.ASN1Identifier { .primitiveOctetString @@ -51,10 +51,10 @@ extension ASN1 { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1.ASN1OctetString: Hashable { } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1.ASN1OctetString: ContiguousBytes { func withUnsafeBytes(_ body: (UnsafeRawBufferPointer) throws -> R) rethrows -> R { return try self.bytes.withUnsafeBytes(body) diff --git a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Strings.swift b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Strings.swift index da3ef9d5..7f7443f7 100644 --- a/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Strings.swift +++ b/Sources/Crypto/ASN1/Basic ASN1 Types/ASN1Strings.swift @@ -16,11 +16,11 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1 { /// A UTF8String is roughly what it sounds like. We note that all the string types are encoded as implicitly tagged /// octet strings, and so for now we just piggyback on the decoder and encoder for that type. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct ASN1UTF8String: ASN1ImplicitlyTaggable, Hashable, ContiguousBytes, ExpressibleByStringLiteral { static var defaultIdentifier: ASN1.ASN1Identifier { .primitiveUTF8String @@ -56,7 +56,7 @@ extension ASN1 { /// We note that all the string types are encoded as implicitly tagged /// octet strings, and so for now we just piggyback on the decoder and encoder for that type. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct ASN1TeletexString: ASN1ImplicitlyTaggable, Hashable, ContiguousBytes, ExpressibleByStringLiteral { static var defaultIdentifier: ASN1.ASN1Identifier { .primitiveTeletexString @@ -92,7 +92,7 @@ extension ASN1 { /// We note that all the string types are encoded as implicitly tagged /// octet strings, and so for now we just piggyback on the decoder and encoder for that type. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct ASN1PrintableString: ASN1ImplicitlyTaggable, Hashable, ContiguousBytes, ExpressibleByStringLiteral { static var defaultIdentifier: ASN1.ASN1Identifier { .primitivePrintableString @@ -128,7 +128,7 @@ extension ASN1 { /// We note that all the string types are encoded as implicitly tagged /// octet strings, and so for now we just piggyback on the decoder and encoder for that type. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct ASN1UniversalString: ASN1ImplicitlyTaggable, Hashable, ContiguousBytes, ExpressibleByStringLiteral { static var defaultIdentifier: ASN1.ASN1Identifier { .primitiveUniversalString @@ -164,7 +164,7 @@ extension ASN1 { /// We note that all the string types are encoded as implicitly tagged /// octet strings, and so for now we just piggyback on the decoder and encoder for that type. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct ASN1BMPString: ASN1ImplicitlyTaggable, Hashable, ContiguousBytes, ExpressibleByStringLiteral { static var defaultIdentifier: ASN1.ASN1Identifier { .primitiveBMPString diff --git a/Sources/Crypto/ASN1/Basic ASN1 Types/ArraySliceBigint.swift b/Sources/Crypto/ASN1/Basic ASN1 Types/ArraySliceBigint.swift index 20c1cf07..fbdb6332 100644 --- a/Sources/Crypto/ASN1/Basic ASN1 Types/ArraySliceBigint.swift +++ b/Sources/Crypto/ASN1/Basic ASN1 Types/ArraySliceBigint.swift @@ -22,7 +22,7 @@ extension ArraySlice: ASN1Parseable where Element == UInt8 { } extension ArraySlice: ASN1ImplicitlyTaggable where Element == UInt8 { } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ArraySlice: ASN1IntegerRepresentable where Element == UInt8 { // We only use unsigned "bigint"s static var isSigned: Bool { diff --git a/Sources/Crypto/ASN1/Basic ASN1 Types/GeneralizedTime.swift b/Sources/Crypto/ASN1/Basic ASN1 Types/GeneralizedTime.swift index 5113b8c1..74177f76 100644 --- a/Sources/Crypto/ASN1/Basic ASN1 Types/GeneralizedTime.swift +++ b/Sources/Crypto/ASN1/Basic ASN1 Types/GeneralizedTime.swift @@ -16,9 +16,9 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1 { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct GeneralizedTime: ASN1ImplicitlyTaggable, Hashable { static var defaultIdentifier: ASN1.ASN1Identifier { .generalizedTime @@ -171,7 +171,7 @@ extension ASN1 { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1.GeneralizedTime { fileprivate static func parseDateBytes(_ bytes: ArraySlice) throws -> ASN1.GeneralizedTime { var bytes = bytes @@ -254,7 +254,7 @@ extension ASN1.GeneralizedTime { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ArraySlice where Element == UInt8 { fileprivate mutating func readFourDigitDecimalInteger() -> Int? { guard let first = self.readTwoDigitDecimalInteger(), @@ -320,7 +320,7 @@ extension ArraySlice where Element == UInt8 { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Array where Element == UInt8 { fileprivate mutating func append(_ generalizedTime: ASN1.GeneralizedTime) { self.appendFourDigitDecimal(generalizedTime.year) @@ -370,7 +370,7 @@ extension Array where Element == UInt8 { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Int { fileprivate init?(fromDecimalASCII ascii: UInt8) { let asciiZero = UInt8(ascii: "0") diff --git a/Sources/Crypto/ASN1/Basic ASN1 Types/ObjectIdentifier.swift b/Sources/Crypto/ASN1/Basic ASN1 Types/ObjectIdentifier.swift index 55641bc6..81de77ea 100644 --- a/Sources/Crypto/ASN1/Basic ASN1 Types/ObjectIdentifier.swift +++ b/Sources/Crypto/ASN1/Basic ASN1 Types/ObjectIdentifier.swift @@ -16,14 +16,14 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1 { /// An Object Identifier is a representation of some kind of object: really any kind of object. /// /// It represents a node in an OID hierarchy, and is usually represented as an ordered sequence of numbers. /// /// We mostly don't care about the semantics of the thing, we just care about being able to store and compare them. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct ASN1ObjectIdentifier: ASN1ImplicitlyTaggable { static var defaultIdentifier: ASN1.ASN1Identifier { .objectIdentifier @@ -133,19 +133,19 @@ extension ASN1 { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1.ASN1ObjectIdentifier: Hashable {} -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1.ASN1ObjectIdentifier: ExpressibleByArrayLiteral { init(arrayLiteral elements: UInt...) { self.oidComponents = elements } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1.ASN1ObjectIdentifier { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) enum NamedCurves { static let secp256r1: ASN1.ASN1ObjectIdentifier = [1, 2, 840, 10_045, 3, 1, 7] @@ -154,19 +154,19 @@ extension ASN1.ASN1ObjectIdentifier { static let secp521r1: ASN1.ASN1ObjectIdentifier = [1, 3, 132, 0, 35] } - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) enum HashFunctions { static let sha256: ASN1.ASN1ObjectIdentifier = [2, 16, 840, 1, 101, 3, 4, 2, 1] static let sha384: ASN1.ASN1ObjectIdentifier = [2, 16, 840, 1, 101, 3, 4, 2, 2] static let sha512: ASN1.ASN1ObjectIdentifier = [2, 16, 840, 1, 101, 3, 4, 2, 3] } - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) enum AlgorithmIdentifier { static let idEcPublicKey: ASN1.ASN1ObjectIdentifier = [1, 2, 840, 10_045, 2, 1] } - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) enum NameAttributes { static let name: ASN1.ASN1ObjectIdentifier = [2, 5, 4, 41] static let surname: ASN1.ASN1ObjectIdentifier = [2, 5, 4, 4] @@ -189,7 +189,7 @@ extension ASN1.ASN1ObjectIdentifier { } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ArraySlice where Element == UInt8 { mutating fileprivate func readOIDSubidentifier() throws -> UInt { // In principle OID subidentifiers can be too large to fit into a UInt. We are choosing to not care about that @@ -206,7 +206,7 @@ extension ArraySlice where Element == UInt8 { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension UInt { fileprivate init(sevenBitBigEndianBytes bytes: Bytes) throws where Bytes.Element == UInt8 { // We need to know how many bytes we _need_ to store this "int". diff --git a/Sources/Crypto/ASN1/ECDSASignature.swift b/Sources/Crypto/ASN1/ECDSASignature.swift index a4038f07..24945387 100644 --- a/Sources/Crypto/ASN1/ECDSASignature.swift +++ b/Sources/Crypto/ASN1/ECDSASignature.swift @@ -16,7 +16,7 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1 { /// An ECDSA signature is laid out as follows: /// @@ -26,7 +26,7 @@ extension ASN1 { /// } /// /// This type is generic because our different backends want to use different bignum representations. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct ECDSASignature: ASN1ImplicitlyTaggable { static var defaultIdentifier: ASN1.ASN1Identifier { .sequence diff --git a/Sources/Crypto/ASN1/PEMDocument.swift b/Sources/Crypto/ASN1/PEMDocument.swift index 6bddccb9..f7314117 100644 --- a/Sources/Crypto/ASN1/PEMDocument.swift +++ b/Sources/Crypto/ASN1/PEMDocument.swift @@ -16,10 +16,10 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1 { /// A PEM document is some data, and a discriminator type that is used to advertise the content. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct PEMDocument { private static let lineLength = 64 @@ -88,7 +88,7 @@ extension ASN1 { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Substring { fileprivate var pemStartDiscriminator: String? { return self.pemDiscriminator(expectedPrefix: "-----BEGIN ", expectedSuffix: "-----") diff --git a/Sources/Crypto/ASN1/PKCS8PrivateKey.swift b/Sources/Crypto/ASN1/PKCS8PrivateKey.swift index 4eda9bcf..22d7cee0 100644 --- a/Sources/Crypto/ASN1/PKCS8PrivateKey.swift +++ b/Sources/Crypto/ASN1/PKCS8PrivateKey.swift @@ -16,7 +16,7 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1 { // A PKCS#8 private key is one of two formats, depending on the version: // @@ -40,7 +40,7 @@ extension ASN1 { // // The private key octet string contains (surprise!) a SEC1-encoded private key! So we recursively invoke the // ASN.1 parser and go again. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct PKCS8PrivateKey: ASN1ImplicitlyTaggable { static var defaultIdentifier: ASN1.ASN1Identifier { return .sequence diff --git a/Sources/Crypto/ASN1/SEC1PrivateKey.swift b/Sources/Crypto/ASN1/SEC1PrivateKey.swift index 936a658a..4bde009a 100644 --- a/Sources/Crypto/ASN1/SEC1PrivateKey.swift +++ b/Sources/Crypto/ASN1/SEC1PrivateKey.swift @@ -16,7 +16,7 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1 { // For private keys, SEC 1 uses: // @@ -26,7 +26,7 @@ extension ASN1 { // parameters [0] EXPLICIT ECDomainParameters OPTIONAL, // publicKey [1] EXPLICIT BIT STRING OPTIONAL // } - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct SEC1PrivateKey: ASN1ImplicitlyTaggable { static var defaultIdentifier: ASN1.ASN1Identifier { return .sequence diff --git a/Sources/Crypto/ASN1/SubjectPublicKeyInfo.swift b/Sources/Crypto/ASN1/SubjectPublicKeyInfo.swift index c1bbd7f8..cf48a032 100644 --- a/Sources/Crypto/ASN1/SubjectPublicKeyInfo.swift +++ b/Sources/Crypto/ASN1/SubjectPublicKeyInfo.swift @@ -16,9 +16,9 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1 { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct SubjectPublicKeyInfo: ASN1ImplicitlyTaggable { static var defaultIdentifier: ASN1.ASN1Identifier { .sequence @@ -61,7 +61,7 @@ extension ASN1 { } } - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct RFC5480AlgorithmIdentifier: ASN1ImplicitlyTaggable, Hashable { static var defaultIdentifier: ASN1.ASN1Identifier { .sequence @@ -112,7 +112,7 @@ extension ASN1 { } // MARK: Algorithm Identifier Statics -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ASN1.RFC5480AlgorithmIdentifier { static let ecdsaP256 = ASN1.RFC5480AlgorithmIdentifier(algorithm: .AlgorithmIdentifier.idEcPublicKey, parameters: try! .init(erasing: ASN1.ASN1ObjectIdentifier.NamedCurves.secp256r1)) diff --git a/Sources/Crypto/CryptoKitErrors.swift b/Sources/Crypto/CryptoKitErrors.swift index c3c61c92..4bc957d5 100644 --- a/Sources/Crypto/CryptoKitErrors.swift +++ b/Sources/Crypto/CryptoKitErrors.swift @@ -15,7 +15,7 @@ @_exported import CryptoKit #else /// General cryptography errors used by CryptoKit. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum CryptoKitError: Error { /// The key size is incorrect. case incorrectKeySize @@ -34,11 +34,11 @@ public enum CryptoKitError: Error { case invalidParameter } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension CryptoKitError: Equatable, Hashable {} /// Errors from decoding ASN.1 content. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum CryptoKitASN1Error: Equatable, Error, Hashable { /// The ASN.1 tag for this field is invalid or unsupported. case invalidFieldIdentifier diff --git a/Sources/Crypto/Digests/BoringSSL/Digest_boring.swift b/Sources/Crypto/Digests/BoringSSL/Digest_boring.swift index 7b4c757d..b6e759cf 100644 --- a/Sources/Crypto/Digests/BoringSSL/Digest_boring.swift +++ b/Sources/Crypto/Digests/BoringSSL/Digest_boring.swift @@ -16,10 +16,10 @@ #else @_implementationOnly import CCryptoBoringSSL -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol HashFunctionImplementationDetails: HashFunction where Digest: DigestPrivate {} -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol BoringSSLBackedHashFunction: HashFunctionImplementationDetails { associatedtype Context static var digestSize: Int { get } @@ -28,7 +28,7 @@ protocol BoringSSLBackedHashFunction: HashFunctionImplementationDetails { static func finalize(_ context: inout Context, digest: UnsafeMutableRawBufferPointer) -> Bool } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Insecure.MD5: BoringSSLBackedHashFunction { static var digestSize: Int { Int(MD5_DIGEST_LENGTH) @@ -51,7 +51,7 @@ extension Insecure.MD5: BoringSSLBackedHashFunction { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Insecure.SHA1: BoringSSLBackedHashFunction { static var digestSize: Int { Int(SHA_DIGEST_LENGTH) @@ -74,7 +74,7 @@ extension Insecure.SHA1: BoringSSLBackedHashFunction { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SHA256: BoringSSLBackedHashFunction { static var digestSize: Int { Int(SHA256_DIGEST_LENGTH) @@ -97,7 +97,7 @@ extension SHA256: BoringSSLBackedHashFunction { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SHA384: BoringSSLBackedHashFunction { static var digestSize: Int { Int(SHA384_DIGEST_LENGTH) @@ -120,7 +120,7 @@ extension SHA384: BoringSSLBackedHashFunction { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SHA512: BoringSSLBackedHashFunction { static var digestSize: Int { Int(SHA512_DIGEST_LENGTH) @@ -143,7 +143,7 @@ extension SHA512: BoringSSLBackedHashFunction { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct OpenSSLDigestImpl { private var context: DigestContext @@ -163,7 +163,7 @@ struct OpenSSLDigestImpl { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) private final class DigestContext { private var context: H.Context diff --git a/Sources/Crypto/Digests/Digest.swift b/Sources/Crypto/Digests/Digest.swift index 58d6481e..9a73eb90 100644 --- a/Sources/Crypto/Digests/Digest.swift +++ b/Sources/Crypto/Digests/Digest.swift @@ -17,18 +17,18 @@ import Foundation /// A type that represents the output of a hash. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public protocol Digest: Hashable, ContiguousBytes, CustomStringConvertible, Sequence where Element == UInt8 { /// The number of bytes in the digest. static var byteCount: Int { get } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol DigestPrivate: Digest { init?(bufferPointer: UnsafeRawBufferPointer) } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension DigestPrivate { @inlinable init?(bytes: [UInt8]) { @@ -44,7 +44,7 @@ extension DigestPrivate { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Digest { public func makeIterator() -> Array.Iterator { self.withUnsafeBytes({ (buffPtr) in @@ -54,7 +54,7 @@ extension Digest { } // We want to implement constant-time comparison for digests. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Digest { /// Determines whether two digests are equal. /// diff --git a/Sources/Crypto/Digests/Digests.swift b/Sources/Crypto/Digests/Digests.swift index 8b853d80..e539bb26 100644 --- a/Sources/Crypto/Digests/Digests.swift +++ b/Sources/Crypto/Digests/Digests.swift @@ -20,7 +20,7 @@ // MARK: - SHA256Digest + DigestPrivate /// The output of a Secure Hashing Algorithm 2 (SHA-2) hash with a 256-bit digest. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct SHA256Digest: DigestPrivate { let bytes: (UInt64, UInt64, UInt64, UInt64) @@ -91,7 +91,7 @@ public struct SHA256Digest: DigestPrivate { // MARK: - SHA384Digest + DigestPrivate /// The output of a Secure Hashing Algorithm 2 (SHA-2) hash with a 384-bit digest. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct SHA384Digest: DigestPrivate { let bytes: (UInt64, UInt64, UInt64, UInt64, UInt64, UInt64) @@ -164,7 +164,7 @@ public struct SHA384Digest: DigestPrivate { // MARK: - SHA512Digest + DigestPrivate /// The output of a Secure Hashing Algorithm 2 (SHA-2) hash with a 512-bit digest. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct SHA512Digest: DigestPrivate { let bytes: (UInt64, UInt64, UInt64, UInt64, UInt64, UInt64, UInt64, UInt64) @@ -236,11 +236,11 @@ public struct SHA512Digest: DigestPrivate { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Insecure { // MARK: - SHA1Digest + DigestPrivate /// The output of a SHA1 hash. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct SHA1Digest: DigestPrivate { let bytes: (UInt64, UInt64, UInt64) @@ -307,11 +307,11 @@ public struct SHA1Digest: DigestPrivate { } } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Insecure { // MARK: - MD5Digest + DigestPrivate /// The output of a MD5 hash. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct MD5Digest: DigestPrivate { let bytes: (UInt64, UInt64) diff --git a/Sources/Crypto/Digests/HashFunctions.swift b/Sources/Crypto/Digests/HashFunctions.swift index f1da60e4..96e2b19f 100644 --- a/Sources/Crypto/Digests/HashFunctions.swift +++ b/Sources/Crypto/Digests/HashFunctions.swift @@ -15,10 +15,10 @@ @_exported import CryptoKit #else #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) typealias DigestImpl = CoreCryptoDigestImpl #else -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) typealias DigestImpl = OpenSSLDigestImpl #endif @@ -42,7 +42,7 @@ import Foundation /// authentication code (MAC) like ``HMAC`` instead. MACs rely on hashing, but /// incorporate a secret cryptographic key into the digest computation. Only a /// user that has the key can generate a valid MAC. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public protocol HashFunction { /// The number of bytes that represents the hash function’s internal state. static var blockByteCount: Int { get } @@ -97,7 +97,7 @@ public protocol HashFunction { func finalize() -> Digest } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension HashFunction { /// Computes a digest of the buffer. /// diff --git a/Sources/Crypto/Digests/HashFunctions_SHA2.swift b/Sources/Crypto/Digests/HashFunctions_SHA2.swift index 234c06ad..a87a03d6 100644 --- a/Sources/Crypto/Digests/HashFunctions_SHA2.swift +++ b/Sources/Crypto/Digests/HashFunctions_SHA2.swift @@ -26,7 +26,7 @@ /// in memory, you can compute the digest iteratively by creating a new hash /// instance, calling the ``update(data:)`` method repeatedly with blocks of /// data, and then calling the ``finalize()`` method to get the result. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct SHA256: HashFunctionImplementationDetails { /// The number of bytes that represents the hash function’s internal state. public static var blockByteCount: Int { @@ -109,7 +109,7 @@ public struct SHA256: HashFunctionImplementationDetails { /// in memory, you can compute the digest iteratively by creating a new hash /// instance, calling the ``update(data:)`` method repeatedly with blocks of /// data, and then calling the ``finalize()`` method to get the result. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct SHA384: HashFunctionImplementationDetails { /// The number of bytes that represents the hash function’s internal state. public static var blockByteCount: Int { @@ -193,7 +193,7 @@ public struct SHA384: HashFunctionImplementationDetails { /// in memory, you can compute the digest iteratively by creating a new hash /// instance, calling the ``update(data:)`` method repeatedly with blocks of /// data, and then calling the ``finalize()`` method to get the result. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct SHA512: HashFunctionImplementationDetails { /// The number of bytes that represents the hash function’s internal state. public static var blockByteCount: Int { diff --git a/Sources/Crypto/HPKE/Ciphersuite/HPKE-AEAD.swift b/Sources/Crypto/HPKE/Ciphersuite/HPKE-AEAD.swift index 173ac93f..90764659 100644 --- a/Sources/Crypto/HPKE/Ciphersuite/HPKE-AEAD.swift +++ b/Sources/Crypto/HPKE/Ciphersuite/HPKE-AEAD.swift @@ -17,10 +17,10 @@ import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension HPKE { /// The authenticated encryption with associated data (AEAD) algorithms to use in HPKE. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum AEAD: CaseIterable, Hashable { /// An Advanced Encryption Standard cipher in Galois/Counter Mode with a key length of 128 bits. case AES_GCM_128 diff --git a/Sources/Crypto/HPKE/Ciphersuite/HPKE-Ciphersuite.swift b/Sources/Crypto/HPKE/Ciphersuite/HPKE-Ciphersuite.swift index 1f82f72c..5a145ce1 100644 --- a/Sources/Crypto/HPKE/Ciphersuite/HPKE-Ciphersuite.swift +++ b/Sources/Crypto/HPKE/Ciphersuite/HPKE-Ciphersuite.swift @@ -17,7 +17,7 @@ import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension HPKE { /// Cipher suites to use in hybrid public key encryption. /// @@ -25,7 +25,7 @@ extension HPKE { /// and decrypting messages, the key derivation function (KDF) for deriving the shared key, and the key encapsulation /// mechanism (KEM) for sharing the symmetric key. The sender and recipient of encrypted messages need to use the /// same cipher suite. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct Ciphersuite { /// A cipher suite for HPKE that uses NIST P-256 elliptic curve key agreement, SHA-2 key derivation /// with a 256-bit digest, and the Advanced Encryption Standard cipher in Galois/Counter Mode with a key length of 256 bits. diff --git a/Sources/Crypto/HPKE/Ciphersuite/HPKE-KDF.swift b/Sources/Crypto/HPKE/Ciphersuite/HPKE-KDF.swift index 81f233fc..5109adae 100644 --- a/Sources/Crypto/HPKE/Ciphersuite/HPKE-KDF.swift +++ b/Sources/Crypto/HPKE/Ciphersuite/HPKE-KDF.swift @@ -16,10 +16,10 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension HPKE { /// The key derivation functions to use in HPKE. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum KDF: CaseIterable, Hashable { /// An HMAC-based key derivation function that uses SHA-2 hashing with a 256-bit digest. case HKDF_SHA256 diff --git a/Sources/Crypto/HPKE/Ciphersuite/HPKE-KexKeyDerivation.swift b/Sources/Crypto/HPKE/Ciphersuite/HPKE-KexKeyDerivation.swift index 26e3d29e..05026a10 100644 --- a/Sources/Crypto/HPKE/Ciphersuite/HPKE-KexKeyDerivation.swift +++ b/Sources/Crypto/HPKE/Ciphersuite/HPKE-KexKeyDerivation.swift @@ -16,12 +16,12 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) private let suiteIDLabel = Data("KEM".utf8) -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension HPKE { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct KexUtils { static func ExtractAndExpand(dh: ContiguousBytes, enc: Data, pkRm: Data, pkSm: Data? = nil, kem: HPKE.KEM, kdf: HPKE.KDF) -> SymmetricKey { diff --git a/Sources/Crypto/HPKE/Ciphersuite/HPKE-LabeledExtract.swift b/Sources/Crypto/HPKE/Ciphersuite/HPKE-LabeledExtract.swift index 634fcf45..8f3ae5f9 100644 --- a/Sources/Crypto/HPKE/Ciphersuite/HPKE-LabeledExtract.swift +++ b/Sources/Crypto/HPKE/Ciphersuite/HPKE-LabeledExtract.swift @@ -16,32 +16,32 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) private let protocolLabel = Data("HPKE-v1".utf8) -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) private let eaePRKLabel = Data("eae_prk".utf8) -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) private let sharedSecretLabel = Data("shared_secret".utf8) -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Data { internal init(unsafeFromContiguousBytes cb: ContiguousBytes) { self = cb.withUnsafeBytes { return Data($0) } } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal func ExtractAndExpand(zz: ContiguousBytes, kemContext: Data, suiteID: Data, kem: HPKE.KEM, kdf: HPKE.KDF) -> SymmetricKey { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) let eaePrk = LabeledExtract(salt: Data(), label: eaePRKLabel, ikm: zz, suiteID: suiteID, kdf: kdf) return LabeledExpand(prk: eaePrk, label: sharedSecretLabel, info: kemContext, outputByteCount: kem.nSecret, suiteID: suiteID, kdf: kdf) } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal func LabeledExtract(salt: Data?, label: Data, ikm: ContiguousBytes?, suiteID: Data, kdf: HPKE.KDF) -> SymmetricKey { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) var labeled_ikm = protocolLabel labeled_ikm.append(suiteID) labeled_ikm.append(label) @@ -49,9 +49,9 @@ internal func LabeledExtract(salt: Data?, label: Data, ikm: ContiguousBytes?, su return kdf.extract(salt: salt ?? Data(), ikm: SymmetricKey(data: labeled_ikm)) } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal func LabeledExpand(prk: SymmetricKey, label: Data, info: Info, outputByteCount: UInt16, suiteID: Data, kdf: HPKE.KDF) -> SymmetricKey { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) var labeled_info = I2OSP(value: Int(outputByteCount), outputByteCount: 2) labeled_info.append(protocolLabel) labeled_info.append(suiteID) @@ -60,12 +60,12 @@ internal func LabeledExpand(prk: SymmetricKey, label: Data, return kdf.expand(prk: prk, info: labeled_info, outputByteCount: Int(outputByteCount)) } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal func NonSecretOutputLabeledExtract(salt: Data?, label: Data, ikm: ContiguousBytes?, suiteID: Data, kdf: HPKE.KDF) -> Data { return Data(unsafeFromContiguousBytes: LabeledExtract(salt: salt, label: label, ikm: ikm, suiteID: suiteID, kdf: kdf)) } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal func NonSecretOutputLabeledExpand(prk: SymmetricKey, label: Data, info: Data, outputByteCount: UInt16, suiteID: Data, kdf: HPKE.KDF) -> Data { return Data(unsafeFromContiguousBytes: LabeledExpand(prk: prk, label: label, info: info, outputByteCount: outputByteCount, suiteID: suiteID, kdf: kdf)) } diff --git a/Sources/Crypto/HPKE/Ciphersuite/HPKE-Utils.swift b/Sources/Crypto/HPKE/Ciphersuite/HPKE-Utils.swift index 27077b53..d0e8f812 100644 --- a/Sources/Crypto/HPKE/Ciphersuite/HPKE-Utils.swift +++ b/Sources/Crypto/HPKE/Ciphersuite/HPKE-Utils.swift @@ -16,16 +16,16 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal func I2OSP(value: Int, outputByteCount: Int) -> Data { precondition(outputByteCount > 0, "Cannot I2OSP with no output length.") precondition(value >= 0, "I2OSP requires a non-null value.") - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) let requiredBytes = Int(ceil(log2(Double(max(value, 1) + 1)) / 8)) precondition(outputByteCount >= requiredBytes) - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) var data = Data(repeating: 0, count: outputByteCount) for i in (outputByteCount - requiredBytes)...(outputByteCount - 1) { diff --git a/Sources/Crypto/HPKE/Ciphersuite/KEM/Conformances/DHKEM.swift b/Sources/Crypto/HPKE/Ciphersuite/KEM/Conformances/DHKEM.swift index 755551d5..b6200704 100644 --- a/Sources/Crypto/HPKE/Ciphersuite/KEM/Conformances/DHKEM.swift +++ b/Sources/Crypto/HPKE/Ciphersuite/KEM/Conformances/DHKEM.swift @@ -17,7 +17,7 @@ import Foundation /// A type that ``HPKE`` uses to encode the public key. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public protocol HPKEPublicKeySerialization { /// Creates a public key from an encoded representation. /// @@ -35,7 +35,7 @@ public protocol HPKEPublicKeySerialization { } /// A type that represents the public key in a Diffie-Hellman key exchange. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public protocol HPKEDiffieHellmanPublicKey: HPKEPublicKeySerialization where EphemeralPrivateKey.PublicKey == Self { /// The type of the ephemeral private key. associatedtype EphemeralPrivateKey: HPKEDiffieHellmanPrivateKeyGeneration @@ -43,22 +43,22 @@ public protocol HPKEDiffieHellmanPublicKey: HPKEPublicKeySerialization where Eph /// A type that represents the private key in a Diffie-Hellman key exchange. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public protocol HPKEDiffieHellmanPrivateKey: DiffieHellmanKeyAgreement where PublicKey: HPKEDiffieHellmanPublicKey {} /// A type that represents the generation of private keys in a Diffie-Hellman key exchange. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public protocol HPKEDiffieHellmanPrivateKeyGeneration: HPKEDiffieHellmanPrivateKey { /// Creates a private key generator. init() } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension HPKE { /// A container for Diffie-Hellman key encapsulation mechanisms (KEMs). - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum DHKEM { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct PublicKey: KEMPublicKey where DHPK == DHPK.EphemeralPrivateKey.PublicKey { let kem: HPKE.KEM let key: DHPK @@ -91,7 +91,7 @@ extension HPKE { } } - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct PrivateKey: KEMPrivateKey { let kem: HPKE.KEM let key: DHSK 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 4a8c8287..e271956e 100644 --- a/Sources/Crypto/HPKE/Ciphersuite/KEM/Conformances/HPKE-KEM-Curve25519.swift +++ b/Sources/Crypto/HPKE/Ciphersuite/KEM/Conformances/HPKE-KEM-Curve25519.swift @@ -16,11 +16,11 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Curve25519.KeyAgreement.PrivateKey: HPKEDiffieHellmanPrivateKeyGeneration {} -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Curve25519.KeyAgreement.PublicKey: HPKEDiffieHellmanPublicKey { /// The type of the ephemeral private key associated with this public key. public typealias EphemeralPrivateKey = Curve25519.KeyAgreement.PrivateKey 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 b734646f..3a8f2ad1 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 @@ -18,7 +18,7 @@ import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P256.KeyAgreement.PrivateKey: HPKEDiffieHellmanPrivateKeyGeneration { /// Creates a NIST P-256 elliptic curve private key for use with Diffie-Hellman key exchange. public init() { @@ -27,7 +27,7 @@ extension P256.KeyAgreement.PrivateKey: HPKEDiffieHellmanPrivateKeyGeneration { } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P256.KeyAgreement.PublicKey: HPKEDiffieHellmanPublicKey { /// The type of the ephemeral private key associated with this public key. public typealias EphemeralPrivateKey = P256.KeyAgreement.PrivateKey @@ -68,7 +68,7 @@ extension P256.KeyAgreement.PublicKey: HPKEDiffieHellmanPublicKey { } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P384.KeyAgreement.PrivateKey: HPKEDiffieHellmanPrivateKeyGeneration { /// Creates a NIST P-384 elliptic curve private key for use with Diffie-Hellman key exchange. public init() { @@ -77,7 +77,7 @@ extension P384.KeyAgreement.PrivateKey: HPKEDiffieHellmanPrivateKeyGeneration { } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P384.KeyAgreement.PublicKey: HPKEDiffieHellmanPublicKey { /// The type of the ephemeral private key associated with this public key. public typealias EphemeralPrivateKey = P384.KeyAgreement.PrivateKey @@ -118,7 +118,7 @@ extension P384.KeyAgreement.PublicKey: HPKEDiffieHellmanPublicKey { } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P521.KeyAgreement.PrivateKey: HPKEDiffieHellmanPrivateKeyGeneration { /// Creates a NIST P-521 elliptic curve private key for use with Diffie-Hellman key exchange. public init() { @@ -127,7 +127,7 @@ extension P521.KeyAgreement.PrivateKey: HPKEDiffieHellmanPrivateKeyGeneration { } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P521.KeyAgreement.PublicKey: HPKEDiffieHellmanPublicKey { /// The type of the ephemeral private key associated with this public key. public typealias EphemeralPrivateKey = P521.KeyAgreement.PrivateKey diff --git a/Sources/Crypto/HPKE/Ciphersuite/KEM/HPKE-KEM.swift b/Sources/Crypto/HPKE/Ciphersuite/KEM/HPKE-KEM.swift index 118fccde..6cc3f466 100644 --- a/Sources/Crypto/HPKE/Ciphersuite/KEM/HPKE-KEM.swift +++ b/Sources/Crypto/HPKE/Ciphersuite/KEM/HPKE-KEM.swift @@ -16,10 +16,10 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension HPKE { /// The key encapsulation mechanisms to use in HPKE. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum KEM: CaseIterable, Hashable { /// A key encapsulation mechanism using NIST P-256 elliptic curve key agreement /// and SHA-2 hashing with a 256-bit digest. diff --git a/Sources/Crypto/HPKE/HPKE-Errors.swift b/Sources/Crypto/HPKE/HPKE-Errors.swift index aaa33f54..21764150 100644 --- a/Sources/Crypto/HPKE/HPKE-Errors.swift +++ b/Sources/Crypto/HPKE/HPKE-Errors.swift @@ -16,10 +16,10 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension HPKE { /// Hybrid public key encryption (HPKE) errors that CryptoKit uses. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum Errors: Error { /// The parameters for initializing an HPKE sender or receiver are inconsistent. case inconsistentParameters diff --git a/Sources/Crypto/HPKE/HPKE.swift b/Sources/Crypto/HPKE/HPKE.swift index 48d521a7..83fe1741 100644 --- a/Sources/Crypto/HPKE/HPKE.swift +++ b/Sources/Crypto/HPKE/HPKE.swift @@ -45,10 +45,10 @@ import Foundation /// /// ### Handling errors /// - ``Errors`` -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum HPKE {} -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension HPKE { /// A type that represents the sending side of an HPKE message exchange. /// @@ -58,7 +58,7 @@ extension HPKE { /// in turn to retrieve its ciphertext. The recipient of the messages needs to process them in the /// same order as the `Sender`, using the same encryption mode, cipher suite, and key schedule information /// (`info`), as well as the `Sender`'s ``encapsulatedKey``. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct Sender { private var context: Context /// The encapsulated symmetric key that the recipient uses to decrypt messages. @@ -196,7 +196,7 @@ extension HPKE { /// same order as the `Sender`, using the same cipher suite, encryption mode, and key schedule information /// (`info` data). /// Use a separate `Recipient` instance for each stream of messages. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct Recipient { private var context: Context diff --git a/Sources/Crypto/HPKE/Key Schedule/HPKE-Context.swift b/Sources/Crypto/HPKE/Key Schedule/HPKE-Context.swift index 9fad29bb..f072a664 100644 --- a/Sources/Crypto/HPKE/Key Schedule/HPKE-Context.swift +++ b/Sources/Crypto/HPKE/Key Schedule/HPKE-Context.swift @@ -16,9 +16,9 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension HPKE { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct Context { var keySchedule: KeySchedule var encapsulated: Data diff --git a/Sources/Crypto/HPKE/Key Schedule/HPKE-KeySchedule.swift b/Sources/Crypto/HPKE/Key Schedule/HPKE-KeySchedule.swift index 1df28a29..72e22da9 100644 --- a/Sources/Crypto/HPKE/Key Schedule/HPKE-KeySchedule.swift +++ b/Sources/Crypto/HPKE/Key Schedule/HPKE-KeySchedule.swift @@ -16,9 +16,9 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension HPKE { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal struct KeySchedule { fileprivate static let pksIDHashLabel = Data("psk_id_hash".utf8) fileprivate static let infoHashLabel = Data("info_hash".utf8) diff --git a/Sources/Crypto/HPKE/Modes/HPKE-Modes.swift b/Sources/Crypto/HPKE/Modes/HPKE-Modes.swift index a050febf..bae1d76d 100644 --- a/Sources/Crypto/HPKE/Modes/HPKE-Modes.swift +++ b/Sources/Crypto/HPKE/Modes/HPKE-Modes.swift @@ -15,10 +15,10 @@ @_exported import CryptoKit #else -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension HPKE { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal enum Mode: CaseIterable { case base case psk diff --git a/Sources/Crypto/Insecure/Insecure.swift b/Sources/Crypto/Insecure/Insecure.swift index 54593749..19adb1f2 100644 --- a/Sources/Crypto/Insecure/Insecure.swift +++ b/Sources/Crypto/Insecure/Insecure.swift @@ -19,6 +19,6 @@ /// - Important: These algorithms aren’t considered cryptographically secure, /// but the framework provides them for backward compatibility with older /// services that require them. For new services, avoid these algorithms. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum Insecure {} #endif // Linux or !SwiftPM diff --git a/Sources/Crypto/Insecure/Insecure_HashFunctions.swift b/Sources/Crypto/Insecure/Insecure_HashFunctions.swift index f91c7409..a82e5330 100644 --- a/Sources/Crypto/Insecure/Insecure_HashFunctions.swift +++ b/Sources/Crypto/Insecure/Insecure_HashFunctions.swift @@ -14,7 +14,7 @@ #if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @_exported import CryptoKit #else -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Insecure { /// An implementation of SHA1 hashing. /// @@ -32,7 +32,7 @@ extension Insecure { /// secure, but is provided for backward compatibility with older services /// that require it. For new services, prefer one of the secure hashes, like /// ``SHA512``. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct SHA1: HashFunctionImplementationDetails { /// The number of bytes that represents the hash function’s internal /// state. @@ -121,7 +121,7 @@ extension Insecure { /// secure, but is provided for backward compatibility with older services /// that require it. For new services, prefer one of the secure hashes, like /// ``SHA512``. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct MD5: HashFunctionImplementationDetails { /// The number of bytes that represents the hash function’s internal /// state. diff --git a/Sources/Crypto/KEM/KEM.swift b/Sources/Crypto/KEM/KEM.swift index fe410c3d..e3939b65 100644 --- a/Sources/Crypto/KEM/KEM.swift +++ b/Sources/Crypto/KEM/KEM.swift @@ -17,10 +17,10 @@ import Foundation /// A Key Encapsulation Mechanism -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum KEM { /// The result of an encapsulation operation - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct EncapsulationResult { /// The shared secret public let sharedSecret: SymmetricKey @@ -35,7 +35,7 @@ public enum KEM { } /// A Key Encapsulation Mechanism's Public Key -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public protocol KEMPublicKey { /// Encapsulates the generated shared secret /// - Returns: The shared secret and its encapsulated version @@ -43,7 +43,7 @@ public protocol KEMPublicKey { } /// A Key Encapsulation Mechanism's Private Key -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public protocol KEMPrivateKey { associatedtype PublicKey: KEMPublicKey diff --git a/Sources/Crypto/Key Agreement/BoringSSL/ECDH_boring.swift b/Sources/Crypto/Key Agreement/BoringSSL/ECDH_boring.swift index 70b59d3b..932d61b4 100644 --- a/Sources/Crypto/Key Agreement/BoringSSL/ECDH_boring.swift +++ b/Sources/Crypto/Key Agreement/BoringSSL/ECDH_boring.swift @@ -16,7 +16,7 @@ #else @_implementationOnly import CCryptoBoringSSL -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P256.KeyAgreement.PrivateKey { internal func openSSLSharedSecretFromKeyAgreement( with publicKeyShare: P256.KeyAgreement.PublicKey @@ -26,7 +26,7 @@ extension P256.KeyAgreement.PrivateKey { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P384.KeyAgreement.PrivateKey { internal func openSSLSharedSecretFromKeyAgreement( with publicKeyShare: P384.KeyAgreement.PublicKey @@ -36,7 +36,7 @@ extension P384.KeyAgreement.PrivateKey { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P521.KeyAgreement.PrivateKey { internal func openSSLSharedSecretFromKeyAgreement( with publicKeyShare: P521.KeyAgreement.PublicKey diff --git a/Sources/Crypto/Key Agreement/DH.swift b/Sources/Crypto/Key Agreement/DH.swift index bced91f7..4eead0b6 100644 --- a/Sources/Crypto/Key Agreement/DH.swift +++ b/Sources/Crypto/Key Agreement/DH.swift @@ -17,7 +17,7 @@ import Foundation /// A Diffie-Hellman Key Agreement Key -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public protocol DiffieHellmanKeyAgreement { /// The public key share type to perform the DH Key Agreement associatedtype PublicKey @@ -48,7 +48,7 @@ public protocol DiffieHellmanKeyAgreement { /// symmetric key suitable for creating a message authentication code like /// ``HMAC``, or for opening and closing a sealed box with a cipher like /// ``ChaChaPoly`` or ``AES``. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct SharedSecret: ContiguousBytes { var ss: SecureBytes @@ -146,7 +146,7 @@ public struct SharedSecret: ContiguousBytes { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SharedSecret: Hashable { public func hash(into hasher: inout Hasher) { ss.withUnsafeBytes { hasher.combine(bytes: $0) } @@ -154,7 +154,7 @@ extension SharedSecret: Hashable { } // We want to implement constant-time comparison for digests. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SharedSecret: CustomStringConvertible, Equatable { public static func == (lhs: Self, rhs: Self) -> Bool { return safeCompare(lhs, rhs) @@ -183,7 +183,7 @@ extension SharedSecret: CustomStringConvertible, Equatable { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension HashFunction { // A wrapper function to keep the unsafe code in one place. mutating func update(_ secret: SharedSecret) { diff --git a/Sources/Crypto/Key Agreement/ECDH.swift b/Sources/Crypto/Key Agreement/ECDH.swift index 1d88cb46..56bf0dc5 100644 --- a/Sources/Crypto/Key Agreement/ECDH.swift +++ b/Sources/Crypto/Key Agreement/ECDH.swift @@ -15,14 +15,14 @@ @_exported import CryptoKit #else #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) typealias NISTCurvePublicKeyImpl = CoreCryptoNISTCurvePublicKeyImpl -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) typealias NISTCurvePrivateKeyImpl = CoreCryptoNISTCurvePrivateKeyImpl #else -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) typealias NISTCurvePublicKeyImpl = OpenSSLNISTCurvePublicKeyImpl -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) typealias NISTCurvePrivateKeyImpl = OpenSSLNISTCurvePrivateKeyImpl #endif @@ -33,16 +33,16 @@ import Foundation // see section `gyb` in `README` for details. // MARK: - P256 + Signing -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P256 { /// A mechanism used to create or verify a cryptographic signature using /// the NIST P-256 elliptic curve digital signature algorithm (ECDSA). - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum Signing { /// A P-256 public key used to verify cryptographic signatures. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct PublicKey: NISTECPublicKey { var impl: NISTCurvePublicKeyImpl @@ -142,7 +142,7 @@ extension P256 { } /// A P-256 private key used to create cryptographic signatures. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct PrivateKey: NISTECPrivateKey { let impl: NISTCurvePrivateKeyImpl @@ -251,17 +251,17 @@ extension P256 { } } // MARK: - P256 + KeyAgreement -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P256 { /// A mechanism used to create a shared secret between two users by /// performing NIST P-256 elliptic curve Diffie Hellman (ECDH) key /// exchange. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum KeyAgreement { /// A P-256 public key used for key agreement. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct PublicKey: NISTECPublicKey { var impl: NISTCurvePublicKeyImpl @@ -361,7 +361,7 @@ extension P256 { } /// A P-256 private key used for key agreement. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct PrivateKey: NISTECPrivateKey { let impl: NISTCurvePrivateKeyImpl @@ -470,16 +470,16 @@ extension P256 { } } // MARK: - P384 + Signing -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P384 { /// A mechanism used to create or verify a cryptographic signature using /// the NIST P-384 elliptic curve digital signature algorithm (ECDSA). - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum Signing { /// A P-384 public key used to verify cryptographic signatures. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct PublicKey: NISTECPublicKey { var impl: NISTCurvePublicKeyImpl @@ -579,7 +579,7 @@ extension P384 { } /// A P-384 private key used to create cryptographic signatures. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct PrivateKey: NISTECPrivateKey { let impl: NISTCurvePrivateKeyImpl @@ -688,17 +688,17 @@ extension P384 { } } // MARK: - P384 + KeyAgreement -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P384 { /// A mechanism used to create a shared secret between two users by /// performing NIST P-384 elliptic curve Diffie Hellman (ECDH) key /// exchange. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum KeyAgreement { /// A P-384 public key used for key agreement. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct PublicKey: NISTECPublicKey { var impl: NISTCurvePublicKeyImpl @@ -798,7 +798,7 @@ extension P384 { } /// A P-384 private key used for key agreement. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct PrivateKey: NISTECPrivateKey { let impl: NISTCurvePrivateKeyImpl @@ -907,16 +907,16 @@ extension P384 { } } // MARK: - P521 + Signing -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P521 { /// A mechanism used to create or verify a cryptographic signature using /// the NIST P-521 elliptic curve digital signature algorithm (ECDSA). - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum Signing { /// A P-521 public key used to verify cryptographic signatures. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct PublicKey: NISTECPublicKey { var impl: NISTCurvePublicKeyImpl @@ -1016,7 +1016,7 @@ extension P521 { } /// A P-521 private key used to create cryptographic signatures. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct PrivateKey: NISTECPrivateKey { let impl: NISTCurvePrivateKeyImpl @@ -1125,17 +1125,17 @@ extension P521 { } } // MARK: - P521 + KeyAgreement -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P521 { /// A mechanism used to create a shared secret between two users by /// performing NIST P-521 elliptic curve Diffie Hellman (ECDH) key /// exchange. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum KeyAgreement { /// A P-521 public key used for key agreement. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct PublicKey: NISTECPublicKey { var impl: NISTCurvePublicKeyImpl @@ -1235,7 +1235,7 @@ extension P521 { } /// A P-521 private key used for key agreement. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct PrivateKey: NISTECPrivateKey { let impl: NISTCurvePrivateKeyImpl @@ -1345,7 +1345,7 @@ extension P521 { } // MARK: - P256 + DH -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P256.KeyAgreement.PrivateKey: DiffieHellmanKeyAgreement { /// Computes a shared secret with the provided public key from another party. /// @@ -1362,7 +1362,7 @@ extension P256.KeyAgreement.PrivateKey: DiffieHellmanKeyAgreement { } } // MARK: - P384 + DH -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P384.KeyAgreement.PrivateKey: DiffieHellmanKeyAgreement { /// Computes a shared secret with the provided public key from another party. /// @@ -1379,7 +1379,7 @@ extension P384.KeyAgreement.PrivateKey: DiffieHellmanKeyAgreement { } } // MARK: - P521 + DH -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P521.KeyAgreement.PrivateKey: DiffieHellmanKeyAgreement { /// Computes a shared secret with the provided public key from another party. /// diff --git a/Sources/Crypto/Key Derivation/HKDF.swift b/Sources/Crypto/Key Derivation/HKDF.swift index eb5c3ded..9208634b 100644 --- a/Sources/Crypto/Key Derivation/HKDF.swift +++ b/Sources/Crypto/Key Derivation/HKDF.swift @@ -34,7 +34,7 @@ import Android /// material in the form of a hashed authentication code, then call /// ``expand(pseudoRandomKey:info:outputByteCount:)`` using that key material to /// generate a symmetric key of the length you specify. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct HKDF { /// Derives a symmetric encryption key from a main key or passcode using /// HKDF key derivation with information and salt you specify. diff --git a/Sources/Crypto/Key Wrapping/AESWrap.swift b/Sources/Crypto/Key Wrapping/AESWrap.swift index 7c61add2..33626e6d 100644 --- a/Sources/Crypto/Key Wrapping/AESWrap.swift +++ b/Sources/Crypto/Key Wrapping/AESWrap.swift @@ -17,18 +17,18 @@ import Foundation #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) typealias AESWRAPImpl = CoreCryptoAESWRAPImpl #else -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) typealias AESWRAPImpl = BoringSSLAESWRAPImpl #endif -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension AES { /// An implementation of AES Key Wrapping in accordance with the IETF RFC /// 3394 specification. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum KeyWrap { /// Wraps a key using the AES wrap algorithm. /// diff --git a/Sources/Crypto/Key Wrapping/BoringSSL/AESWrap_boring.swift b/Sources/Crypto/Key Wrapping/BoringSSL/AESWrap_boring.swift index 230b8582..5eebd15b 100644 --- a/Sources/Crypto/Key Wrapping/BoringSSL/AESWrap_boring.swift +++ b/Sources/Crypto/Key Wrapping/BoringSSL/AESWrap_boring.swift @@ -17,7 +17,7 @@ @_implementationOnly import CCryptoBoringSSL import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) enum BoringSSLAESWRAPImpl { static func wrap(key: SymmetricKey, keyToWrap: SymmetricKey) throws -> Data { // There's a flat 8-byte overhead to AES KeyWrap. @@ -96,9 +96,9 @@ enum BoringSSLAESWRAPImpl { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SymmetricKey { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) fileprivate enum AESKeyMode { case encrypting case decrypting diff --git a/Sources/Crypto/Keys/EC/BoringSSL/Ed25519_boring.swift b/Sources/Crypto/Keys/EC/BoringSSL/Ed25519_boring.swift index 4c58cf7e..4a16757b 100644 --- a/Sources/Crypto/Keys/EC/BoringSSL/Ed25519_boring.swift +++ b/Sources/Crypto/Keys/EC/BoringSSL/Ed25519_boring.swift @@ -19,10 +19,10 @@ import Foundation // For signing and verifying, we use BoringSSL's Ed25519, not the X25519 stuff. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Curve25519.Signing { @usableFromInline - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct OpenSSLCurve25519PrivateKeyImpl { var _privateKey: SecureBytes @usableFromInline var _publicKey: [UInt8] @@ -94,7 +94,7 @@ extension Curve25519.Signing { } @usableFromInline - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct OpenSSLCurve25519PublicKeyImpl { @usableFromInline var keyBytes: [UInt8] diff --git a/Sources/Crypto/Keys/EC/BoringSSL/NISTCurvesKeys_boring.swift b/Sources/Crypto/Keys/EC/BoringSSL/NISTCurvesKeys_boring.swift index beacf8ef..fc7d7bdc 100644 --- a/Sources/Crypto/Keys/EC/BoringSSL/NISTCurvesKeys_boring.swift +++ b/Sources/Crypto/Keys/EC/BoringSSL/NISTCurvesKeys_boring.swift @@ -20,13 +20,13 @@ import CryptoBoringWrapper import Foundation @usableFromInline -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol OpenSSLSupportedNISTCurve { @inlinable static var group: BoringSSLEllipticCurveGroup { get } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension OpenSSLSupportedNISTCurve { @inlinable static var coordinateByteCount: Int { @@ -34,7 +34,7 @@ extension OpenSSLSupportedNISTCurve { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P256: OpenSSLSupportedNISTCurve { @inlinable static var group: BoringSSLEllipticCurveGroup { @@ -42,7 +42,7 @@ extension P256: OpenSSLSupportedNISTCurve { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P384: OpenSSLSupportedNISTCurve { @inlinable static var group: BoringSSLEllipticCurveGroup { @@ -50,7 +50,7 @@ extension P384: OpenSSLSupportedNISTCurve { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P521: OpenSSLSupportedNISTCurve { @inlinable static var group: BoringSSLEllipticCurveGroup { @@ -59,7 +59,7 @@ extension P521: OpenSSLSupportedNISTCurve { } @usableFromInline -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct OpenSSLNISTCurvePrivateKeyImpl { @usableFromInline var key: BoringSSLECPrivateKeyWrapper @@ -90,7 +90,7 @@ struct OpenSSLNISTCurvePrivateKeyImpl { } @usableFromInline -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct OpenSSLNISTCurvePublicKeyImpl { @usableFromInline var key: BoringSSLECPublicKeyWrapper @@ -140,7 +140,7 @@ struct OpenSSLNISTCurvePublicKeyImpl { /// A simple wrapper for an EC_KEY pointer for a private key. This manages the lifetime of that pointer and /// allows some helper operations. @usableFromInline -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) class BoringSSLECPrivateKeyWrapper { @usableFromInline var key: OpaquePointer @@ -345,7 +345,7 @@ class BoringSSLECPrivateKeyWrapper { /// A simple wrapper for an EC_KEY pointer for a public key. This manages the lifetime of that pointer and /// allows some helper operations. @usableFromInline -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) class BoringSSLECPublicKeyWrapper { @usableFromInline var key: OpaquePointer @@ -581,7 +581,7 @@ class BoringSSLECPublicKeyWrapper { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ContiguousBytes { func readx963PrivateNumbers() throws -> ( x: ArbitraryPrecisionInteger, y: ArbitraryPrecisionInteger, k: ArbitraryPrecisionInteger @@ -651,26 +651,26 @@ extension ContiguousBytes { } @usableFromInline -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) func readRawPublicNumbers( copyingBytes bytesPtr: UnsafeRawBufferPointer ) throws -> ( x: ArbitraryPrecisionInteger, y: ArbitraryPrecisionInteger ) { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) let stride = bytesPtr.count / 2 - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) var offset = 0 - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) let xPointer = UnsafeRawBufferPointer(rebasing: bytesPtr[offset..<(offset + stride)]) offset += stride - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) let yPointer = UnsafeRawBufferPointer(rebasing: bytesPtr[offset..<(offset + stride)]) // We cannot handle allocation errors, so we check for fatal error. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) let x = try ArbitraryPrecisionInteger(bytes: xPointer) - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) let y = try ArbitraryPrecisionInteger(bytes: yPointer) return (x: x, y: y) @@ -681,7 +681,7 @@ func readRawPublicNumbers( /// The check is defined in https://tools.ietf.org/id/draft-jivsov-ecc-compact-05.html#rfc.section.4.2.1. Specifically, a /// point is compact representable if its y coordinate is the smaller of min(y, p-y) where p is the order of the prime field. @usableFromInline -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) func _isCompactRepresentable( group: BoringSSLEllipticCurveGroup, publicKeyPoint: EllipticCurvePoint @@ -689,11 +689,11 @@ func _isCompactRepresentable( // We have three try!s here: any of those failing is the result of an allocation error, and we cannot recover from // those. let (_, y) = try! publicKeyPoint.affineCoordinates(group: group) - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) let p = group.weierstrassCoefficients.field - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) let context = try! FiniteFieldArithmeticContext(fieldSize: p) - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) let newY = try! context.subtract(y, from: group.order) // The point is compact representable if y is less than or equal to newY. diff --git a/Sources/Crypto/Keys/EC/BoringSSL/X25519Keys_boring.swift b/Sources/Crypto/Keys/EC/BoringSSL/X25519Keys_boring.swift index 329503ac..67217df6 100644 --- a/Sources/Crypto/Keys/EC/BoringSSL/X25519Keys_boring.swift +++ b/Sources/Crypto/Keys/EC/BoringSSL/X25519Keys_boring.swift @@ -18,13 +18,13 @@ @_implementationOnly import CCryptoBoringSSLShims import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Curve25519.KeyAgreement { @usableFromInline static let keySizeBytes = 32 @usableFromInline - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct OpenSSLCurve25519PublicKeyImpl { @usableFromInline var keyBytes: [UInt8] @@ -52,7 +52,7 @@ extension Curve25519.KeyAgreement { } @usableFromInline - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct OpenSSLCurve25519PrivateKeyImpl { var key: SecureBytes diff --git a/Sources/Crypto/Keys/EC/Curve25519.swift b/Sources/Crypto/Keys/EC/Curve25519.swift index c254d469..9f8b4a13 100644 --- a/Sources/Crypto/Keys/EC/Curve25519.swift +++ b/Sources/Crypto/Keys/EC/Curve25519.swift @@ -15,6 +15,6 @@ @_exported import CryptoKit #else /// An elliptic curve that enables X25519 key agreement and Ed25519 signatures. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum Curve25519 {} #endif // Linux or !SwiftPM diff --git a/Sources/Crypto/Keys/EC/Ed25519Keys.swift b/Sources/Crypto/Keys/EC/Ed25519Keys.swift index 2f4ec26a..a5ba229e 100644 --- a/Sources/Crypto/Keys/EC/Ed25519Keys.swift +++ b/Sources/Crypto/Keys/EC/Ed25519Keys.swift @@ -16,18 +16,18 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Curve25519.Signing { static var keyByteCount: Int { return 32 } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Curve25519 { /// A mechanism used to create or verify a cryptographic signature using /// Ed25519. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum Signing { #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API typealias Curve25519PrivateKeyImpl = Curve25519.Signing.CoreCryptoCurve25519PrivateKeyImpl @@ -38,7 +38,7 @@ extension Curve25519 { #endif /// A Curve25519 private key used to create cryptographic signatures. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct PrivateKey: ECPrivateKey { private var baseKey: Curve25519.Signing.Curve25519PrivateKeyImpl @@ -74,7 +74,7 @@ extension Curve25519 { } /// A Curve25519 public key used to verify cryptographic signatures. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct PublicKey { private var baseKey: Curve25519.Signing.Curve25519PublicKeyImpl diff --git a/Sources/Crypto/Keys/EC/NISTCurvesKeys.swift b/Sources/Crypto/Keys/EC/NISTCurvesKeys.swift index 0535bc52..2bb00bb3 100644 --- a/Sources/Crypto/Keys/EC/NISTCurvesKeys.swift +++ b/Sources/Crypto/Keys/EC/NISTCurvesKeys.swift @@ -17,26 +17,26 @@ import Foundation @_exported import CryptoKit #else #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) typealias SupportedCurveDetailsImpl = CorecryptoSupportedNISTCurve #else -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) typealias SupportedCurveDetailsImpl = OpenSSLSupportedNISTCurve #endif -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol ECPublicKey { init (rawRepresentation: Bytes) throws var rawRepresentation: Data { get } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol ECPrivateKey { associatedtype PK var publicKey: PK { get } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol NISTECPublicKey: ECPublicKey { init(compactRepresentation: Bytes) throws init(compressedRepresentation: Bytes) throws @@ -46,21 +46,21 @@ protocol NISTECPublicKey: ECPublicKey { var x963Representation: Data { get } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol NISTECPrivateKey: ECPrivateKey where PK: NISTECPublicKey { init (rawRepresentation: Bytes) throws var rawRepresentation: Data { get } } /// An elliptic curve that enables NIST P-256 signatures and key agreement. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum P256 { } /// An elliptic curve that enables NIST P-384 signatures and key agreement. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum P384 { } /// An elliptic curve that enables NIST P-521 signatures and key agreement. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum P521 { } #endif // Linux or !SwiftPM diff --git a/Sources/Crypto/Keys/EC/X25519Keys.swift b/Sources/Crypto/Keys/EC/X25519Keys.swift index c165ed80..78b26e12 100644 --- a/Sources/Crypto/Keys/EC/X25519Keys.swift +++ b/Sources/Crypto/Keys/EC/X25519Keys.swift @@ -16,18 +16,18 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Curve25519.KeyAgreement { static var keyByteCount: Int { return 32 } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Curve25519 { /// A mechanism used to create a shared secret between two users by /// performing X25519 key agreement. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum KeyAgreement { #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API typealias Curve25519PrivateKeyImpl = Curve25519.KeyAgreement.CoreCryptoCurve25519PrivateKeyImpl @@ -38,7 +38,7 @@ extension Curve25519 { #endif /// A Curve25519 public key used for key agreement. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct PublicKey: ECPublicKey { fileprivate var baseKey: Curve25519PublicKeyImpl @@ -72,7 +72,7 @@ extension Curve25519 { } /// A Curve25519 private key used for key agreement. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct PrivateKey: DiffieHellmanKeyAgreement { fileprivate var baseKey: Curve25519PrivateKeyImpl diff --git a/Sources/Crypto/Keys/Symmetric/SymmetricKeys.swift b/Sources/Crypto/Keys/Symmetric/SymmetricKeys.swift index f48f04de..dfc84220 100644 --- a/Sources/Crypto/Keys/Symmetric/SymmetricKeys.swift +++ b/Sources/Crypto/Keys/Symmetric/SymmetricKeys.swift @@ -23,7 +23,7 @@ import Foundation /// standard key sizes, like ``bits128``, ``bits192``, or ``bits256``. When you /// need a key with a non-standard length, use the ``init(bitCount:)`` /// initializer to create a `SymmetricKeySize` instance with a custom bit count. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct SymmetricKeySize { /// The number of bits in the key. public let bitCount: Int @@ -64,7 +64,7 @@ public struct SymmetricKeySize { /// symmetric key to compute a message authentication code like ``HMAC``, or to /// open and close a sealed box (``ChaChaPoly/SealedBox`` or /// ``AES/GCM/SealedBox``) using a cipher like ``ChaChaPoly`` or ``AES``. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct SymmetricKey: ContiguousBytes { let sb: SecureBytes @@ -124,7 +124,7 @@ public struct SymmetricKey: ContiguousBytes { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SymmetricKey: Equatable { public static func == (lhs: Self, rhs: Self) -> Bool { return safeCompare(lhs, rhs) diff --git a/Sources/Crypto/Message Authentication Codes/HMAC/HMAC.swift b/Sources/Crypto/Message Authentication Codes/HMAC/HMAC.swift index 170e11dd..3d722185 100644 --- a/Sources/Crypto/Message Authentication Codes/HMAC/HMAC.swift +++ b/Sources/Crypto/Message Authentication Codes/HMAC/HMAC.swift @@ -29,7 +29,7 @@ import Foundation /// need to encrypt the data as well as authenticate it, use a cipher like /// ``AES`` or ``ChaChaPoly`` to put the data into a sealed box (an instance of /// ``AES/GCM/SealedBox`` or ``ChaChaPoly/SealedBox``). -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct HMAC: MACAlgorithm { /// An alias for the symmetric key type used to compute or verify a message /// authentication code. @@ -194,7 +194,7 @@ public struct HMAC: MACAlgorithm { } /// A hash-based message authentication code. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct HashedAuthenticationCode: MessageAuthenticationCode { let digest: H.Digest diff --git a/Sources/Crypto/Message Authentication Codes/MACFunctions.swift b/Sources/Crypto/Message Authentication Codes/MACFunctions.swift index 51cb5c1b..851d4912 100644 --- a/Sources/Crypto/Message Authentication Codes/MACFunctions.swift +++ b/Sources/Crypto/Message Authentication Codes/MACFunctions.swift @@ -16,7 +16,7 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol MACAlgorithm { associatedtype Key #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API @@ -41,7 +41,7 @@ protocol MACAlgorithm { func finalize() -> MAC } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension MACAlgorithm { /// Computes a Message Authentication Code. /// diff --git a/Sources/Crypto/Message Authentication Codes/MessageAuthenticationCode.swift b/Sources/Crypto/Message Authentication Codes/MessageAuthenticationCode.swift index 378da9a6..a5b881b5 100644 --- a/Sources/Crypto/Message Authentication Codes/MessageAuthenticationCode.swift +++ b/Sources/Crypto/Message Authentication Codes/MessageAuthenticationCode.swift @@ -17,13 +17,13 @@ import Foundation /// A type that represents a message authentication code. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public protocol MessageAuthenticationCode: Hashable, ContiguousBytes, CustomStringConvertible, Sequence where Element == UInt8 { /// The number of bytes in the message authentication code. var byteCount: Int { get } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension MessageAuthenticationCode { /// Returns a Boolean value indicating whether two message authentication /// codes are equal. diff --git a/Sources/Crypto/PRF/AES.swift b/Sources/Crypto/PRF/AES.swift index 892aba49..da5d082b 100644 --- a/Sources/Crypto/PRF/AES.swift +++ b/Sources/Crypto/PRF/AES.swift @@ -15,12 +15,12 @@ @_exported import CryptoKit #else /// A container for Advanced Encryption Standard (AES) ciphers. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum AES { static let blockSizeByteCount = 16 } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension AES { static func isValidKey(_ key: SymmetricKey) -> Bool { switch key.bitCount { diff --git a/Sources/Crypto/Signatures/BoringSSL/ECDSASignature_boring.swift b/Sources/Crypto/Signatures/BoringSSL/ECDSASignature_boring.swift index 1494b1ea..28855a14 100644 --- a/Sources/Crypto/Signatures/BoringSSL/ECDSASignature_boring.swift +++ b/Sources/Crypto/Signatures/BoringSSL/ECDSASignature_boring.swift @@ -20,7 +20,7 @@ import CryptoBoringWrapper import Foundation /// A wrapper around BoringSSL's ECDSA_SIG with some lifetime management. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) class ECDSASignature { private var _baseSig: UnsafeMutablePointer diff --git a/Sources/Crypto/Signatures/BoringSSL/ECDSA_boring.swift b/Sources/Crypto/Signatures/BoringSSL/ECDSA_boring.swift index b1443675..d72b0226 100644 --- a/Sources/Crypto/Signatures/BoringSSL/ECDSA_boring.swift +++ b/Sources/Crypto/Signatures/BoringSSL/ECDSA_boring.swift @@ -18,7 +18,7 @@ import CryptoBoringWrapper import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Data { init( derSignature derBytes: D, @@ -59,7 +59,7 @@ extension Data { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P256.Signing.ECDSASignature { init(openSSLDERSignature derRepresentation: D) throws { self.rawRepresentation = try Data(derSignature: derRepresentation, over: P256.self) @@ -70,7 +70,7 @@ extension P256.Signing.ECDSASignature { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P256.Signing.PrivateKey { func openSSLSignature(for digest: D) throws -> P256.Signing.ECDSASignature { let baseSignature = try self.impl.key.sign(digest: digest) @@ -78,7 +78,7 @@ extension P256.Signing.PrivateKey { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P256.Signing.PublicKey { func openSSLIsValidSignature( _ signature: P256.Signing.ECDSASignature, @@ -96,7 +96,7 @@ extension P256.Signing.PublicKey { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P384.Signing.ECDSASignature { init(openSSLDERSignature derRepresentation: D) throws { self.rawRepresentation = try Data(derSignature: derRepresentation, over: P384.self) @@ -107,7 +107,7 @@ extension P384.Signing.ECDSASignature { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P384.Signing.PrivateKey { func openSSLSignature(for digest: D) throws -> P384.Signing.ECDSASignature { let baseSignature = try self.impl.key.sign(digest: digest) @@ -115,7 +115,7 @@ extension P384.Signing.PrivateKey { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P384.Signing.PublicKey { func openSSLIsValidSignature( _ signature: P384.Signing.ECDSASignature, @@ -133,7 +133,7 @@ extension P384.Signing.PublicKey { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P521.Signing.ECDSASignature { init(openSSLDERSignature derRepresentation: D) throws { self.rawRepresentation = try Data(derSignature: derRepresentation, over: P521.self) @@ -144,7 +144,7 @@ extension P521.Signing.ECDSASignature { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P521.Signing.PrivateKey { func openSSLSignature(for digest: D) throws -> P521.Signing.ECDSASignature { let baseSignature = try self.impl.key.sign(digest: digest) @@ -152,7 +152,7 @@ extension P521.Signing.PrivateKey { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P521.Signing.PublicKey { func openSSLIsValidSignature( _ signature: P521.Signing.ECDSASignature, diff --git a/Sources/Crypto/Signatures/BoringSSL/EdDSA_boring.swift b/Sources/Crypto/Signatures/BoringSSL/EdDSA_boring.swift index a22229cc..b2ea6d2c 100644 --- a/Sources/Crypto/Signatures/BoringSSL/EdDSA_boring.swift +++ b/Sources/Crypto/Signatures/BoringSSL/EdDSA_boring.swift @@ -18,7 +18,7 @@ @_implementationOnly import CCryptoBoringSSLShims import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Curve25519.Signing.PublicKey { // We do this to enable inlinability on these methods. @usableFromInline @@ -97,7 +97,7 @@ extension Curve25519.Signing.PublicKey { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Curve25519.Signing.PrivateKey { @inlinable func openSSLSignature(for data: D) throws -> Data { diff --git a/Sources/Crypto/Signatures/ECDSA.swift b/Sources/Crypto/Signatures/ECDSA.swift index 94102471..84959ee5 100644 --- a/Sources/Crypto/Signatures/ECDSA.swift +++ b/Sources/Crypto/Signatures/ECDSA.swift @@ -19,7 +19,7 @@ import Foundation // any edits of this file WILL be overwritten and thus discarded // see section `gyb` in `README` for details. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol NISTECDSASignature { init(rawRepresentation: D) throws init(derRepresentation: D) throws @@ -27,7 +27,7 @@ protocol NISTECDSASignature { var rawRepresentation: Data { get } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol NISTSigning { associatedtype PublicKey: NISTECPublicKey & DataValidator & DigestValidator associatedtype PrivateKey: NISTECPrivateKey & Signer @@ -35,11 +35,11 @@ protocol NISTSigning { } // MARK: - P256 + Signing -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P256.Signing { /// A P-256 elliptic curve digital signature algorithm (ECDSA) signature. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct ECDSASignature: ContiguousBytes, NISTECDSASignature { /// A raw data representation of a P-256 digital signature. @@ -131,11 +131,11 @@ extension P256.Signing { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P256.Signing: NISTSigning {} // MARK: - P256 + PrivateKey -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P256.Signing.PrivateKey: DigestSigner { /// Generates an Elliptic Curve Digital Signature Algorithm (ECDSA) /// signature of the digest you provide over the P-256 elliptic curve. @@ -154,7 +154,7 @@ extension P256.Signing.PrivateKey: DigestSigner { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P256.Signing.PrivateKey: Signer { /// Generates an Elliptic Curve Digital Signature Algorithm (ECDSA) /// signature of the data you provide over the P-256 elliptic curve, @@ -170,7 +170,7 @@ extension P256.Signing.PrivateKey: Signer { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P256.Signing.PublicKey: DigestValidator { /// Verifies an elliptic curve digital signature algorithm (ECDSA) /// signature on a digest over the P-256 elliptic curve. @@ -189,7 +189,7 @@ extension P256.Signing.PublicKey: DigestValidator { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P256.Signing.PublicKey: DataValidator { /// Verifies an elliptic curve digital signature algorithm (ECDSA) /// signature on a block of data over the P-256 elliptic curve. @@ -205,11 +205,11 @@ extension P256.Signing.PublicKey: DataValidator { } // MARK: - P384 + Signing -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P384.Signing { /// A P-384 elliptic curve digital signature algorithm (ECDSA) signature. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct ECDSASignature: ContiguousBytes, NISTECDSASignature { /// A raw data representation of a P-384 digital signature. @@ -301,11 +301,11 @@ extension P384.Signing { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P384.Signing: NISTSigning {} // MARK: - P384 + PrivateKey -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P384.Signing.PrivateKey: DigestSigner { /// Generates an Elliptic Curve Digital Signature Algorithm (ECDSA) /// signature of the digest you provide over the P-384 elliptic curve. @@ -324,7 +324,7 @@ extension P384.Signing.PrivateKey: DigestSigner { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P384.Signing.PrivateKey: Signer { /// Generates an Elliptic Curve Digital Signature Algorithm (ECDSA) /// signature of the data you provide over the P-384 elliptic curve, @@ -340,7 +340,7 @@ extension P384.Signing.PrivateKey: Signer { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P384.Signing.PublicKey: DigestValidator { /// Verifies an elliptic curve digital signature algorithm (ECDSA) /// signature on a digest over the P-384 elliptic curve. @@ -359,7 +359,7 @@ extension P384.Signing.PublicKey: DigestValidator { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P384.Signing.PublicKey: DataValidator { /// Verifies an elliptic curve digital signature algorithm (ECDSA) /// signature on a block of data over the P-384 elliptic curve. @@ -375,11 +375,11 @@ extension P384.Signing.PublicKey: DataValidator { } // MARK: - P521 + Signing -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P521.Signing { /// A P-521 elliptic curve digital signature algorithm (ECDSA) signature. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct ECDSASignature: ContiguousBytes, NISTECDSASignature { /// A raw data representation of a P-521 digital signature. @@ -471,11 +471,11 @@ extension P521.Signing { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P521.Signing: NISTSigning {} // MARK: - P521 + PrivateKey -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P521.Signing.PrivateKey: DigestSigner { /// Generates an Elliptic Curve Digital Signature Algorithm (ECDSA) /// signature of the digest you provide over the P-521 elliptic curve. @@ -494,7 +494,7 @@ extension P521.Signing.PrivateKey: DigestSigner { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P521.Signing.PrivateKey: Signer { /// Generates an Elliptic Curve Digital Signature Algorithm (ECDSA) /// signature of the data you provide over the P-521 elliptic curve, @@ -510,7 +510,7 @@ extension P521.Signing.PrivateKey: Signer { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P521.Signing.PublicKey: DigestValidator { /// Verifies an elliptic curve digital signature algorithm (ECDSA) /// signature on a digest over the P-521 elliptic curve. @@ -529,7 +529,7 @@ extension P521.Signing.PublicKey: DigestValidator { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P521.Signing.PublicKey: DataValidator { /// Verifies an elliptic curve digital signature algorithm (ECDSA) /// signature on a block of data over the P-521 elliptic curve. diff --git a/Sources/Crypto/Signatures/Ed25519.swift b/Sources/Crypto/Signatures/Ed25519.swift index fd77c0c4..a6b38b30 100644 --- a/Sources/Crypto/Signatures/Ed25519.swift +++ b/Sources/Crypto/Signatures/Ed25519.swift @@ -16,26 +16,26 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol DigestValidator { associatedtype Signature func isValidSignature(_ signature: Signature, for digest: D) -> Bool } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol DataValidator { associatedtype Signature func isValidSignature(_ signature: Signature, for signedData: D) -> Bool } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Curve25519.Signing { static var signatureByteCount: Int { return 64 } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Curve25519.Signing.PublicKey: DataValidator { typealias Signature = Data @@ -56,7 +56,7 @@ extension Curve25519.Signing.PublicKey: DataValidator { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Curve25519.Signing.PrivateKey: Signer { /// Generates an EdDSA signature over Curve25519. /// diff --git a/Sources/Crypto/Signatures/Signature.swift b/Sources/Crypto/Signatures/Signature.swift index b1c88d7d..b51f9434 100644 --- a/Sources/Crypto/Signatures/Signature.swift +++ b/Sources/Crypto/Signatures/Signature.swift @@ -16,18 +16,18 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol SignatureVerification { func verifySignature(signature: Data, data: Data) throws -> Bool } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol DigestSigner { associatedtype Signature func signature(for digest: D) throws -> Signature } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol Signer { associatedtype Signature func signature(for data: D) throws -> Signature diff --git a/Sources/Crypto/Util/BoringSSL/CryptoKitErrors_boring.swift b/Sources/Crypto/Util/BoringSSL/CryptoKitErrors_boring.swift index 42380462..78cd140a 100644 --- a/Sources/Crypto/Util/BoringSSL/CryptoKitErrors_boring.swift +++ b/Sources/Crypto/Util/BoringSSL/CryptoKitErrors_boring.swift @@ -16,7 +16,7 @@ #else @_implementationOnly import CCryptoBoringSSL -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension CryptoKitError { /// A helper function that packs the value of `ERR_get_error` into the internal error field. @usableFromInline diff --git a/Sources/Crypto/Util/BoringSSL/RNG_boring.swift b/Sources/Crypto/Util/BoringSSL/RNG_boring.swift index 4c907723..674bdb9a 100644 --- a/Sources/Crypto/Util/BoringSSL/RNG_boring.swift +++ b/Sources/Crypto/Util/BoringSSL/RNG_boring.swift @@ -15,7 +15,7 @@ @_exported import CryptoKit #else -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension UnsafeMutableRawBufferPointer { func initializeWithRandomBytes(count: Int) { guard count > 0 else { diff --git a/Sources/Crypto/Util/BoringSSL/SafeCompare_boring.swift b/Sources/Crypto/Util/BoringSSL/SafeCompare_boring.swift index 7ec16fba..0999addf 100644 --- a/Sources/Crypto/Util/BoringSSL/SafeCompare_boring.swift +++ b/Sources/Crypto/Util/BoringSSL/SafeCompare_boring.swift @@ -16,7 +16,7 @@ import Foundation /// This function performs a safe comparison between two buffers of bytes. It exists as a temporary shim until we refactor /// some of the usage sites to pass better data structures to us. @inlinable -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal func openSSLSafeCompare( _ lhs: LHS, _ rhs: RHS @@ -32,7 +32,7 @@ internal func openSSLSafeCompare( /// A straightforward constant-time comparison function for any two collections of bytes. @inlinable -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal func constantTimeCompare(_ lhs: LHS, _ rhs: RHS) -> Bool where LHS.Element == UInt8, RHS.Element == UInt8 { guard lhs.count == rhs.count else { diff --git a/Sources/Crypto/Util/BoringSSL/Zeroization_boring.swift b/Sources/Crypto/Util/BoringSSL/Zeroization_boring.swift index 398271ea..1991f2f6 100644 --- a/Sources/Crypto/Util/BoringSSL/Zeroization_boring.swift +++ b/Sources/Crypto/Util/BoringSSL/Zeroization_boring.swift @@ -14,7 +14,7 @@ #if !canImport(Darwin) @_implementationOnly import CCryptoBoringSSL -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) typealias errno_t = CInt // This is a Swift wrapper for the libc function that does not exist on Linux. We shim it via a call to OPENSSL_cleanse. diff --git a/Sources/Crypto/Util/PrettyBytes.swift b/Sources/Crypto/Util/PrettyBytes.swift index d49a6c96..8db832af 100644 --- a/Sources/Crypto/Util/PrettyBytes.swift +++ b/Sources/Crypto/Util/PrettyBytes.swift @@ -13,23 +13,23 @@ //===----------------------------------------------------------------------===// import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) enum ByteHexEncodingErrors: Error { case incorrectHexValue case incorrectString } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) let charA = UInt8(UnicodeScalar("a").value) -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) let char0 = UInt8(UnicodeScalar("0").value) -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) private func itoh(_ value: UInt8) -> UInt8 { return (value > 9) ? (charA + value - 10) : (char0 + value) } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) private func htoi(_ value: UInt8) throws -> UInt8 { switch value { case char0...char0 + 9: @@ -41,7 +41,7 @@ private func htoi(_ value: UInt8) throws -> UInt8 { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension DataProtocol { var hexString: String { let hexLen = self.count * 2 @@ -60,14 +60,14 @@ extension DataProtocol { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension MutableDataProtocol { mutating func appendByte(_ byte: UInt64) { withUnsafePointer(to: byte.littleEndian, { self.append(contentsOf: UnsafeRawBufferPointer(start: $0, count: 8)) }) } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Data { init(hexString: String) throws { self.init() @@ -87,7 +87,7 @@ extension Data { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Array where Element == UInt8 { init(hexString: String) throws { self.init() diff --git a/Sources/Crypto/Util/SafeCompare.swift b/Sources/Crypto/Util/SafeCompare.swift index 17310c12..29fe5ea9 100644 --- a/Sources/Crypto/Util/SafeCompare.swift +++ b/Sources/Crypto/Util/SafeCompare.swift @@ -16,7 +16,7 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal func safeCompare(_ lhs: LHS, _ rhs: RHS) -> Bool { #if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API return coreCryptoSafeCompare(lhs, rhs) diff --git a/Sources/Crypto/Util/SecureBytes.swift b/Sources/Crypto/Util/SecureBytes.swift index 5ad2544d..8797d39c 100644 --- a/Sources/Crypto/Util/SecureBytes.swift +++ b/Sources/Crypto/Util/SecureBytes.swift @@ -16,10 +16,10 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) private let emptyStorage:SecureBytes.Backing = SecureBytes.Backing.createEmpty() -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct SecureBytes { @usableFromInline var backing: Backing @@ -57,7 +57,7 @@ struct SecureBytes { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SecureBytes { @inlinable mutating func append(_ data: C) where C.Element == UInt8 { @@ -83,7 +83,7 @@ extension SecureBytes { } // MARK: - Equatable conformance, constant-time -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SecureBytes: Equatable { public static func == (lhs: SecureBytes, rhs: SecureBytes) -> Bool { return safeCompare(lhs, rhs) @@ -91,10 +91,10 @@ extension SecureBytes: Equatable { } // MARK: - Collection conformance -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SecureBytes: Collection { @usableFromInline - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct Index { /* fileprivate but usableFromInline */ @usableFromInline var offset: Int @@ -135,7 +135,7 @@ extension SecureBytes: Collection { } // MARK: - BidirectionalCollection conformance -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SecureBytes: BidirectionalCollection { @inlinable func index(before index: Index) -> Index { @@ -144,15 +144,15 @@ extension SecureBytes: BidirectionalCollection { } // MARK: - RandomAccessCollection conformance -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SecureBytes: RandomAccessCollection { } // MARK: - MutableCollection conformance -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SecureBytes: MutableCollection { } // MARK: - RangeReplaceableCollection conformance -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SecureBytes: RangeReplaceableCollection { @inlinable mutating func replaceSubrange(_ subrange: Range, with newElements: C) where C.Element == UInt8 { @@ -194,7 +194,7 @@ extension SecureBytes: RangeReplaceableCollection { } // MARK: - ContiguousBytes conformance -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SecureBytes: ContiguousBytes { @inlinable func withUnsafeBytes(_ body: (UnsafeRawBufferPointer) throws -> T) rethrows -> T { @@ -217,7 +217,7 @@ extension SecureBytes: ContiguousBytes { } // MARK: - DataProtocol conformance -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SecureBytes: DataProtocol { @inlinable var regions: CollectionOfOne { @@ -226,21 +226,21 @@ extension SecureBytes: DataProtocol { } // MARK: - MutableDataProtocol conformance -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SecureBytes: MutableDataProtocol { } // MARK: - Index conformances -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SecureBytes.Index: Hashable { } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SecureBytes.Index: Comparable { static func <(lhs: SecureBytes.Index, rhs: SecureBytes.Index) -> Bool { return lhs.offset < rhs.offset } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SecureBytes.Index: Strideable { func advanced(by n: Int) -> SecureBytes.Index { return SecureBytes.Index(offset: self.offset + n) @@ -252,10 +252,10 @@ extension SecureBytes.Index: Strideable { } // MARK: - Heap allocated backing storage. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SecureBytes { @usableFromInline - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal struct BackingHeader { @usableFromInline internal var count: Int @@ -265,7 +265,7 @@ extension SecureBytes { } @usableFromInline - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal class Backing: ManagedBuffer { @usableFromInline @@ -341,7 +341,7 @@ extension SecureBytes { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SecureBytes.Backing { func replaceSubrangeFittingWithinCapacity(_ subrange: Range, with newElements: C) where C.Element == UInt8 { // This function is called when have a unique reference to the backing storage, and we have enough room to store these bytes without @@ -439,7 +439,7 @@ extension SecureBytes.Backing { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SecureBytes.Backing: ContiguousBytes { func withUnsafeBytes(_ body: (UnsafeRawBufferPointer) throws -> T) rethrows -> T { let count = self.count @@ -476,7 +476,7 @@ extension SecureBytes.Backing: ContiguousBytes { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension UInt32 { /// Returns the next power of two unless that would overflow, in which case UInt32.max (on 64-bit systems) or /// Int32.max (on 32-bit systems) is returned. The returned value is always safe to be cast to Int and passed @@ -510,7 +510,7 @@ extension UInt32 { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Data { /// A custom initializer for Data that attempts to share the same storage as the current SecureBytes instance. /// This is our best-effort attempt to expose the data in an auto-zeroing fashion. Any mutating function called on diff --git a/Sources/Crypto/Util/Zeroization.swift b/Sources/Crypto/Util/Zeroization.swift index 077b0179..07f9e8b5 100644 --- a/Sources/Crypto/Util/Zeroization.swift +++ b/Sources/Crypto/Util/Zeroization.swift @@ -16,12 +16,12 @@ #else import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol Zeroization { mutating func zeroize() } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension UnsafeMutablePointer: Zeroization { /// Zeroizes the pointee func zeroize() { @@ -30,14 +30,14 @@ extension UnsafeMutablePointer: Zeroization { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension UnsafeMutableRawBufferPointer: Zeroization { func zeroize() { memset_s(self.baseAddress, self.count, 0, self.count) } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Array: Zeroization where Element == UInt8 { /// Zeroizes the array mutating func zeroize() { @@ -45,7 +45,7 @@ extension Array: Zeroization where Element == UInt8 { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Data: Zeroization { internal mutating func zeroize() { _ = self.withUnsafeMutableBytes { diff --git a/Sources/CryptoBoringWrapper/AEAD/BoringSSLAEAD.swift b/Sources/CryptoBoringWrapper/AEAD/BoringSSLAEAD.swift index 6f5015de..b4033e07 100644 --- a/Sources/CryptoBoringWrapper/AEAD/BoringSSLAEAD.swift +++ b/Sources/CryptoBoringWrapper/AEAD/BoringSSLAEAD.swift @@ -17,7 +17,7 @@ import Foundation /// An abstraction over a BoringSSL AEAD -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum BoringSSLAEAD { /// The supported AEAD ciphers for BoringSSL. case aes128gcm @@ -28,11 +28,11 @@ public enum BoringSSLAEAD { case chacha20 } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension BoringSSLAEAD { // Arguably this class is excessive, but it's probably better for this API to be as safe as possible // rather than rely on defer statements for our cleanup. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public class AEADContext { private var context: EVP_AEAD_CTX @@ -68,7 +68,7 @@ extension BoringSSLAEAD { // MARK: - Sealing -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension BoringSSLAEAD.AEADContext { /// The main entry point for sealing data. Covers the full gamut of types, including discontiguous data types. This must be inlinable. public func seal< @@ -202,7 +202,7 @@ extension BoringSSLAEAD.AEADContext { // MARK: - Opening -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension BoringSSLAEAD.AEADContext { /// The main entry point for opening data. Covers the full gamut of types, including discontiguous data types. This must be inlinable. @inlinable @@ -403,7 +403,7 @@ extension BoringSSLAEAD.AEADContext { // MARK: - Supported ciphers -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension BoringSSLAEAD { var boringSSLCipher: OpaquePointer { switch self { diff --git a/Sources/CryptoBoringWrapper/CryptoKitErrors_boring.swift b/Sources/CryptoBoringWrapper/CryptoKitErrors_boring.swift index 0ca7807f..bc3a5c25 100644 --- a/Sources/CryptoBoringWrapper/CryptoKitErrors_boring.swift +++ b/Sources/CryptoBoringWrapper/CryptoKitErrors_boring.swift @@ -14,7 +14,7 @@ @_implementationOnly import CCryptoBoringSSL -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum CryptoBoringWrapperError: Error { /// The key size is incorrect. case incorrectKeySize @@ -33,7 +33,7 @@ public enum CryptoBoringWrapperError: Error { case invalidParameter } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension CryptoBoringWrapperError { /// A helper function that packs the value of `ERR_get_error` into the internal error field. @usableFromInline diff --git a/Sources/CryptoBoringWrapper/EC/EllipticCurve.swift b/Sources/CryptoBoringWrapper/EC/EllipticCurve.swift index 2329f811..2f980f8c 100644 --- a/Sources/CryptoBoringWrapper/EC/EllipticCurve.swift +++ b/Sources/CryptoBoringWrapper/EC/EllipticCurve.swift @@ -16,7 +16,7 @@ /// A wrapper around BoringSSL's EC_GROUP object that handles reference counting and /// liveness. @usableFromInline -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) package final class BoringSSLEllipticCurveGroup { @usableFromInline var _group: OpaquePointer @@ -36,7 +36,7 @@ package final class BoringSSLEllipticCurveGroup { // MARK: - Helpers -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension BoringSSLEllipticCurveGroup { @usableFromInline package var coordinateByteCount: Int { @@ -110,10 +110,10 @@ extension BoringSSLEllipticCurveGroup { // MARK: - CurveName -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension BoringSSLEllipticCurveGroup { @usableFromInline - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) package enum CurveName { case p256 case p384 @@ -135,7 +135,7 @@ extension BoringSSLEllipticCurveGroup { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension BoringSSLEllipticCurveGroup.CurveName { @usableFromInline var baseNID: CInt { diff --git a/Sources/CryptoBoringWrapper/EC/EllipticCurvePoint.swift b/Sources/CryptoBoringWrapper/EC/EllipticCurvePoint.swift index 8b780051..ed476bef 100644 --- a/Sources/CryptoBoringWrapper/EC/EllipticCurvePoint.swift +++ b/Sources/CryptoBoringWrapper/EC/EllipticCurvePoint.swift @@ -19,7 +19,7 @@ import struct Foundation.Data /// A wrapper around BoringSSL's EC_POINT with some lifetime management. @usableFromInline -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) package final class EllipticCurvePoint { @usableFromInline var _basePoint: OpaquePointer @@ -364,7 +364,7 @@ package final class EllipticCurvePoint { // MARK: - Helpers -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension EllipticCurvePoint { @inlinable package func withPointPointer(_ body: (OpaquePointer) throws -> T) rethrows -> T { diff --git a/Sources/CryptoBoringWrapper/Util/ArbitraryPrecisionInteger.swift b/Sources/CryptoBoringWrapper/Util/ArbitraryPrecisionInteger.swift index 0278bd36..41f53a9f 100644 --- a/Sources/CryptoBoringWrapper/Util/ArbitraryPrecisionInteger.swift +++ b/Sources/CryptoBoringWrapper/Util/ArbitraryPrecisionInteger.swift @@ -21,7 +21,7 @@ import Foundation /// A wrapper around the OpenSSL BIGNUM object that is appropriately lifetime managed, /// and that provides better Swift types for this object. @usableFromInline -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) package struct ArbitraryPrecisionInteger { private var _backing: BackingStorage @@ -47,9 +47,9 @@ package struct ArbitraryPrecisionInteger { // MARK: - BackingStorage -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ArbitraryPrecisionInteger { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) fileprivate final class BackingStorage { private var _backing: BIGNUM @@ -93,7 +93,7 @@ extension ArbitraryPrecisionInteger { // MARK: - Extra initializers -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ArbitraryPrecisionInteger { @usableFromInline package init(bytes: Bytes) throws { @@ -109,7 +109,7 @@ extension ArbitraryPrecisionInteger { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ArbitraryPrecisionInteger.BackingStorage { convenience init(bytes: Bytes) throws { self.init() @@ -146,7 +146,7 @@ extension ArbitraryPrecisionInteger.BackingStorage { // MARK: - Pointer helpers -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ArbitraryPrecisionInteger { package func withUnsafeBignumPointer( _ body: (UnsafePointer) throws -> T @@ -168,7 +168,7 @@ extension ArbitraryPrecisionInteger { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ArbitraryPrecisionInteger.BackingStorage { func withUnsafeBignumPointer(_ body: (UnsafePointer) throws -> T) rethrows -> T { try body(&self._backing) @@ -185,7 +185,7 @@ extension ArbitraryPrecisionInteger.BackingStorage { // MARK: - Other helpers -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ArbitraryPrecisionInteger { @usableFromInline static func _compare( lhs: ArbitraryPrecisionInteger, @@ -258,7 +258,7 @@ extension ArbitraryPrecisionInteger { // MARK: - Equatable -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ArbitraryPrecisionInteger: Equatable { @inlinable package static func == (lhs: ArbitraryPrecisionInteger, rhs: ArbitraryPrecisionInteger) -> Bool { @@ -268,7 +268,7 @@ extension ArbitraryPrecisionInteger: Equatable { // MARK: - Comparable -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ArbitraryPrecisionInteger: Comparable { @inlinable package static func < (lhs: ArbitraryPrecisionInteger, rhs: ArbitraryPrecisionInteger) -> Bool { @@ -293,12 +293,12 @@ extension ArbitraryPrecisionInteger: Comparable { // MARK: - ExpressibleByIntegerLiteral -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ArbitraryPrecisionInteger: ExpressibleByIntegerLiteral {} // MARK: - AdditiveArithmetic -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ArbitraryPrecisionInteger: AdditiveArithmetic { @inlinable package static var zero: ArbitraryPrecisionInteger { @@ -370,7 +370,7 @@ extension ArbitraryPrecisionInteger: AdditiveArithmetic { // MARK: - Numeric -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ArbitraryPrecisionInteger: Numeric { @usableFromInline package typealias Magnitude = Self @@ -433,7 +433,7 @@ extension ArbitraryPrecisionInteger: Numeric { // MARK: - Modular arithmetic -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ArbitraryPrecisionInteger { @usableFromInline package func modulo( @@ -563,7 +563,7 @@ extension ArbitraryPrecisionInteger { // MARK: - SignedNumeric -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ArbitraryPrecisionInteger: SignedNumeric { @usableFromInline package mutating func negate() { @@ -577,7 +577,7 @@ extension ArbitraryPrecisionInteger: SignedNumeric { // MARK: - Other arithmetic operations -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ArbitraryPrecisionInteger { @usableFromInline package var trailingZeroBitCount: Int32 { @@ -687,7 +687,7 @@ extension ArbitraryPrecisionInteger { // MARK: - Serializing -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Data { /// Serializes an ArbitraryPrecisionInteger padded out to a certain minimum size. @usableFromInline @@ -726,7 +726,7 @@ extension Data { // MARK: - Printing -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ArbitraryPrecisionInteger: CustomDebugStringConvertible { @usableFromInline package var debugDescription: String { diff --git a/Sources/CryptoBoringWrapper/Util/FiniteFieldArithmeticContext.swift b/Sources/CryptoBoringWrapper/Util/FiniteFieldArithmeticContext.swift index d83d9abc..ca6d6a26 100644 --- a/Sources/CryptoBoringWrapper/Util/FiniteFieldArithmeticContext.swift +++ b/Sources/CryptoBoringWrapper/Util/FiniteFieldArithmeticContext.swift @@ -29,7 +29,7 @@ import Foundation /// Annoyingly, because of the way we have implemented ArbitraryPrecisionInteger, we can't actually use these temporary bignums /// ourselves. @usableFromInline -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) package class FiniteFieldArithmeticContext { private var fieldSize: ArbitraryPrecisionInteger private var bnCtx: OpaquePointer @@ -52,7 +52,7 @@ package class FiniteFieldArithmeticContext { // MARK: - Arithmetic operations -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension FiniteFieldArithmeticContext { @usableFromInline package func residue(_ x: ArbitraryPrecisionInteger) throws -> ArbitraryPrecisionInteger { diff --git a/Sources/CryptoBoringWrapper/Util/RandomBytes.swift b/Sources/CryptoBoringWrapper/Util/RandomBytes.swift index 2a69e797..77284a86 100644 --- a/Sources/CryptoBoringWrapper/Util/RandomBytes.swift +++ b/Sources/CryptoBoringWrapper/Util/RandomBytes.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension UnsafeMutableRawBufferPointer { @inlinable package func initializeWithRandomBytes(count: Int) { @@ -45,7 +45,7 @@ extension UnsafeMutableRawBufferPointer { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SystemRandomNumberGenerator { @inlinable package static func randomBytes(count: Int) -> [UInt8] { diff --git a/Sources/_CryptoExtras/AES/AES_CBC.swift b/Sources/_CryptoExtras/AES/AES_CBC.swift index 1fc024c4..6d7263a7 100644 --- a/Sources/_CryptoExtras/AES/AES_CBC.swift +++ b/Sources/_CryptoExtras/AES/AES_CBC.swift @@ -15,11 +15,11 @@ import Crypto import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension AES { /// The Advanced Encryption Standard (AES) Cipher Block Chaining (CBC) cipher /// suite. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum _CBC { private static var blockSize: Int { 16 } @@ -143,10 +143,10 @@ extension AES { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension AES._CBC { /// An initialization vector. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct IV: Sendable { // AES CBC uses a 128-bit IV. var ivBytes: ( @@ -196,7 +196,7 @@ extension AES._CBC { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Data { fileprivate mutating func trimPadding() throws { guard let paddingBytes = self.last else { diff --git a/Sources/_CryptoExtras/AES/AES_CFB.swift b/Sources/_CryptoExtras/AES/AES_CFB.swift index 77361edb..6c5645a7 100644 --- a/Sources/_CryptoExtras/AES/AES_CFB.swift +++ b/Sources/_CryptoExtras/AES/AES_CFB.swift @@ -16,12 +16,12 @@ import Crypto import Foundation @usableFromInline -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) typealias AESCFBImpl = OpenSSLAESCFBImpl -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension AES { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum _CFB { @inlinable public static func encrypt( @@ -45,9 +45,9 @@ extension AES { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension AES._CFB { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct IV: Sendable { // AES CFB uses a 128-bit IV. private var ivBytes: (UInt64, UInt64) diff --git a/Sources/_CryptoExtras/AES/AES_CTR.swift b/Sources/_CryptoExtras/AES/AES_CTR.swift index b7cd5cd3..85b94689 100644 --- a/Sources/_CryptoExtras/AES/AES_CTR.swift +++ b/Sources/_CryptoExtras/AES/AES_CTR.swift @@ -16,13 +16,13 @@ import Crypto import Foundation @usableFromInline -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) typealias AESCTRImpl = OpenSSLAESCTRImpl -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension AES { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum _CTR { @inlinable public static func encrypt( @@ -46,9 +46,9 @@ extension AES { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension AES._CTR { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct Nonce: Sendable { // AES CTR uses a 128-bit counter. It's most usual to use a 96-bit nonce // and a 32-bit counter at the end, so we support that specific mode of diff --git a/Sources/_CryptoExtras/AES/AES_GCM_SIV.swift b/Sources/_CryptoExtras/AES/AES_GCM_SIV.swift index 5b8745e5..8c3d136d 100644 --- a/Sources/_CryptoExtras/AES/AES_GCM_SIV.swift +++ b/Sources/_CryptoExtras/AES/AES_GCM_SIV.swift @@ -19,10 +19,10 @@ import CryptoBoringWrapper import Foundation /// Types associated with the AES GCM SIV algorithm -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension AES.GCM { /// AES in GCM SIV mode with 128-bit tags. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum _SIV { static let tagByteCount = 16 static let nonceByteCount = 12 @@ -82,9 +82,9 @@ extension AES.GCM { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension AES.GCM._SIV { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct Nonce: Sendable, ContiguousBytes, Sequence { let bytes: Data @@ -118,9 +118,9 @@ extension AES.GCM._SIV { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension AES.GCM._SIV { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct SealedBox: Sendable { /// The combined representation ( nonce || ciphertext || tag) public let combined: Data diff --git a/Sources/_CryptoExtras/AES/Block Function.swift b/Sources/_CryptoExtras/AES/Block Function.swift index 1ed20228..4cc8b8fd 100644 --- a/Sources/_CryptoExtras/AES/Block Function.swift +++ b/Sources/_CryptoExtras/AES/Block Function.swift @@ -18,7 +18,7 @@ import Crypto import CryptoBoringWrapper import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension AES { private static let blockSize = 128 / 8 @@ -79,7 +79,7 @@ extension AES { } } - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) enum Permutation { case forward case backward @@ -112,7 +112,7 @@ extension AES { } } - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct Block { private static var blockSize: Int { 16 } @@ -207,7 +207,7 @@ extension AES { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension AES.Block: RandomAccessCollection, MutableCollection { var startIndex: Int { 0 diff --git a/Sources/_CryptoExtras/AES/BoringSSL/AES_CFB_boring.swift b/Sources/_CryptoExtras/AES/BoringSSL/AES_CFB_boring.swift index 9088df51..5ce90f78 100644 --- a/Sources/_CryptoExtras/AES/BoringSSL/AES_CFB_boring.swift +++ b/Sources/_CryptoExtras/AES/BoringSSL/AES_CFB_boring.swift @@ -17,7 +17,7 @@ import Crypto import Foundation @usableFromInline -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) enum OpenSSLAESCFBImpl { @usableFromInline enum Mode { diff --git a/Sources/_CryptoExtras/AES/BoringSSL/AES_CTR_boring.swift b/Sources/_CryptoExtras/AES/BoringSSL/AES_CTR_boring.swift index 2af34c73..e37df624 100644 --- a/Sources/_CryptoExtras/AES/BoringSSL/AES_CTR_boring.swift +++ b/Sources/_CryptoExtras/AES/BoringSSL/AES_CTR_boring.swift @@ -17,7 +17,7 @@ import Crypto import Foundation @usableFromInline -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) enum OpenSSLAESCTRImpl { @inlinable static func encrypt( diff --git a/Sources/_CryptoExtras/AES/BoringSSL/AES_GCM_SIV_boring.swift b/Sources/_CryptoExtras/AES/BoringSSL/AES_GCM_SIV_boring.swift index 0d4a8a66..141e2b60 100644 --- a/Sources/_CryptoExtras/AES/BoringSSL/AES_GCM_SIV_boring.swift +++ b/Sources/_CryptoExtras/AES/BoringSSL/AES_GCM_SIV_boring.swift @@ -20,7 +20,7 @@ import Crypto import CryptoBoringWrapper import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension BoringSSLAEAD { /// Seal a given message. func seal( @@ -57,7 +57,7 @@ extension BoringSSLAEAD { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) enum OpenSSLAESGCMSIVImpl { @inlinable static func seal( diff --git a/Sources/_CryptoExtras/ARC/ARC+API.swift b/Sources/_CryptoExtras/ARC/ARC+API.swift index af2583d2..3a29f85b 100644 --- a/Sources/_CryptoExtras/ARC/ARC+API.swift +++ b/Sources/_CryptoExtras/ARC/ARC+API.swift @@ -15,7 +15,7 @@ import Crypto import Foundation // MARK: - P384 + ARC(P-384) -@available(iOS 16.0, macOS 13.0, watchOS 9.0, tvOS 16.0, *) +@available(iOS 16.0, macOS 13.0, watchOS 9.0, tvOS 16.0, macCatalyst 16.0, visionOS 2.0, *) extension P384 { /// Anonymous Rate-Limited Credentials (ARC). /// @@ -31,7 +31,7 @@ extension P384 { } } -@available(iOS 16.0, macOS 13.0, watchOS 9.0, tvOS 16.0, *) +@available(iOS 16.0, macOS 13.0, watchOS 9.0, tvOS 16.0, macCatalyst 16.0, visionOS 2.0, *) extension P384._ARCV1 { /// The server secrets used to issue and verify credentials. public struct PrivateKey: Sendable { @@ -248,7 +248,7 @@ extension P384._ARCV1 { } } -@available(iOS 16.0, macOS 13.0, watchOS 9.0, tvOS 16.0, *) +@available(iOS 16.0, macOS 13.0, watchOS 9.0, tvOS 16.0, macCatalyst 16.0, visionOS 2.0, *) extension P384._ARCV1.PublicKey { internal func prepareCredentialRequest( requestContext: D, @@ -285,7 +285,7 @@ extension P384._ARCV1.PublicKey { } } -@available(iOS 16.0, macOS 13.0, watchOS 9.0, tvOS 16.0, *) +@available(iOS 16.0, macOS 13.0, watchOS 9.0, tvOS 16.0, macCatalyst 16.0, visionOS 2.0, *) extension P384._ARCV1.PrivateKey { internal func issue( _ credentialRequest: P384._ARCV1.CredentialRequest, @@ -301,7 +301,7 @@ extension P384._ARCV1.PrivateKey { } } -@available(iOS 16.0, macOS 13.0, watchOS 9.0, tvOS 16.0, *) +@available(iOS 16.0, macOS 13.0, watchOS 9.0, tvOS 16.0, macCatalyst 16.0, visionOS 2.0, *) extension P384._ARCV1.PublicKey { /// Create a credential from the issuer response. public func finalize( @@ -313,7 +313,7 @@ extension P384._ARCV1.PublicKey { } } -@available(iOS 16.0, macOS 13.0, watchOS 9.0, tvOS 16.0, *) +@available(iOS 16.0, macOS 13.0, watchOS 9.0, tvOS 16.0, macCatalyst 16.0, visionOS 2.0, *) extension P384._ARCV1.Credential { internal mutating func makePresentation( context: D, @@ -358,7 +358,7 @@ extension P384._ARCV1.Credential { } } -@available(iOS 16.0, macOS 13.0, watchOS 9.0, tvOS 16.0, *) +@available(iOS 16.0, macOS 13.0, watchOS 9.0, tvOS 16.0, macCatalyst 16.0, visionOS 2.0, *) extension P384._ARCV1.PrivateKey { /// Verify a presentation is valid for a given attribute. /// diff --git a/Sources/_CryptoExtras/ARC/ARC.swift b/Sources/_CryptoExtras/ARC/ARC.swift index cd0d2b9e..73bda212 100644 --- a/Sources/_CryptoExtras/ARC/ARC.swift +++ b/Sources/_CryptoExtras/ARC/ARC.swift @@ -16,10 +16,10 @@ import Foundation /// Anonymous Rate-Limited Credentials (ARC) using the CMZ14 MACGGM construction, as defined in /// https://chris-wood.github.io/draft-arc/draft-yun-cfrg-arc.html -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) enum ARC {} -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) extension ARC { static let domain = "ARCV1-P384" diff --git a/Sources/_CryptoExtras/ARC/ARCCredential.swift b/Sources/_CryptoExtras/ARC/ARCCredential.swift index 98ef7e40..05442263 100644 --- a/Sources/_CryptoExtras/ARC/ARCCredential.swift +++ b/Sources/_CryptoExtras/ARC/ARCCredential.swift @@ -14,7 +14,7 @@ import Crypto import Foundation -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) extension ARC { struct Credential { typealias Group = H2G.G diff --git a/Sources/_CryptoExtras/ARC/ARCEncoding.swift b/Sources/_CryptoExtras/ARC/ARCEncoding.swift index 13f5690d..7c77ab18 100644 --- a/Sources/_CryptoExtras/ARC/ARCEncoding.swift +++ b/Sources/_CryptoExtras/ARC/ARCEncoding.swift @@ -14,12 +14,12 @@ import Foundation import Crypto -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) typealias ARCCurve = P384 -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) typealias ARCH2G = HashToCurveImpl -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) extension ARC.CredentialRequest where H2G == ARCH2G { static let scalarCount = 5 static let serializedByteCount = 2 * ARCCurve.compressedx962PointByteCount + Self.scalarCount * ARCCurve.orderByteCount @@ -47,7 +47,7 @@ extension ARC.CredentialRequest where H2G == ARCH2G { } } -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) extension ARC.CredentialResponse where H2G == ARCH2G { static let scalarCount = 8 static let serializedByteCount = 6 * ARCCurve.compressedx962PointByteCount + Self.scalarCount * ARCCurve.orderByteCount @@ -86,7 +86,7 @@ extension ARC.CredentialResponse where H2G == ARCH2G { } } -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) extension ARC.Presentation where H2G == ARCH2G { static let scalarCount = 5 static let pointCount = 4 @@ -121,7 +121,7 @@ extension ARC.Presentation where H2G == ARCH2G { } } -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) extension ARC.ServerPublicKey where H2G == ARCH2G { static let serializedByteCount = 3 * ARCCurve.compressedx962PointByteCount static let pointCount = 3 // TODO: delete @@ -151,7 +151,7 @@ extension ARC.ServerPublicKey where H2G == ARCH2G { } } -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) extension Proof where H2G == ARCH2G { func serialize() -> Data { let scalarCount = self.responses.count + 1 @@ -190,7 +190,7 @@ extension Proof where H2G == ARCH2G { // Serialize a ARC credential, to save and restore client state. // This will only be called client-side, and never be sent over the wire. -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) extension ARC.Credential where H2G == ARCH2G { static let scalarCount = 1 static let pointCount = 5 @@ -238,7 +238,7 @@ extension ARC.Credential where H2G == ARCH2G { // Serialize a ARC PresentationState, to help save and restore a credential. // This will only be called client-side, and never be sent over the wire. -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) extension ARC.PresentationState { func serialize() throws -> Data { let encoder = PropertyListEncoder() diff --git a/Sources/_CryptoExtras/ARC/ARCPrecredential.swift b/Sources/_CryptoExtras/ARC/ARCPrecredential.swift index 6a6b2cc8..4b3f0cd0 100644 --- a/Sources/_CryptoExtras/ARC/ARCPrecredential.swift +++ b/Sources/_CryptoExtras/ARC/ARCPrecredential.swift @@ -14,7 +14,7 @@ import Crypto import Foundation -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) extension ARC { struct ClientSecrets { let m1: Scalar // secret at request and verification diff --git a/Sources/_CryptoExtras/ARC/ARCPresentation.swift b/Sources/_CryptoExtras/ARC/ARCPresentation.swift index 700fd152..4cdc6906 100644 --- a/Sources/_CryptoExtras/ARC/ARCPresentation.swift +++ b/Sources/_CryptoExtras/ARC/ARCPresentation.swift @@ -14,7 +14,7 @@ import Crypto import Foundation -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) extension ARC { /// Presentation consists of a commitment to a MACGGC evaluation over two attributes, /// a commitment to one of the attributes, a tag and its public inputs (presentationContext, nonce), diff --git a/Sources/_CryptoExtras/ARC/ARCRequest.swift b/Sources/_CryptoExtras/ARC/ARCRequest.swift index 1f880305..25bf7c55 100644 --- a/Sources/_CryptoExtras/ARC/ARCRequest.swift +++ b/Sources/_CryptoExtras/ARC/ARCRequest.swift @@ -14,7 +14,7 @@ import Crypto import Foundation -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) extension ARC { /// CredentialRequest consists of encryptions of the two client attributes, in the form of Pedersen commitments, /// along with a zero-knowledge proof of the following statements: diff --git a/Sources/_CryptoExtras/ARC/ARCResponse.swift b/Sources/_CryptoExtras/ARC/ARCResponse.swift index 9dbc7772..cf0e3e13 100644 --- a/Sources/_CryptoExtras/ARC/ARCResponse.swift +++ b/Sources/_CryptoExtras/ARC/ARCResponse.swift @@ -14,7 +14,7 @@ import Crypto import Foundation -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) extension ARC { /// CredentialResponse consists of a MACGGM evaluation over a Pedersen commitment to a private attribute, /// along with the corresponding proof that it was calculated correctly over the expected key commitments: diff --git a/Sources/_CryptoExtras/ARC/ARCServer.swift b/Sources/_CryptoExtras/ARC/ARCServer.swift index 368ed6e8..0565536b 100644 --- a/Sources/_CryptoExtras/ARC/ARCServer.swift +++ b/Sources/_CryptoExtras/ARC/ARCServer.swift @@ -14,7 +14,7 @@ import Crypto import Foundation -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) extension ARC { struct ServerPrivateKey { let x0: Scalar diff --git a/Sources/_CryptoExtras/ChaCha20CTR/BoringSSL/ChaCha20CTR_boring.swift b/Sources/_CryptoExtras/ChaCha20CTR/BoringSSL/ChaCha20CTR_boring.swift index 7125f5f3..bd4378af 100644 --- a/Sources/_CryptoExtras/ChaCha20CTR/BoringSSL/ChaCha20CTR_boring.swift +++ b/Sources/_CryptoExtras/ChaCha20CTR/BoringSSL/ChaCha20CTR_boring.swift @@ -18,7 +18,7 @@ import Crypto import CryptoBoringWrapper import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) enum OpenSSLChaCha20CTRImpl { static func encrypt( key: SymmetricKey, diff --git a/Sources/_CryptoExtras/ChaCha20CTR/ChaCha20CTR.swift b/Sources/_CryptoExtras/ChaCha20CTR/ChaCha20CTR.swift index 1c124379..837ba5c1 100644 --- a/Sources/_CryptoExtras/ChaCha20CTR/ChaCha20CTR.swift +++ b/Sources/_CryptoExtras/ChaCha20CTR/ChaCha20CTR.swift @@ -18,13 +18,13 @@ import Crypto import CryptoBoringWrapper import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) typealias ChaCha20CTRImpl = OpenSSLChaCha20CTRImpl -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Insecure { /// ChaCha20-CTR with 96-bit nonces and a 32 bit counter. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum ChaCha20CTR { static let keyBitsCount = 256 static let nonceByteCount = 12 @@ -53,9 +53,9 @@ extension Insecure { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Insecure.ChaCha20CTR { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct Nonce: Sendable, ContiguousBytes, Sequence { let bytes: Data @@ -88,7 +88,7 @@ extension Insecure.ChaCha20CTR { } } - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct Counter: Sendable, ContiguousBytes { let counter: UInt32 diff --git a/Sources/_CryptoExtras/ECToolbox/BoringSSL/ECToolbox_boring.swift b/Sources/_CryptoExtras/ECToolbox/BoringSSL/ECToolbox_boring.swift index 0f11627d..3fe5faf0 100644 --- a/Sources/_CryptoExtras/ECToolbox/BoringSSL/ECToolbox_boring.swift +++ b/Sources/_CryptoExtras/ECToolbox/BoringSSL/ECToolbox_boring.swift @@ -19,7 +19,7 @@ import Foundation /// support ECToolbox. It is (re-)defined here because its counterpart in the Crypto module is only conditionally /// compiled on _non-Darwin_ platforms, but we implement ECToolbox on both Darwin and non-Darwin platforms. @usableFromInline -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol OpenSSLSupportedNISTCurve { associatedtype H: HashFunction @@ -42,7 +42,7 @@ protocol OpenSSLSupportedNISTCurve { } /// NOTE: This conformance applies to this type from the Crypto module even if it comes from the SDK. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P256: OpenSSLSupportedNISTCurve { @usableFromInline typealias H = SHA256 @@ -64,7 +64,7 @@ extension P256: OpenSSLSupportedNISTCurve { } /// NOTE: This conformance applies to this type from the Crypto module even if it comes from the SDK. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P384: OpenSSLSupportedNISTCurve { @usableFromInline typealias H = SHA384 @@ -86,7 +86,7 @@ extension P384: OpenSSLSupportedNISTCurve { } /// NOTE: This conformance applies to this type from the Crypto module even if it comes from the SDK. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P521: OpenSSLSupportedNISTCurve { @usableFromInline typealias H = SHA512 @@ -107,7 +107,7 @@ extension P521: OpenSSLSupportedNISTCurve { static var hashToFieldByteCount: Int { 98 } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct OpenSSLGroupScalar: GroupScalar, CustomStringConvertible { var openSSLScalar: ArbitraryPrecisionInteger @@ -175,7 +175,7 @@ struct OpenSSLGroupScalar: GroupScalar, CustomStri } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct OpenSSLCurvePoint: GroupElement { var ecPoint: EllipticCurvePoint typealias Scalar = OpenSSLGroupScalar @@ -223,14 +223,14 @@ struct OpenSSLCurvePoint: GroupElement { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension OpenSSLCurvePoint { var compressedRepresentation: Data { try! self.ecPoint.x962Representation(compressed: true, on: C.group) } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension OpenSSLCurvePoint: OPRFGroupElement { init(oprfRepresentation data: Data) throws { let point = try EllipticCurvePoint(x962Representation: data, on: C.group) @@ -240,7 +240,7 @@ extension OpenSSLCurvePoint: OPRFGroupElement { var oprfRepresentation: Data { self.compressedRepresentation } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct OpenSSLGroup: Group { typealias Element = OpenSSLCurvePoint @@ -250,7 +250,7 @@ struct OpenSSLGroup: Group { } } -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) struct OpenSSLHashToCurve: HashToGroup { typealias H = C.H typealias GE = OpenSSLCurvePoint diff --git a/Sources/_CryptoExtras/ECToolbox/ECToolbox.swift b/Sources/_CryptoExtras/ECToolbox/ECToolbox.swift index 8aa58604..5a9eb7c3 100644 --- a/Sources/_CryptoExtras/ECToolbox/ECToolbox.swift +++ b/Sources/_CryptoExtras/ECToolbox/ECToolbox.swift @@ -15,23 +15,23 @@ import Crypto import Foundation #if canImport(Darwin) && !CRYPTO_IN_SWIFTPM -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) typealias SupportedCurveDetailsImpl = CorecryptoSupportedNISTCurve -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) typealias GroupImpl = CoreCryptoGroup -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) typealias HashToCurveImpl = CoreCryptoHashToCurve #else -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) typealias SupportedCurveDetailsImpl = OpenSSLSupportedNISTCurve -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) typealias GroupImpl = OpenSSLGroup -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) typealias HashToCurveImpl = OpenSSLHashToCurve #endif /// A prime-order group -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol Group { /// Group element associatedtype Element: GroupElement @@ -43,7 +43,7 @@ protocol Group { static var cofactor: Int { get } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol HashToGroup { associatedtype H: HashFunction associatedtype G: Group where G.Element: OPRFGroupElement @@ -52,7 +52,7 @@ protocol HashToGroup { static func hashToGroup(_ data: Data, domainSeparationString: Data) -> G.Element } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol GroupScalar { init(bytes: Data, reductionIsModOrder: Bool) throws @@ -75,7 +75,7 @@ protocol GroupScalar { static func == (left: Self, right: Self) -> Bool } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol GroupElement { associatedtype Scalar: GroupScalar diff --git a/Sources/_CryptoExtras/H2G/HashToField.swift b/Sources/_CryptoExtras/H2G/HashToField.swift index dcefaa98..d1dfd153 100644 --- a/Sources/_CryptoExtras/H2G/HashToField.swift +++ b/Sources/_CryptoExtras/H2G/HashToField.swift @@ -14,7 +14,7 @@ import Foundation import Crypto -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Data { static func ^ (left: Data, right: Data) -> Data { precondition(left.count == right.count) @@ -27,13 +27,13 @@ extension Data { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) enum Hash2FieldErrors: Error { case outputSizeIsTooLarge } /// HashToField hashes a byte string msg of arbitrary length into one or more elements of a finite field -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) struct HashToField { static func expandMessageXMD(_ msg: Data, DST: Data, outputByteCount L: Int) throws -> Data { typealias H = C.H diff --git a/Sources/_CryptoExtras/Key Derivation/KDF.swift b/Sources/_CryptoExtras/Key Derivation/KDF.swift index e3634453..258a7054 100644 --- a/Sources/_CryptoExtras/Key Derivation/KDF.swift +++ b/Sources/_CryptoExtras/Key Derivation/KDF.swift @@ -19,7 +19,7 @@ import Foundation #endif /// A container for Key Detivation Function algorithms. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum KDF: Sendable { /// A container for older, cryptographically insecure algorithms. /// diff --git a/Sources/_CryptoExtras/Key Derivation/PBKDF2/BoringSSL/PBKDF2_boring.swift b/Sources/_CryptoExtras/Key Derivation/PBKDF2/BoringSSL/PBKDF2_boring.swift index 07f2cc19..2279ed1c 100644 --- a/Sources/_CryptoExtras/Key Derivation/PBKDF2/BoringSSL/PBKDF2_boring.swift +++ b/Sources/_CryptoExtras/Key Derivation/PBKDF2/BoringSSL/PBKDF2_boring.swift @@ -23,7 +23,7 @@ import Foundation @_implementationOnly import CCryptoBoringSSL @_implementationOnly import CCryptoBoringSSLShims -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal struct BoringSSLPBKDF2 { /// Derives a secure key using the provided hash function, passphrase and salt. /// @@ -71,7 +71,7 @@ internal struct BoringSSLPBKDF2 { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension KDF.Insecure.PBKDF2.HashFunction { var digest: OpaquePointer { switch self { diff --git a/Sources/_CryptoExtras/Key Derivation/PBKDF2/BoringSSL/PBKDF2_commoncrypto.swift b/Sources/_CryptoExtras/Key Derivation/PBKDF2/BoringSSL/PBKDF2_commoncrypto.swift index 66db124c..24b7b9b2 100644 --- a/Sources/_CryptoExtras/Key Derivation/PBKDF2/BoringSSL/PBKDF2_commoncrypto.swift +++ b/Sources/_CryptoExtras/Key Derivation/PBKDF2/BoringSSL/PBKDF2_commoncrypto.swift @@ -22,7 +22,7 @@ import Foundation #if canImport(CommonCrypto) @_implementationOnly import CommonCrypto -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal struct CommonCryptoPBKDF2 { /// Derives a secure key using the provided hash function, passphrase and salt. /// @@ -71,7 +71,7 @@ internal struct CommonCryptoPBKDF2 { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension KDF.Insecure.PBKDF2.HashFunction { var ccHash: CCPBKDFAlgorithm { switch self { diff --git a/Sources/_CryptoExtras/Key Derivation/PBKDF2/PBKDF2.swift b/Sources/_CryptoExtras/Key Derivation/PBKDF2/PBKDF2.swift index d94af190..bc59237f 100644 --- a/Sources/_CryptoExtras/Key Derivation/PBKDF2/PBKDF2.swift +++ b/Sources/_CryptoExtras/Key Derivation/PBKDF2/PBKDF2.swift @@ -19,17 +19,17 @@ import Foundation #endif #if canImport(CommonCrypto) -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) fileprivate typealias BackingPBKDF2 = CommonCryptoPBKDF2 #else -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) fileprivate typealias BackingPBKDF2 = BoringSSLPBKDF2 #endif -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension KDF.Insecure { /// An implementation of PBKDF2 key derivation function. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct PBKDF2: Sendable { /// Derives a symmetric key using the PBKDF2 algorithm. /// diff --git a/Sources/_CryptoExtras/Key Derivation/Scrypt/BoringSSL/Scrypt_boring.swift b/Sources/_CryptoExtras/Key Derivation/Scrypt/BoringSSL/Scrypt_boring.swift index 96bb03c3..08905f83 100644 --- a/Sources/_CryptoExtras/Key Derivation/Scrypt/BoringSSL/Scrypt_boring.swift +++ b/Sources/_CryptoExtras/Key Derivation/Scrypt/BoringSSL/Scrypt_boring.swift @@ -29,21 +29,21 @@ import Android #if os(Windows) import WinSDK -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) private func getPageSize() -> Int { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) var info = SYSTEM_INFO() GetSystemInfo(&info) return Int(info.dwPageSize) } #else -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) private func getPageSize() -> Int { Int(sysconf(Int32(_SC_PAGESIZE))) } #endif -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal struct BoringSSLScrypt { /// Derives a secure key using the provided passphrase and salt. /// diff --git a/Sources/_CryptoExtras/Key Derivation/Scrypt/Scrypt.swift b/Sources/_CryptoExtras/Key Derivation/Scrypt/Scrypt.swift index 2001b32c..3cc7d6d7 100644 --- a/Sources/_CryptoExtras/Key Derivation/Scrypt/Scrypt.swift +++ b/Sources/_CryptoExtras/Key Derivation/Scrypt/Scrypt.swift @@ -18,13 +18,13 @@ import Foundation @preconcurrency import Foundation #endif -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) fileprivate typealias BackingScrypt = BoringSSLScrypt -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension KDF { /// An implementation of scrypt key derivation function. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum Scrypt: Sendable { /// Derives a symmetric key using the scrypt algorithm. /// diff --git a/Sources/_CryptoExtras/OPRFs/OPRF.swift b/Sources/_CryptoExtras/OPRFs/OPRF.swift index b29765b6..65ce0599 100644 --- a/Sources/_CryptoExtras/OPRFs/OPRF.swift +++ b/Sources/_CryptoExtras/OPRFs/OPRF.swift @@ -16,10 +16,10 @@ import Crypto /// (Verifiable Partly-)Oblivious Pseudorandom Functions /// https://cfrg.github.io/draft-irtf-cfrg-voprf/draft-irtf-cfrg-voprf.html -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) enum OPRF {} -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) extension OPRF { enum Errors: Error { case invalidProof @@ -30,13 +30,13 @@ extension OPRF { } /// Defines the IETF Serializations for OPRFs -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol OPRFGroupElement: GroupElement { init(oprfRepresentation: Data) throws var oprfRepresentation: Data { get } } -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) extension OPRF { static func oprfVersion(v8CompatibilityMode: Bool) -> String { if v8CompatibilityMode { diff --git a/Sources/_CryptoExtras/OPRFs/OPRFClient.swift b/Sources/_CryptoExtras/OPRFs/OPRFClient.swift index bf20458d..0e676961 100644 --- a/Sources/_CryptoExtras/OPRFs/OPRFClient.swift +++ b/Sources/_CryptoExtras/OPRFs/OPRFClient.swift @@ -14,7 +14,7 @@ import Crypto import Foundation -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) extension OPRF { struct Client { let mode: Mode diff --git a/Sources/_CryptoExtras/OPRFs/OPRFServer.swift b/Sources/_CryptoExtras/OPRFs/OPRFServer.swift index cf858f7f..ef527912 100644 --- a/Sources/_CryptoExtras/OPRFs/OPRFServer.swift +++ b/Sources/_CryptoExtras/OPRFs/OPRFServer.swift @@ -14,7 +14,7 @@ import Foundation import Crypto -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) extension OPRF { struct Server { typealias G = H2G.G diff --git a/Sources/_CryptoExtras/OPRFs/VOPRF+API.swift b/Sources/_CryptoExtras/OPRFs/VOPRF+API.swift index 1987cfac..6f1ea6c3 100644 --- a/Sources/_CryptoExtras/OPRFs/VOPRF+API.swift +++ b/Sources/_CryptoExtras/OPRFs/VOPRF+API.swift @@ -15,14 +15,14 @@ import Crypto import Foundation // MARK: - P384 + VPORF (P384-SHA384) -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P384 { /// A mechanism to compute the output of a pseudorandom without the client learning the secret or the server /// learning the input using the P384-SHA384 Verifiable Oblivious Pseudorandom Function (VOPRF). /// /// - Seealso: [RFC 9497: VOPRF Protocol](https://www.rfc-editor.org/rfc/rfc9497.html#name-voprf-protocol). /// - Seealso: [RFC 9497: OPRF(P-384, SHA-384)](https://www.rfc-editor.org/rfc/rfc9497.html#name-oprfp-384-sha-384). - @available(iOS 16.0, macOS 13.0, watchOS 9.0, tvOS 16.0, *) + @available(iOS 16.0, macOS 13.0, watchOS 9.0, tvOS 16.0, macCatalyst 16.0, visionOS 2.0, *) public enum _VOPRF { typealias H2G = HashToCurveImpl typealias Ciphersuite = OPRF.Ciphersuite @@ -197,7 +197,7 @@ extension P384 { } } -@available(iOS 16.0, macOS 13.0, watchOS 9.0, tvOS 16.0, *) +@available(iOS 16.0, macOS 13.0, watchOS 9.0, tvOS 16.0, macCatalyst 16.0, visionOS 2.0, *) extension P384._VOPRF { /// A blinding value, used to blind an input. /// @@ -360,7 +360,7 @@ extension P384._VOPRF { } } -@available(iOS 16.0, macOS 13.0, watchOS 9.0, tvOS 16.0, *) +@available(iOS 16.0, macOS 13.0, watchOS 9.0, tvOS 16.0, macCatalyst 16.0, visionOS 2.0, *) extension P384._VOPRF.PublicKey { internal func blind(_ input: D, with fixedBlind: P384._VOPRF.H2G.G.Scalar) throws -> P384._VOPRF.BlindedInput { let input = Data(input) @@ -401,7 +401,7 @@ extension P384._VOPRF.PublicKey { } } -@available(iOS 16.0, macOS 13.0, watchOS 9.0, tvOS 16.0, *) +@available(iOS 16.0, macOS 13.0, watchOS 9.0, tvOS 16.0, macCatalyst 16.0, visionOS 2.0, *) extension P384._VOPRF.PrivateKey { static var hashToGroupDST: Data { Data("HashToGroup-".utf8) + OPRF.setupContext(mode: .verifiable, suite: P384._VOPRF.ciphersuite, v8CompatibilityMode: false) diff --git a/Sources/_CryptoExtras/OPRFs/VOPRFClient.swift b/Sources/_CryptoExtras/OPRFs/VOPRFClient.swift index 8687e3bb..15e5ffad 100644 --- a/Sources/_CryptoExtras/OPRFs/VOPRFClient.swift +++ b/Sources/_CryptoExtras/OPRFs/VOPRFClient.swift @@ -14,7 +14,7 @@ import Crypto import Foundation -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) extension OPRF { struct VerifiableClient { fileprivate let client: OPRF.Client diff --git a/Sources/_CryptoExtras/OPRFs/VOPRFServer.swift b/Sources/_CryptoExtras/OPRFs/VOPRFServer.swift index c5de9040..f42e98e7 100644 --- a/Sources/_CryptoExtras/OPRFs/VOPRFServer.swift +++ b/Sources/_CryptoExtras/OPRFs/VOPRFServer.swift @@ -14,7 +14,7 @@ import Foundation import Crypto -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) extension OPRF { struct VerifiableServer { typealias G = H2G.G diff --git a/Sources/_CryptoExtras/RSA/RSA+BlindSigning.swift b/Sources/_CryptoExtras/RSA/RSA+BlindSigning.swift index 8229fdb3..a1d56f23 100644 --- a/Sources/_CryptoExtras/RSA/RSA+BlindSigning.swift +++ b/Sources/_CryptoExtras/RSA/RSA+BlindSigning.swift @@ -16,20 +16,20 @@ import Crypto import CryptoBoringWrapper // NOTE: RSABSSA API is implemented using BoringSSL on all platforms. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) fileprivate typealias BackingPublicKey = BoringSSLRSAPublicKey -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) fileprivate typealias BackingPrivateKey = BoringSSLRSAPrivateKey -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension _RSA { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum BlindSigning {} } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension _RSA.BlindSigning { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct PublicKey: Sendable { public typealias Parameters = _RSA.BlindSigning.Parameters @@ -138,9 +138,9 @@ extension _RSA.BlindSigning { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension _RSA.BlindSigning { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct PrivateKey: Sendable { public typealias Parameters = _RSA.BlindSigning.Parameters @@ -282,9 +282,9 @@ extension _RSA.BlindSigning { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension _RSA.BlindSigning { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct BlindSignature: Sendable, ContiguousBytes { public var rawRepresentation: Data @@ -302,7 +302,7 @@ extension _RSA.BlindSigning { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension _RSA.BlindSigning { /// Parameters used in the blind signing protocol. /// @@ -312,7 +312,7 @@ extension _RSA.BlindSigning { /// The RECOMMENDED variants are RSABSSA-SHA384-PSS-Randomized or RSABSSA-SHA384-PSSZERO-Randomized. /// /// - Seealso: [RFC 9474: RSABSSA Variants](https://www.rfc-editor.org/rfc/rfc9474.html#name-rsabssa-variants). - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct Parameters: Sendable { enum Padding { case PSS, PSSZERO } var padding: Padding @@ -329,7 +329,7 @@ extension _RSA.BlindSigning { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension _RSA.BlindSigning.Parameters where H == SHA384 { /// RSABSSA-SHA384-PSS-Randomized /// @@ -379,12 +379,12 @@ extension _RSA.BlindSigning.Parameters where H == SHA384 { public static let RSABSSA_SHA384_PSSZERO_Deterministic = Self(padding: .PSSZERO, preparation: .identity) } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension _RSA.BlindSigning { /// An input ready to be blinded, possibly prepended with random bytes. /// /// Users cannot create values of this type manually; it is created and returned by the prepare operation. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct PreparedMessage { var rawRepresentation: Data } @@ -392,7 +392,7 @@ extension _RSA.BlindSigning { /// The blinding inverse for a blinded message, used to unblind a blind signature. /// /// Users cannot create values of this type manually; it is created and returned by the blind operation. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct BlindingInverse { var rawRepresentation: Data } @@ -400,7 +400,7 @@ extension _RSA.BlindSigning { /// The blinded message and its blinding inverse for unblinding its blind signature. /// /// Users cannot create values of this type manually; it is created and returned by the blind operation. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct BlindingResult { /// Blinded message to be sent to the issuer. public var blindedMessage: Data @@ -410,7 +410,7 @@ extension _RSA.BlindSigning { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension _RSA.BlindSigning.PrivateKey { /// Generate a blind signature with the given key for a blinded message. /// @@ -424,7 +424,7 @@ extension _RSA.BlindSigning.PrivateKey { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension _RSA.BlindSigning.PublicKey { /// Prepare a message to be signed using the blind signing protocol. /// @@ -491,14 +491,14 @@ extension _RSA.BlindSigning.PublicKey { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension _RSA.BlindSigning { /// Errors defined in the RSA Blind Signatures protocol. /// /// - NOTE: This type does not conform to `Swift.Error`, it is used to construct a `CryptoKitError`. /// /// - Seealso: [RFC 9474: Errors](https://www.rfc-editor.org/rfc/rfc9474.html#name-errors). - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) enum ProtocolError { case messageTooLong case encodingError @@ -510,7 +510,7 @@ extension _RSA.BlindSigning { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension CryptoKitError { /// Map an error from the RSA Blind Signatures protocol to a CryptoKitError. init(_ error: _RSA.BlindSigning.ProtocolError) { diff --git a/Sources/_CryptoExtras/RSA/RSA.swift b/Sources/_CryptoExtras/RSA/RSA.swift index 749ddc00..df6a5876 100644 --- a/Sources/_CryptoExtras/RSA/RSA.swift +++ b/Sources/_CryptoExtras/RSA/RSA.swift @@ -17,14 +17,14 @@ import CryptoBoringWrapper import SwiftASN1 #if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) fileprivate typealias BackingPublicKey = SecurityRSAPublicKey -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) fileprivate typealias BackingPrivateKey = SecurityRSAPrivateKey #else -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) fileprivate typealias BackingPublicKey = BoringSSLRSAPublicKey -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) fileprivate typealias BackingPrivateKey = BoringSSLRSAPrivateKey #endif @@ -38,20 +38,20 @@ fileprivate typealias BackingPrivateKey = BoringSSLRSAPrivateKey /// When rolling out new cryptosystems, users should avoid RSA and use ECDSA or edDSA instead. RSA /// support is provided for interoperability with legacy systems. @_documentation(visibility: public) -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum _RSA { } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension _RSA { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum Signing { } - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum Encryption { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension _RSA.Signing { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct PublicKey: Sendable { public struct Primitives: Sendable, Hashable { public var modulus: Data @@ -161,9 +161,9 @@ extension _RSA.Signing { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension _RSA.Signing { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct PrivateKey: Sendable { private var backing: BackingPrivateKey @@ -299,9 +299,9 @@ extension _RSA.Signing { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension _RSA.Signing { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct RSASignature: Sendable, ContiguousBytes { public var rawRepresentation: Data @@ -319,9 +319,9 @@ extension _RSA.Signing { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension _RSA.Signing { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct Padding: Sendable { internal enum Backing { case pkcs1v1_5 @@ -357,7 +357,7 @@ extension _RSA.Signing { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension _RSA.Signing.PrivateKey { /// Generates an RSA signature with the given key using the default padding. /// @@ -406,7 +406,7 @@ extension _RSA.Signing.PrivateKey { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension _RSA.Signing.PublicKey { /// Verifies an RSA signature with the given padding over a given digest using the default padding. /// @@ -459,9 +459,9 @@ extension _RSA.Signing.PublicKey { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension _RSA.Signing { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct KeySize: Sendable { public let bitCount: Int @@ -485,10 +485,10 @@ extension _RSA.Signing { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension _RSA.Encryption { /// Identical to ``_RSA/Signing/PublicKey``. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct PublicKey { public struct Primitives: Sendable, Hashable { public var modulus: Data @@ -565,7 +565,7 @@ extension _RSA.Encryption { } /// Identical to ``_RSA/Signing/PrivateKey``. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct PrivateKey { private var backing: BackingPrivateKey @@ -672,9 +672,9 @@ extension _RSA.Encryption { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension _RSA.Encryption { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public struct Padding: Sendable { internal enum Backing { case pkcs1_oaep(Digest) @@ -693,14 +693,14 @@ extension _RSA.Encryption { public static let PKCS1_OAEP_SHA256 = Self(.pkcs1_oaep(.sha256)) } - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal enum Digest { case sha1 case sha256 } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension _RSA.Encryption.PrivateKey { /// Decrypt a message encrypted with this key's public key and using the specified padding mode. /// @@ -711,7 +711,7 @@ extension _RSA.Encryption.PrivateKey { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension _RSA.Encryption.PublicKey { /// Return the maximum amount of data in bytes this key can encrypt in a single operation when using /// the specified padding mode. @@ -741,7 +741,7 @@ extension _RSA.Encryption.PublicKey { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension _RSA { static let PKCS1KeyType = "RSA PRIVATE KEY" @@ -752,7 +752,7 @@ extension _RSA { static let SPKIPublicKeyType = "PUBLIC KEY" } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension _RSA { static func extractPrimeFactors( n: ArbitraryPrecisionInteger, diff --git a/Sources/_CryptoExtras/RSA/RSA_boring.swift b/Sources/_CryptoExtras/RSA/RSA_boring.swift index 785b8278..cd560d75 100644 --- a/Sources/_CryptoExtras/RSA/RSA_boring.swift +++ b/Sources/_CryptoExtras/RSA/RSA_boring.swift @@ -19,7 +19,7 @@ import Crypto import CryptoBoringWrapper import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal struct BoringSSLRSAPublicKey: Sendable { private var backing: Backing @@ -68,7 +68,7 @@ internal struct BoringSSLRSAPublicKey: Sendable { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal struct BoringSSLRSAPrivateKey: Sendable { private var backing: Backing @@ -119,7 +119,7 @@ internal struct BoringSSLRSAPrivateKey: Sendable { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension BoringSSLRSAPrivateKey { internal func signature( for digest: D, @@ -143,7 +143,7 @@ extension BoringSSLRSAPrivateKey { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension BoringSSLRSAPublicKey { func isValidSignature( _ signature: _RSA.Signing.RSASignature, @@ -179,9 +179,9 @@ extension BoringSSLRSAPublicKey { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension BoringSSLRSAPublicKey { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) fileprivate final class Backing { private let pointer: OpaquePointer @@ -550,9 +550,9 @@ extension BoringSSLRSAPublicKey { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension BoringSSLRSAPrivateKey { - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) fileprivate final class Backing { private let pointer: OpaquePointer @@ -983,7 +983,7 @@ extension BoringSSLRSAPrivateKey { } /// This namespace enum just provides helper functions for some of the steps outlined in the RFC. -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) enum BlindSigningHelpers { fileprivate static func RSASSAPSSVerify( rsaPublicKey: OpaquePointer!, diff --git a/Sources/_CryptoExtras/RSA/RSA_security.swift b/Sources/_CryptoExtras/RSA/RSA_security.swift index f726aabd..0a88fcc6 100644 --- a/Sources/_CryptoExtras/RSA/RSA_security.swift +++ b/Sources/_CryptoExtras/RSA/RSA_security.swift @@ -18,7 +18,7 @@ import Crypto @_implementationOnly import Security // unchecked sendable until `SecKey` gets sendable annotations -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal struct SecurityRSAPublicKey: @unchecked Sendable { private var backing: SecKey @@ -80,7 +80,7 @@ internal struct SecurityRSAPublicKey: @unchecked Sendable { } // unchecked sendable until `SecKey` gets sendable annotations -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal struct SecurityRSAPrivateKey: @unchecked Sendable { private var backing: SecKey @@ -178,7 +178,7 @@ internal struct SecurityRSAPrivateKey: @unchecked Sendable { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SecurityRSAPrivateKey { internal func signature(for digest: D, padding: _RSA.Signing.Padding) throws -> _RSA.Signing.RSASignature { let algorithm = try SecKeyAlgorithm(digestType: D.self, padding: padding) @@ -195,7 +195,7 @@ extension SecurityRSAPrivateKey { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SecurityRSAPrivateKey { internal func decrypt(_ data: D, padding: _RSA.Encryption.Padding) throws -> Data { let algorithm = try SecKeyAlgorithm(padding: padding) @@ -211,7 +211,7 @@ extension SecurityRSAPrivateKey { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SecurityRSAPublicKey { func isValidSignature(_ signature: _RSA.Signing.RSASignature, for digest: D, padding: _RSA.Signing.Padding) -> Bool { do { @@ -231,7 +231,7 @@ extension SecurityRSAPublicKey { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SecurityRSAPublicKey { internal func encrypt(_ data: D, padding: _RSA.Encryption.Padding) throws -> Data { let algorithm = try SecKeyAlgorithm(padding: padding) @@ -247,7 +247,7 @@ extension SecurityRSAPublicKey { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SecKeyAlgorithm { fileprivate init(digestType: D.Type = D.self, padding: _RSA.Signing.Padding) throws { switch (digestType, padding.backing) { @@ -288,7 +288,7 @@ extension SecKeyAlgorithm { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Data { init(_ digest: D) { self = digest.withUnsafeBytes { Data($0) } @@ -448,7 +448,7 @@ extension Data { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Int { fileprivate var _bytesNeededToEncodeASN1Length: Int { // ASN.1 lengths are in two forms. If we can store the length in 7 bits, we should: @@ -466,7 +466,7 @@ extension Int { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension UInt { // Bytes needed to store a given integer in 7 bit bytes. fileprivate var neededBytes: Int { diff --git a/Sources/_CryptoExtras/Util/BoringSSLHelpers.swift b/Sources/_CryptoExtras/Util/BoringSSLHelpers.swift index b9985b0d..2a2c31c5 100644 --- a/Sources/_CryptoExtras/Util/BoringSSLHelpers.swift +++ b/Sources/_CryptoExtras/Util/BoringSSLHelpers.swift @@ -18,7 +18,7 @@ import Foundation import Crypto -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal enum BIOHelper { static func withReadOnlyMemoryBIO( wrapping pointer: UnsafeRawBufferPointer, _ block: (UnsafeMutablePointer) throws -> ReturnValue @@ -52,7 +52,7 @@ internal enum BIOHelper { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Data { init(copyingMemoryBIO bio: UnsafeMutablePointer) throws { var innerPointer: UnsafePointer? = nil @@ -66,7 +66,7 @@ extension Data { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension String { init(copyingUTF8MemoryBIO bio: UnsafeMutablePointer) throws { var innerPointer: UnsafePointer? = nil @@ -80,7 +80,7 @@ extension String { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension FixedWidthInteger { func withBignumPointer(_ block: (UnsafeMutablePointer) throws -> ReturnType) rethrows -> ReturnType { precondition(self.bitWidth <= UInt.bitWidth) diff --git a/Sources/_CryptoExtras/Util/CryptoKitErrors_boring.swift b/Sources/_CryptoExtras/Util/CryptoKitErrors_boring.swift index fe64e1a5..21d5da6f 100644 --- a/Sources/_CryptoExtras/Util/CryptoKitErrors_boring.swift +++ b/Sources/_CryptoExtras/Util/CryptoKitErrors_boring.swift @@ -15,7 +15,7 @@ @_implementationOnly import CCryptoBoringSSL import Crypto -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension CryptoKitError { /// A helper function that packs the value of `ERR_get_error` into the internal error field. @usableFromInline diff --git a/Sources/_CryptoExtras/Util/DigestType.swift b/Sources/_CryptoExtras/Util/DigestType.swift index 6dd15dbf..e4d268a5 100644 --- a/Sources/_CryptoExtras/Util/DigestType.swift +++ b/Sources/_CryptoExtras/Util/DigestType.swift @@ -16,7 +16,7 @@ @_implementationOnly import CCryptoBoringSSL import Crypto -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct DigestType { var dispatchTable: OpaquePointer diff --git a/Sources/_CryptoExtras/Util/Error.swift b/Sources/_CryptoExtras/Util/Error.swift index bdc325e5..dfd36561 100644 --- a/Sources/_CryptoExtras/Util/Error.swift +++ b/Sources/_CryptoExtras/Util/Error.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum _CryptoRSAError: Error { case invalidPEMDocument } diff --git a/Sources/_CryptoExtras/Util/I2OSP.swift b/Sources/_CryptoExtras/Util/I2OSP.swift index c7aca7f3..66ae9372 100644 --- a/Sources/_CryptoExtras/Util/I2OSP.swift +++ b/Sources/_CryptoExtras/Util/I2OSP.swift @@ -13,16 +13,16 @@ //===----------------------------------------------------------------------===// import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) func I2OSP(value: Int, outputByteCount: Int) -> Data { precondition(outputByteCount > 0, "Cannot I2OSP with no output length.") precondition(value >= 0, "I2OSP requires a non-null value.") - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) let requiredBytes = Int(ceil(log2(Double(max(value, 1) + 1)) / 8)) precondition(outputByteCount >= requiredBytes) - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) var data = Data(repeating: 0, count: outputByteCount) for i in (outputByteCount - requiredBytes)...(outputByteCount - 1) { diff --git a/Sources/_CryptoExtras/Util/PEMDocument.swift b/Sources/_CryptoExtras/Util/PEMDocument.swift index 9939076a..22f64c43 100644 --- a/Sources/_CryptoExtras/Util/PEMDocument.swift +++ b/Sources/_CryptoExtras/Util/PEMDocument.swift @@ -14,10 +14,10 @@ import Foundation import Crypto -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) enum ASN1 { /// A PEM document is some data, and a discriminator type that is used to advertise the content. - @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct PEMDocument { private static let lineLength = 64 @@ -86,7 +86,7 @@ enum ASN1 { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Substring { fileprivate var pemStartDiscriminator: String? { return self.pemDiscriminator(expectedPrefix: "-----BEGIN ", expectedSuffix: "-----") diff --git a/Sources/_CryptoExtras/Util/PrettyBytes.swift b/Sources/_CryptoExtras/Util/PrettyBytes.swift index d49a6c96..8db832af 100644 --- a/Sources/_CryptoExtras/Util/PrettyBytes.swift +++ b/Sources/_CryptoExtras/Util/PrettyBytes.swift @@ -13,23 +13,23 @@ //===----------------------------------------------------------------------===// import Foundation -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) enum ByteHexEncodingErrors: Error { case incorrectHexValue case incorrectString } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) let charA = UInt8(UnicodeScalar("a").value) -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) let char0 = UInt8(UnicodeScalar("0").value) -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) private func itoh(_ value: UInt8) -> UInt8 { return (value > 9) ? (charA + value - 10) : (char0 + value) } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) private func htoi(_ value: UInt8) throws -> UInt8 { switch value { case char0...char0 + 9: @@ -41,7 +41,7 @@ private func htoi(_ value: UInt8) throws -> UInt8 { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension DataProtocol { var hexString: String { let hexLen = self.count * 2 @@ -60,14 +60,14 @@ extension DataProtocol { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension MutableDataProtocol { mutating func appendByte(_ byte: UInt64) { withUnsafePointer(to: byte.littleEndian, { self.append(contentsOf: UnsafeRawBufferPointer(start: $0, count: 8)) }) } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Data { init(hexString: String) throws { self.init() @@ -87,7 +87,7 @@ extension Data { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension Array where Element == UInt8 { init(hexString: String) throws { self.init() diff --git a/Sources/_CryptoExtras/Util/SubjectPublicKeyInfo.swift b/Sources/_CryptoExtras/Util/SubjectPublicKeyInfo.swift index 3c69492c..40e778cc 100644 --- a/Sources/_CryptoExtras/Util/SubjectPublicKeyInfo.swift +++ b/Sources/_CryptoExtras/Util/SubjectPublicKeyInfo.swift @@ -14,7 +14,7 @@ import SwiftASN1 -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct SubjectPublicKeyInfo: DERImplicitlyTaggable, Hashable { static var defaultIdentifier: ASN1Identifier { .sequence @@ -57,7 +57,7 @@ struct SubjectPublicKeyInfo: DERImplicitlyTaggable, Hashable { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct RFC5480AlgorithmIdentifier: DERImplicitlyTaggable, Hashable { static var defaultIdentifier: ASN1Identifier { .sequence @@ -106,7 +106,7 @@ struct RFC5480AlgorithmIdentifier: DERImplicitlyTaggable, Hashable { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension SubjectPublicKeyInfo { static func stripRsaPssParameters(derEncoded: [UInt8]) throws -> [UInt8] { guard var spki = try? SubjectPublicKeyInfo(derEncoded: derEncoded), diff --git a/Sources/_CryptoExtras/ZKPs/DLEQ.swift b/Sources/_CryptoExtras/ZKPs/DLEQ.swift index 8483a1ea..0eb97ed7 100644 --- a/Sources/_CryptoExtras/ZKPs/DLEQ.swift +++ b/Sources/_CryptoExtras/ZKPs/DLEQ.swift @@ -15,7 +15,7 @@ import Foundation import Crypto /// A DLEQ Proof as described in https://cfrg.github.io/draft-irtf-cfrg-voprf/draft-irtf-cfrg-voprf.html#name-generateproof -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct DLEQProof { var c: GS var s: GS @@ -28,7 +28,7 @@ struct DLEQProof { // Discrete Log Equivalence Proof // Proves that for a value kept secret k, the relation between B=k*A and D=k*C is such that log_A(B)==log_C(D) -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct DLEQ { typealias GE = H2G.G.Element diff --git a/Sources/_CryptoExtras/ZKPs/Prover.swift b/Sources/_CryptoExtras/ZKPs/Prover.swift index c9a1b4d7..b02670b4 100644 --- a/Sources/_CryptoExtras/ZKPs/Prover.swift +++ b/Sources/_CryptoExtras/ZKPs/Prover.swift @@ -14,7 +14,7 @@ import Foundation import Crypto -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct Prover: ProofParticipant { typealias Group = H2G.G var label: String diff --git a/Sources/_CryptoExtras/ZKPs/Verifier.swift b/Sources/_CryptoExtras/ZKPs/Verifier.swift index be5f1939..a7e27915 100644 --- a/Sources/_CryptoExtras/ZKPs/Verifier.swift +++ b/Sources/_CryptoExtras/ZKPs/Verifier.swift @@ -14,7 +14,7 @@ import Foundation import Crypto -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct Verifier: ProofParticipant { typealias Group = H2G.G var label: String diff --git a/Sources/_CryptoExtras/ZKPs/ZKPToolbox.swift b/Sources/_CryptoExtras/ZKPs/ZKPToolbox.swift index 80437d67..15c730e5 100644 --- a/Sources/_CryptoExtras/ZKPs/ZKPToolbox.swift +++ b/Sources/_CryptoExtras/ZKPs/ZKPToolbox.swift @@ -14,17 +14,17 @@ import Foundation import Crypto -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct ScalarVar { var index: Int } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct PointVar { var index: Int } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) enum ZKPErrors: Error { case invalidVariableAllocation case invalidInputLength @@ -33,7 +33,7 @@ enum ZKPErrors: Error { // A Schnorr proof, which stores the challenge instead of // commitments to the prover's randomness (blindedPoints). -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) struct Proof { typealias Group = H2G.G public let challenge: Group.Scalar @@ -59,7 +59,7 @@ struct Proof { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol ProofParticipant { associatedtype Point: GroupElement var label: String { get } @@ -69,7 +69,7 @@ protocol ProofParticipant { var constraints: [(PointVar, [(ScalarVar, PointVar)])] { get set } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension ProofParticipant { mutating func constrain(result: PointVar, linearCombination: [(ScalarVar, PointVar)]) { self.constraints.append((result, linearCombination)) diff --git a/Sources/crypto-shasum/main.swift b/Sources/crypto-shasum/main.swift index 9475bb66..b5e449d4 100644 --- a/Sources/crypto-shasum/main.swift +++ b/Sources/crypto-shasum/main.swift @@ -22,7 +22,7 @@ With no FILE, or when FILE is -, read standard input. -a, --algorithm 256 (default), 384, 512 """ -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) enum SupportedHashFunction { case sha256 case sha384 @@ -89,7 +89,7 @@ extension String { } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) func processInputs(_ handles: [String: FileHandle], algorithm: SupportedHashFunction) { for (name, fh) in handles { let result = algorithm.hashLoop(from: fh) @@ -97,7 +97,7 @@ func processInputs(_ handles: [String: FileHandle], algorithm: SupportedHashFunc } } -@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) +@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) func main() { var arguments = CommandLine.arguments.dropFirst() var algorithm = SupportedHashFunction.sha256 // Default to sha256 diff --git a/Tests/CryptoTests/Digests/DigestsTests.swift b/Tests/CryptoTests/Digests/DigestsTests.swift index be96c47c..fddeadd7 100644 --- a/Tests/CryptoTests/Digests/DigestsTests.swift +++ b/Tests/CryptoTests/Digests/DigestsTests.swift @@ -113,7 +113,7 @@ class DigestsTests: XCTestCase { try orFail { try testHashFunctionImplementsCoW(hf: SHA512.self) } } - @available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) + @available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) func testBlockSizes() { XCTAssertEqual(Insecure.MD5.blockByteCount, 64) XCTAssertEqual(Insecure.SHA1.blockByteCount, 64) diff --git a/Tests/_CryptoExtrasTests/ARC/ARCAPITests.swift b/Tests/_CryptoExtrasTests/ARC/ARCAPITests.swift index d4381d14..ddc22dc5 100644 --- a/Tests/_CryptoExtrasTests/ARC/ARCAPITests.swift +++ b/Tests/_CryptoExtrasTests/ARC/ARCAPITests.swift @@ -15,7 +15,7 @@ import Crypto @testable import _CryptoExtras import XCTest -@available(iOS 16.0, macOS 13.0, watchOS 9.0, tvOS 16.0, *) +@available(iOS 16.0, macOS 13.0, watchOS 9.0, tvOS 16.0, macCatalyst 16.0, visionOS 2.0, *) final class ARCAPITests: XCTestCase { func testVectors() throws { diff --git a/Tests/_CryptoExtrasTests/ARC/ARCEncodingTests.swift b/Tests/_CryptoExtrasTests/ARC/ARCEncodingTests.swift index de0d22d5..a02a8471 100644 --- a/Tests/_CryptoExtrasTests/ARC/ARCEncodingTests.swift +++ b/Tests/_CryptoExtrasTests/ARC/ARCEncodingTests.swift @@ -15,7 +15,7 @@ import XCTest import Crypto -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) class ARCEncodingTests: XCTestCase { func testserverPublicKeyEncoding() throws { let ciphersuite = ARC.Ciphersuite(HashToCurveImpl.self) diff --git a/Tests/_CryptoExtrasTests/ARC/ARCPublicAPITests.swift b/Tests/_CryptoExtrasTests/ARC/ARCPublicAPITests.swift index b206195b..112e4c1e 100644 --- a/Tests/_CryptoExtrasTests/ARC/ARCPublicAPITests.swift +++ b/Tests/_CryptoExtrasTests/ARC/ARCPublicAPITests.swift @@ -15,7 +15,7 @@ import Crypto import _CryptoExtras // NOTE: No @testable import, because we want to test the public API. import XCTest -@available(iOS 16.0, macOS 13.0, watchOS 9.0, tvOS 16.0, *) +@available(iOS 16.0, macOS 13.0, watchOS 9.0, tvOS 16.0, macCatalyst 16.0, visionOS 2.0, *) final class ARCPublicAPITests: XCTestCase { func testARCEndToEnd() throws { diff --git a/Tests/_CryptoExtrasTests/ARC/ARCTestVectors.swift b/Tests/_CryptoExtrasTests/ARC/ARCTestVectors.swift index daa667ee..d5fefcca 100644 --- a/Tests/_CryptoExtrasTests/ARC/ARCTestVectors.swift +++ b/Tests/_CryptoExtrasTests/ARC/ARCTestVectors.swift @@ -144,7 +144,7 @@ struct ARCTestVector: Codable { let Presentation2: ARCPresentationTestVector } -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) class ARCTestVectors: XCTestCase { func testVectors() throws { let data = ARCEncodedTestVector.data(using: .utf8)! @@ -265,7 +265,7 @@ private func elementFromString(CurveType _: Cu return try GroupImpl.Element(oprfRepresentation: Data(hexString: value)) } -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) private func proofFromString(CurveType _: Curve.Type, value: String, scalarCount: Int) throws -> Proof> { let scalarHexCharacterCount = Curve.orderByteCount * 2 var startIndex = value.index(value.startIndex, offsetBy: 0) diff --git a/Tests/_CryptoExtrasTests/ARC/ARCTests.swift b/Tests/_CryptoExtrasTests/ARC/ARCTests.swift index 46a3432e..b254c727 100644 --- a/Tests/_CryptoExtrasTests/ARC/ARCTests.swift +++ b/Tests/_CryptoExtrasTests/ARC/ARCTests.swift @@ -15,7 +15,7 @@ import Crypto @testable import _CryptoExtras import XCTest -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) class ARCTests: XCTestCase { func endToEndWorkflow(CurveType _: Curve.Type) throws { let ciphersuite = ARC.Ciphersuite(HashToCurveImpl.self) diff --git a/Tests/_CryptoExtrasTests/ECToolbox/HashToCurveTests.swift b/Tests/_CryptoExtrasTests/ECToolbox/HashToCurveTests.swift index 4357591e..88efc4e3 100644 --- a/Tests/_CryptoExtrasTests/ECToolbox/HashToCurveTests.swift +++ b/Tests/_CryptoExtrasTests/ECToolbox/HashToCurveTests.swift @@ -34,7 +34,7 @@ struct HashToCurveTestVector: Codable { let msg: String } -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) class HashToCurveTests: XCTestCase { func testVector(vectorFileName file: String, with h2c: HashToCurveImpl.Type) throws { diff --git a/Tests/_CryptoExtrasTests/OPRFs/ECVOPRFTests.swift b/Tests/_CryptoExtrasTests/OPRFs/ECVOPRFTests.swift index 70b88b44..cb0c4216 100644 --- a/Tests/_CryptoExtrasTests/OPRFs/ECVOPRFTests.swift +++ b/Tests/_CryptoExtrasTests/OPRFs/ECVOPRFTests.swift @@ -50,7 +50,7 @@ enum Result: String { case invalidOPRFOutput = "invalidOPRFOutput" } -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) class ECVOPRFTests: XCTestCase { func testSuite(suite: OPRFSuite, C: G.Type, modeValue: Int, v8DraftCompatible: Bool) throws { switch modeValue { diff --git a/Tests/_CryptoExtrasTests/ZKPs/ZKPToolbox.swift b/Tests/_CryptoExtrasTests/ZKPs/ZKPToolbox.swift index 6898fb77..67a76760 100644 --- a/Tests/_CryptoExtrasTests/ZKPs/ZKPToolbox.swift +++ b/Tests/_CryptoExtrasTests/ZKPs/ZKPToolbox.swift @@ -15,7 +15,7 @@ import Crypto @testable import _CryptoExtras import XCTest -@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, macCatalyst 13.2, visionOS 1.2, *) class ZKPToolboxTests: XCTestCase { typealias H2G = HashToCurveImpl typealias Group = H2G.G