Conversation
…ND_KEY The derived key's CKA_NEVER_EXTRACTABLE value was written to CKA_ALWAYS_SENSITIVE instead, overwriting it, and CKA_NEVER_EXTRACTABLE was not set. Add tests with generated keys, which have these attributes set. Also fix the CKA_MODIFIABLE check in the AES unwrap test, which read the value into the shared CK_FALSE template variable and then compared it with itself, so it always passed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughThe PR corrects the ChangesDerived-key attributes
Modifiable attribute test
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to Derived keys now retain the separate sensitivity and extractability history attributes, with tests covering the relevant input combinations. The supplied change context indicates no actionable merge risk. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change corrects key-attribute reporting without widening access to key material. Existing key-access and failure-cleanup behavior merits separate verification, but this PR does not appear to make it riskier. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
A key generated with CKA_SENSITIVE and CKA_EXTRACTABLE both false is never extractable but not always sensitive. Deriving with it must give a key that is not always sensitive, which the previous code got wrong. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes
CKA_NEVER_EXTRACTABLEhandling for keys derived withCKM_CONCATENATE_BASE_AND_KEY, and fixes a test check that could never fail.Changes
Derive fix:
deriveSymmetriccomputed the derived key'sCKA_NEVER_EXTRACTABLEvalue, but wrote it toCKA_ALWAYS_SENSITIVE. As a result:CKA_ALWAYS_SENSITIVEwas overwritten, so a derived key could lose it even when both source keys were always sensitive.CKA_NEVER_EXTRACTABLEwas never set from the source keys.PKCS#11 v2.40 Current Mechanisms §2.31.3, Concatenation of a base key and another key:
Test fix: the
CKA_MODIFIABLEcheck inaesWrapUnwrapNonModifiableGenericread the attribute into the sharedbFalsetemplate variable and then comparedbFalsewith itself, so it always passed. It could also have changedbFalsefor later tests. It now reads into its own variable. This was found in the review of Add support for DES3 wrap/unwrap #812.Tests
DeriveTests::testMiscDerivationsnow derives from generated keys, since keys fromC_CreateObjectalways have both attributesCK_FALSE. It checks two cases:Without the fix, each case fails on its own: the first on
CKA_NEVER_EXTRACTABLE, the second and third onCKA_ALWAYS_SENSITIVE.p11testpasses 81/81 with the OpenSSL 3 backend.🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests