NSS-kryoptic integration finds#431
Open
FrantisekKrenzelok wants to merge 4 commits intolatchset:mainfrom
Open
Conversation
Registers a GenericSecretKeyFactory for the (CKO_SECRET_KEY, CKK_HKDF) object type in the HKDF module, ensuring that HKDF secret keys can be correctly instantiated and operations on them are supported. Signed-off-by: Krenželok František <fkrenzel@redhat.com>
76c3035 to
9ae5988
Compare
simo5
requested changes
Mar 24, 2026
Permits CKM_HKDF_DERIVE and CKM_HKDF_DATA operations to use CKO_DATA objects as the base key material, bypassing standard CKA_DERIVE checks when specific extract constraints (bExtract=TRUE, correct size, non-null salt) are met. This follows PKCS latchset#11 specification 3.2 sectoin: 6.62.3 HKDF derive "The input key must be of type CKK_HKDF or CKK_GENERIC_SECRET and the length must be the size of the underlying hash function specified in prfHashMechanism. The exception is a data object which has the same size as the underlying hash function, and which may be supplied as an input key. In this case bExtract should be true and non-null salt should be supplied." Signed-off-by: Krenželok František <fkrenzel@redhat.com>
Validates that a CKO_DATA object can be used as the root keying material for CKM_HKDF_DERIVE operations, ensuring that derivation behaves strictly according to the PKCS#11 extract phase constraints (bExtract=TRUE, correct size, non-null salt). Co-authored-by: Gemini <gemini@google.com> Signed-off-by: Krenželok František <fkrenzel@redhat.com>
Removes the 'in_use' state requirement in OpenSSL HashOperation finalization, enabling empty data streams or operations without a preceding update function call. This follows PKCS latchset#11 specification v3.2 section: 5.12.1 "After calling C_DigestInit, the application can either call C_Digest to digest data in a single part; or call C_DigestUpdate zero or more times, followed by C_DigestFinal, to digest data in multiple parts. The message-digesting operation is active until the application uses a call to C_Digest or C_DigestFinal to actually obtain the message digest. To process additional data (in single or multiple parts), the application MUST call C_DigestInit again." Signed-off-by: Krenželok František <fkrenzel@redhat.com>
9ae5988 to
db25a47
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.
Description
This PR implements logic to permit
CKO_DATAobjects to be used directly as input key material for HKDF derivation (CKM_HKDF_DERIVEandCKM_HKDF_DATA), safely bypassing the standardCKA_DERIVEcheck. This aligns with PKCS#11 extraction phase constraints, enabling data objects to be employed providedbExtractis set to TRUE, the exact size matches the HMAC hash length, and a non-null salt is supplied.Additionally, this PR includes:
GenericSecretKeyFactoryfor theCKK_HKDFkey type to ensure these secret keys can be correctly instantiated.in_usecheck inside the OpenSSLHashOperationwrapper, properly enabling the finalization of digest operations (and HKDF derivations) on empty data streams.src/tests/kdfs.rsvalidating success and failure requirements of HKDF derivation fromCKO_DATAobjects.Checklist
Reviewer's checklist: