Tspi_S...ibData(3)

πŸ’… Tspi_SetAttribData β€” bestie edition ✨

okay so this is a page from the TCG Software Stack Developer's Reference, and the function we're simping for is Tspi_SetAttribData. It's the manual page Tspi_SetAttribData(3), and yes it's giving "niche TPM lore" but stick with me, it's actually so good 🫢


🌸 NAME 🌸

Tspi_SetAttribData β€” set a non-32bit attribute of an object πŸ’–

like, if your attribute is not a UINT32, this is the girl you call.


✨ SYNOPSIS ✨

First you gotta include the whole squad of headers, no skipping:

#include <tss/platform.h>
#include <tss/tcpa_defines.h>
#include <tss/tcpa_typedef.h>
#include <tss/tcpa_struct.h>
#include <tss/tss_typedef.h>
#include <tss/tss_structs.h>
#include <tss/tspi.h>

and then the function itself, looking all main-character:

TSS_RESULT Tspi_SetAttribData(TSS_HOBJECT hObject, TSS_FLAG attribFlag,
                              TSS_FLAG    subFlag, UINT32   ulAttribDataSize,
                              BYTE*       rgbAttribData);

πŸ¦‹ DESCRIPTION πŸ¦‹

So Tspi_SetAttribData sets the attributes attached to a given class of object β€” but only the ones that aren't UINT32. If you came here with a UINT32, bestie, wrong door, this is not your function πŸ’€

And here's the tea: the structure and the size of the attribute data? They depend on the attribute. So don't be out here assuming a shape, because it changes per attribute. iykyk.


πŸŽ€ PARAMETERS πŸŽ€

hObject

Handle of the object where the attribute is gonna get set. This is the thing you're decorating πŸ’…

attribFlag

The flag that says which attribute to set. It's the vibe check for "what are we even doing here".

subFlag

The sub flag that says which attribute to set. Yeah, there's a sub flag. It's giving "layers". 🌈

ulAttribDataSize

Supplies the length, in bytes, of rgbAttribData. Basically: how much data are we handing over, queen? πŸ‘‘

rgbAttribData

Pointer to the actual data that gets set for the specified attribute. The real one. The payload. The moment. ⭐


πŸ”₯ RETURN CODES πŸ”₯

Tspi_SetAttribData returns TSS_SUCCESS when everything slays. If it doesn't? One of these beauties comes back at you:

  • TSS_E_INVALID_HANDLE β€” hObject is an invalid parameter. 😭
  • TSS_E_ATTRIB_FLAG β€” attribFlag is an invalid parameter.
  • TSS_E_ATTRIB_SUBFLAG β€” subFlag is an invalid parameter.
  • TSS_E_ATTRIB_DATA β€” rgbAttribData is an invalid parameter.
  • TSS_E_BAD_PARAMETER
  • TSS_E_INTERNAL_ERROR β€” an error happened internal to the TSS. not us, it's them 🫠

πŸ’œ CONFORMING TO πŸ’œ

Tspi_SetAttribData conforms to the Trusted Computing Group Software Specification version 1.1 Golden. iconic behaviour, honestly.


πŸ“ SEE ALSO πŸ“


πŸ’€ heads up bestie: this page literally says the structure and size of the attribute data depend on the attribute, so don't go guessing. Read the spec. no cap.

TSS 1.1 Β· 2004-05-26 β€” yeah she's vintage, she's been around since 2004 and she still ate. mwah πŸ’‹ bye bestie! πŸ‘‘βœ¨