Skip to content

Commit f90ac83

Browse files
committed
Fix 5.8 warnings
1 parent 0cd2bb5 commit f90ac83

14 files changed

+34
-13
lines changed

Sources/X509/CertificatePrivateKey.swift

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
@preconcurrency import Crypto
1616
@preconcurrency import _CryptoExtras
17+
import Foundation
1718

1819
extension Certificate {
1920
/// A private key that can be used with a certificate.

Sources/X509/CertificatePublicKey.swift

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import SwiftASN1
1616
@preconcurrency import Crypto
1717
@preconcurrency import _CryptoExtras
18+
import Foundation
1819

1920
extension Certificate {
2021
/// A public key that can be used with a certificate.

Sources/X509/DistinguishedNameBuilder/CommonName.swift

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
import SwiftASN1
16+
1517
/// Set the Common Name (CN) of a ``DistinguishedName``.
1618
///
1719
/// This type is used in ``DistinguishedNameBuilder`` contexts.

Sources/X509/DistinguishedNameBuilder/CountryName.swift

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
import SwiftASN1
16+
1517
/// Set the Country Name (C) of a ``DistinguishedName``.
1618
///
1719
/// This type is used in ``DistinguishedNameBuilder`` contexts.

Sources/X509/DistinguishedNameBuilder/LocalityName.swift

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
import SwiftASN1
16+
1517
/// Set the Locality Name (L) of a ``DistinguishedName``.
1618
///
1719
/// This type is used in ``DistinguishedNameBuilder`` contexts.

Sources/X509/DistinguishedNameBuilder/OrganizationName.swift

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
import SwiftASN1
16+
1517
/// Set the Organization Name (O) of a ``DistinguishedName``.
1618
///
1719
/// This type is used in ``DistinguishedNameBuilder`` contexts.

Sources/X509/DistinguishedNameBuilder/OrganizationalUnitName.swift

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
import SwiftASN1
16+
1517
/// Set the Organizational Unit Name (OU) of a ``DistinguishedName``.
1618
///
1719
/// This type is used in ``DistinguishedNameBuilder`` contexts.

Sources/X509/DistinguishedNameBuilder/StateOrProvinceName.swift

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
import SwiftASN1
16+
1517
/// Set the State or Province Name (ST) of a ``DistinguishedName``.
1618
///
1719
/// This type is used in ``DistinguishedNameBuilder`` contexts.

Sources/X509/DistinguishedNameBuilder/StreetAddress.swift

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
import SwiftASN1
16+
1517
/// Set the Street Address (STREET) of a ``DistinguishedName``.
1618
///
1719
/// This type is used in ``DistinguishedNameBuilder`` contexts.

Sources/X509/OCSP/OCSPPolicy.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ enum OCSPRequestHashAlgorithm {
7777
}
7878
}
7979

80-
public struct OCSPVerifierPolicy<Requester: OCSPRequester>: VerifierPolicy {
80+
public struct OCSPVerifierPolicy<Requester: OCSPRequester>: VerifierPolicy, Sendable {
8181

8282
private var requester: Requester
8383
private var requestHashAlgorithm: OCSPRequestHashAlgorithm
@@ -303,7 +303,7 @@ extension OCSPSingleResponse {
303303
/// - maxDuration: max execution duration in seconds of `operation`
304304
/// - operation: the task to start and cancel after `maxDuration` seconds
305305
/// - Returns: the result of `operation`
306-
private func withTimeout<Result>(
306+
private func withTimeout<Result: Sendable>(
307307
_ maxDuration: TimeInterval,
308308
operation: @escaping @Sendable () async -> Result
309309
) async -> Result {

Sources/X509/Signature.swift

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import SwiftASN1
1616
@preconcurrency import Crypto
1717
@preconcurrency import _CryptoExtras
18+
import Foundation
1819

1920
extension Certificate {
2021
/// An abstract representation of the cryptographic signature on a certificate.

Sources/X509/Verifier/VerifierPolicy.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public protocol VerifierPolicy {
1616
mutating func chainMeetsPolicyRequirements(chain: UnverifiedCertificateChain) async -> PolicyEvaluationResult
1717
}
1818

19-
public enum PolicyEvaluationResult {
19+
public enum PolicyEvaluationResult: Sendable {
2020
case meetsPolicy
2121
case failsToMeetPolicy(reason: String)
2222
}

Tests/X509Tests/DistinguishedNameTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ final class DistinguishedNameTests: XCTestCase {
159159
StateOrProvinceName("DigiLand")
160160
}
161161

162-
for name in ["foo", "bar", "baz"].filter { $0 == "baz" } {
162+
for name in ["foo", "bar", "baz"].filter({ $0 == "baz" }) {
163163
CommonName(name)
164164
}
165165
}

Tests/X509Tests/OCSPPolicyVerifierTests.swift

+13-9
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ final class OCSPVerifierPolicyTests: XCTestCase {
171171
}
172172

173173
func testSingleCertWithOCSP() async {
174+
let now = self.now
174175
await self.assertChainMeetsPolicy(
175176
chain: Self.chainWithSingleCertWithOCSP,
176177
requester: .noThrow { request, uri -> OCSPResponse in
@@ -182,14 +183,15 @@ final class OCSPVerifierPolicyTests: XCTestCase {
182183
return .successful(.signed(responses: [OCSPSingleResponse(
183184
certID: singleRequest.certID,
184185
certStatus: .good,
185-
thisUpdate: try .init(self.now - .days(1)),
186-
nextUpdate: try .init(self.now + .days(1))
186+
thisUpdate: try .init(now - .days(1)),
187+
nextUpdate: try .init(now + .days(1))
187188
)], responseExtensions: { nonce }))
188189
}
189190
)
190191
}
191192

192193
func testWrongNonce() async {
194+
let now = self.now
193195
await self.assertChainFailsToMeetPolicy(
194196
chain: Self.chainWithSingleCertWithOCSP,
195197
requester: .noThrow { request, uri -> OCSPResponse in
@@ -201,14 +203,15 @@ final class OCSPVerifierPolicyTests: XCTestCase {
201203
return .successful(.signed(responses: [OCSPSingleResponse(
202204
certID: singleRequest.certID,
203205
certStatus: .good,
204-
thisUpdate: try .init(self.now - .days(1)),
205-
nextUpdate: try .init(self.now + .days(1))
206+
thisUpdate: try .init(now - .days(1)),
207+
nextUpdate: try .init(now + .days(1))
206208
)], responseExtensions: { OCSPNonce() }))
207209
}
208210
)
209211
}
210212

211213
func testRevokedCert() async {
214+
let now = self.now
212215
await self.assertChainFailsToMeetPolicy(
213216
chain: Self.chainWithSingleCertWithOCSP,
214217
requester: .noThrow { request, uri -> OCSPResponse in
@@ -220,17 +223,18 @@ final class OCSPVerifierPolicyTests: XCTestCase {
220223
return .successful(.signed(responses: [OCSPSingleResponse(
221224
certID: singleRequest.certID,
222225
certStatus: .revoked(.init(
223-
revocationTime: try .init(self.now),
226+
revocationTime: try .init(now),
224227
revocationReason: .unspecified
225228
)),
226-
thisUpdate: try .init(self.now - .days(1)),
227-
nextUpdate: try .init(self.now + .days(1))
229+
thisUpdate: try .init(now - .days(1)),
230+
nextUpdate: try .init(now + .days(1))
228231
)], responseExtensions: { nonce }))
229232
}
230233
)
231234
}
232235

233236
func testResponseDoesNotIncludeResponseForRequestedCert() async {
237+
let now = self.now
234238
await self.assertChainFailsToMeetPolicy(
235239
chain: Self.chainWithSingleCertWithOCSP,
236240
requester: .noThrow { request, uri -> OCSPResponse in
@@ -246,8 +250,8 @@ final class OCSPVerifierPolicyTests: XCTestCase {
246250
serialNumber: .init()
247251
),
248252
certStatus: .good,
249-
thisUpdate: try .init(self.now - .days(1)),
250-
nextUpdate: try .init(self.now + .days(1))
253+
thisUpdate: try .init(now - .days(1)),
254+
nextUpdate: try .init(now + .days(1))
251255
)], responseExtensions: { nonce }))
252256
}
253257
)

0 commit comments

Comments
 (0)