Skip to content

Move HKDF and PBKDF2 fallback logic to cryptobackend - #2512

Merged
George Adams (gdams) merged 2 commits into
microsoft/mainfrom
dev/qmuntal/kdf-fallback
Sep 22, 2026
Merged

George Adams (gdams) merged 2 commits into
microsoft/mainfrom
dev/qmuntal/kdf-fallback

Conversation

@qmuntal

@qmuntal Quim Muntal (qmuntal) commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

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.

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.
Copilot AI lite review requested due to automatic review settings September 22, 2026 12:32
@qmuntal
Quim Muntal (qmuntal) requested a review from a team as a code owner September 22, 2026 12:32
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 High severity

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.

Comment thread cryptobackend/hkdf/hkdf_test.go Outdated
Comment thread cryptobackend/pbkdf2/pbkdf2_test.go Outdated
Rely on the existing standard-library HKDF and PBKDF2 tests.
@gdams
George Adams (gdams) merged commit 5cc5ccc into microsoft/main Sep 22, 2026
58 checks passed
@gdams
George Adams (gdams) deleted the dev/qmuntal/kdf-fallback branch September 22, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants