Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added tvOS support #78

Merged
merged 2 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,25 @@ env:
RUSTFLAGS: -D warnings -F unused_must_use

jobs:
clippy-build-std:
name: Clippy (-Zbuild-std)
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- uses: dtolnay/rust-toolchain@nightly
with:
components: clippy

- name: Clippy (tvOS)
run: |
rustup component add rust-src --toolchain nightly-x86_64-apple-darwin
cargo +nightly clippy -Zbuild-std --target aarch64-apple-tvos

clippy:
name: Clippy
name: Clippy (stable)
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand Down
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions rustls-platform-verifier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ base64 = { version = "0.21", optional = true } # Only used when the `cert-loggin
jni = { version = "0.19", default-features = false, optional = true } # Only used during doc generation
once_cell = "1.9"

[target.'cfg(all(unix, not(target_os = "android"), not(target_os = "macos"), not(target_os = "ios")))'.dependencies]
[target.'cfg(all(unix, not(target_os = "android"), not(target_os = "macos"), not(target_os = "ios"), not(target_os = "tvos")))'.dependencies]
rustls-native-certs = "0.7"
webpki = { package = "rustls-webpki", version = "0.102", features = ["ring", "alloc", "std"] }

Expand All @@ -52,11 +52,11 @@ webpki-roots = "0.26"
[target.'cfg(target_os = "freebsd")'.dev-dependencies]
webpki-roots = "0.26"

[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies]
[target.'cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))'.dependencies]
core-foundation = "0.9"
core-foundation-sys = "0.8"
security-framework = { version = "2.6", features = ["OSX_10_14"] }
security-framework-sys = { version = "2.4", features = ["OSX_10_14"] }
security-framework = { version = "2.10", features = ["OSX_10_14"] }
security-framework-sys = { version = "2.10", features = ["OSX_10_14"] }
cpu marked this conversation as resolved.
Show resolved Hide resolved

[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3", features = ["wincrypt", "winerror"] }
Expand Down
6 changes: 5 additions & 1 deletion rustls-platform-verifier/src/tests/verification_mock/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
//! any parts of the system outside of these tests. See the `#![cfg(...)]`
//! immediately below to see which platforms run these tests.

#![cfg(all(any(windows, unix, target_os = "android"), not(target_os = "ios")))]
#![cfg(all(
any(windows, unix, target_os = "android"),
not(target_os = "ios"),
not(target_os = "tvos")
))]

use super::TestCase;
use crate::tests::{assert_cert_error_eq, ensure_global_state, verification_time};
Expand Down
12 changes: 7 additions & 5 deletions rustls-platform-verifier/src/verification/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,24 @@
any(unix, target_arch = "wasm32"),
not(target_os = "android"),
not(target_os = "macos"),
not(target_os = "ios")
not(target_os = "ios"),
not(target_os = "tvos")
))]
mod others;

#[cfg(all(
any(unix, target_arch = "wasm32"),
not(target_os = "android"),
not(target_os = "macos"),
not(target_os = "ios")
not(target_os = "ios"),
not(target_os = "tvos")
))]
pub use others::Verifier;

#[cfg(any(target_os = "macos", target_os = "ios"))]
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))]
mod apple;

#[cfg(any(target_os = "macos", target_os = "ios"))]
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))]
pub use apple::Verifier;

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

// Unknown certificate error shorthand. Used when we need to construct an "Other" certificate
// error with a platform specific error message.
#[cfg(any(windows, target_os = "macos", target_os = "ios"))]
#[cfg(any(windows, target_os = "macos", target_os = "ios", target_os = "tvos"))]
fn invalid_certificate(reason: impl Into<String>) -> rustls::Error {
rustls::Error::InvalidCertificate(rustls::CertificateError::Other(rustls::OtherError(
std::sync::Arc::from(Box::from(reason.into())),
Expand Down
Loading