@@ -137,10 +137,7 @@ where
137
137
. with_no_client_auth ( )
138
138
}
139
139
} else {
140
- #[ cfg( any( feature = "_tls-rustls-aws-lc-rs" , feature = "_tls-rustls-ring-webpki" ) ) ]
141
- let mut cert_store = certs_from_webpki ( ) ;
142
- #[ cfg( feature = "_tls-rustls-ring-native-roots" ) ]
143
- let mut cert_store = certs_from_native_store ( ) ;
140
+ let mut cert_store = import_root_certs ( ) ;
144
141
145
142
if let Some ( ca) = tls_config. root_cert_path {
146
143
let data = ca. data ( ) . await ?;
@@ -211,13 +208,13 @@ fn private_key_from_pem(pem: Vec<u8>) -> Result<PrivateKeyDer<'static>, Error> {
211
208
}
212
209
}
213
210
214
- #[ cfg( any ( feature = "_tls-rustls-aws-lc-rs " , feature = "_tls- rustls-ring-webpki" ) ) ]
215
- fn certs_from_webpki ( ) -> RootCertStore {
211
+ #[ cfg( all ( feature = "webpki-roots " , not ( feature = "rustls-native-certs" ) ) ) ]
212
+ fn import_root_certs ( ) -> RootCertStore {
216
213
RootCertStore :: from_iter ( webpki_roots:: TLS_SERVER_ROOTS . iter ( ) . cloned ( ) )
217
214
}
218
215
219
- #[ cfg( feature = "_tls- rustls-ring- native-roots " ) ]
220
- fn certs_from_native_store ( ) -> RootCertStore {
216
+ #[ cfg( feature = "rustls-native-certs " ) ]
217
+ fn import_root_certs ( ) -> RootCertStore {
221
218
let mut root_cert_store = RootCertStore :: empty ( ) ;
222
219
223
220
let load_results = rustls_native_certs:: load_native_certs ( ) ;
@@ -233,6 +230,12 @@ fn certs_from_native_store() -> RootCertStore {
233
230
root_cert_store
234
231
}
235
232
233
+ // Not currently used but allows for a "tls-rustls-no-roots" feature.
234
+ #[ cfg( not( any( feature = "rustls-native-certs" , feature = "webpki-roots" ) ) ) ]
235
+ fn import_root_certs ( ) -> RootCertStore {
236
+ RootCertStore :: empty ( )
237
+ }
238
+
236
239
#[ derive( Debug ) ]
237
240
struct DummyTlsVerifier {
238
241
provider : Arc < CryptoProvider > ,
0 commit comments