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

Coverity 1521557: Error handling issues #20409

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion crypto/dsa/dsa_backend.c
Expand Up @@ -173,7 +173,10 @@ DSA *ossl_dsa_key_from_pkcs8(const PKCS8_PRIV_KEY_INFO *p8inf,
ERR_raise(ERR_LIB_DSA, DSA_R_BN_ERROR);
goto dsaerr;
}
DSA_set0_key(dsa, dsa_pubkey, dsa_privkey);
if (!DSA_set0_key(dsa, dsa_pubkey, dsa_privkey)) {
ERR_raise(ERR_LIB_DSA, ERR_R_BN_LIB);
Copy link
Member

@slontis slontis Mar 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea how we came up with these different error reasons... ERR_R_BN_LIB and also DSA_R_BN_ERROR. I would think this should not be a ERR_R_BN_LIB?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What should it be?
"internal error" might make sense.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is the only place that does a raise on the setkey :) Not sure INVALID_KEY is great either..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point error raising probably needs to be added all over the place.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed about more error raising.
Technically, the error here cannot be raised. DSA_set0_key never fails. At least currently, but I doubt it will change.

goto dsaerr;
}

goto done;

Expand Down