tpm_sealdata(3)

πŸ“¦
version 1.3.9.2 Β· 2 versions
  • 1.3.9.2 Β· debian bookworm, debian trixie, epel 10, epel 9, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 1.3.9.2 Β· fedora 43, fedora 44
, in debian bookworm, debian trixie, epel 10, epel 9, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– tpm_sealdata(3) β€” Library Functions Manual πŸ’–

okay bestie, welcome to the TPM Management corner of the library. we're doing tpmUnsealFile, tpmUnsealShred, and tpmUnsealStrerror today and honestly? these three carry the whole unseal arc. 🫢


✨ NAME ✨

tpmUnsealFile, tpmUnsealShred, tpmUnsealStrerror β€” unseal routines

like. the unseal girlies. that's the name. periodt. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <tpm_unseal/tpm_unseal.h>

int tpmUnsealFile(char* file, char** data, int* size);
void tpmUnsealShred(char* data, int size);
char* tpmUnsealStrerror(int rc);

look at those signatures. so clean. so iconic. ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

so the whole tpmUnseal family exists for one reason and one reason only: getting you access to a piece of sensitive data that's been sealed to the TPM configuration of a given system. and it only lets you in if the conditions are right, which means:

  • the SRK has not changed, and
  • the PCRs (if any) that were specified at seal time are of the appropriate value.

that's it. that's the vibe check. no right conditions, no data. πŸ’€


πŸ“ tpmUnsealFile πŸ“

this one returns the contents of the file, unsealed, into the data buffer.

⚠️ bestie listen to me. the memory at *data must be freed by the caller. that's on you. not the library. you. don't make it weird. 😭

🧚 tpmUnsealShred 🧚

this one zeroes and frees the memory for you. it's giving responsible. it's giving cleanup crew. it's giving "i got you, bestie." πŸ’–


🌸 tpmUnsealStrerror 🌸

this one takes the return code from tpmUnsealFile and converts it into a human comprehensible string, using an internal errno variable. so instead of staring at a sad little negative number like πŸ‘οΈπŸ‘„πŸ‘οΈ you get actual words. slay.


πŸ‘‘ Return Value πŸ‘‘

  • tpmUnsealFile β€” returns 0 on success and a negative number on error. 🫠
  • tpmUnsealStrerror β€” returns the error string on success, and the empty string on an error. yes, the error function can error. iconic behaviour honestly. πŸ’€

🌈 SEE ALSO 🌈


πŸ’œ REPORTING BUGS πŸ’œ

found a bug? don't sit on it, bestie, report it to:

<trousers-users@lists.sourceforge.net>

they're lovely. they'll help. fr fr. 🫢


and that's the whole page!! TPM Management, dated 2005-08-10 β€” yes she's an elder but she ate and left no crumbs. go unseal something responsibly, and remember: free your memory. literally. πŸ’…βœ¨πŸ‘‘