Skip to content

Commit b6a8fe8

Browse files
committed
Add basic support for other Apple platforms
1 parent 8befd1d commit b6a8fe8

File tree

6 files changed

+27
-20
lines changed

6 files changed

+27
-20
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@ jobs:
3333
rustup component add rust-src --toolchain nightly-aarch64-apple-darwin
3434
cargo +nightly clippy -Zbuild-std --target aarch64-apple-tvos
3535
36+
- name: Clippy (watchOS)
37+
run: |
38+
rustup component add rust-src --toolchain nightly-aarch64-apple-darwin
39+
cargo +nightly clippy -Zbuild-std --target aarch64-apple-watchos
40+
41+
- name: Clippy (visionOS)
42+
run: |
43+
rustup component add rust-src --toolchain nightly-aarch64-apple-darwin
44+
cargo +nightly clippy -Zbuild-std --target aarch64-apple-visionos
45+
3646
clippy:
3747
name: Clippy (stable)
3848
runs-on: ${{ matrix.os }}

rustls-platform-verifier/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jni = { version = "0.19", default-features = false, optional = true } # Only use
3636
once_cell = "1.9"
3737
paste = { version = "1.0", default-features = false, optional = true } # Only used when `ffi-testing` feature is enabled
3838

39-
[target.'cfg(all(unix, not(target_os = "android"), not(target_os = "macos"), not(target_os = "ios"), not(target_os = "tvos"), not(target_arch = "wasm32")))'.dependencies]
39+
[target.'cfg(all(unix, not(target_os = "android"), not(target_vendor = "apple"), not(target_arch = "wasm32")))'.dependencies]
4040
rustls-native-certs = "0.7"
4141
webpki = { package = "rustls-webpki", version = "0.102", default-features = false }
4242

@@ -54,7 +54,7 @@ webpki-root-certs = "0.26"
5454
[target.'cfg(target_os = "freebsd")'.dev-dependencies]
5555
webpki-root-certs = "0.26"
5656

57-
[target.'cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))'.dependencies]
57+
[target.'cfg(any(target_vendor = "apple"))'.dependencies]
5858
core-foundation = "0.9"
5959
core-foundation-sys = "0.8"
6060
security-framework = { version = "2.10", features = ["OSX_10_14"] }

rustls-platform-verifier/src/tests/ffi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ mod dummy {
150150
#[cfg(any(
151151
windows,
152152
target_os = "android",
153-
target_os = "macos",
153+
target_vendor = "apple",
154154
target_os = "linux"
155155
))]
156156
let _ = tests::verification_mock::ALL_TEST_CASES;

rustls-platform-verifier/src/tests/verification_mock/mod.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
#![cfg(all(
1717
any(windows, unix, target_os = "android"),
1818
not(target_os = "ios"),
19-
not(target_os = "tvos")
19+
// These OSes require a simulator runtime and bundle.
20+
not(target_os = "tvos"),
21+
not(target_os = "watchos"),
22+
not(target_os = "visionos")
2023
))]
2124

