Skip to content

Fix info field padding, mechanism flags and API docs - #231

Merged
Frauschi merged 56 commits into
wolfSSL:masterfrom
aidangarske:fenrir-fixes-2769-6053
Oct 15, 2026
Merged

Frauschi merged 56 commits into
wolfSSL:masterfrom
aidangarske:fenrir-fixes-2769-6053

Conversation

@aidangarske

@aidangarske aidangarske commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

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.

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

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

Unresolved clock, concurrency, wrap cleanup, configuration-gating, and test-skip issues can produce incorrect behavior or misleading results.

6 open findings
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 thread src/slot.c
Comment thread src/slot.c Outdated
Comment thread src/slot.c
Comment thread tests/login_pin_state_test.c Outdated
Comment on lines +156 to +157
#if defined(DEBUG_WOLFPKCS11) && !defined(WOLFPKCS11_NO_STORE) && \
!defined(NO_AES)
Comment thread tests/object_policy_integrity_test.c Outdated
Comment thread tests/object_store_decode_test.c Outdated

@Frauschi Frauschi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two comments, inline.

Comment thread src/crypto.c
Comment thread tests/info_mech_table_test.c Outdated
@aidangarske
aidangarske force-pushed the fenrir-fixes-2769-6053 branch from ab24e28 to dfe8102 Compare October 13, 2026 22:19
@aidangarske
aidangarske requested a review from Frauschi October 13, 2026 22:24
@aidangarske
aidangarske force-pushed the fenrir-fixes-2769-6053 branch 3 times, most recently from 28f5e65 to 6bbb8a8 Compare October 13, 2026 23:43

@Frauschi Frauschi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unwrap change looks good. One problem with the new wrap check, inline: it's why nss-test is red from here up to #237.

Comment thread src/crypto.c Outdated
Frauschi
Frauschi previously approved these changes Oct 15, 2026
@aidangarske
aidangarske dismissed Frauschi’s stale review October 15, 2026 20:36

The merge-base changed after approval.

@aidangarske
aidangarske force-pushed the fenrir-fixes-2769-6053 branch from 8483d8a to 61ac0c8 Compare October 15, 2026 21:00
@Frauschi
Frauschi merged commit 61ac0c8 into wolfSSL:master Oct 15, 2026
89 checks passed
@aidangarske
aidangarske deleted the fenrir-fixes-2769-6053 branch October 15, 2026 21:41
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.

4 participants