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

Sealing on empty file patch #26

Merged
merged 3 commits into from
Sep 15, 2020

Conversation

wmillstone
Copy link
Contributor

Added a check in kmyth_wrap_input in src/util/tpm2_kmyth_seal.c to validate that the file being sealed is not empty.

@@ -665,6 +665,14 @@ int kmyth_wrap_input(char *inPath,
return 1;
}
kmyth_log(LOG_DEBUG, "read in %d bytes of data to be wrapped", data_length);

// validate non-empty plaintext buffer specified
if (data_length == 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

For completeness we should also check that data is not NULL.

Copy link
Contributor

Choose a reason for hiding this comment

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

I apologize, my earlier comment wasn't clear. I meant that we should check that data is not NULL in addition to checking that data_length is not zero before using it, I wasn't suggesting to check that data is not NULL before freeing it.

Copy link
Contributor

@b-carr b-carr left a comment

Choose a reason for hiding this comment

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

@PircDef Do we want to squash these commits before merging them in?

@b-carr b-carr merged commit 3dc29c3 into NationalSecurityAgency:master Sep 15, 2020
@b-carr b-carr linked an issue Sep 24, 2020 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Seal failing on empty input file
2 participants