Improve decryption error logging
This CL adds the decryption level to decryption failure logging. It helps debug tests by allowing us to see whether a decryption failure was expected.
gfe-relnote: log-only change, not flag protected
PiperOrigin-RevId: 304252053
Change-Id: Iab2970ab1ed6cbf4de7fd2fec0c34e0f3057707a
diff --git a/quic/core/quic_framer.cc b/quic/core/quic_framer.cc
index d41b6b1..f900191 100644
--- a/quic/core/quic_framer.cc
+++ b/quic/core/quic_framer.cc
@@ -1758,7 +1758,10 @@
visitor_->OnUndecryptablePacket(
QuicEncryptedPacket(encrypted_reader->FullPayload()),
decryption_level, has_decryption_key);
- set_detailed_error("Unable to decrypt header protection.");
+ set_detailed_error(quiche::QuicheStrCat(
+ "Unable to decrypt ", EncryptionLevelToString(decryption_level),
+ " header protection", has_decryption_key ? "" : " (missing key)",
+ "."));
return RaiseError(QUIC_DECRYPTION_FAILURE);
}
RecordDroppedPacketReason(DroppedPacketReason::INVALID_PACKET_NUMBER);
@@ -1823,7 +1826,13 @@
visitor_->OnUndecryptablePacket(
QuicEncryptedPacket(encrypted_reader->FullPayload()), decryption_level,
has_decryption_key);
- set_detailed_error("Unable to decrypt payload.");
+ set_detailed_error(quiche::QuicheStrCat(
+ "Unable to decrypt ", EncryptionLevelToString(decryption_level),
+ " payload",
+ has_decryption_key || !version_.KnowsWhichDecrypterToUse()
+ ? ""
+ : " (missing key)",
+ "."));
RecordDroppedPacketReason(DroppedPacketReason::DECRYPTION_FAILURE);
return RaiseError(QUIC_DECRYPTION_FAILURE);
}
@@ -1914,7 +1923,9 @@
QuicEncryptedPacket(encrypted_reader->FullPayload()), decryption_level,
has_decryption_key);
RecordDroppedPacketReason(DroppedPacketReason::DECRYPTION_FAILURE);
- set_detailed_error("Unable to decrypt payload.");
+ set_detailed_error(quiche::QuicheStrCat(
+ "Unable to decrypt ", EncryptionLevelToString(decryption_level),
+ " payload."));
return RaiseError(QUIC_DECRYPTION_FAILURE);
}