2225
use super::TestCase;
@@ -209,31 +212,31 @@ mock_root_test_cases! {
209212
// Check that self-signed certificates, which may or may not be revokved, do not return any
210213
// kind of revocation error. It is expected that non-public certificates without revocation information
211214
// have no revocation checking performed across platforms.
212-
revoked_dns [ any(windows, target_os = "android", target_os = "macos") ] => TestCase {
215+
revoked_dns [ any(windows, target_os = "android", target_vendor = "apple") ] => TestCase {
213216
reference_id: EXAMPLE_COM,
214217
chain: &[include_bytes!("root1-int1-ee_example.com-revoked.crt"), ROOT1_INT1],
215218
stapled_ocsp: None,
216219
verification_time: verification_time(),
217220
expected_result: Ok(()),
218221
other_error: no_error!(),
219222
},
220-
stapled_revoked_dns [ any(windows, target_os = "android", target_os = "macos") ] => TestCase {
223+
stapled_revoked_dns [ any(windows, target_os = "android", target_vendor = "apple") ] => TestCase {
221224
reference_id: EXAMPLE_COM,
222225
chain: &[include_bytes!("root1-int1-ee_example.com-revoked.crt"), ROOT1_INT1],
223226
stapled_ocsp: Some(include_bytes!("root1-int1-ee_example.com-revoked.ocsp")),
224227
verification_time: verification_time(),
225228
expected_result: Err(TlsError::InvalidCertificate(CertificateError::Revoked)),
226229
other_error: no_error!(),
227230
},
228-
stapled_revoked_ipv4 [ any(windows, target_os = "android", target_os = "macos") ] => TestCase {
231+
stapled_revoked_ipv4 [ any(windows, target_os = "android", target_vendor = "apple") ] => TestCase {
229232
reference_id: LOCALHOST_IPV4,
230233
chain: &[include_bytes!("root1-int1-ee_127.0.0.1-revoked.crt"), ROOT1_INT1],
231234
stapled_ocsp: Some(include_bytes!("root1-int1-ee_127.0.0.1-revoked.ocsp")),
232235
verification_time: verification_time(),
233236
expected_result: Err(TlsError::InvalidCertificate(CertificateError::Revoked)),
234237
other_error: no_error!(),
235238
},
236-
stapled_revoked_ipv6 [ any(windows, target_os = "android", target_os = "macos") ] => TestCase {
239+
stapled_revoked_ipv6 [ any(windows, target_os = "android", target_vendor = "apple") ] => TestCase {
237240
reference_id: LOCALHOST_IPV6,
238241
chain: &[include_bytes!("root1-int1-ee_1-revoked.crt"), ROOT1_INT1],
239242
stapled_ocsp: Some(include_bytes!("root1-int1-ee_1-revoked.ocsp")),

rustls-platform-verifier/src/verification/mod.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,21 @@ use std::sync::Arc;
44
#[cfg(all(
55
any(unix, target_arch = "wasm32"),
66
not(target_os = "android"),
7-
not(target_os = "macos"),
8-
not(target_os = "ios"),
9-
not(target_os = "tvos")
7+
not(target_vendor = "apple"),
108
))]
119
mod others;
1210

1311
#[cfg(all(
1412
any(unix, target_arch = "wasm32"),
1513
not(target_os = "android"),
16-
not(target_os = "macos"),
17-
not(target_os = "ios"),
18-
not(target_os = "tvos")
14+
not(target_vendor = "apple"),
1915
))]
2016
pub use others::Verifier;
2117

22-
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))]
18+
#[cfg(target_vendor = "apple")]
2319
mod apple;
2420

25-
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))]
21+
#[cfg(target_vendor = "apple")]
2622
pub use apple::Verifier;
2723

2824
#[cfg(target_os = "android")]
@@ -67,7 +63,7 @@ fn log_server_cert(_end_entity: &rustls::pki_types::CertificateDer<'_>) {
6763

6864
// Unknown certificate error shorthand. Used when we need to construct an "Other" certificate
6965
// error with a platform specific error message.
70-
#[cfg(any(windows, target_os = "macos", target_os = "ios", target_os = "tvos"))]
66+
#[cfg(any(windows, target_vendor = "apple"))]
7167
fn invalid_certificate(reason: impl Into<String>) -> rustls::Error {
7268
rustls::Error::InvalidCertificate(rustls::CertificateError::Other(rustls::OtherError(
7369
Arc::from(Box::from(reason.into())),

rustls-platform-verifier/src/verification/others.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,7 @@ impl Verifier {
124124
#[cfg(all(
125125
unix,
126126
not(target_os = "android"),
127-
not(target_os = "macos"),
128-
not(target_os = "ios"),
129-
not(target_os = "tvos"),
127+
not(target_vendor = "apple"),
130128
not(target_arch = "wasm32"),
131129
))]
132130
match rustls_native_certs::load_native_certs() {

0 commit comments

Comments
 (0)