summaryrefslogtreecommitdiffstats
path: root/src/tpm2-setup/tpm2-setup.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* variuos: fwrite() does not set errnoZbigniew Jędrzejewski-Szmek2023-12-051-2/+4
| | | | | | | | The man page doesn't even mention errno. It just says that ferror() should be used to check for errors. Those writes are unlikely to fail, but if they do, errno might even be 0. Also, we have fflush_and_check() which does additional paranoia around errno, because we apparently do not trust that errno will always be set correctly.
* tpm2-setup: also save the SRK to the file system in TPM2_PUBLIC formatLennart Poettering2023-11-091-14/+57
| | | | | | We already save it in PEM format, also store it TPM2_PUBLIC format next to it. This is useful for usage with systemd-cryptenroll's --tpm2-device-key= switch.
* tpm2-setup: drop the COMMAND placeholder from the helpFrantisek Sumsal2023-10-251-1/+1
| | | | Since systemd-tpm2-setup doesn't expect any arguments.
* tpm2-setup: terminate the option arrayFrantisek Sumsal2023-10-251-0/+1
| | | | | | | Otherwise bad things happen: $ build/systemd-tpm2-setup --foo Segmentation fault (core dumped)
* tpm2: downgrade most log functions from error to debugDan Streetman2023-10-031-2/+2
| | | | | | | | | | Because most TPM2 functions here are 'library-like' functions, they should be at debug level, not error level. The only functions not reduced to logging at debug are tpm2_list_devices(), since it is expected to print output, and the tpm2_parse_pcr_argument_*() functions, since the system-wide parse_*_argument() functions generally log at error level.
* tpm2-setup: add new early boot tool for initializing the SRKLennart Poettering2023-09-291-0/+327
This adds an explicit service for initializing the TPM2 SRK. This is implicitly also done by systemd-cryptsetup, hence strictly speaking redundant, but doing this early has the benefit that we can parallelize this in a nicer way. This also write a copy of the SRK public key in PEM format to /run/ + /var/lib/, thus pinning the disk image to the TPM. Making the SRK public key is also useful for allowing easy offline encryption for a specific TPM. Sooner or later we should probably grow what this service does, the above is just the first step. For example, the service should probably offer the ability to reset the TPM (clear the owner hierarchy?) on a factory reset, if such a policy is needed. And we might want to install some default AK (?). Fixes: #27986 Also see: #22637