Repository navigation
Tighten ECDH derive input checks and derived key state - #233
Open
aidangarske wants to merge 102 commits into
Open
aidangarske wants to merge 102 commits into
aidangarske wants to merge 102 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Several feature-gated tests incorrectly report PASS instead of SKIP, and the description omits substantial behavioral changes.
4 open findings
What changed in this PR
Hardens ECDH derivation and also introduces broader PKCS#11 state, persistence, login, and operation-lifecycle fixes.
Changes:
- Validates ECDH inputs, derived-key state, locking, and login requirements.
- Improves token storage, PIN state, operation cancellation, and mechanism metadata.
- Adds extensive regression tests and CI configurations.
| File | Description |
|---|---|
.github/workflows/unit-test.yml |
Adds TPM-debug and no-environment CI jobs. |
src/crypto.c |
Hardens derive and operation lifecycle behavior. |
src/internal.c |
Updates storage, locking, login, and session internals. |
src/slot.c |
Corrects token metadata, PIN handling, and mechanisms. |
src/wolfpkcs11.c |
Reports finalization failures and pads metadata. |
tests/ec_derive_test.c |
Adds ECDH regression coverage. |
tests/include.am |
Registers new test programs. |
tests/info_mech_table_test.c |
Tests metadata and mechanism consistency. |
tests/login_pin_state_test.c |
Tests login, PIN, and concurrency state. |
tests/object_policy_integrity_test.c |
Tests persisted object-policy integrity. |
tests/object_store_decode_test.c |
Tests malformed stored-object handling. |
tests/pkcs11mtt.c |
Updates v3 operation-cancellation expectations. |
tests/pkcs11test.c |
Updates clock and cancellation expectations. |
tests/session_op_lifecycle_test.c |
Tests operation cleanup and cancellation. |
tests/token_store_test.c |
Tests transactional token persistence. |
wolfpkcs11/internal.h |
Declares new limits and internal helpers. |
wolfpkcs11/pkcs11.h |
Adds the operation-cancellation error constant. |
🧠 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-10396-1610
branch
3 times, most recently
from
October 10, 2026 03:20
97ed5c1 to
aafebc1
Compare
Frauschi
reviewed
Oct 13, 2026
Frauschi
left a comment
Member
There was a problem hiding this comment.
Looks good, one test request inline.
aidangarske
force-pushed
the
fenrir-fixes-10396-1610
branch
from
October 13, 2026 22:19
aafebc1 to
a653795
Compare
aidangarske
force-pushed
the
fenrir-fixes-10396-1610
branch
from
October 13, 2026 22:45
a653795 to
921c4f5
Compare
aidangarske
force-pushed
the
fenrir-fixes-10396-1610
branch
from
October 13, 2026 23:44
916da34 to
5beb906
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-10396- d904877 - C_DeriveKey ECDH now returns CKR_MECHANISM_PARAM_INVALID when shared data is supplied with CKD_NULL.F-4272- e879a0b - ECDH derive now rejects public data longer than 2 * MAX_ECC_BYTES + 4 and passes the length as word32.F-1610- 64809c7 - The raw point fallback in WP11_EC_Derive now resets its index and skips the DER length re-parse, so an unsupported DER length form is treated as a raw point.F-5159- 451c81e - ECDH derive now requires the encoded point length to fit in what remains of the supplied public data, returning BUFFER_E otherwise.F-10383- 800b60c - WP11_EC_Derive now clears the key's RNG association before freeing its stack RNG, and token keys take the key write lock for the whole derive.F-6959- a1f3613 - C_DeriveKey now calls CheckPrivateLogin after the CKA_DERIVE check, as C_GenerateKey does, so deriving a private key object requires a user login.F-13818- 0ff14c3 - C_DeriveKey now sets the initial states before AddObject and frees the object if AddObject fails.F-13816- 955c000 - New SetDerivedStates sets ALWAYS_SENSITIVE and NEVER_EXTRACTABLE on a derived key from the base key's history and its own SENSITIVE and EXTRACTABLE values.F-3403- 97ed5c1 - A SymmKeyLen failure in C_DeriveKey now returns CKR_FUNCTION_FAILED instead of a raw wolfCrypt error code.