diff --git a/Sources/_CryptoExtras/ARC/ARC.swift b/Sources/_CryptoExtras/ARC/ARC.swift index b85238c4..cd0d2b9e 100644 --- a/Sources/_CryptoExtras/ARC/ARC.swift +++ b/Sources/_CryptoExtras/ARC/ARC.swift @@ -16,8 +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, *) enum ARC {} +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) extension ARC { static let domain = "ARCV1-P384" diff --git a/Sources/_CryptoExtras/ARC/ARCCredential.swift b/Sources/_CryptoExtras/ARC/ARCCredential.swift index 96c79ade..2cded1bc 100644 --- a/Sources/_CryptoExtras/ARC/ARCCredential.swift +++ b/Sources/_CryptoExtras/ARC/ARCCredential.swift @@ -14,6 +14,7 @@ import Crypto import Foundation +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) extension ARC { struct Credential { typealias Group = H2G.G diff --git a/Sources/_CryptoExtras/ARC/ARCEncoding.swift b/Sources/_CryptoExtras/ARC/ARCEncoding.swift index c2e32e9e..5accb636 100644 --- a/Sources/_CryptoExtras/ARC/ARCEncoding.swift +++ b/Sources/_CryptoExtras/ARC/ARCEncoding.swift @@ -15,6 +15,7 @@ import Foundation import Crypto typealias ARCCurve = P384 +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) typealias ARCH2G = HashToCurveImpl internal func DecodeInt(value: Data) -> Int { @@ -32,6 +33,7 @@ internal func EncodeInt(value: Int) -> Data { return I2OSP(value: value, outputByteCount: 4) } +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) extension ARC.CredentialRequest where H2G == ARCH2G { static let scalarCount = 5 static let pointCount = 2 @@ -61,6 +63,7 @@ extension ARC.CredentialRequest where H2G == ARCH2G { } } +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) extension ARC.CredentialResponse where H2G == ARCH2G { static let scalarCount = 8 static let pointCount = 6 @@ -104,6 +107,7 @@ extension ARC.CredentialResponse where H2G == ARCH2G { } } +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) extension ARC.Presentation where H2G == ARCH2G { static let scalarCount = 5 static let pointCount = 4 @@ -142,6 +146,7 @@ extension ARC.Presentation where H2G == ARCH2G { } } +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) extension ARC.ServerPublicKey where H2G == ARCH2G { static let pointCount = 3 @@ -173,6 +178,7 @@ extension ARC.ServerPublicKey where H2G == ARCH2G { } } +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) extension Proof where H2G == ARCH2G { func serialize() -> Data { let scalarCount = self.responses.count + 1 @@ -212,6 +218,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, *) extension ARC.Credential where H2G == ARCH2G { static let scalarCount = 1 static let pointCount = 5 diff --git a/Sources/_CryptoExtras/ARC/ARCPrecredential.swift b/Sources/_CryptoExtras/ARC/ARCPrecredential.swift index f15d9dde..d1b6fcdc 100644 --- a/Sources/_CryptoExtras/ARC/ARCPrecredential.swift +++ b/Sources/_CryptoExtras/ARC/ARCPrecredential.swift @@ -14,6 +14,7 @@ import Crypto import Foundation +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) 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 790320b2..700fd152 100644 --- a/Sources/_CryptoExtras/ARC/ARCPresentation.swift +++ b/Sources/_CryptoExtras/ARC/ARCPresentation.swift @@ -14,6 +14,7 @@ import Crypto import Foundation +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) 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 1e1b7dca..1f880305 100644 --- a/Sources/_CryptoExtras/ARC/ARCRequest.swift +++ b/Sources/_CryptoExtras/ARC/ARCRequest.swift @@ -14,6 +14,7 @@ import Crypto import Foundation +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) 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 4ef18351..9dbc7772 100644 --- a/Sources/_CryptoExtras/ARC/ARCResponse.swift +++ b/Sources/_CryptoExtras/ARC/ARCResponse.swift @@ -14,6 +14,7 @@ import Crypto import Foundation +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) 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 d7fe9bac..368ed6e8 100644 --- a/Sources/_CryptoExtras/ARC/ARCServer.swift +++ b/Sources/_CryptoExtras/ARC/ARCServer.swift @@ -14,6 +14,7 @@ import Crypto import Foundation +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) extension ARC { struct ServerPrivateKey { let x0: Scalar diff --git a/Tests/_CryptoExtrasTests/ARC/ARCEncodingTests.swift b/Tests/_CryptoExtrasTests/ARC/ARCEncodingTests.swift index a0531569..51973b0f 100644 --- a/Tests/_CryptoExtrasTests/ARC/ARCEncodingTests.swift +++ b/Tests/_CryptoExtrasTests/ARC/ARCEncodingTests.swift @@ -15,6 +15,7 @@ import XCTest import Crypto +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) class ARCEncodingTests: XCTestCase { func testserverPublicKeyEncoding() throws { let ciphersuite = ARC.Ciphersuite(HashToCurveImpl.self) diff --git a/Tests/_CryptoExtrasTests/ARC/ARCTestVectors.swift b/Tests/_CryptoExtrasTests/ARC/ARCTestVectors.swift index e5d1476c..47288857 100644 --- a/Tests/_CryptoExtrasTests/ARC/ARCTestVectors.swift +++ b/Tests/_CryptoExtrasTests/ARC/ARCTestVectors.swift @@ -144,6 +144,7 @@ struct ARCTestVector: Codable { let Presentation2: ARCPresentationTestVector } +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) class ARCTestVectors: XCTestCase { func testVectors() throws { let data = ARCEncodedTestVector.data(using: .utf8)! @@ -264,6 +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, *) 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 a52ed5f7..ae55694b 100644 --- a/Tests/_CryptoExtrasTests/ARC/ARCTests.swift +++ b/Tests/_CryptoExtrasTests/ARC/ARCTests.swift @@ -15,6 +15,7 @@ import Crypto @testable import _CryptoExtras import XCTest +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) 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 22e4e026..4357591e 100644 --- a/Tests/_CryptoExtrasTests/ECToolbox/HashToCurveTests.swift +++ b/Tests/_CryptoExtrasTests/ECToolbox/HashToCurveTests.swift @@ -34,6 +34,7 @@ struct HashToCurveTestVector: Codable { let msg: String } +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) 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 a873c1c2..70b88b44 100644 --- a/Tests/_CryptoExtrasTests/OPRFs/ECVOPRFTests.swift +++ b/Tests/_CryptoExtrasTests/OPRFs/ECVOPRFTests.swift @@ -50,6 +50,7 @@ enum Result: String { case invalidOPRFOutput = "invalidOPRFOutput" } +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) 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 aa566d3f..6898fb77 100644 --- a/Tests/_CryptoExtrasTests/ZKPs/ZKPToolbox.swift +++ b/Tests/_CryptoExtrasTests/ZKPs/ZKPToolbox.swift @@ -15,6 +15,7 @@ import Crypto @testable import _CryptoExtras import XCTest +@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *) class ZKPToolboxTests: XCTestCase { typealias H2G = HashToCurveImpl typealias Group = H2G.G