Tspi_Hash_Sign(3)

πŸ’– Tspi_Hash_Sign(3) πŸ’–

okay bestie, welcome to the TCG Software Stack Developer's Reference β€” this is the Tspi_Hash_Sign(3) page from the Library Functions Manual, and it's literally the moment your hash data gets its signature glow-up. no cap. πŸ¦‹


✨ NAME ✨

Tspi_Hash_Sign β€” sign the hash data of an object with a signing key

like. that's it. that's the whole job. sign the hash data of an object with a signing key. iconic behavior. πŸ’…


🌸 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_Hash_Sign(TSS_HHASH hHash,              TSS_HKEY hKey,
                          UINT32    pulSignatureLength, BYTE**   prgbSignature);

all those includes? yeah you need every single one of them, don't @ me, just copy them in. πŸ™ˆ


πŸŽ€ DESCRIPTION πŸŽ€

so Tspi_Hash_Sign signs the hash data of an object with a given signing key. simple. elegant. the way that it just does the thing. πŸ”₯

BUT β€” and this is the part where you gotta pay attention, bestie β€” the data must be set at the hash instance associated with hHash by calling Tspi_Hash_SetHashValue or Tspi_Hash_UpdateHashValue. no data, no signature. it's giving "you have to actually put something in before you ask for something out." πŸ’€

also real talk: the Tspi_Hash_Sign method allocates a memory block for the prgbSignature data. so that memory is yours now, and you must release it using Tspi_Context_FreeMemory. do not ghost that memory block. free it. it's the respectful thing to do. 🫢


🌈 PARAMETERS 🌈

πŸ’œ hHash

The handle to the hash object instance whose hash value should be signed.

like, which hash are we signing here, girlie. this is that one.

πŸ’œ hKey

Handle to the key object which should be used for the signature.

the signing key. the main character of this whole operation tbh. πŸ‘‘

πŸ’œ pulSignatureLength

Receives the length of the signature data returned at the parameter prgbSignature on successful completion.

it's an out-param! it catches the length of the signature for you once everything works. ✨

πŸ’œ prgbSignature

Receives a pointer to the signature data on successful completion.

and this one catches the actual pointer to the signature data. and again β€” free that memory with Tspi_Context_FreeMemory, bestie, i am begging. 😭


⭐ RETURN CODES ⭐

Tspi_Hash_Sign returns TSS_SUCCESS on success (slay πŸŽ‰), otherwise one of the following values is returned:

  • TSS_E_INVALID_HANDLE β€” hKey is not a valid handle. like it's just not valid. nope. πŸ™…
  • TSS_E_INTERNAL_ERROR β€” An internal SW error has been detected. not our fault, it's the internals being messy.
  • TSS_E_BAD_PARAMETER β€” One or more parameters is bad. something you passed in is misbehaving.
  • TSS_E_HASH_INVALID_LENGTH β€” Hash length is inconsistent with hash algorithm. the length and the algorithm are not matching each other's energy. πŸ’€
  • TSS_E_HASH_NO_DATA β€” Hash object has no internal hash value. empty. void. nothing in there. go call Tspi_Hash_SetHashValue or Tspi_Hash_UpdateHashValue first fr fr.
  • TSS_E_HASH_NO_IDENTIFIER β€” The hash algorithm identifier is not set. it doesn't even know what algorithm it is. identity crisis core. 😭

πŸ‘‘ CONFORMING TO πŸ‘‘

Tspi_Hash_Sign conforms to the Trusted Computing Group Software Specification version 1.1 Golden

periodt. that's the spec, that's the standard, that's the vibe. βœ…


πŸ¦‹ SEE ALSO πŸ¦‹

go read those too, they're all part of the same little friend group. iykyk. πŸ’–


and that's the page, bestie!! this one's from TSS 1.1, dated 2004-05-25 β€” yeah she's an elder but she still eats. go sign something. responsibly. and FREE YOUR MEMORY. πŸŽ€βœ¨πŸ’