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

Add NULL checks to EVP_MD_CTX_cleanse/cleanup #1519

Merged
merged 1 commit into from
Apr 9, 2024

Conversation

dkostic
Copy link
Contributor

@dkostic dkostic commented Apr 8, 2024

Issues:

Resolves P125068189

Description of changes:

Add NULL checks to EVP_MD_CTX_cleanse/cleanup.

Call-outs:

Point out areas that need special attention or support during the review process. Discuss architecture or design changes.

Testing:

How is this change tested (unit tests, fuzz tests, etc.)? Are there any testing steps to be verified by the reviewer?

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.

@@ -114,6 +117,9 @@ int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx) {
}

void EVP_MD_CTX_cleanse(EVP_MD_CTX *ctx) {
if (ctx == NULL || ctx->md_data == NULL || ctx->digest == NULL) {
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

NP: Normally all ctx->digest should have a ctx_size, but would it be worth considering adding assert(ctx->digest->ctx_size != NULL && sizeof(ctx->md_data) == ctx->digest->ctx_size) if we're adding new checks?

@dkostic dkostic merged commit 0afd2a8 into aws:main Apr 9, 2024
45 checks passed
@dkostic dkostic deleted the null-check-evp-md-clean branch April 9, 2024 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants