Skip to content

Instantly share code, notes, and snippets.

@sargun
Created December 23, 2020 04:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sargun/5f999c83baaea48817ccd7ee2b26d29f to your computer and use it in GitHub Desktop.
Save sargun/5f999c83baaea48817ccd7ee2b26d29f to your computer and use it in GitHub Desktop.
/*
* Excerpt from trusted_tpm1.c
* https://elixir.bootlin.com/linux/latest/source/security/keys/trusted-keys/trusted_tpm1.c#L387
*/
static int pcrlock(const int pcrnum)
{
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
return tpm_pcr_extend(chip, pcrnum, digests) ? -EINVAL : 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment