Skip to content

Commit 3bf81b0

Browse files
committed
More CodeRabbitAI suggestions
1 parent 8609c5a commit 3bf81b0

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/lib/SoftHSM.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10064,8 +10064,8 @@ CK_RV SoftHSM::generateMLDSA
1006410064
return CKR_TEMPLATE_INCOMPLETE;
1006510065
}
1006610066

10067-
if (paramSet != 1UL && paramSet != 2UL && paramSet != 3UL) {
10068-
INFO_MSG("Wrong parameterSet: %ld", paramSet);
10067+
if (paramSet != CKP_ML_DSA_44 && paramSet != CKP_ML_DSA_65 && paramSet != CKP_ML_DSA_87) {
10068+
INFO_MSG("Unsupported parameter set: %lu", (unsigned long)paramSet);
1006910069
return CKR_PARAMETER_SET_NOT_SUPPORTED;
1007010070
}
1007110071

src/lib/crypto/OSSLMLDSAPrivateKey.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,16 @@ void OSSLMLDSAPrivateKey::createOSSLKey()
148148
ByteString localValue = getValue();
149149

150150
const char* name = OSSL::mldsaParameterSet2Name(getParameterSet());
151+
if (name == NULL)
152+
{
153+
ERROR_MSG("Unknown ML-DSA parameter set (value length: %zu)", localValue.size());
154+
return;
155+
}
156+
if (localValue.size() == 0)
157+
{
158+
ERROR_MSG("Empty ML-DSA private key value; cannot create EVP_PKEY");
159+
return;
160+
}
151161

152162
int selection = 0;
153163
EVP_PKEY_CTX *ctx = NULL;

0 commit comments

Comments
 (0)