-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tls: improve TLS handshake/read/write error log #14600
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
910396d
ssl: improve TLS handshake/read/write error log
Shikugawa 622c900
fix spell
Shikugawa d83fc4d
allow logs without fips
Shikugawa 08dea59
add generic get error interface
Shikugawa eb3b529
fix test
Shikugawa b41e655
add test
Shikugawa 53f7810
review
Shikugawa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,6 +138,39 @@ TEST(UtilityTest, TestGetCertificationExtensionValue) { | |
EXPECT_EQ("", Utility::getCertificateExtensionValue(*cert, "foo")); | ||
} | ||
|
||
TEST(UtilityTest, SslErrorDescriptionTest) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't feel like this test adds much value. Was it needed just to keep coverage up? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. It is needed for test coverage. |
||
const std::vector<std::pair<int, std::string>> test_set = { | ||
{0, "NONE"}, | ||
{1, "SSL"}, | ||
{2, "WANT_READ"}, | ||
{3, "WANT_WRITE"}, | ||
{4, "WANT_X509_LOOKUP"}, | ||
{5, "SYSCALL"}, | ||
{6, "ZERO_RETURN"}, | ||
{7, "WANT_CONNECT"}, | ||
{8, "WANT_ACCEPT"}, | ||
{9, "WANT_CHANNEL_ID_LOOKUP"}, | ||
{11, "PENDING_SESSION"}, | ||
{12, "PENDING_CERTIFICATE"}, | ||
{13, "WANT_PRIVATE_KEY_OPERATION"}, | ||
{14, "PENDING_TICKET"}, | ||
{15, "EARLY_DATA_REJECTED"}, | ||
{16, "WANT_CERTIFICATE_VERIFY"}, | ||
{17, "HANDOFF"}, | ||
{18, "HANDBACK"}, | ||
}; | ||
|
||
for (const auto& test_data : test_set) { | ||
EXPECT_EQ(test_data.second, Utility::getErrorDescription(test_data.first)); | ||
} | ||
|
||
#if defined(NDEBUG) | ||
EXPECT_EQ(Utility::getErrorDescription(19), "UNKNOWN_ERROR"); | ||
#else | ||
EXPECT_DEATH(Utility::getErrorDescription(19), "Unknown BoringSSL error had occurred"); | ||
#endif | ||
} | ||
|
||
} // namespace | ||
} // namespace Tls | ||
} // namespace TransportSockets | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drive by: It seems like this is a function that could be provided by BoringSSL? cc @PiotrSikora @davidben @ggreenway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is.
SSL_error_description
:-)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, thanks. @Shikugawa can you please do a follow up PR to swap this out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidben @mattklein123 I found a problem that SSL_error_description can't be utilized when BORINGSSL_FIPS. I didn't survey about this issue but considered this approach would be no problem and more performant with string_view.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That function isn't gated on FIPS mode in BoringSSL. I'm guessing Envoy pins to a much much older version in some build configurations? I'm not sure what you all's policy on that is. @PiotrSikora?
SSL_error_description
was added way back in August of 2019.If callers want to support a range of versions, our usual recommendation is to add preprocessor checks on
BORINGSSL_API_VERSION
, so that you can still call into newer functions when they're available, and then to retire the old paths when no longer needed. In particular,SSL_error_description
will pick up new values when we add them. So that may be an option.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidben BoringSSL-FIPS builds are pinned to the latest FIPS-validated version for Linux x86-64, which per crypto/fipsmodule/FIPS.md is
fips-20190808
, tagged ~2 weeks beforeSSL_error_description
was added.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK @Shikugawa can you possibly add a TODO so thast when we bump the FIPS version we can remove this function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure