Draft
Add SHA-384/SHA-512 support to Pkcs5HashPassword (PBKDF2)#266
Conversation
Copilot
AI
changed the title
[WIP] Add PBKDF2-SHA512 support for password hashing
Add SHA-384/SHA-512 support to Pkcs5HashPassword (PBKDF2)
Jul 9, 2026
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
Pkcs5HashPassword(PBKDF2) only mappedSHA1_DIGEST_SIZEandSHA256_DIGEST_SIZE, so platforms could not select SHA-384/SHA-512 for password hashing. This blocks CNSA 2.0–aligned configurations. This change extends the digest-size switch in both BaseCryptLib backends to cover SHA-384 and SHA-512; iteration count is already a caller-supplied parameter.CryptPkcs5Pbkdf2.c): mapSHA384_DIGEST_SIZE → EVP_sha384(),SHA512_DIGEST_SIZE → EVP_sha512().CryptPkcs5Pbkdf2.c): mapSHA384_DIGEST_SIZE → MBEDTLS_MD_SHA384,SHA512_DIGEST_SIZE → MBEDTLS_MD_SHA512(config already enablesMBEDTLS_SHA384_C/MBEDTLS_SHA512_C).*Null.cvariants to list the newly supported digest sizes.How This Was Tested
CodeQL security scan and code review pass with no findings. No host-based unit test infrastructure exists for
Pkcs5HashPasswordin this repo, so no automated tests were added. Existing callers using SHA-1/SHA-256 are unaffected (additive switch cases only).Integration Instructions
Callers wishing to use stronger hashes pass
SHA384_DIGEST_SIZEorSHA512_DIGEST_SIZEasDigestSizewith an appropriateIterationCount. Backwards compatibility (stored-hash migration) and any OS-facing capability reporting (e.g., ECIT) are platform responsibilities and out of scope here.