Skip to content

Commit

Permalink
Drop log messages on error paths
Browse files Browse the repository at this point in the history
  • Loading branch information
djc committed Apr 13, 2023
1 parent 86719f8 commit 4c973b6
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 8 deletions.
3 changes: 0 additions & 3 deletions rustls/src/client/tls13.rs
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,6 @@ impl State<ClientConnectionData> for ExpectCertificate {

// This is only non-empty for client auth.
if !cert_chain.context.0.is_empty() {
warn!("certificate with non-empty context during handshake");
return Err(cx.common.send_fatal_alert(
AlertDescription::DecodeError,
InvalidMessage::InvalidCertRequest,
Expand All @@ -620,7 +619,6 @@ impl State<ClientConnectionData> for ExpectCertificate {
if cert_chain.any_entry_has_duplicate_extension()
|| cert_chain.any_entry_has_unknown_extension()
{
warn!("certificate chain contains unsolicited/unknown extension");
return Err(cx.common.send_fatal_alert(
AlertDescription::UnsupportedExtension,
PeerMisbehaved::BadCertChainExtensions,
Expand Down Expand Up @@ -1022,7 +1020,6 @@ impl ExpectTraffic {
#[cfg(feature = "quic")]
{
if let Protocol::Quic = common.protocol {
warn!("KeyUpdate received in QUIC connection");
return Err(common.send_fatal_alert(
AlertDescription::UnexpectedMessage,
PeerMisbehaved::KeyUpdateReceivedInQuicConnection,
Expand Down
4 changes: 1 addition & 3 deletions rustls/src/common_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::enums::{AlertDescription, ContentType, HandshakeType, ProtocolVersion
use crate::error::{Error, InvalidMessage, PeerMisbehaved};
use crate::key;
#[cfg(feature = "logging")]
use crate::log::{debug, error, warn};
use crate::log::{debug, warn};
use crate::msgs::alert::AlertMessagePayload;
use crate::msgs::base::Payload;
use crate::msgs::enums::{AlertLevel, KeyUpdateRequest};
Expand Down Expand Up @@ -463,7 +463,6 @@ impl CommonState {
}
}

error!("TLS alert received: {:#?}", alert);
Err(err)
}

Expand All @@ -483,7 +482,6 @@ impl CommonState {
desc: AlertDescription,
err: impl Into<Error>,
) -> Error {
warn!("Sending fatal alert {:?}", desc);
debug_assert!(!self.sent_fatal_alert);
let m = Message::build_alert(AlertLevel::Fatal, desc);
self.send_msg(m, self.record_layer.is_encrypting());
Expand Down
1 change: 0 additions & 1 deletion rustls/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ mod log {
macro_rules! trace ( ($($tt:tt)*) => {{}} );
macro_rules! debug ( ($($tt:tt)*) => {{}} );
macro_rules! warn ( ($($tt:tt)*) => {{}} );
macro_rules! error ( ($($tt:tt)*) => {{}} );
}

#[macro_use]
Expand Down
1 change: 0 additions & 1 deletion rustls/src/server/tls13.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1222,7 +1222,6 @@ impl ExpectTraffic {
#[cfg(feature = "quic")]
{
if let Protocol::Quic = common.protocol {
warn!("KeyUpdate received in QUIC connection");
return Err(common.send_fatal_alert(
AlertDescription::UnexpectedMessage,
PeerMisbehaved::KeyUpdateReceivedInQuicConnection,
Expand Down

0 comments on commit 4c973b6

Please sign in to comment.