Repository navigation
Fix info field padding, mechanism flags and API docs - #231
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved clock, concurrency, wrap cleanup, configuration-gating, and test-skip issues can produce incorrect behavior or misleading results.
6 open findings
Snapshot token fields under the slot lock · New Handle unavailable clock before calling gmtime · New Abort and scrub CBC operation after length query · New Restrict path-mutating tests to the file store · New Return 77 when the configuration is unsupported · New Return 77 when the configuration is unsupported · New
What changed in this PR
Updates PKCS#11 metadata, mechanism reporting, operation lifecycle handling, storage integrity, and related API documentation.
Changes:
- Corrects info-field padding, clock reporting, mechanism flags, and key-size metadata.
- Hardens operation cleanup, PIN/session state, and stored-object validation.
- Adds extensive regression tests and build integration.
| File | Description |
|---|---|
| wolfpkcs11/pkcs11.h | Adds operation-cancel failure code. |
| wolfpkcs11/internal.h | Adds limits and internal helpers. |
| src/internal.c | Implements cleanup, padding, PIN, and storage hardening. |
| src/wolfpkcs11.c | Updates initialization docs and info padding. |
| src/slot.c | Corrects token info, mechanisms, PIN handling, and session errors. |
| src/crypto.c | Improves cancellation and operation cleanup. |
| tests/pkcs11test.c | Updates clock and v3 cancellation expectations. |
| tests/pkcs11mtt.c | Updates multithreaded cancellation expectations. |
| tests/login_pin_state_test.c | Adds login, PIN, and concurrency tests. |
| tests/object_store_decode_test.c | Adds malformed-store tests. |
| tests/object_policy_integrity_test.c | Adds stored-policy integrity tests. |
| tests/session_op_lifecycle_test.c | Adds operation lifecycle tests. |
| tests/info_mech_table_test.c | Adds metadata and mechanism tests. |
| 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 on lines
+156
to
+157
| #if defined(DEBUG_WOLFPKCS11) && !defined(WOLFPKCS11_NO_STORE) && \ | ||
| !defined(NO_AES) |
aidangarske
force-pushed
the
fenrir-fixes-2769-6053
branch
2 times, most recently
from
October 10, 2026 03:20
0bf8411 to
ab24e28
Compare
Frauschi
reviewed
Oct 13, 2026
aidangarske
force-pushed
the
fenrir-fixes-2769-6053
branch
from
October 13, 2026 22:19
ab24e28 to
dfe8102
Compare
aidangarske
force-pushed
the
fenrir-fixes-2769-6053
branch
3 times, most recently
from
October 13, 2026 23:43
28f5e65 to
6bbb8a8
Compare
This was referenced Oct 14, 2026
aidangarske
force-pushed
the
fenrir-fixes-2769-6053
branch
from
October 15, 2026 16:11
99c993c to
8483d8a
Compare
Frauschi
previously approved these changes
Oct 15, 2026
aidangarske
dismissed
Frauschi’s stale review
October 15, 2026 20:36
The merge-base changed after approval.
aidangarske
force-pushed
the
fenrir-fixes-2769-6053
branch
from
October 15, 2026 21:00
8483d8a to
61ac0c8
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-2769- 3c54759 - Fixed-length info fields in C_GetInfo, C_GetSlotInfo and C_GetTokenInfo are now blank padded with a new WP11_BlankPad helper, and the serial number filler is '0' instead of NUL.F-6230- 29e6c4f - C_GetTokenInfo now reports the token clock only when a valid UTC time is available, and otherwise clears CKF_CLOCK_ON_TOKEN and blanks the time field.F-6053- e68df1b - Wrap and unwrap are now advertised for RSA_PKCS, AES_ECB and AES CBC pad, and no longer for RSA_X_509, matching what C_WrapKey supports.F-12477- c44d5ac - Generic secret key generation sizes are now reported in bits, from 8 up to the maximum symmetric key size times 8.F-13248- 5ace913 - PBKDF2 and PKCS#12 PBE key generation mechanisms are now listed only when HMAC is available.F-8634- c62af7f - C_OpenSession now maps MEMORY_E to CKR_HOST_MEMORY and any other error to CKR_FUNCTION_FAILED instead of returning CKR_OK.F-10370- 6d69944 - The C_Initialize documentation now describes pInitArgs as an optional input that is validated and lists CKR_ARGUMENTS_BAD.F-10371- 7640f42 - Removes the incorrect CKR_BUFFER_TOO_SMALL entry for a NULL pulCount from the C_GetMechanismList documentation.F-10372- 60341a9 - The C_InitToken documentation now lists CKR_PIN_LEN_RANGE for a bad PIN length and CKR_PIN_INCORRECT for a mismatch.F-10373- fda9251 - The C_InitPIN documentation now lists CKR_PIN_LEN_RANGE for a bad PIN length.F-10374- 896ffc1 - The C_SetPIN documentation now lists CKR_PIN_INCORRECT for a bad old PIN and CKR_PIN_LEN_RANGE for a bad new PIN length.F-9413- 0bf8411 - The WP11_Slot_UserLogin documentation now lists LOGGED_IN_E and LOGGED_IN_ANOTHER_E and drops READ_ONLY_E.