Skip to content

Commit 809ae36

Browse files
committed
Added visionos target support
1 parent 0b69ce6 commit 809ae36

File tree

3 files changed

+21
-19
lines changed

3 files changed

+21
-19
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ rustdoc-args = ["--cfg", "docsrs"]
1616
vendored = ["openssl/vendored"]
1717
alpn = ["security-framework/alpn"]
1818

19-
[target.'cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos", target_os = "tvos"))'.dependencies]
19+
[target.'cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos"))'.dependencies]
2020
security-framework = "2.0.0"
2121
security-framework-sys = "2.0.0"
2222
libc = "0.2"
@@ -25,7 +25,7 @@ tempfile = "3.1.0"
2525
[target.'cfg(target_os = "windows")'.dependencies]
2626
schannel = "0.1.17"
2727

28-
[target.'cfg(not(any(target_os = "windows", target_os = "macos", target_os = "ios", target_os = "watchos", target_os = "tvos")))'.dependencies]
28+
[target.'cfg(not(any(target_os = "windows", target_os = "macos", target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos")))'.dependencies]
2929
log = "0.4.5"
3030
openssl = "0.10.29"
3131
openssl-sys = "0.9.55"

src/imp/security_framework.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,24 @@ use std::str;
2020
use std::sync::Mutex;
2121
use std::sync::Once;
2222

23-
#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos")))]
23+
#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos")))]
2424
use self::security_framework::os::macos::certificate::{PropertyType, SecCertificateExt};
25-
#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos")))]
25+
#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos")))]
2626
use self::security_framework::os::macos::certificate_oids::CertificateOid;
27-
#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos")))]
27+
#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos")))]
2828
use self::security_framework::os::macos::identity::SecIdentityExt;
29-
#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos")))]
29+
#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos")))]
3030
use self::security_framework::os::macos::import_export::{
3131
ImportOptions, Pkcs12ImportOptionsExt, SecItems,
3232
};
33-
#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos")))]
33+
#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos")))]
3434
use self::security_framework::os::macos::keychain::{self, KeychainSettings, SecKeychain};
3535

3636
use {Protocol, TlsAcceptorBuilder, TlsConnectorBuilder};
3737

3838
static SET_AT_EXIT: Once = Once::new();
3939

40-
#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos")))]
40+
#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos")))]
4141
static TEMP_KEYCHAIN: Mutex<Option<(SecKeychain, TempDir)>> = Mutex::new(None);
4242

4343
fn convert_protocol(protocol: Protocol) -> SslProtocol {
@@ -82,12 +82,12 @@ pub struct Identity {
8282
}
8383

8484
impl Identity {
85-
#[cfg(any(target_os = "ios", target_os = "watchos", target_os = "tvos"))]
85+
#[cfg(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos"))]
8686
pub fn from_pkcs8(_: &[u8], _: &[u8]) -> Result<Identity, Error> {
8787
panic!("Not implemented on iOS");
8888
}
8989

90-
#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos")))]
90+
#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos")))]
9191
pub fn from_pkcs8(pem: &[u8], key: &[u8]) -> Result<Identity, Error> {
9292
if !key.starts_with(b"-----BEGIN PRIVATE KEY-----") {
9393
return Err(Error(base::Error::from(errSecParam)));
@@ -145,7 +145,7 @@ impl Identity {
145145
})
146146
}
147147

148-
#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos")))]
148+
#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos")))]
149149
fn import_options(buf: &[u8], pass: &str) -> Result<Vec<ImportedIdentity>, Error> {
150150
SET_AT_EXIT.call_once(|| {
151151
extern "C" fn atexit() {
@@ -177,7 +177,7 @@ impl Identity {
177177
Ok(imports)
178178
}
179179

180-
#[cfg(any(target_os = "ios", target_os = "watchos", target_os = "tvos"))]
180+
#[cfg(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos"))]
181181
fn import_options(buf: &[u8], pass: &str) -> Result<Vec<ImportedIdentity>, Error> {
182182
let imports = Pkcs12ImportOptions::new().passphrase(pass).import(buf)?;
183183
Ok(imports)
@@ -206,7 +206,7 @@ impl Certificate {
206206
Ok(Certificate(cert))
207207
}
208208

209-
#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos")))]
209+
#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos")))]
210210
pub fn from_pem(buf: &[u8]) -> Result<Certificate, Error> {
211211
let mut items = SecItems::default();
212212
ImportOptions::new().items(&mut items).import(buf)?;
@@ -217,9 +217,9 @@ impl Certificate {
217217
}
218218
}
219219

220-
#[cfg(any(target_os = "ios", target_os = "watchos", target_os = "tvos"))]
220+
#[cfg(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos"))]
221221
pub fn from_pem(_: &[u8]) -> Result<Certificate, Error> {
222-
panic!("Not implemented on iOS, tvOS or watchOS");
222+
panic!("Not implemented on iOS, tvOS, watchOS or visionOS");
223223
}
224224

225225
pub fn to_der(&self) -> Result<Vec<u8>, Error> {
@@ -476,12 +476,12 @@ impl<S: io::Read + io::Write> TlsStream<S> {
476476
}
477477
}
478478

479-
#[cfg(any(target_os = "ios", target_os = "watchos", target_os = "tvos"))]
479+
#[cfg(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos"))]
480480
pub fn tls_server_end_point(&self) -> Result<Option<Vec<u8>>, Error> {
481481
Ok(None)
482482
}
483483

484-
#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos")))]
484+
#[cfg(not(any(target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos")))]
485485
pub fn tls_server_end_point(&self) -> Result<Option<Vec<u8>>, Error> {
486486
let cert = match self.cert {
487487
Some(ref cert) => cert.clone(),

src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ extern crate log;
117117
target_os = "macos",
118118
target_os = "ios",
119119
target_os = "watchos",
120-
target_os = "tvos"
120+
target_os = "tvos",
121+
target_os = "visionos"
121122
))]
122123
#[path = "imp/security_framework.rs"]
123124
mod imp;
@@ -129,7 +130,8 @@ mod imp;
129130
target_os = "windows",
130131
target_os = "ios",
131132
target_os = "watchos",
132-
target_os = "tvos"
133+
target_os = "tvos",
134+
target_os = "visionos"
133135
)))]
134136
#[path = "imp/openssl.rs"]
135137
mod imp;

0 commit comments

Comments
 (0)