Skip to content

Commit 8af0572

Browse files
committed
Add swift-certificates. Cleanup swift-crypto. Swift 5.7 and macOS 12.
Basically: swiftlang#6216 swiftlang#6138 swiftlang#6214
1 parent 405bc98 commit 8af0572

File tree

3 files changed

+9
-27
lines changed

3 files changed

+9
-27
lines changed

Package.swift

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.5
1+
// swift-tools-version:5.7
22

33
//===----------------------------------------------------------------------===//
44
//
@@ -55,13 +55,6 @@ automatic linking type with `-auto` suffix appended to product's name.
5555
*/
5656
let autoProducts = [swiftPMProduct, swiftPMDataModelProduct]
5757

58-
let useSwiftCryptoV2 = ProcessInfo.processInfo.environment["SWIFTPM_USE_SWIFT_CRYPTO_V1"] == nil
59-
let minimumCryptoVersion: Version = useSwiftCryptoV2 ? "2.2.3" : "1.1.7"
60-
var swiftSettings: [SwiftSetting] = []
61-
if useSwiftCryptoV2 {
62-
swiftSettings.append(.define("CRYPTO_v2"))
63-
}
64-
6558
var packageCollectionsSigningTargets = [Target]()
6659
var packageCollectionsSigningDeps: [Target.Dependency] = [
6760
"Basics",
@@ -96,15 +89,14 @@ packageCollectionsSigningTargets.append(
9689
.target(
9790
/** Package collections signing */
9891
name: "PackageCollectionsSigning",
99-
dependencies: packageCollectionsSigningDeps,
100-
swiftSettings: swiftSettings
92+
dependencies: packageCollectionsSigningDeps
10193
)
10294
)
10395

10496
let package = Package(
10597
name: "SwiftPM",
10698
platforms: [
107-
.macOS("10.15.4"),
99+
.macOS(.v12),
108100
.iOS("13.4")
109101
],
110102
products:
@@ -710,7 +702,7 @@ let relatedDependenciesBranch = "main"
710702
if ProcessInfo.processInfo.environment["SWIFTPM_LLBUILD_FWK"] == nil {
711703
if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
712704
package.dependencies += [
713-
.package(url: "https://github.com/apple/swift-llbuild.git", .branch(relatedDependenciesBranch)),
705+
.package(url: "https://github.com/apple/swift-llbuild.git", branch: relatedDependenciesBranch),
714706
]
715707
} else {
716708
// In Swift CI, use a local path to llbuild to interoperate with tools
@@ -724,15 +716,16 @@ if ProcessInfo.processInfo.environment["SWIFTPM_LLBUILD_FWK"] == nil {
724716

725717
if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
726718
package.dependencies += [
727-
.package(url: "https://github.com/apple/swift-tools-support-core.git", .branch(relatedDependenciesBranch)),
719+
.package(url: "https://github.com/apple/swift-tools-support-core.git", branch: relatedDependenciesBranch),
728720
// The 'swift-argument-parser' version declared here must match that
729721
// used by 'swift-driver' and 'sourcekit-lsp'. Please coordinate
730722
// dependency version changes here with those projects.
731723
.package(url: "https://github.com/apple/swift-argument-parser.git", .upToNextMinor(from: "1.2.2")),
732-
.package(url: "https://github.com/apple/swift-driver.git", .branch(relatedDependenciesBranch)),
733-
.package(url: "https://github.com/apple/swift-crypto.git", .upToNextMinor(from: minimumCryptoVersion)),
724+
.package(url: "https://github.com/apple/swift-driver.git", branch: relatedDependenciesBranch),
725+
.package(url: "https://github.com/apple/swift-crypto.git", .upToNextMinor(from: "2.3.0")),
734726
.package(url: "https://github.com/apple/swift-system.git", .upToNextMinor(from: "1.1.1")),
735727
.package(url: "https://github.com/apple/swift-collections.git", .upToNextMinor(from: "1.0.1")),
728+
.package(url: "https://github.com/apple/swift-certificates.git", branch: "main"),
736729
]
737730
} else {
738731
package.dependencies += [
@@ -742,6 +735,7 @@ if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
742735
.package(path: "../swift-crypto"),
743736
.package(path: "../swift-system"),
744737
.package(path: "../swift-collections"),
738+
.package(path: "../swift-certificates"),
745739
]
746740
}
747741

Sources/PackageCollectionsSigning/Certificate/Certificate.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,7 @@ struct CoreCertificate {
113113

114114
#elseif os(Linux) || os(Windows) || os(Android)
115115
final class BoringSSLCertificate {
116-
#if CRYPTO_v2
117116
typealias Pointer = OpaquePointer
118-
#else
119-
typealias Pointer = UnsafeMutablePointer<X509>
120-
#endif
121117

122118
private let underlying: Pointer
123119

@@ -203,11 +199,7 @@ final class BoringSSLCertificate {
203199
}
204200

205201
private extension CertificateName {
206-
#if CRYPTO_v2
207202
typealias Pointer = OpaquePointer
208-
#else
209-
typealias Pointer = UnsafeMutablePointer<X509_NAME>
210-
#endif
211203

212204
init(x509Name: Pointer) {
213205
func getStringValue(from name: Pointer, of nid: CInt) -> String? {

Sources/PackageCollectionsSigning/Certificate/CertificatePolicy.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,7 @@ extension CertificatePolicy {
102102
}
103103

104104
#elseif os(Linux) || os(Windows) || os(Android)
105-
#if CRYPTO_v2
106105
typealias BoringSSLVerifyCallback = @convention(c) (CInt, OpaquePointer?) -> CInt
107-
#else
108-
typealias BoringSSLVerifyCallback = @convention(c) (CInt, UnsafeMutablePointer<X509_STORE_CTX>?) -> CInt
109-
#endif
110106

111107
/// Verifies a certificate chain.
112108
///

0 commit comments

Comments
 (0)