Uh oh!
There was an error while loading. Please reload this page.
Add cooperative PBKDF2 compare operations - #1
Merged
Conversation
zekageri
marked this pull request as ready for review
July 10, 2026 19:52
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
Summary
Adds a stateful PBKDF2 comparison API so password verification can be split into bounded work slices instead of one monolithic mbedTLS call.
Root cause
The existing
compare()implementation holds Knot's global mutex whilembedtls_pkcs5_pbkdf2_hmac_ext()performs the complete PBKDF2 workload. At production costs this can monopolize the caller task, exceed responsiveness budgets, and prevent request cancellation or CPU budgeting.Changes
KnotCompareOperation,KnotStepResult, andKnotStepStatus.beginCompare()overloads.U, accumulatedT, derived-key block, salt, expected hash, password copy, and reusable HMAC context between calls.step()to the caller-provided iteration budget.$knot$v1$c<cost>$<salt>$<hash>format and synchronouscompare()API.Validation
beginCompare().-Wall -Wextra -pedantic.The PR CI also runs the existing host suite, cooperative tests, sanitizers, and the ESP32 example build matrix.