Compare commits

...
Author SHA1 Message Date
Rick Newton-Rogers e3981f7093 TESTING 2025-03-14 15:13:02 +00:00
Gus Cairo a6ce32a18b Fix availability mismatches (#339)
https://github.com/apple/swift-crypto/issues/338 pointed to some
availability guard platform mismatches on `ARC` and its extensions. This
PR aims to fix these and make sure all platforms build correctly.
2025-03-12 22:03:06 +00:00
Si Beaumont 67e54ae1db Add missing availability guards required when development mode enabled (#337)
### Motivation

When developing code that uses the BoringSSL backend on macOS,
developers set a `development` boolean flag in the Package.swift. We
recently switched from declaring minimum platform versions to annotating
symbols with availability annotations. However, when `development =
true`, it flushes out some annotations that were missing in the first
pass. The result is that `main` currently doesn't build on macOS with
this flag set.

### Modifications

- Add missing availability guards required when development mode
enabled.

### Result:

Code builds macOS with `development = true` in Package.swift.
2025-03-12 15:18:27 +00:00
13 changed files with 34 additions and 9 deletions

No files matched your search

+16 -7
View File
@@ -12,13 +12,6 @@ jobs:
license_header_check_project_name: "SwiftCrypto"
docs_check_enabled: false
cmake-lists:
name: Check cmake lists
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main
with:
name: "Check cmake lists"
matrix_linux_command: ./scripts/check-cmake-lists.sh
unit-tests:
name: Unit tests
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
@@ -38,3 +31,19 @@ jobs:
cxx-interop:
name: Cxx interop
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main
cmake-lists:
name: Check cmake lists
uses: apple/swift-nio/.github/workflows/cmake_tests.yml@main
with:
update_cmake_lists_config: >-
{
"targets": [
{ "name": "CCryptoBoringSSL", "type": "source", "exceptions": [] },
{ "name": "CCryptoBoringSSLShims", "type": "source", "exceptions": [] },
{ "name": "CryptoBoringWrapper", "type": "source", "exceptions": [] },
{ "name": "Crypto", "type": "source", "exceptions": [] },
{ "name": "_CryptoExtras", "type": "source", "exceptions": [] },
{ "name": "CCryptoBoringSSL", "type": "assembly", "exceptions": [ "*/AES/*.swift" ] }
]
}
+2
View File
@@ -127,6 +127,7 @@ extension ASN1 {
}
}
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
extension ASN1.ASN1ParserNode: Hashable { }
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
@@ -335,6 +336,7 @@ extension ASN1 {
}
}
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
extension ASN1.ASN1ParseResult: Hashable { }
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
@@ -58,6 +58,7 @@ extension ASN1 {
}
}
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
extension ASN1.ASN1BitString: Hashable { }
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
@@ -138,6 +138,7 @@ extension ASN1.ASN1Identifier {
internal static let generalizedTime = try! ASN1.ASN1Identifier(rawIdentifier: 0x18)
}
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
extension ASN1.ASN1Identifier: Hashable { }
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
@@ -170,6 +170,7 @@ extension IntegerBytesCollection: RandomAccessCollection {
}
}
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
extension IntegerBytesCollection.Index: Equatable { }
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
@@ -51,6 +51,7 @@ extension ASN1 {
}
}
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
extension ASN1.ASN1OctetString: Hashable { }
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
@@ -133,6 +133,7 @@ extension ASN1 {
}
}
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
extension ASN1.ASN1ObjectIdentifier: Hashable {}
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
+1
View File
@@ -34,6 +34,7 @@ public enum CryptoKitError: Error {
case invalidParameter
}
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
extension CryptoKitError: Equatable, Hashable {}
/// Errors from decoding ASN.1 content.
@@ -16,6 +16,7 @@
#else
import Foundation
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
extension Curve25519.KeyAgreement.PrivateKey: HPKEDiffieHellmanPrivateKeyGeneration {}
+3
View File
@@ -131,6 +131,7 @@ extension P256.Signing {
}
}
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
extension P256.Signing: NISTSigning {}
// MARK: - P256 + PrivateKey
@@ -300,6 +301,7 @@ extension P384.Signing {
}
}
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
extension P384.Signing: NISTSigning {}
// MARK: - P384 + PrivateKey
@@ -469,6 +471,7 @@ extension P521.Signing {
}
}
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
extension P521.Signing: NISTSigning {}
// MARK: - P521 + PrivateKey
+4
View File
@@ -144,9 +144,11 @@ extension SecureBytes: BidirectionalCollection {
}
// MARK: - RandomAccessCollection conformance
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
extension SecureBytes: RandomAccessCollection { }
// MARK: - MutableCollection conformance
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
extension SecureBytes: MutableCollection { }
// MARK: - RangeReplaceableCollection conformance
@@ -224,9 +226,11 @@ extension SecureBytes: DataProtocol {
}
// MARK: - MutableDataProtocol conformance
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
extension SecureBytes: MutableDataProtocol { }
// MARK: - Index conformances
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
extension SecureBytes.Index: Hashable { }
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
+1 -1
View File
@@ -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, watchOS 6, tvOS 13, *)
@available(macOS 10.15, iOS 13.2, tvOS 13.2, watchOS 6.1, *)
extension ARC.PresentationState {
func serialize() throws -> Data {
let encoder = PropertyListEncoder()
+1 -1
View File
@@ -149,7 +149,7 @@ func main() {
}
if #available(macOS 10.15, *) {
if #available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) {
main()
} else {
fatalError("crypto-shasum can only be run on macOS 10.15 and later")