-
Notifications
You must be signed in to change notification settings - Fork 56
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
Remove the gensalt function for the bcrypt x variant ($2x$). #60
Conversation
The “default” hash, used by crypt_gensalt when its prefix argument is NULL, was formerly hardcoded in hashes.lst, which meant that if you disabled that specific hash, crypt_gensalt would go back to failing when its prefix argument is NULL. Now, the default will be the strongest of the hashes that’s enabled, unless all of the STRONG hashes are disabled, in which case crypt_gensalt still fails when its prefix argument is NULL. We assume you know what you’re doing if you configure the library with nothing but weak hashes, but you must also acknowledge at runtime that you want to use them for new passphrases.
Codecov Report
@@ Coverage Diff @@
## develop #60 +/- ##
========================================
Coverage 91.96% 91.96%
========================================
Files 32 32
Lines 2988 2988
========================================
Hits 2748 2748
Misses 240 240
Continue to review full report at Codecov.
|
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.
The (subtype != 'a' && subtype != 'b' && subtype != 'x' && subtype != 'y')
check in BF_gensalt
should have the subtype != 'x'
portion dropped. That would revert this code back to what it is in crypt_blowfish.
c5fdd66
to
c847b54
Compare
@solardiz Fixed in rebased commit. I've also added a comment in |
@zackw Are you fine with this change? |
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.
Apart from the apparently-unrelated changes to the main loop in test-gensalt-extradata
, this looks good to me. This is undoubtedly my fault, back when I started hacking up libxcrypt for glibc binary compatibility I did not understand the differences among the bcrypt variants properly and I must have thought lack of gensalt support for $2x$
was an oversight.
@zackw Do you agree with my explaination? |
c847b54
to
1ffdc1a
Compare
@zackw Waiting for Travis to finish. I will merge then and push |
This prefix was never intended for use when hashing new passphrases. The only use case originally intended was to manually edit '$2a$' to '$2x$' in passphrase hashes to knowingly take the risk yet enable users to continue to log in when upgrading systems with buggy bcrypt implementations to fixed versions. There was never an intent to be able to generate new setting strings with that prefix. The original implementation of the bcrypt gensalt function doesn't allow the use of the prefix '$2x'. Thus libxcrypt must not, either.
1ffdc1a
to
06e8d9f
Compare
This prefix was never intended for use when hashing new passphrases.
The only use case originally intended was to manually edit '$2a$' to '$2x$' in passphrase hashes to knowingly take the risk yet enable users to continue to log in when upgrading systems with buggy bcrypt implementations to fixed versions.
There was never an intent to be able to generate new setting strings with that prefix. The original implementation of the bcrypt gensalt function doesn't allow the use of the prefix '$2x'.
Thus libxcrypt must not, either.