Skip to content
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

SCRUTINICE fixes #2180

Merged
merged 10 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion crypto/fipsmodule/ec/ec_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,6 @@ EC_KEY_METHOD *EC_KEY_METHOD_new(const EC_KEY_METHOD *eckey_meth) {

ret = OPENSSL_zalloc(sizeof(EC_KEY_METHOD));
if(ret == NULL) {
OPENSSL_PUT_ERROR(EC, ERR_R_MALLOC_FAILURE);
return NULL;
}

Expand Down
5 changes: 5 additions & 0 deletions crypto/fipsmodule/evp/p_pqdsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ static int pkey_pqdsa_verify_generic(EVP_PKEY_CTX *ctx, const uint8_t *sig,
PQDSA_PKEY_CTX *dctx = ctx->data;
const PQDSA *pqdsa = dctx->pqdsa;

if (sig == NULL) {
OPENSSL_PUT_ERROR(EVP, EVP_R_MISSING_PARAMETERS);
return 0;
}

if (pqdsa == NULL) {
if (ctx->pkey == NULL) {
OPENSSL_PUT_ERROR(EVP, EVP_R_NO_PARAMETERS_SET);
Expand Down
8 changes: 6 additions & 2 deletions crypto/fipsmodule/ml_dsa/ml_dsa_ref/sign.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ static int ml_dsa_keypair_pct(ml_dsa_params *params,
uint8_t *pk,
uint8_t *sk) {
uint8_t signature[MLDSA87_SIGNATURE_BYTES];
ml_dsa_sign(params, signature, &params->bytes, NULL, 0, NULL, 0, sk);
return ml_dsa_verify(params, signature, params->bytes, NULL, 0, NULL, 0, pk) == 0;
uint8_t empty_msg[1] = {0};
int ret = ml_dsa_sign(params, signature, &params->bytes, empty_msg, 0, NULL, 0, sk);
if (ret < 0) {
return 0;
}
return ml_dsa_verify(params, signature, params->bytes, empty_msg, 0, NULL, 0, pk) == 0;
}
#endif

Expand Down
11 changes: 6 additions & 5 deletions crypto/fipsmodule/pqdsa/pqdsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,13 @@ int PQDSA_KEY_set_raw_keypair_from_seed(PQDSA_KEY *key, CBS *in) {

//allocate buffers to store key pair
uint8_t *public_key = OPENSSL_malloc(key->pqdsa->public_key_len);
uint8_t *private_key = OPENSSL_malloc(key->pqdsa->private_key_len);
if (public_key == NULL) {
return 0;
}

// check buffers are allocated
if (public_key == NULL || private_key == NULL) {
OPENSSL_PUT_ERROR(CRYPTO, ERR_R_MALLOC_FAILURE);
uint8_t *private_key = OPENSSL_malloc(key->pqdsa->private_key_len);
if (private_key == NULL) {
OPENSSL_free(public_key);
return 0;
}

Expand Down Expand Up @@ -131,7 +133,6 @@ int PQDSA_KEY_set_raw_private_key(PQDSA_KEY *key, CBS *in) {
uint8_t *public_key = OPENSSL_malloc(pk_len);

if (public_key == NULL) {
OPENSSL_PUT_ERROR(EVP, ERR_R_MALLOC_FAILURE);
return 0;
}

Expand Down
1 change: 0 additions & 1 deletion crypto/fipsmodule/rsa/rsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,6 @@ RSA_METHOD *RSA_meth_new(const char *name, int flags) {
RSA_METHOD *meth = OPENSSL_zalloc(sizeof(*meth));

if (meth == NULL) {
OPENSSL_PUT_ERROR(RSA, ERR_R_MALLOC_FAILURE);
return NULL;
}

Expand Down
Loading