@@ -20,24 +20,24 @@ use std::str;
20
20
use std:: sync:: Mutex ;
21
21
use std:: sync:: Once ;
22
22
23
- #[ cfg( not( target_os = "ios" ) ) ]
23
+ #[ cfg( not( any ( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ) ]
24
24
use self :: security_framework:: os:: macos:: certificate:: { PropertyType , SecCertificateExt } ;
25
- #[ cfg( not( target_os = "ios" ) ) ]
25
+ #[ cfg( not( any ( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ) ]
26
26
use self :: security_framework:: os:: macos:: certificate_oids:: CertificateOid ;
27
- #[ cfg( not( target_os = "ios" ) ) ]
27
+ #[ cfg( not( any ( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ) ]
28
28
use self :: security_framework:: os:: macos:: identity:: SecIdentityExt ;
29
- #[ cfg( not( target_os = "ios" ) ) ]
29
+ #[ cfg( not( any ( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ) ]
30
30
use self :: security_framework:: os:: macos:: import_export:: {
31
31
ImportOptions , Pkcs12ImportOptionsExt , SecItems ,
32
32
} ;
33
- #[ cfg( not( target_os = "ios" ) ) ]
33
+ #[ cfg( not( any ( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ) ]
34
34
use self :: security_framework:: os:: macos:: keychain:: { self , KeychainSettings , SecKeychain } ;
35
35
36
36
use { Protocol , TlsAcceptorBuilder , TlsConnectorBuilder } ;
37
37
38
38
static SET_AT_EXIT : Once = Once :: new ( ) ;
39
39
40
- #[ cfg( not( target_os = "ios" ) ) ]
40
+ #[ cfg( not( any ( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ) ]
41
41
static TEMP_KEYCHAIN : Mutex < Option < ( SecKeychain , TempDir ) > > = Mutex :: new ( None ) ;
42
42
43
43
fn convert_protocol ( protocol : Protocol ) -> SslProtocol {
@@ -82,12 +82,12 @@ pub struct Identity {
82
82
}
83
83
84
84
impl Identity {
85
- #[ cfg( target_os = "ios" ) ]
85
+ #[ cfg( any ( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ]
86
86
pub fn from_pkcs8 ( _: & [ u8 ] , _: & [ u8 ] ) -> Result < Identity , Error > {
87
87
panic ! ( "Not implemented on iOS" ) ;
88
88
}
89
89
90
- #[ cfg( not( target_os = "ios" ) ) ]
90
+ #[ cfg( not( any ( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ) ]
91
91
pub fn from_pkcs8 ( pem : & [ u8 ] , key : & [ u8 ] ) -> Result < Identity , Error > {
92
92
if !key. starts_with ( b"-----BEGIN PRIVATE KEY-----" ) {
93
93
return Err ( Error ( base:: Error :: from ( errSecParam) ) ) ;
@@ -145,7 +145,7 @@ impl Identity {
145
145
} )
146
146
}
147
147
148
- #[ cfg( not( target_os = "ios" ) ) ]
148
+ #[ cfg( not( any ( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ) ]
149
149
fn import_options ( buf : & [ u8 ] , pass : & str ) -> Result < Vec < ImportedIdentity > , Error > {
150
150
SET_AT_EXIT . call_once ( || {
151
151
extern "C" fn atexit ( ) {
@@ -177,7 +177,7 @@ impl Identity {
177
177
Ok ( imports)
178
178
}
179
179
180
- #[ cfg( target_os = "ios" ) ]
180
+ #[ cfg( any ( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ]
181
181
fn import_options ( buf : & [ u8 ] , pass : & str ) -> Result < Vec < ImportedIdentity > , Error > {
182
182
let imports = Pkcs12ImportOptions :: new ( ) . passphrase ( pass) . import ( buf) ?;
183
183
Ok ( imports)
@@ -206,7 +206,7 @@ impl Certificate {
206
206
Ok ( Certificate ( cert) )
207
207
}
208
208
209
- #[ cfg( not( target_os = "ios" ) ) ]
209
+ #[ cfg( not( any ( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ) ]
210
210
pub fn from_pem ( buf : & [ u8 ] ) -> Result < Certificate , Error > {
211
211
let mut items = SecItems :: default ( ) ;
212
212
ImportOptions :: new ( ) . items ( & mut items) . import ( buf) ?;
@@ -217,9 +217,9 @@ impl Certificate {
217
217
}
218
218
}
219
219
220
- #[ cfg( target_os = "ios" ) ]
220
+ #[ cfg( any ( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ]
221
221
pub fn from_pem ( _: & [ u8 ] ) -> Result < Certificate , Error > {
222
- panic ! ( "Not implemented on iOS" ) ;
222
+ panic ! ( "Not implemented on iOS, tvOS or watchOS " ) ;
223
223
}
224
224
225
225
pub fn to_der ( & self ) -> Result < Vec < u8 > , Error > {
@@ -476,12 +476,12 @@ impl<S: io::Read + io::Write> TlsStream<S> {
476
476
}
477
477
}
478
478
479
- #[ cfg( target_os = "ios" ) ]
479
+ #[ cfg( any ( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ]
480
480
pub fn tls_server_end_point ( & self ) -> Result < Option < Vec < u8 > > , Error > {
481
481
Ok ( None )
482
482
}
483
483
484
- #[ cfg( not( target_os = "ios" ) ) ]
484
+ #[ cfg( not( any ( target_os = "ios" , target_os = "watchos" , target_os = "tvos" ) ) ) ]
485
485
pub fn tls_server_end_point ( & self ) -> Result < Option < Vec < u8 > > , Error > {
486
486
let cert = match self . cert {
487
487
Some ( ref cert) => cert. clone ( ) ,
0 commit comments