ESYS_CONTEXT(3)
πΈ ESYS_CONTEXT(3) β Library Functions Manual, but make it cute πΈ
okay so bestie, this is the ESYS_CONTEXT(3) page from the Library Functions Manual, and itβs all about the context object that keeps your TPM connection and resource metadata together. Letβs get into it π
π NAME π
ESYS_CONTEXT β Esys Context ESYS_CONTEXT β¨
β¨ SYNOPSIS β¨
π§ Typedefs
typedef struct ESYS_CONTEXT ESYS_CONTEXT
π οΈ Functions
TSS2_RC Esys_Initialize (ESYS_CONTEXT **esys_context, TSS2_TCTI_CONTEXT *tcti, TSS2_ABI_VERSION *abiVersion)
TSS2_RC Esys_GetTcti (ESYS_CONTEXT *esys_context, TSS2_TCTI_CONTEXT **tcti)
TSS2_RC Esys_GetPollHandles (ESYS_CONTEXT *esys_context, TSS2_TCTI_POLL_HANDLE **handles, size_t *count)
TSS2_RC Esys_SetTimeout (ESYS_CONTEXT *esys_context, int32_t timeout)
TSS2_RC Esys_GetSysContext (ESYS_CONTEXT *esys_context, TSS2_SYS_CONTEXT **sys_context)
TSS2_RC Esys_SetCryptoCallbacks (ESYS_CONTEXT *esysContext, ESYS_CRYPTO_CALLBACKS *callbacks)
void Esys_Free (void *__ptr)
π«Ά Detailed Description π«Ά
An ESYS_CONTEXT holds tdata for the connection to the TPM as well as the metadata for TPM Resource; such as Transient key, Persistent objects, NV spaces, Sessions or PCRs. π₯
π Typedef Documentation π
π¦ typedef struct ESYS_CONTEXT ESYS_CONTEXT
Reference to the ESYS_CONTEXT that holds data for the connection to the TPM as well as the metadata for TPM Resource; such as Transient key, Persistent objects, NV spaces, Sessions or PCRs. π
π Function Documentation π
π TSS2_RC Esys_GetPollHandles (ESYS_CONTEXT * esys_context, TSS2_TCTI_POLL_HANDLE ** handles, size_t * count)
Return the poll handles of the used TCTI. π
The connection to the TPM is held using a TCTI. These may optionally provide handles that can be used to poll for incoming data. This is useful when using the asynchronous function of ESAPI in an event-loop model.
Parameters
esys_context [in]β TheESYS_CONTEXT.handles [out]β The poll handles (callee-allocated, usefree()).count [out]β The number of poll handles.
Return values
TSS2_RC_SUCCESSon Success.TSS2_ESYS_RC_BAD_REFERENCEifesysContext,handlesorcountis NULL.TSS2_RCsproduced by lower layers of the software stack.
πΈ TSS2_RC Esys_GetSysContext (ESYS_CONTEXT * esys_context, TSS2_SYS_CONTEXT ** sys_context)
Helper function that returns the sys context from the given esys context. π«Ά
Function returns the sys context from the given esys context.
Parameters
esys_context [in]β ESYS context.sys_context [out]β SYS context.
Return values
TSS2_RC_SUCCESSon Success.TSS2_ESYS_RC_BAD_REFERENCEifesys_contextorsys_contextare NULL.
π TSS2_RC Esys_GetTcti (ESYS_CONTEXT * esys_context, TSS2_TCTI_CONTEXT ** tcti)
Return the used TCTI context. π§
If a tcti context was passed into Esys_Initialize then this tcti context is returned. If NULL was passed in, then NULL will be returned. This function is useful before Esys_Finalize to retrieve the tcti context and perform a clean Tss2_Tcti_Finalize.
Parameters
esys_context [in]β TheESYS_CONTEXT.tcti [out]β The TCTI context used to connect to the TPM (may beNULL).
Return values
TSS2_RC_SUCCESSon Success.TSS2_ESYS_RC_BAD_REFERENCEifesysContextortctiis NULL.
π₯ TSS2_RC Esys_Initialize (ESYS_CONTEXT ** esys_context, TSS2_TCTI_CONTEXT * tcti, TSS2_ABI_VERSION * abiVersion)
Initialize an ESYS_CONTEXT for further use. β¨
Initialize an ESYS_CONTEXT that holds all the state and metadata information during an interaction with the TPM. If not specified, load a TCTI in this order:
- Library
libtss2-tcti-default.so(link to the preferred TCTI) - Library
libtss2-tcti-tabrmd.so(tabrmd) - Device
/dev/tpmrm0(kernel resident resource manager) - Device
/dev/tpm0(hardware TPM) - Device
/dev/tcm0(hardware TCM) - TCP socket
localhost:2321(TPM simulator)
Parameters
esys_context [out]β TheESYS_CONTEXT.tcti [in]β The TCTI context used to connect to the TPM (may beNULL).abiVersion [in,out]β The abi version to check and the abi version supported by this implementation (may beNULL).
Return values
TSS2_ESYS_RC_SUCCESSif the function call was a success.TSS2_ESYS_RC_BAD_REFERENCEifesysContextis NULL.TSS2_ESYS_RC_MEMORYif the ESAPI cannot allocate enough memory to create the context.TSS2_RCsproduced by lower layers of the software stack may be returned to the caller unaltered unless handled internally.
π§ TSS2_RC Esys_SetCryptoCallbacks (ESYS_CONTEXT * esysContext, ESYS_CRYPTO_CALLBACKS * callbacks)
Set Crypto Callbacks. π
This is an advanced functionality that should be used with caution and by those who know exactly what they are doing.
This function provides the ability to set and restore to the original state, the cryptographic callbacks that ESAPI uses internally. This is useful for custom builds where runtime configurable cryptography is beneficial over a configure time, --with-crypto=<ossl|mbed> backend.
Parameters
esysContextβ TheESYS_CONTEXT.callbacksβ The user define crypto callbacks orNULLfor a reset to the./configuretime state.
Return values
TSS2_ESYS_RC_BAD_REFERENCEifesysContextis NULL.TSS2_TSS2_ESYS_RC_CALLBACK_NULLif a required callback pointer is NULL.USER_DEFINEDuser defined errors if the user callback fails.
Note If./configure --with-crypto=none, ESAPI functions that need crypto will fail withTSS2_TSS2_ESYS_RC_CALLBACK_NULLuntil the application registers callbacks. Under the same scenario, It will also fail if the application resets the state back to the original state.
β° TSS2_RC Esys_SetTimeout (ESYS_CONTEXT * esys_context, int32_t timeout)
Set the timeout of Esys asynchronous functions. β³
Sets the timeout for the _finish() functions in the asynchronous versions of the Esys commands.
Parameters
esys_context [in]β TheESYS_CONTEXT.timeout [in]β The timeout in ms or-1to block indefinitely.
Return values
TSS2_RC_SUCCESSon Success.TSS2_ESYS_RC_BAD_REFERENCEifesysContextis NULL.
π Author π
Generated automatically by Doxygen for tpm2-tss from the source code. π
π cute sign-off: this pageβs source/version is tpm2-tss, Version 4.1.5 β and thereβs no separate date printed on the original, so Iβm not inventing one, bestie π
π¦ where this page comes from
- fedora 44: tpm2-tss-devel 4.1.5-1.fc44 Β· BSD-2-Clause
- fedora 44: tpm2-tss-devel 4.1.5-1.fc44 Β· BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms