Skip to content

Bind stored object policy to the encrypted key data - #229

Open
aidangarske wants to merge 25 commits into
wolfSSL:masterfrom
aidangarske:fenrir-fixes-10400
Open

aidangarske wants to merge 25 commits into
wolfSSL:masterfrom
aidangarske:fenrir-fixes-10400

Conversation

@aidangarske

@aidangarske aidangarske commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

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.

@aidangarske aidangarske self-assigned this Oct 8, 2026
Copilot AI balanced review requested due to automatic review settings October 8, 2026 21:19

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.

🟡 Changes recommended

Object lifetime and persistence paths currently permit use-after-free, unbounded secret retention, and inconsistent policy/ciphertext records.

6 open findings
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.

Comment thread src/internal.c
Comment thread src/internal.c Outdated
Comment thread src/internal.c
Comment thread src/internal.c
Comment thread tests/object_policy_integrity_test.c Outdated
Comment thread tests/object_store_decode_test.c Outdated
LinuxJedi
LinuxJedi previously approved these changes Oct 9, 2026
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