Move HKDF and PBKDF2 fallback logic to cryptobackend - #2512
Merged
Merged
Conversation
Move HKDF and PBKDF2 backend selection and pure-Go fallback into cryptobackend, following the hash and HMAC packages. Keep FIPS-only checks in the public crypto packages and add custom-hash fallback tests. Updates #2489.
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The standalone cryptobackend CI tests can panic because fallback implementations are unavailable without the msgostd tag.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 2
Open (2)
What changed in this PR
Moves HKDF and PBKDF2 backend dispatch and fallback implementations into cryptobackend, preserving validation and FIPS behavior.
Changes:
- Adds HKDF and PBKDF2 backend dispatch and fallback paths.
- Adds platform-specific implementations and tests.
- Regenerates vendor and crypto-backend patches.
| File | Description |
|---|---|
patches/0002-Add-crypto-backends.patch |
Updated crypto integration patch. |
patches/0001-Vendor-external-dependencies.patch |
Regenerated vendor patch. |
cryptobackend/pbkdf2/pbkdf2.go |
PBKDF2 implementation. |
cryptobackend/pbkdf2/pbkdf2_windows.go |
Windows implementation. |
cryptobackend/pbkdf2/pbkdf2_test.go |
PBKDF2 tests. |
cryptobackend/pbkdf2/pbkdf2_openssl.go |
OpenSSL implementation. |
cryptobackend/pbkdf2/pbkdf2_nomsgostd.go |
Non-msgostd fallback shim. |
cryptobackend/pbkdf2/pbkdf2_msgostd.go |
msgostd fallback implementation. |
cryptobackend/pbkdf2/pbkdf2_darwin.go |
Darwin implementation. |
cryptobackend/pbkdf2/nobackend.go |
No-backend behavior. |
cryptobackend/pbkdf2/init.go |
PBKDF2 initialization. |
cryptobackend/hkdf/nobackend.go |
No-backend behavior. |
cryptobackend/hkdf/init.go |
HKDF initialization. |
cryptobackend/hkdf/hkdf.go |
HKDF implementation. |
cryptobackend/hkdf/hkdf_windows.go |
Windows implementation. |
cryptobackend/hkdf/hkdf_test.go |
HKDF tests. |
cryptobackend/hkdf/hkdf_openssl.go |
OpenSSL implementation. |
cryptobackend/hkdf/hkdf_nomsgostd.go |
Non-msgostd fallback shim. |
cryptobackend/hkdf/hkdf_msgostd.go |
msgostd fallback implementation. |
cryptobackend/hkdf/hkdf_darwin.go |
Darwin implementation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Rely on the existing standard-library HKDF and PBKDF2 tests.
Quim Muntal (qmuntal)
enabled auto-merge
September 22, 2026 12:59
George Adams (gdams)
approved these changes
Sep 22, 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.

Move HKDF and PBKDF2 backend selection and pure-Go fallback into cryptobackend, following the HMAC and SHA packages. Keep FIPS-only checks and HKDF length validation in the public packages, and preserve native backend errors.
Regenerate the vendor and crypto-backend patches. Rely on the existing standard-library tests without adding tests in cryptobackend.
Updates #2489.
Validation: existing HMAC, HKDF, and PBKDF2 tests; KDF tests with the system backend enabled and disabled and with FIPS enabled; FIPS-only enforcement; dependency checks.