Skip to content

Commit 60cd872

Browse files
committed
Fix issue where the build would crash if building on macOS, visionOS, or watchOS
1 parent fede90d commit 60cd872

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

Sources/ATCryptography/Extensions/P256Extensions.swift

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ extension P256.Signing.PublicKey {
2121
/// - Throws: An error if the raw representation is invalid or not uncompressed.
2222
@available(iOS, introduced: 13, obsoleted: 16)
2323
@available(tvOS, introduced: 13, obsoleted: 16)
24-
@available(macOS, unavailable)
25-
@available(visionOS, unavailable)
26-
@available(watchOS, unavailable)
2724
public func compressedRepresentationCompat() throws -> Data {
2825
let rawKey = self.rawRepresentation
2926

@@ -55,9 +52,6 @@ extension P256.Signing.PublicKey {
5552
/// if the data is malformed or does not represent a point on the P256 curve.
5653
@available(iOS, introduced: 13, obsoleted: 16)
5754
@available(tvOS, introduced: 13, obsoleted: 16)
58-
@available(macOS, unavailable)
59-
@available(visionOS, unavailable)
60-
@available(watchOS, unavailable)
6155
public static func decompressP256PublicKey(compressed compressedKey: Data) throws -> P256.Signing.PublicKey {
6256
guard compressedKey.count == 33 else {
6357
throw P256Error.invalidCompressedKey
@@ -115,10 +109,7 @@ extension P256.Signing.PublicKey {
115109
/// the simplified square root algorithm cannot be used.
116110
@available(iOS, introduced: 13, obsoleted: 16)
117111
@available(tvOS, introduced: 13, obsoleted: 16)
118-
@available(macOS, unavailable)
119-
@available(visionOS, unavailable)
120-
@available(watchOS, unavailable)
121-
private static func modularSquareRoot(_ squareRoot: BigUInt, prime prime: BigUInt) throws -> BigUInt? {
112+
private static func modularSquareRoot(_ squareRoot: BigUInt, prime: BigUInt) throws -> BigUInt? {
122113
// Special case for p256 where prime ≡ 3 mod 4:
123114
// sqrt(squareRoot) ≡ squareRoot^((prime + 1) / 4) mod prime
124115
if prime % 4 == 3 {
@@ -148,9 +139,6 @@ extension Data {
148139
/// If the current length is already `>= length`, the original data is returned unchanged.
149140
@available(iOS, introduced: 13, obsoleted: 16)
150141
@available(tvOS, introduced: 13, obsoleted: 16)
151-
@available(macOS, unavailable)
152-
@available(visionOS, unavailable)
153-
@available(watchOS, unavailable)
154142
public func pad(to length: Int) -> Data {
155143
if count >= length { return self }
156144
return Data(repeating: 0, count: length - count) + self
@@ -168,9 +156,6 @@ extension Data {
168156
/// on newer platforms.
169157
@available(iOS, introduced: 13, obsoleted: 16)
170158
@available(tvOS, introduced: 13, obsoleted: 16)
171-
@available(macOS, unavailable)
172-
@available(visionOS, unavailable)
173-
@available(watchOS, unavailable)
174159
public struct CompressedP256 {
175160

176161
/// Compresses a P256 public key using SEC1 encoding.
@@ -196,9 +181,6 @@ public struct CompressedP256 {
196181
/// Errors that may occur while working with compressed P256 keys.
197182
@available(iOS, introduced: 13, obsoleted: 16)
198183
@available(tvOS, introduced: 13, obsoleted: 16)
199-
@available(macOS, unavailable)
200-
@available(visionOS, unavailable)
201-
@available(watchOS, unavailable)
202184
public enum P256Error: Error {
203185

204186
/// The input data is not a valid compressed P256 key.

0 commit comments

Comments
 (0)