Skip to content

Tighten unwrap, key pair generation and encapsulation checks - #243

Open
aidangarske wants to merge 230 commits into
wolfSSL:masterfrom
aidangarske:fenrir-fixes-4271-8658
Open

aidangarske wants to merge 230 commits into
wolfSSL:masterfrom
aidangarske:fenrir-fixes-4271-8658

Conversation

@aidangarske

@aidangarske aidangarske commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

F-4271 - 5af17b9 - C_UnwrapKey now returns CKR_WRAPPED_KEY_LEN_RANGE for a wrapped key length that does not fit in 32 bits, before allocating either work buffer.

F-8658 - c9c4c4d - C_UnwrapKey now returns the CKR_WRAPPED_KEY codes for AES and RSA decrypt failures, and the RSA path rejects a blob that is not the modulus size before allocating.

F-13246 - 07db9a1 - C_GenerateKeyPair now sets the initial states for both keys before calling AddObject.

F-10390 - 94a7d59 - C_GenerateKeyPair now performs the common label copy before adding the public key and checks the result, returning CKR_DEVICE_MEMORY or CKR_FUNCTION_FAILED on failure.

F-6659 - 317bb77 - The CKM_HKDF_KEY_GEN case in C_GenerateKey is now guarded by WOLFPKCS11_HKDF and returns CKR_MECHANISM_INVALID when HKDF keys are compiled out.

F-4635 - 848f4d4 - C_DecapsulateKey now returns CKR_ARGUMENTS_BAD for an ML-KEM ciphertext length that does not fit in 32 bits.

F-6960 - 6163dcc - C_EncapsulateKey and C_DecapsulateKey now call CheckPrivateLogin so a user login is required when the new secret is private, including when CKA_PRIVATE is left at its default.

F-11519 - 97bb7d3 - GetRsaExponentValue now accumulates in an unsigned long, and WP11_Rsa_GenerateKeyPair rejects an exponent above LONG_MAX.

Merge order for this stack (each PR is stacked on the previous one):

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

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@aidangarske
aidangarske force-pushed the fenrir-fixes-4271-8658 branch 2 times, most recently from 2ad445b to 97bb7d3 Compare October 9, 2026 02:00
@aidangarske aidangarske changed the title Tighten unwrap, key pair generation, and encapsulation checks Tighten unwrap, key pair generation and encapsulation checks Oct 9, 2026
@aidangarske
aidangarske force-pushed the fenrir-fixes-4271-8658 branch from 97bb7d3 to 101fe0a Compare October 10, 2026 03:20

@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.

A few comments, inline.

Comment thread src/crypto.c
Comment thread src/crypto.c Outdated
Comment thread tests/unwrap_keygen_test.c Outdated
Comment thread tests/unwrap_keygen_test.c Outdated
@aidangarske
aidangarske force-pushed the fenrir-fixes-4271-8658 branch from 101fe0a to eb0959b 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-4271-8658 branch 2 times, most recently from 8511d4b to 023f3df Compare October 13, 2026 22:50
@aidangarske
aidangarske force-pushed the fenrir-fixes-4271-8658 branch from a4dcc48 to 44be119 Compare October 13, 2026 23:47
Frauschi
Frauschi previously approved these changes Oct 14, 2026

@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.

Thanks, all addressed.

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