Allow zero-length PEM passwords in callback paths#3073
Merged
Conversation
Four sites incorrectly rejected empty passwords by checking pass_len <= 0 instead of pass_len < 0 after invoking the password callback. The callback returns negative on error and 0 for a valid empty password, so the check should be < 0.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3073 +/- ##
==========================================
+ Coverage 78.36% 78.39% +0.03%
==========================================
Files 689 689
Lines 121144 121166 +22
Branches 16973 16973
==========================================
+ Hits 94935 94993 +58
+ Misses 25314 25279 -35
+ Partials 895 894 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
justsmth
reviewed
Mar 6, 2026
| TEST(PEMTest, WriteReadPKCS8DerEmptyPassword) { | ||
| bssl::UniquePtr<EC_KEY> ec_key(EC_KEY_new_by_curve_name(NID_X9_62_prime256v1)); | ||
| ASSERT_TRUE(ec_key); | ||
| ASSERT_TRUE(EC_KEY_generate_key(ec_key.get())); |
Contributor
There was a problem hiding this comment.
NP: Should this be conditioned as it is in PEMTest.WriteReadECPemEmptyPassword?
#if defined(BORINGSSL_FIPS)
ASSERT_TRUE(EC_KEY_generate_key_fips(ec_key.get()));
#else
ASSERT_TRUE(EC_KEY_generate_key(ec_key.get()));
#endif
sgmenda
approved these changes
Mar 10, 2026
justsmth
approved these changes
Mar 11, 2026
WillChilds-Klein
pushed a commit
to WillChilds-Klein/aws-lc
that referenced
this pull request
Mar 11, 2026
### Description of changes: Four sites incorrectly rejected empty passwords by checking pass_len <= 0 instead of pass_len < 0 after invoking the password callback. The callback returns negative on error and 0 for a valid empty password, so the check should be < 0. ### Testing: How is this change tested (unit tests, fuzz tests, etc.)? Are there any testing steps to be verified by the reviewer? CI By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license. --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of changes:
Four sites incorrectly rejected empty passwords by checking
pass_len <= 0 instead of pass_len < 0 after invoking the password
callback. The callback returns negative on error and 0 for a valid
empty password, so the check should be < 0.
Testing:
How is this change tested (unit tests, fuzz tests, etc.)? Are there any testing steps to be verified by the reviewer?
CI
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.