-
Notifications
You must be signed in to change notification settings - Fork 386
rsa-oaep-support #821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
rsa-oaep-support #821
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -111,9 +111,16 @@ struct AsymRSAMGF | |||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| struct RSA_PKCS_PSS_PARAMS | ||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||
| HashAlgo::Type hashAlg; | ||||||||||||||||||||||||||||||||
| AsymRSAMGF::Type mgf; | ||||||||||||||||||||||||||||||||
| size_t sLen; | ||||||||||||||||||||||||||||||||
| HashAlgo::Type hashAlg; | ||||||||||||||||||||||||||||||||
| AsymRSAMGF::Type mgf; | ||||||||||||||||||||||||||||||||
| size_t sLen; | ||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| struct RSA_PKCS_OAEP_PARAMS | ||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||
| HashAlgo::Type hashAlg; | ||||||||||||||||||||||||||||||||
| AsymRSAMGF::Type mgf; | ||||||||||||||||||||||||||||||||
| size_t hashLen; | ||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||
|
Comment on lines
+119
to
124
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OAEP label not represented; risks silent label ignore PKCS#11 CK_RSA_PKCS_OAEP_PARAMS includes label fields; the current struct lacks them. Either add and plumb label support or ensure upstream rejects non-empty labels to avoid non-compliance and silent behavior differences. struct RSA_PKCS_OAEP_PARAMS
{
HashAlgo::Type hashAlg;
AsymRSAMGF::Type mgf;
size_t hashLen;
+ // Optional OAEP label (may be NULL when labelLen == 0)
+ const unsigned char* label;
+ size_t labelLen;
};If adding later, document that labelLen must be 0 for now and enforce rejection in backends. Based on learnings. 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| class AsymmetricAlgorithm | ||||||||||||||||||||||||||||||||
|
|
@@ -138,14 +145,14 @@ class AsymmetricAlgorithm | |||||||||||||||||||||||||||||||
| virtual bool verifyFinal(const ByteString& signature); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| // Encryption functions | ||||||||||||||||||||||||||||||||
| virtual bool encrypt(PublicKey* publicKey, const ByteString& data, ByteString& encryptedData, const AsymMech::Type padding) = 0; | ||||||||||||||||||||||||||||||||
| virtual bool encrypt(PublicKey* publicKey, const ByteString& data, ByteString& encryptedData, const AsymMech::Type padding, const void* param = NULL, const size_t paramLen = 0) = 0; | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| // Decryption functions | ||||||||||||||||||||||||||||||||
| virtual bool decrypt(PrivateKey* privateKey, const ByteString& encryptedData, ByteString& data, const AsymMech::Type padding) = 0; | ||||||||||||||||||||||||||||||||
| // Decryption functions | ||||||||||||||||||||||||||||||||
| virtual bool decrypt(PrivateKey* privateKey, const ByteString& encryptedData, ByteString& data, const AsymMech::Type padding, const void* param = NULL, const size_t paramLen = 0) = 0; | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| // Wrap/Unwrap keys | ||||||||||||||||||||||||||||||||
| bool wrapKey(PublicKey* publicKey, const ByteString& data, ByteString& encryptedData, const AsymMech::Type padding); | ||||||||||||||||||||||||||||||||
| bool unwrapKey(PrivateKey* privateKey, const ByteString& encryptedData, ByteString& data, const AsymMech::Type padding); | ||||||||||||||||||||||||||||||||
| // Wrap/Unwrap keys | ||||||||||||||||||||||||||||||||
| bool wrapKey(PublicKey* publicKey, const ByteString& data, ByteString& encryptedData, const AsymMech::Type padding, const void* param = NULL, const size_t paramLen = 0); | ||||||||||||||||||||||||||||||||
| bool unwrapKey(PrivateKey* privateKey, const ByteString& encryptedData, ByteString& data, const AsymMech::Type padding, const void* param = NULL, const size_t paramLen = 0); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| // Key factory | ||||||||||||||||||||||||||||||||
| virtual bool generateKeyPair(AsymmetricKeyPair** ppKeyPair, AsymmetricParameters* parameters, RNG* rng = NULL) = 0; | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restore missing declaration for
RSA_PKCS_OAEP_PARAMSSoftHSM.hnow usesRSA_PKCS_OAEP_PARAMSin the public signature, but the header neither includes the definition nor forward declares the struct. Compiling a TU that includesSoftHSM.hbefore any other OAEP headers currently fails with “RSA_PKCS_OAEP_PARAMShas not been declared.” Please add a declaration (or the defining include) in this header so it remains self-contained.+#include "AsymmetricAlgorithm.h"📝 Committable suggestion
🤖 Prompt for AI Agents