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

Enable systemd-cryptenroll to support pcr literals on the command line. #28339

Closed
wants to merge 8 commits into from

Conversation

flixman
Copy link

@flixman flixman commented Jul 10, 2023

THIS IS WORK IN PROGRESS.
Current implementation of tpm2-related tools in systemd-cryptenroll support specifying a PCR index, but not giving a literal hash value. This PR provides such functionality. The idea is to reuse as much code as possible, so the specification of the registers would go like

 --tpm2-pcrs=7+11:sha256=<hash>+14

@github-actions github-actions bot added util-lib tests repart tpm2 please-review PR is ready for (re-)review by a maintainer labels Jul 10, 2023
@flixman flixman closed this Jul 10, 2023
@flixman flixman reopened this Jul 10, 2023
@flixman flixman marked this pull request as draft July 10, 2023 12:00
@github-actions github-actions bot added please-review PR is ready for (re-)review by a maintainer and removed please-review PR is ready for (re-)review by a maintainer labels Jul 10, 2023
@github-actions
Copy link

An -rc1 tag has been created and a release is being prepared, so please note that PRs introducing new features and APIs will be held back until the new version has been released.

@flixman flixman changed the title Tpm/pcr literals Enable systemd-cryptenroll to support pcr literals on the command line. Jul 10, 2023
@github-actions
Copy link

An -rc1 tag has been created and a release is being prepared, so please note that PRs introducing new features and APIs will be held back until the new version has been released.

src/shared/tpm2-util.c Outdated Show resolved Hide resolved
src/creds/creds.c Outdated Show resolved Hide resolved
src/shared/tpm2-util.c Outdated Show resolved Hide resolved
src/shared/tpm2-util.c Outdated Show resolved Hide resolved
src/shared/tpm2-util.c Outdated Show resolved Hide resolved
src/shared/tpm2-util.c Outdated Show resolved Hide resolved
src/test/test-tpm2.c Outdated Show resolved Hide resolved
src/test/test-tpm2.c Outdated Show resolved Hide resolved
src/test/test-tpm2.c Outdated Show resolved Hide resolved
Copy link
Contributor

@ddstreet ddstreet left a comment

Choose a reason for hiding this comment

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

I'm also working on adding this, BTW....

src/shared/tpm2-util.c Outdated Show resolved Hide resolved
@flixman
Copy link
Author

flixman commented Jul 13, 2023

@poettering @ddstreet I have been traveling for the last two days. After your remark on the issue I have moved everything to hashmap and I am applying the coding style. My apologies for the (lack of) quality of this draft, but its purpose was only to show the proposal to get any architectural concerns. I hope I will finish this in the coming few days (I am still on the go, with limited time :-/).

@ddstreet: on your remark about tpm2_pcr_from_string: I am currently changing the signature of tpm2_pcr_from_string so that it does not return the literals mask and the values themselves, but only a <bank, pcrs> hashmap, where pcrs is another <index, digest>, in which digest is a TPM2B_DIGEST. Additionally, I am providing a function that, given the pcrs hashmap, will return the mask for those literals.

@poettering: I will incorporate your remarks in the coming commits. Thank you very much! I am having a bit of a problem accessing a hashmap whose values are also hashmaps, but I will update the PR as soon as I get around it.

I am commiting my work in progress. It is not yet for review, but to show the status of the work.

src/test/test-tpm2.c Fixed Show fixed Hide fixed
@ddstreet
Copy link
Contributor

I don't mean to step on your work, but I have #28398 which I think is a more comprehensive approach.

@flixman
Copy link
Author

flixman commented Jul 14, 2023

@ddstreet Good! then I stop on that. Good luck!

@flixman flixman closed this Jul 14, 2023
@github-actions github-actions bot removed the please-review PR is ready for (re-)review by a maintainer label Jul 14, 2023
@flixman flixman deleted the tpm/pcr_literals branch February 17, 2024 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

3 participants