Skip to content

Commit 66a8512

Browse files
authored
Drop Swift 5.10 (#283)
Motivation: Swift 5.10 is no longer supported. We should raise the minimum Swift tools version to 6.0, fix consequent build warnings/errors, and remove 5.10 CI jobs. Modifications: - Raised the Swift tools version to 6.0 in both the main `swift-certificates` package and the Benchmark package. - Removed the now redundant `StrictConcurrency=complete` flag in `swift-certificates`' `Package.swift`. - Removed 5.10 CI job arguments. - Removed 5.10 benchmark thresholds. - Added an explicit type annotation to the `package-benchmark` setup closure to address a build error. - Updated `VerifierBenchmark` to use newer, non-deprecated `RFC5280Policy` initializers (as a result of #276). - Updated a test case in `Tests/X509Tests/PEMTests.swift` to no longer use a deprecated `String` initializer. Result: Code reflects our support window.
1 parent 23b6a15 commit 66a8512

12 files changed

+46
-45
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ jobs:
1414
name: Unit tests
1515
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
1616
with:
17-
linux_5_10_arguments_override: "--explicit-target-dependency-import-check error"
1817
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
1918
linux_6_1_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
2019
linux_6_2_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"

.github/workflows/pull_request.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ jobs:
1818
name: Unit tests
1919
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
2020
with:
21-
linux_5_10_arguments_override: "--explicit-target-dependency-import-check error"
2221
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
2322
linux_6_1_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
2423
linux_6_2_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"

Benchmarks/Benchmarks/CertificatesBenchmark/VerifierBenchmark.swift

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
import Benchmark
16-
import X509
16+
@_spi(FixedExpiryValidationTime) import X509
1717
import Foundation
1818
import Crypto
1919
import SwiftASN1
@@ -50,7 +50,7 @@ func testTrivialChainBuilding() async -> Int {
5050
let roots = CertificateStore([TestCertificate.ca1])
5151

5252
var verifier = Verifier(rootCertificates: roots) {
53-
RFC5280Policy(validationTime: TestCertificate.referenceTime)
53+
RFC5280Policy(fixedExpiryValidationTime: TestCertificate.referenceTime)
5454
}
5555
let result = await verifier.validate(
5656
leaf: TestCertificate.localhostLeaf,
@@ -67,7 +67,9 @@ func testTrivialChainBuilding() async -> Int {
6767
func testExtraRootsAreIgnored() async -> Int {
6868
let roots = CertificateStore([TestCertificate.ca1, TestCertificate.ca2])
6969

70-
var verifier = Verifier(rootCertificates: roots) { RFC5280Policy(validationTime: TestCertificate.referenceTime) }
70+
var verifier = Verifier(rootCertificates: roots) {
71+
RFC5280Policy(fixedExpiryValidationTime: TestCertificate.referenceTime)
72+
}
7173
let result = await verifier.validate(
7274
leaf: TestCertificate.localhostLeaf,
7375
intermediates: CertificateStore([TestCertificate.intermediate1])
@@ -83,7 +85,9 @@ func testExtraRootsAreIgnored() async -> Int {
8385
func testPuttingRootsInTheIntermediariesIsntAProblem() async -> Int {
8486
let roots = CertificateStore([TestCertificate.ca1, TestCertificate.ca2])
8587

86-
var verifier = Verifier(rootCertificates: roots) { RFC5280Policy(validationTime: TestCertificate.referenceTime) }
88+
var verifier = Verifier(rootCertificates: roots) {
89+
RFC5280Policy(fixedExpiryValidationTime: TestCertificate.referenceTime)
90+
}
8791
let result = await verifier.validate(
8892
leaf: TestCertificate.localhostLeaf,
8993
intermediates: CertificateStore([TestCertificate.intermediate1, TestCertificate.ca1, TestCertificate.ca2])
@@ -99,7 +103,9 @@ func testPuttingRootsInTheIntermediariesIsntAProblem() async -> Int {
99103
func testSupportsCrossSignedRootWithoutTrouble() async -> Int {
100104
let roots = CertificateStore([TestCertificate.ca2])
101105

102-
var verifier = Verifier(rootCertificates: roots) { RFC5280Policy(validationTime: TestCertificate.referenceTime) }
106+
var verifier = Verifier(rootCertificates: roots) {
107+
RFC5280Policy(fixedExpiryValidationTime: TestCertificate.referenceTime)
108+
}
103109
let result = await verifier.validate(
104110
leaf: TestCertificate.localhostLeaf,
105111
intermediates: CertificateStore([TestCertificate.intermediate1, TestCertificate.ca1CrossSignedByCA2])
@@ -115,7 +121,9 @@ func testSupportsCrossSignedRootWithoutTrouble() async -> Int {
115121
func testBuildsTheShorterPathInTheCaseOfCrossSignedRoots() async -> Int {
116122
let roots = CertificateStore([TestCertificate.ca1, TestCertificate.ca2])
117123

118-
var verifier = Verifier(rootCertificates: roots) { RFC5280Policy(validationTime: TestCertificate.referenceTime) }
124+
var verifier = Verifier(rootCertificates: roots) {
125+
RFC5280Policy(fixedExpiryValidationTime: TestCertificate.referenceTime)
126+
}
119127
let result = await verifier.validate(
120128
leaf: TestCertificate.localhostLeaf,
121129
intermediates: CertificateStore([
@@ -133,7 +141,9 @@ func testBuildsTheShorterPathInTheCaseOfCrossSignedRoots() async -> Int {
133141
func testPrefersToUseIntermediatesWithSKIThatMatches() async -> Int {
134142
let roots = CertificateStore([TestCertificate.ca1])
135143

136-
var verifier = Verifier(rootCertificates: roots) { RFC5280Policy(validationTime: TestCertificate.referenceTime) }
144+
var verifier = Verifier(rootCertificates: roots) {
145+
RFC5280Policy(fixedExpiryValidationTime: TestCertificate.referenceTime)
146+
}
137147
let result = await verifier.validate(
138148
leaf: TestCertificate.localhostLeaf,
139149
intermediates: CertificateStore([TestCertificate.intermediate1, TestCertificate.intermediate1WithoutSKIAKI])
@@ -149,7 +159,9 @@ func testPrefersToUseIntermediatesWithSKIThatMatches() async -> Int {
149159
func testPrefersNoSKIToNonMatchingSKI() async -> Int {
150160
let roots = CertificateStore([TestCertificate.ca1])
151161

152-
var verifier = Verifier(rootCertificates: roots) { RFC5280Policy(validationTime: TestCertificate.referenceTime) }
162+
var verifier = Verifier(rootCertificates: roots) {
163+
RFC5280Policy(fixedExpiryValidationTime: TestCertificate.referenceTime)
164+
}
153165
let result = await verifier.validate(
154166
leaf: TestCertificate.localhostLeaf,
155167
intermediates: CertificateStore([
@@ -167,7 +179,9 @@ func testPrefersNoSKIToNonMatchingSKI() async -> Int {
167179
func testRejectsRootsThatDidNotSignTheCertBeforeThem() async -> Int {
168180
let roots = CertificateStore([TestCertificate.ca1WithAlternativePrivateKey, TestCertificate.ca2])
169181

170-
var verifier = Verifier(rootCertificates: roots) { RFC5280Policy(validationTime: TestCertificate.referenceTime) }
182+
var verifier = Verifier(rootCertificates: roots) {
183+
RFC5280Policy(fixedExpiryValidationTime: TestCertificate.referenceTime)
184+
}
171185
let result = await verifier.validate(
172186
leaf: TestCertificate.localhostLeaf,
173187
intermediates: CertificateStore([
@@ -186,7 +200,7 @@ func testPolicyFailuresCanFindLongerPaths() async -> Int {
186200

187201
var verifier = Verifier(rootCertificates: roots) {
188202
FailIfCertInChainPolicy(forbiddenCert: TestCertificate.ca1)
189-
RFC5280Policy(validationTime: TestCertificate.referenceTime)
203+
RFC5280Policy(fixedExpiryValidationTime: TestCertificate.referenceTime)
190204
}
191205
let result = await verifier.validate(
192206
leaf: TestCertificate.localhostLeaf,
@@ -205,7 +219,9 @@ func testPolicyFailuresCanFindLongerPaths() async -> Int {
205219
func testSelfSignedCertsAreTrustedWhenInTrustStore() async -> Int {
206220
let roots = CertificateStore([TestCertificate.ca1, TestCertificate.isolatedSelfSignedCert])
207221

208-
var verifier = Verifier(rootCertificates: roots) { RFC5280Policy(validationTime: TestCertificate.referenceTime) }
222+
var verifier = Verifier(rootCertificates: roots) {
223+
RFC5280Policy(fixedExpiryValidationTime: TestCertificate.referenceTime)
224+
}
209225
let result = await verifier.validate(
210226
leaf: TestCertificate.isolatedSelfSignedCert,
211227
intermediates: CertificateStore([TestCertificate.intermediate1])
@@ -246,7 +262,9 @@ func testTrustRootsCanBeNonSelfSignedLeaves() async -> Int {
246262
func testTrustRootsCanBeNonSelfSignedIntermediates() async -> Int {
247263
let roots = CertificateStore([TestCertificate.intermediate1])
248264

249-
var verifier = Verifier(rootCertificates: roots) { RFC5280Policy(validationTime: TestCertificate.referenceTime) }
265+
var verifier = Verifier(rootCertificates: roots) {
266+
RFC5280Policy(fixedExpiryValidationTime: TestCertificate.referenceTime)
267+
}
250268
let result = await verifier.validate(
251269
leaf: TestCertificate.localhostLeaf,
252270
intermediates: CertificateStore([TestCertificate.intermediate1])
@@ -275,7 +293,9 @@ func testWePoliceCriticalExtensionsOnLeafCerts() async -> Int {
275293
TestCertificate.ca1, TestCertificate.isolatedSelfSignedCertWithWeirdCriticalExtension,
276294
])
277295

278-
var verifier = Verifier(rootCertificates: roots) { RFC5280Policy(validationTime: TestCertificate.referenceTime) }
296+
var verifier = Verifier(rootCertificates: roots) {
297+
RFC5280Policy(fixedExpiryValidationTime: TestCertificate.referenceTime)
298+
}
279299
let result = await verifier.validate(
280300
leaf: TestCertificate.isolatedSelfSignedCertWithWeirdCriticalExtension,
281301
intermediates: CertificateStore([TestCertificate.intermediate1])
@@ -291,7 +311,9 @@ func testWePoliceCriticalExtensionsOnLeafCerts() async -> Int {
291311
func testMissingIntermediateFailsToBuild() async -> Int {
292312
let roots = CertificateStore([TestCertificate.ca1])
293313

294-
var verifier = Verifier(rootCertificates: roots) { RFC5280Policy(validationTime: TestCertificate.referenceTime) }
314+
var verifier = Verifier(rootCertificates: roots) {
315+
RFC5280Policy(fixedExpiryValidationTime: TestCertificate.referenceTime)
316+
}
295317
let result = await verifier.validate(
296318
leaf: TestCertificate.localhostLeaf,
297319
intermediates: CertificateStore([])
@@ -307,7 +329,9 @@ func testMissingIntermediateFailsToBuild() async -> Int {
307329
func testSelfSignedCertsAreRejectedWhenNotInTheTrustStore() async -> Int {
308330
let roots = CertificateStore([TestCertificate.ca1])
309331

310-
var verifier = Verifier(rootCertificates: roots) { RFC5280Policy(validationTime: TestCertificate.referenceTime) }
332+
var verifier = Verifier(rootCertificates: roots) {
333+
RFC5280Policy(fixedExpiryValidationTime: TestCertificate.referenceTime)
334+
}
311335
let result = await verifier.validate(
312336
leaf: TestCertificate.isolatedSelfSignedCert,
313337
intermediates: CertificateStore([TestCertificate.intermediate1])
@@ -322,7 +346,9 @@ func testSelfSignedCertsAreRejectedWhenNotInTheTrustStore() async -> Int {
322346
func testMissingRootFailsToBuild() async -> Int {
323347
let roots = CertificateStore([])
324348

325-
var verifier = Verifier(rootCertificates: roots) { RFC5280Policy(validationTime: TestCertificate.referenceTime) }
349+
var verifier = Verifier(rootCertificates: roots) {
350+
RFC5280Policy(fixedExpiryValidationTime: TestCertificate.referenceTime)
351+
}
326352
let result = await verifier.validate(
327353
leaf: TestCertificate.localhostLeaf,
328354
intermediates: CertificateStore([TestCertificate.intermediate1])

Benchmarks/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.10
1+
// swift-tools-version:6.0
22
//===----------------------------------------------------------------------===//
33
//
44
// This source file is part of the SwiftCertificates open source project

Benchmarks/Thresholds/5.10/CertificatesBenchmark.Parse_WebPKI_Roots_from_DER.p90.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

Benchmarks/Thresholds/5.10/CertificatesBenchmark.Parse_WebPKI_Roots_from_PEM_files.p90.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

Benchmarks/Thresholds/5.10/CertificatesBenchmark.Parse_WebPKI_Roots_from_multi_PEM_file.p90.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

Benchmarks/Thresholds/5.10/CertificatesBenchmark.TinyArray.append.p90.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

Benchmarks/Thresholds/5.10/CertificatesBenchmark.TinyArray_non-allocating_functions.p90.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

Benchmarks/Thresholds/5.10/CertificatesBenchmark.Verifier.p90.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)