Tspi_Data_Bind(3)

πŸ’– Tspi_Data_Bind β€” from the Library Functions Manual (that's the (3) bestie) πŸ’–

TCG Software Stack Developer's Reference ✨


🌸 NAME 🌸

Tspi_Data_Bind β€” encrypts a data blob 🫢


✨ SYNOPSIS ✨

#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>

TSS_RESULT Tspi_Data_Bind(TSS_HENCDATA hEncData,     TSS_HKEY hEncKey,
                          UINT32       ulDataLength, BYTE*    rgbDataToBind);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so Tspi_Data_Bind encrypts a data blob in a way that Tspi_Data_Unbind can decrypt it later. it's giving locked-then-unlockable, no cap πŸ’…

the data blob gets encrypted with a public key operation, using the key that the given encryption key object points at.

now here's the part you need to hear: if you wanna bind data that's larger than the RSA public key modulus, that's on you β€” it is the responsibility of the caller to do the blocking and then the subsequent combination of the data. the function is not gonna hold your hand on that one, bestie 😭

the bound data blob lands in the data object addressed by hEncData, and you can pull it out of that object with Tspi_GetAttribData. πŸŽ€

and fr fr: the caller of this function should perform validations that the public key presented to it is from a valid TPM. do not skip the vibe check on that key πŸ‘‘

πŸ’… PARAMETERS πŸ’…

hEncData

the handle of the data object that holds the encrypted data once the command completes successfully. this is where the glow-up gets stored ✨

hEncKey

handle to the key object addressing the public key that's used to encrypt the data. πŸ”‘

ulDataLength

tells you the length of the data handed over in the rgbDataToBind parameter. πŸ“

rgbDataToBind

a pointer to the data that's about to be encrypted. πŸ“


πŸ’€ RETURN CODES πŸ’€

Tspi_Data_Bind returns TSS_SUCCESS when it slays, otherwise one of these lil guys comes back at you:

  • TSS_E_INVALID_HANDLE β€” hHash is not a valid handle.
  • TSS_E_INTERNAL_ERROR β€” an internal SW error has been detected.
  • TSS_E_BAD_PARAMETER β€” one or more parameters is bad.
  • TSS_E_INVALID_ENCSCHEME β€” invalid encryption scheme.
  • TSS_E_ENC_INVALID_LENGTH β€” invalid length of data to be encypted.
  • TSS_E_ENC_NO_DATA β€” no data to encrypt.
  • TSS_E_ENC_INVALID_TYPE β€” invalid encryption type.

πŸ‘‘ CONFORMING TO πŸ‘‘

Tspi_Data_Bind conforms to the Trusted Computing Group Software Specification version 1.1 Golden ⭐


🌈 SEE ALSO 🌈

Tspi_Data_Unbind(3), Tspi_Data_Unseal(3), Tspi_Data_Seal(3).


and that's the whole page, bestie!! this one's from TSS 1.1, dated 2004-05-25 β€” vintage but iconic, we stan a classic πŸ§šπŸ’œ