@@ -20,24 +20,54 @@ use std::str;
2020use std:: sync:: Mutex ;
2121use std:: sync:: Once ;
2222
23- #[ cfg( not( any( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ) ]
23+ #[ cfg( not( any(
24+ target_os = "ios" ,
25+ target_os = "watchos" ,
26+ target_os = "tvos" ,
27+ target_os = "visionos"
28+ ) ) ) ]
2429use self :: security_framework:: os:: macos:: certificate:: { PropertyType , SecCertificateExt } ;
25- #[ cfg( not( any( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ) ]
30+ #[ cfg( not( any(
31+ target_os = "ios" ,
32+ target_os = "watchos" ,
33+ target_os = "tvos" ,
34+ target_os = "visionos"
35+ ) ) ) ]
2636use self :: security_framework:: os:: macos:: certificate_oids:: CertificateOid ;
27- #[ cfg( not( any( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ) ]
37+ #[ cfg( not( any(
38+ target_os = "ios" ,
39+ target_os = "watchos" ,
40+ target_os = "tvos" ,
41+ target_os = "visionos"
42+ ) ) ) ]
2843use self :: security_framework:: os:: macos:: identity:: SecIdentityExt ;
29- #[ cfg( not( any( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ) ]
44+ #[ cfg( not( any(
45+ target_os = "ios" ,
46+ target_os = "watchos" ,
47+ target_os = "tvos" ,
48+ target_os = "visionos"
49+ ) ) ) ]
3050use self :: security_framework:: os:: macos:: import_export:: {
3151 ImportOptions , Pkcs12ImportOptionsExt , SecItems ,
3252} ;
33- #[ cfg( not( any( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ) ]
53+ #[ cfg( not( any(
54+ target_os = "ios" ,
55+ target_os = "watchos" ,
56+ target_os = "tvos" ,
57+ target_os = "visionos"
58+ ) ) ) ]
3459use self :: security_framework:: os:: macos:: keychain:: { self , KeychainSettings , SecKeychain } ;
3560
3661use { Protocol , TlsAcceptorBuilder , TlsConnectorBuilder } ;
3762
3863static SET_AT_EXIT : Once = Once :: new ( ) ;
3964
40- #[ cfg( not( any( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ) ]
65+ #[ cfg( not( any(
66+ target_os = "ios" ,
67+ target_os = "watchos" ,
68+ target_os = "tvos" ,
69+ target_os = "visionos"
70+ ) ) ) ]
4171static TEMP_KEYCHAIN : Mutex < Option < ( SecKeychain , TempDir ) > > = Mutex :: new ( None ) ;
4272
4373fn convert_protocol ( protocol : Protocol ) -> SslProtocol {
@@ -82,12 +112,22 @@ pub struct Identity {
82112}
83113
84114impl Identity {
85- #[ cfg( any( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ]
115+ #[ cfg( any(
116+ target_os = "ios" ,
117+ target_os = "watchos" ,
118+ target_os = "tvos" ,
119+ target_os = "visionos"
120+ ) ) ]
86121 pub fn from_pkcs8 ( _: & [ u8 ] , _: & [ u8 ] ) -> Result < Identity , Error > {
87122 panic ! ( "Not implemented on iOS" ) ;
88123 }
89124
90- #[ cfg( not( any( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ) ]
125+ #[ cfg( not( any(
126+ target_os = "ios" ,
127+ target_os = "watchos" ,
128+ target_os = "tvos" ,
129+ target_os = "visionos"
130+ ) ) ) ]
91131 pub fn from_pkcs8 ( pem : & [ u8 ] , key : & [ u8 ] ) -> Result < Identity , Error > {
92132 if !key. starts_with ( b"-----BEGIN PRIVATE KEY-----" ) {
93133 return Err ( Error ( base:: Error :: from ( errSecParam) ) ) ;
@@ -145,7 +185,12 @@ impl Identity {
145185 } )
146186 }
147187
148- #[ cfg( not( any( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ) ]
188+ #[ cfg( not( any(
189+ target_os = "ios" ,
190+ target_os = "watchos" ,
191+ target_os = "tvos" ,
192+ target_os = "visionos"
193+ ) ) ) ]
149194 fn import_options ( buf : & [ u8 ] , pass : & str ) -> Result < Vec < ImportedIdentity > , Error > {
150195 SET_AT_EXIT . call_once ( || {
151196 extern "C" fn atexit ( ) {
@@ -177,7 +222,12 @@ impl Identity {
177222 Ok ( imports)
178223 }
179224
180- #[ cfg( any( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ]
225+ #[ cfg( any(
226+ target_os = "ios" ,
227+ target_os = "watchos" ,
228+ target_os = "tvos" ,
229+ target_os = "visionos"
230+ ) ) ]
181231 fn import_options ( buf : & [ u8 ] , pass : & str ) -> Result < Vec < ImportedIdentity > , Error > {
182232 let imports = Pkcs12ImportOptions :: new ( ) . passphrase ( pass) . import ( buf) ?;
183233 Ok ( imports)
@@ -206,7 +256,12 @@ impl Certificate {
206256 Ok ( Certificate ( cert) )
207257 }
208258
209- #[ cfg( not( any( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ) ]
259+ #[ cfg( not( any(
260+ target_os = "ios" ,
261+ target_os = "watchos" ,
262+ target_os = "tvos" ,
263+ target_os = "visionos"
264+ ) ) ) ]
210265 pub fn from_pem ( buf : & [ u8 ] ) -> Result < Certificate , Error > {
211266 let mut items = SecItems :: default ( ) ;
212267 ImportOptions :: new ( ) . items ( & mut items) . import ( buf) ?;
@@ -217,9 +272,14 @@ impl Certificate {
217272 }
218273 }
219274
220- #[ cfg( any( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ]
275+ #[ cfg( any(
276+ target_os = "ios" ,
277+ target_os = "watchos" ,
278+ target_os = "tvos" ,
279+ target_os = "visionos"
280+ ) ) ]
221281 pub fn from_pem ( _: & [ u8 ] ) -> Result < Certificate , Error > {
222- panic ! ( "Not implemented on iOS, tvOS or watchOS " ) ;
282+ panic ! ( "Not implemented on iOS, tvOS, watchOS or visionOS " ) ;
223283 }
224284
225285 pub fn to_der ( & self ) -> Result < Vec < u8 > , Error > {
@@ -476,12 +536,22 @@ impl<S: io::Read + io::Write> TlsStream<S> {
476536 }
477537 }
478538
479- #[ cfg( any( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ]
539+ #[ cfg( any(
540+ target_os = "ios" ,
541+ target_os = "watchos" ,
542+ target_os = "tvos" ,
543+ target_os = "visionos"
544+ ) ) ]
480545 pub fn tls_server_end_point ( & self ) -> Result < Option < Vec < u8 > > , Error > {
481546 Ok ( None )
482547 }
483548
484- #[ cfg( not( any( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ) ]
549+ #[ cfg( not( any(
550+ target_os = "ios" ,
551+ target_os = "watchos" ,
552+ target_os = "tvos" ,
553+ target_os = "visionos"
554+ ) ) ) ]
485555 pub fn tls_server_end_point ( & self ) -> Result < Option < Vec < u8 > > , Error > {
486556 let cert = match self . cert {
487557 Some ( ref cert) => cert. clone ( ) ,
0 commit comments