Gary Lin cd9cb944d9 tpm2_key_protector: Support NV index handles
Previously, NV index mode only supported persistent handles which are
only for TPM objects.

On the other hand, the "NV index" handle allows the user-defined data,
so it can be an alternative to the key file and support TPM 2.0 Key
File format immediately.

The following tpm2-tools commands store the given key file, sealed.tpm,
in either TPM 2.0 Key File format or the raw format into the NV index
handle 0x1000000.

  # tpm2_nvdefine -C o \
      -a "ownerread|ownerwrite" \
      -s $(stat -c %s sealed.tpm) \
      0x1000000
  # tpm2_nvwrite -C o -i sealed.tpm 0x1000000

To unseal the key in GRUB, add the "tpm2_key_protector_init" command to
grub.cfg:

  tpm2_key_protector_init --mode=nv --nvindex=0x1000000
  cryptomount -u <UUID> --protector tpm2

To remove the NV index handle:

  # tpm2_nvundefine -C o 0x1000000

Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2025-04-10 18:10:33 +02:00
..
2013-12-21 03:03:31 +01:00
2022-03-14 15:44:26 +01:00
2022-03-14 15:44:26 +01:00
2015-01-24 20:52:02 +01:00
2022-03-14 15:44:26 +01:00
2022-03-14 15:44:26 +01:00
2022-03-14 15:44:26 +01:00
2015-12-15 10:25:34 +03:00
2022-03-14 15:44:26 +01:00
2023-07-03 14:10:01 +02:00
2012-02-12 15:25:25 +01:00