Skip to content

Commit

Permalink
Add @Availability guards
Browse files Browse the repository at this point in the history
  • Loading branch information
simonjbeaumont committed Nov 6, 2024
1 parent 0807220 commit 9e94b78
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ struct OpenSSLGroup<C: OpenSSLSupportedNISTCurve>: Group {
}
}

@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *)
struct OpenSSLHashToCurve<C: OpenSSLSupportedNISTCurve>: HashToGroup {
typealias H = C.H
typealias GE = OpenSSLCurvePoint<C>
Expand Down
1 change: 1 addition & 0 deletions Sources/_CryptoExtras/ECToolbox/ECToolbox.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ typealias HashToCurveImpl = CoreCryptoHashToCurve
#else
typealias SupportedCurveDetailsImpl = OpenSSLSupportedNISTCurve
typealias GroupImpl = OpenSSLGroup
@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *)
typealias HashToCurveImpl = OpenSSLHashToCurve
#endif

Expand Down
1 change: 1 addition & 0 deletions Sources/_CryptoExtras/H2G/HashToField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ enum Hash2FieldErrors: Error {
}

/// 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, *)
struct HashToField<C: SupportedCurveDetailsImpl> {
static func expandMessageXMD(_ msg: Data, DST: Data, outputByteCount L: Int) throws -> Data {
typealias H = C.H
Expand Down
3 changes: 3 additions & 0 deletions Sources/_CryptoExtras/OPRFs/OPRF.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +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, *)
enum OPRF {}

@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *)
extension OPRF {
enum Errors: Error {
case invalidProof
Expand All @@ -33,6 +35,7 @@ protocol OPRFGroupElement: GroupElement {
var oprfRepresentation: Data { get }
}

@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *)
extension OPRF {
static func oprfVersion(v8CompatibilityMode: Bool) -> String {
if v8CompatibilityMode {
Expand Down
1 change: 1 addition & 0 deletions Sources/_CryptoExtras/OPRFs/OPRFClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import Crypto
import Foundation

@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *)
extension OPRF {
struct Client<H2G: HashToGroup> {
let mode: Mode
Expand Down
1 change: 1 addition & 0 deletions Sources/_CryptoExtras/OPRFs/OPRFServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import Foundation
import Crypto

@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *)
extension OPRF {
struct Server<H2G: HashToGroup> {
typealias G = H2G.G
Expand Down
1 change: 1 addition & 0 deletions Sources/_CryptoExtras/OPRFs/VOPRFClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import Crypto
import Foundation

@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *)
extension OPRF {
struct VerifiableClient<H2G: HashToGroup> {
fileprivate let client: OPRF.Client<H2G>
Expand Down
1 change: 1 addition & 0 deletions Sources/_CryptoExtras/OPRFs/VOPRFServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import Foundation
import Crypto

@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *)
extension OPRF {
struct VerifiableServer<H2G: HashToGroup> {
typealias G = H2G.G
Expand Down
1 change: 1 addition & 0 deletions Tests/_CryptoExtrasTests/OPRFs/VOPRFAPITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ extension OPRFSuite {
}
}

@available(macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0, *)
final class VOPRFAPITests: XCTestCase {
func testVectors() throws {
try testVectorsVOPRF(suite: .P384_SHA384_VORPF)
Expand Down
1 change: 1 addition & 0 deletions Tests/_CryptoExtrasTests/OPRFs/VOPRFPublicAPITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Crypto
import _CryptoExtras // NOTE: No @testable import, because we want to test the public API.
import XCTest

@available(macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0, *)
final class VOPRFPublicAPITests: XCTestCase {

func testEndToEndVOPRF() throws {
Expand Down

0 comments on commit 9e94b78

Please sign in to comment.