@@ -20,24 +20,54 @@ use std::str;
20
20
use std:: sync:: Mutex ;
21
21
use std:: sync:: Once ;
22
22
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
+ ) ) ) ]
24
29
use 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
+ ) ) ) ]
26
36
use 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
+ ) ) ) ]
28
43
use 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
+ ) ) ) ]
30
50
use self :: security_framework:: os:: macos:: import_export:: {
31
51
ImportOptions , Pkcs12ImportOptionsExt , SecItems ,
32
52
} ;
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
+ ) ) ) ]
34
59
use self :: security_framework:: os:: macos:: keychain:: { self , KeychainSettings , SecKeychain } ;
35
60
36
61
use { Protocol , TlsAcceptorBuilder , TlsConnectorBuilder } ;
37
62
38
63
static SET_AT_EXIT : Once = Once :: new ( ) ;
39
64
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
+ ) ) ) ]
41
71
static TEMP_KEYCHAIN : Mutex < Option < ( SecKeychain , TempDir ) > > = Mutex :: new ( None ) ;
42
72
43
73
fn convert_protocol ( protocol : Protocol ) -> SslProtocol {
@@ -82,12 +112,22 @@ pub struct Identity {
82
112
}
83
113
84
114
impl 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
+ ) ) ]
86
121
pub fn from_pkcs8 ( _: & [ u8 ] , _: & [ u8 ] ) -> Result < Identity , Error > {
87
122
panic ! ( "Not implemented on iOS" ) ;
88
123
}
89
124
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
+ ) ) ) ]
91
131
pub fn from_pkcs8 ( pem : & [ u8 ] , key : & [ u8 ] ) -> Result < Identity , Error > {
92
132
if !key. starts_with ( b"-----BEGIN PRIVATE KEY-----" ) {
93
133
return Err ( Error ( base:: Error :: from ( errSecParam) ) ) ;
@@ -145,7 +185,12 @@ impl Identity {
145
185
} )
146
186
}
147
187
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
+ ) ) ) ]
149
194
fn import_options ( buf : & [ u8 ] , pass : & str ) -> Result < Vec < ImportedIdentity > , Error > {
150
195
SET_AT_EXIT . call_once ( || {
151
196
extern "C" fn atexit ( ) {
@@ -177,7 +222,12 @@ impl Identity {
177
222
Ok ( imports)
178
223
}
179
224
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
+ ) ) ]
181
231
fn import_options ( buf : & [ u8 ] , pass : & str ) -> Result < Vec < ImportedIdentity > , Error > {
182
232
let imports = Pkcs12ImportOptions :: new ( ) . passphrase ( pass) . import ( buf) ?;
183
233
Ok ( imports)
@@ -206,7 +256,12 @@ impl Certificate {
206
256
Ok ( Certificate ( cert) )
207
257
}
208
258
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
+ ) ) ) ]
210
265
pub fn from_pem ( buf : & [ u8 ] ) -> Result < Certificate , Error > {
211
266
let mut items = SecItems :: default ( ) ;
212
267
ImportOptions :: new ( ) . items ( & mut items) . import ( buf) ?;
@@ -217,9 +272,14 @@ impl Certificate {
217
272
}
218
273
}
219
274
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
+ ) ) ]
221
281
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 " ) ;
223
283
}
224
284
225
285
pub fn to_der ( & self ) -> Result < Vec < u8 > , Error > {
@@ -476,12 +536,22 @@ impl<S: io::Read + io::Write> TlsStream<S> {
476
536
}
477
537
}
478
538
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
+ ) ) ]
480
545
pub fn tls_server_end_point ( & self ) -> Result < Option < Vec < u8 > > , Error > {
481
546
Ok ( None )
482
547
}
483
548
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
+ ) ) ) ]
485
555
pub fn tls_server_end_point ( & self ) -> Result < Option < Vec < u8 > > , Error > {
486
556
let cert = match self . cert {
487
557
Some ( ref cert) => cert. clone ( ) ,
0 commit comments