From f76ef2e89a25be0ab1e199eeb47450cbe4cda352 Mon Sep 17 00:00:00 2001 From: Yuwei Ba Date: Thu, 28 Dec 2023 01:07:56 +1100 Subject: [PATCH] don't verify at all (#232) --- clash_lib/src/common/tls.rs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/clash_lib/src/common/tls.rs b/clash_lib/src/common/tls.rs index 2637d6bba..6dbfedd50 100644 --- a/clash_lib/src/common/tls.rs +++ b/clash_lib/src/common/tls.rs @@ -1,7 +1,7 @@ use once_cell::sync::Lazy; use rustls::{ - client::{ServerCertVerified, ServerCertVerifier, WebPkiVerifier}, - OwnedTrustAnchor, RootCertStore, + client::{HandshakeSignatureValid, ServerCertVerified, ServerCertVerifier, WebPkiVerifier}, + DigitallySignedStruct, OwnedTrustAnchor, RootCertStore, }; use tracing::warn; @@ -38,6 +38,24 @@ impl ServerCertVerifier for DummyTlsVerifier { ) -> Result { Ok(ServerCertVerified::assertion()) } + + fn verify_tls12_signature( + &self, + _message: &[u8], + _cert: &Certificate, + _dss: &DigitallySignedStruct, + ) -> Result { + Ok(HandshakeSignatureValid::assertion()) + } + + fn verify_tls13_signature( + &self, + _message: &[u8], + _cert: &Certificate, + _dss: &DigitallySignedStruct, + ) -> Result { + Ok(HandshakeSignatureValid::assertion()) + } } pub struct NoHostnameTlsVerifier;