tpm-util: use trial session where appropriate
authorLennart Poettering <lennart@poettering.net>
Mon, 15 Aug 2022 09:44:52 +0000 (11:44 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 16 Aug 2022 01:16:19 +0000 (10:16 +0900)
commit73096907881fcdaba27c128d46a55e6b9ce3cc5e
tree7be9dd39859913addb89ce46651501671ebb5902
parent599884bd9a3cfb376572e44935174939e0dab776
tpm-util: use trial session where appropriate

TPM2 knows two types of policy sessions: "real" ones and "trial" ones. The
latter allow you to calculate a policy hash without this enforcing any
policy, which the former do. Typically you want to use the "trial" ones
when enrolling, and you have to use the "real" ones for unlocking. So
far we used "real" ones for both cases. Which works fine – as long as
the policy put together matches the current reality (e.g. the PCR values
included in the policy are the ones currently in place in the TPM).

Let's switch to using trial sessions for enrolling. First of all this is
preparation for later work to implement further policy extensions (for
example, policies binding to literally specified PCR values, instead of
the once currently measured). But from my perspective more importantly
it actually is cleaner, as it communicates more clearly what we are
actually doing here.

No user-visible change in behaviour.
src/shared/tpm2-util.c