-
Notifications
You must be signed in to change notification settings - Fork 455
CDRIVER-5634: SCRAM-SHA-256 FIPS Compliance #1684
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
Conversation
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.
Looks good overall. Suggested changing returns from int
to bool
and a possible fix to check for BCryptDeriveKeyPBKDF2
.
Nice spot of the duplicate call to BCryptCloseAlgorithmProvider (&_sha256_hmac_algo, 0);
.
e99d593
to
fe0d0f1
Compare
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.
LGTM with another check.
Summary
(Mostly) ensures the driver implementation of SCRAM-SHA-256 (as well as SCRAM-SHA-1) delegates implementation of key derivation is delegated to a cryptographic provider that already is or can be configured to be FIPS-compliant.
What changed?
Previously the driver implemented the PBKDF2 (Password-based-Key-Derivative-Function) itself in
_mongoc_salt_password()
.PKCS5_PBKDF2_HMAC()
withEVP_sha256()
(orEVP_sha1()
) from the OpenSSL EVP library.CCKeyDerivationPBKDF()
withkCCPRFHmacAlgSHA256
(orkCCPRFHmacAlgSHA1
) from the CommonCrypto KeyDerivation library.BCryptDeriveKeyPBKDF2()
with a handle to HMAC-SHA-256 from the Bcrypt library. If the symbol is not supported, the driver reverts to the original key derivation function.MinGW-w64
BCryptDeriveKeyPBKDF2 was added in MinGW-w64 6.0.0, but some hosts for Evergreen tests use older versions. I filed CDRIVER-5649 to “Require MinGW 6.0.0 or higher”, but until then only users with more modern MinGW versions get FIPS compliance on Windows.