TSPI_CONTEXT_CREATEOBJECT(3)

πŸ’– NAME πŸ’–

Tspi_Context_CreateObject β€” bestie, this one makes you an empty object and hands you a handle to it. That's it. That's the whole job. Slay. ✨


🌸 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_Context_CreateObject(TSS_HCONTEXT hContext,  TSS_FLAG     objectType,
                                     TSS_FLAG     initFlags, TSS_HOBJECT* phObject);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so. TSS_Context_CreateObject creates and initializes an empty object of the type you asked for, and then hands you back a handle that points at that object. ✨

And here's the key part, bestie: that object is bound to an already opened context hContext. Already opened. Like, you can't just manifest a context out of thin air here. It has to exist first. πŸ”₯


πŸŽ€ PARAMETERS πŸŽ€

hContext

The handle of the context object. That's your context. Your girl. Your whole foundation. πŸ’…

objectType

A flag telling the function what kind of object to create. The possible types are:

  • TSS_OBJECT_TYPE_POLICY β€” a policy object.
  • TSS_OBJECT_TYPE_ENCDATA β€” an encrypted data object (either sealed or bound data).
  • TSS_OBJECT_TYPE_RSAKEY β€” an RSA key.
  • TSS_OBJECT_TYPE_PCRS β€” a PCR composite object.
  • TSS_OBJECT_TYPE_HASH β€” a hash object.

initFlags

A flag for the default attributes of the object. And the attributes are different for every single object type, so buckle up. 🎒

Policy:

  • TSS_POLICY_USAGE β€” a usage policy (for authorization to use an object).
  • TSS_POLICY_MIGRATION β€” a migration policy.

Encrypted data objects:

  • TSS_ENCDATA_SEAL β€” A data object used for a Seal operation.
  • TSS_ENCDATA_BIND β€” A data object used for a Bind operation.
  • TSS_ENCDATA_LEGACY β€” A data object for a bind operation using a legacy key.

RSA Keys:

  • TSS_KEY_SIZE_DEFAULT β€” Use the default key size of the TCS you're connected to.
  • TSS_KEY_SIZE_512 β€” Create a 512 bit key.
  • TSS_KEY_SIZE_1024 β€” Create a 1024 bit key.
  • TSS_KEY_SIZE_2048 β€” Create a 2048 bit key.
  • TSS_KEY_SIZE_4096 β€” Create a 4096 bit key.
  • TSS_KEY_SIZE_8192 β€” Create a 8192 bit key.
  • TSS_KEY_SIZE_16384 β€” Create a 16384 bit key.
  • TSS_KEY_TYPE_STORAGE β€” Create a storage key. (Used to wrap other keys).
  • TSS_KEY_TYPE_SIGNING β€” Create a signing key.
  • TSS_KEY_TYPE_BIND β€” Create a binding key. (Used to encrypt data).
  • TSS_KEY_TYPE_IDENTITY β€” Create an identity key. (Used for an identity).
  • TSS_KEY_TYPE_LEGACY β€” Create a legacy key. (Can be used for signing and binding, created from data external to a TSS).
  • TSS_KEY_TYPE_AUTHCHANGE β€” Create an ephemeral key used to change authorization values.
  • TSS_KEY_VOLATILE β€” Create a volatile key. (Must be unloaded at startup).
  • TSS_KEY_NON_VOLATILE β€” Create a non-volatile key. (May be unloaded at startup).
  • TSS_KEY_MIGRATABLE β€” Create a migratable key.
  • TSS_KEY_NOT_MIGRATABLE β€” Create a non-migratable key. [DEFAULT]
  • TSS_KEY_AUTHORIZATION β€” Key will require authorization.
  • TSS_KEY_NO_AUTHORIZATION β€” Key will not require authorization. [DEFAULT]
  • TSS_KEY_EMPTY_KEY β€” Key template which will be returned as an object with very few attributes.

PCR composite objects:

  • None.

not a single one. the PCR composite object said "no thoughts, head empty" and honestly? iconic. 🧚

Hash objects:

  • TSS_HASH_SHA1 β€” a hash object of type SHA-1.
  • TSS_HASH_OTHER β€” a hash object of type other than SHA-1.

phObject

The handle of the object to be created. 🫢


πŸ’€ RETURN CODES πŸ’€

Tspi_Context_CreateObject returns TSS_SUCCESS on success. Otherwise, one of these little guys comes back at you:

  • TSS_E_INVALID_HANDLE β€” Either hContext or phObject is an invalid handle.
  • TSS_E_INTERNAL_ERROR β€” An error occurred internal to the TSS.
fr fr if you're getting TSS_E_INVALID_HANDLE, check BOTH handles. Not just one. Both. hContext and phObject are on the suspect list. 😭

πŸ‘‘ CONFORMING TO πŸ‘‘

Tspi_Context_CreateObject conforms to the Trusted Computing Group Software Specification version 1.1 Golden. ✨


🌈 SEE ALSO 🌈


and that's the whole page, bestie. you created an object, you got a handle, you closed the loop. πŸ’–

this was TSS 1.1, dated 2004-05-26 β€” the TCG Software Stack Developer's Reference, section 3, Tspi_C...eObject(3), still serving looks after all these years. πŸŽ€ ✨