Repository navigation
Bind stored object policy to the encrypted key data - #229
Open
aidangarske wants to merge 25 commits into
Open
aidangarske wants to merge 25 commits into
aidangarske wants to merge 25 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Object lifetime and persistence paths currently permit use-after-free, unbounded secret retention, and inconsistent policy/ciphertext records.
6 open findings
Policy metadata and ciphertext updates are not atomic · New Object pointer can be freed before caller use · New Retired private objects leak unbounded secret memory · New Logout does not persist legacy record upgrades · New Unavailable feature is incorrectly reported as a passing test · New Unavailable feature is incorrectly reported as a passing test · New
What changed in this PR
Binds encrypted token keys to their stored policy and strengthens storage decoding, login, logout, and PIN-state handling.
Changes:
- Adds policy AAD to stored-key encryption with legacy-format migration.
- Hardens decoding, object cleanup, locking, and PIN lockout behavior.
- Adds storage integrity and concurrency regression tests.
| File | Description |
|---|---|
wolfpkcs11/internal.h |
Declares new lockout and debug helpers. |
src/internal.c |
Implements policy binding, decoding safeguards, and lifecycle changes. |
src/crypto.c |
Maps rejected policy updates to PKCS#11 errors. |
src/slot.c |
Applies lockout accounting to PIN changes. |
tests/login_pin_state_test.c |
Tests login, logout, PIN, and concurrency invariants. |
tests/object_store_decode_test.c |
Tests malformed stored-record handling. |
tests/object_policy_integrity_test.c |
Tests authenticated policy and legacy migration. |
tests/include.am |
Registers the new test programs. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
18 tasks
aidangarske
force-pushed
the
fenrir-fixes-10400
branch
from
October 9, 2026 02:00
faff5aa to
957fa22
Compare
LinuxJedi
previously approved these changes
Oct 9, 2026
aidangarske
force-pushed
the
fenrir-fixes-10400
branch
from
October 10, 2026 03:20
957fa22 to
9bd0d5c
Compare
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.



F-10400- 957fa22 - Key encryption and decryption now take additional authenticated data built from the object policy (version, class, key type, keygen mechanism, local flag and operation flags). Records stored in the older format still load and are re-encrypted with the policy data on the next store or logout.