@@ -137,10 +137,7 @@ where
137137 . with_no_client_auth ( )
138138 }
139139 } 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 ( ) ;
144141
145142 if let Some ( ca) = tls_config. root_cert_path {
146143 let data = ca. data ( ) . await ?;
@@ -211,13 +208,13 @@ fn private_key_from_pem(pem: Vec<u8>) -> Result<PrivateKeyDer<'static>, Error> {
211208 }
212209}
213210
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 {
216213 RootCertStore :: from_iter ( webpki_roots:: TLS_SERVER_ROOTS . iter ( ) . cloned ( ) )
217214}
218215
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 {
221218 let mut root_cert_store = RootCertStore :: empty ( ) ;
222219
223220 let load_results = rustls_native_certs:: load_native_certs ( ) ;
@@ -233,6 +230,12 @@ fn certs_from_native_store() -> RootCertStore {
233230 root_cert_store
234231}
235232
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+
236239#[ derive( Debug ) ]
237240struct DummyTlsVerifier {
238241 provider : Arc < CryptoProvider > ,
0 commit comments