diff --git a/Cargo.toml b/Cargo.toml index 8960942..902813d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ rustdoc-args = ["--cfg", "docsrs"] vendored = ["openssl/vendored"] alpn = ["security-framework/alpn"] -[target.'cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos", target_os = "tvos"))'.dependencies] +[target.'cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos"))'.dependencies] security-framework = "2.0.0" security-framework-sys = "2.0.0" libc = "0.2" @@ -25,7 +25,7 @@ tempfile = "3.1.0" [target.'cfg(target_os = "windows")'.dependencies] schannel = "0.1.17" -[target.'cfg(not(any(target_os = "windows", target_os = "macos", target_os = "ios", target_os = "watchos", target_os = "tvos")))'.dependencies] +[target.'cfg(not(any(target_os = "windows", target_os = "macos", target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos")))'.dependencies] log = "0.4.5" openssl = "0.10.29" openssl-sys = "0.9.55" diff --git a/src/imp/security_framework.rs b/src/imp/security_framework.rs index 63232b7..02b76a6 100644 --- a/src/imp/security_framework.rs +++ b/src/imp/security_framework.rs @@ -20,24 +20,24 @@ use std::str; use std::sync::Mutex; use std::sync::Once; -#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos")))] +#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos")))] use self::security_framework::os::macos::certificate::{PropertyType, SecCertificateExt}; -#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos")))] +#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos")))] use self::security_framework::os::macos::certificate_oids::CertificateOid; -#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos")))] +#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos")))] use self::security_framework::os::macos::identity::SecIdentityExt; -#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos")))] +#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos")))] use self::security_framework::os::macos::import_export::{ ImportOptions, Pkcs12ImportOptionsExt, SecItems, }; -#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos")))] +#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos")))] use self::security_framework::os::macos::keychain::{self, KeychainSettings, SecKeychain}; use {Protocol, TlsAcceptorBuilder, TlsConnectorBuilder}; static SET_AT_EXIT: Once = Once::new(); -#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos")))] +#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos")))] static TEMP_KEYCHAIN: Mutex> = Mutex::new(None); fn convert_protocol(protocol: Protocol) -> SslProtocol { @@ -82,12 +82,12 @@ pub struct Identity { } impl Identity { - #[cfg(any(target_os = "ios", target_os = "watchos", target_os = "tvos"))] + #[cfg(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos"))] pub fn from_pkcs8(_: &[u8], _: &[u8]) -> Result { panic!("Not implemented on iOS"); } - #[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos")))] + #[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos")))] pub fn from_pkcs8(pem: &[u8], key: &[u8]) -> Result { if !key.starts_with(b"-----BEGIN PRIVATE KEY-----") { return Err(Error(base::Error::from(errSecParam))); @@ -145,7 +145,7 @@ impl Identity { }) } - #[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos")))] + #[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos")))] fn import_options(buf: &[u8], pass: &str) -> Result, Error> { SET_AT_EXIT.call_once(|| { extern "C" fn atexit() { @@ -177,7 +177,7 @@ impl Identity { Ok(imports) } - #[cfg(any(target_os = "ios", target_os = "watchos", target_os = "tvos"))] + #[cfg(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos"))] fn import_options(buf: &[u8], pass: &str) -> Result, Error> { let imports = Pkcs12ImportOptions::new().passphrase(pass).import(buf)?; Ok(imports) @@ -206,7 +206,7 @@ impl Certificate { Ok(Certificate(cert)) } - #[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos")))] + #[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos")))] pub fn from_pem(buf: &[u8]) -> Result { let mut items = SecItems::default(); ImportOptions::new().items(&mut items).import(buf)?; @@ -217,9 +217,9 @@ impl Certificate { } } - #[cfg(any(target_os = "ios", target_os = "watchos", target_os = "tvos"))] + #[cfg(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos"))] pub fn from_pem(_: &[u8]) -> Result { - panic!("Not implemented on iOS, tvOS or watchOS"); + panic!("Not implemented on iOS, tvOS, watchOS or visionOS"); } pub fn to_der(&self) -> Result, Error> { @@ -476,12 +476,12 @@ impl TlsStream { } } - #[cfg(any(target_os = "ios", target_os = "watchos", target_os = "tvos"))] + #[cfg(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos"))] pub fn tls_server_end_point(&self) -> Result>, Error> { Ok(None) } - #[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos")))] + #[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos")))] pub fn tls_server_end_point(&self) -> Result>, Error> { let cert = match self.cert { Some(ref cert) => cert.clone(), diff --git a/src/lib.rs b/src/lib.rs index cc86502..bd684e6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -117,7 +117,8 @@ extern crate log; target_os = "macos", target_os = "ios", target_os = "watchos", - target_os = "tvos" + target_os = "tvos", + target_os = "visionos" ))] #[path = "imp/security_framework.rs"] mod imp; @@ -129,7 +130,8 @@ mod imp; target_os = "windows", target_os = "ios", target_os = "watchos", - target_os = "tvos" + target_os = "tvos", + target_os = "visionos" )))] #[path = "imp/openssl.rs"] mod imp;