Skip to content

Commit 3bf8828

Browse files
committed
Remove crate-level test verifier constructor
As the `Verifier` struct is now part of the public API, this method was fairly redundant and may lead to confusion while reading the source to determine crate usage examples.
1 parent c407804 commit 3bf8828

File tree

3 files changed

+7
-12
lines changed
  • rustls-platform-verifier/src

3 files changed

+7
-12
lines changed

rustls-platform-verifier/src/lib.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,13 @@ pub use tests::ffi::*;
6060
pub fn tls_config() -> ClientConfig {
6161
rustls::ClientConfig::builder()
6262
.with_safe_defaults()
63-
.with_custom_certificate_verifier(verifier_for_testing())
63+
.with_custom_certificate_verifier(Arc::new(Verifier::new()))
6464
.with_no_client_auth()
6565
}
6666

67-
/// Exposed for test usage. Don't use this, use [tls_config] instead.
67+
/// Exposed for debugging certificate issues with standalone tools.
6868
///
69-
/// This verifier must be exactly equivalent to the verifier used in the `ClientConfig` returned by [tls_config].
70-
pub(crate) fn verifier_for_testing() -> Arc<dyn rustls::client::ServerCertVerifier> {
71-
Arc::new(Verifier::new())
72-
}
73-
74-
/// Exposed for debugging customer certificate issues. Don't use this, use [tls_config] instead.
69+
/// This is not intended for production use, you should use [tls_config] instead.
7570
#[cfg(feature = "dbg")]
7671
pub fn verifier_for_dbg(root: &[u8]) -> Arc<dyn rustls::client::ServerCertVerifier> {
7772
Arc::new(Verifier::new_with_fake_root(root))

rustls-platform-verifier/src/tests/verification_mock/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ const LOCALHOST_IPV6: &str = "::1";
8282
#[cfg(any(test, feature = "ffi-testing"))]
8383
#[cfg_attr(feature = "ffi-testing", allow(dead_code))]
8484
pub(super) fn verification_without_mock_root() {
85-
let verifier = crate::verifier_for_testing();
85+
let verifier = Verifier::new();
8686

8787
let server_name = rustls::client::ServerName::try_from(EXAMPLE_COM).unwrap();
8888
let end_entity = rustls::Certificate(ROOT1_INT1_EXAMPLE_COM_GOOD.to_vec());

rustls-platform-verifier/src/tests/verification_real_world/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
//! Thus we don't expect these tests to be flaky w.r.t. that, except for
4343
//! potentially poor performance.
4444
use super::TestCase;
45-
use crate::tests::assert_cert_error_eq;
46-
use rustls::{CertificateError, Error as TlsError};
45+
use crate::{tests::assert_cert_error_eq, Verifier};
46+
use rustls::{client::ServerCertVerifier, CertificateError, Error as TlsError};
4747
use std::convert::TryFrom;
4848

4949
// This is the certificate chain presented by one server for
@@ -124,7 +124,7 @@ macro_rules! no_error {
124124
fn real_world_test<E: std::error::Error>(test_case: &TestCase<E>) {
125125
log::info!("verifying {:?}", test_case.expected_result);
126126

127-
let verifier = crate::verifier_for_testing();
127+
let verifier = Verifier::new();
128128

129129
let mut chain = test_case
130130
.chain

0 commit comments

Comments
 (0)