Esys_PCR_Allocate(3)
β¨ Esys_PCR_Allocate β the TPM2_PCR_Allocate ESAPI function, bestie β¨
Okay so this is from the Library Functions Manual for real, and I'm gonna walk you through it like we're texting at 2am π It's the ESAPI wrapper for the TPM2_PCR_Allocate command β the whole thing is about asking your TPM to hand out PCR banks, and there's a synced-up triple of functions that do it. Let's go π¦
πΈ NAME πΈ
Esys_PCR_Allocate β the ESAPI function for the TPM2_PCR_Allocate command. That's it, that's the vibe β¨
π SYNOPSIS π
Functions
So there's literally three of them, one for each step of the journey π
TSS2_RC Esys_PCR_Allocate_Async (ESYS_CONTEXT *esysContext, ESYS_TR
authHandle, ESYS_TR shandle1, ESYS_TR shandle2, ESYS_TR shandle3,
const TPML_PCR_SELECTION *pcrAllocation)
TSS2_RC Esys_PCR_Allocate (ESYS_CONTEXT *esysContext, ESYS_TR
authHandle, ESYS_TR shandle1, ESYS_TR shandle2, ESYS_TR shandle3,
const TPML_PCR_SELECTION *pcrAllocation, TPMI_YES_NO
*allocationSuccess, UINT32 *maxPCR, UINT32 *sizeNeeded, UINT32
*sizeAvailable)
TSS2_RC Esys_PCR_Allocate_Finish (ESYS_CONTEXT *esysContext, TPMI_YES_NO
*allocationSuccess, UINT32 *maxPCR, UINT32 *sizeNeeded, UINT32
*sizeAvailable)
π¦ Detailed Description π¦
It's an ESAPI function that invokes the TPM2_PCR_Allocate command β and you get to pick your fighter: either the one-call version, or the asynchronous manner. Both slay, just differently π₯
π Function Documentation π
π TSS2_RC Esys_PCR_Allocate (ESYS_CONTEXT * esysContext, ESYS_TR authHandle, ESYS_TR shandle1, ESYS_TR shandle2, ESYS_TR shandle3, const TPML_PCR_SELECTION * pcrAllocation, TPMI_YES_NO * allocationSuccess, UINT32 * maxPCR, UINT32 * sizeNeeded, UINT32 * sizeAvailable)
One-Call function for TPM2_PCR_Allocate
Bestie, this is the "just do it and wait" version. It invokes the TPM2_PCR_Allocate command in a one-call variant, which literally means the function will block until the TPM response is available π΄ All input parameters are const. The memory for the non-simple output parameters is allocated by the function implementation β so you don't gotta do that yourself, icon behavior tbh π«Ά
Parameters
esysContextβ theESYS_CONTEXT. Your whole world basically β¨authHandleβTPM2_RH_PLATFORM+{PP}. That's the vibe check for who's allowed in πshandle1β session handle for authorization ofauthHandleπshandle2β second session handle.shandle3β third session handle.pcrAllocationβ the requested allocation. Like your PCR wishlist πallocationSuccessβYESif the allocation succeeded. Fingers crossed fr fr π€maxPCRβ maximum number of PCR that may be in a bank.sizeNeededβ number of octets required to satisfy the request.sizeAvailableβ number of octets available. Computed before the allocation.. (yes there's a double period in the source, we respect it π)
Return values
TSS2_RC_SUCCESSβ if the function call was a success. PERIODT πTSS2_ESYS_RC_BAD_REFERENCEβ if theesysContextor required input pointers or required output handle references areNULL.TSS2_ESYS_RC_BAD_CONTEXTβ ifesysContextcorruption is detected. Something's sus πTSS2_ESYS_RC_MEMORYβ if the ESAPI cannot allocate enough memory for internal operations or return parameters.TSS2_ESYS_RC_BAD_SEQUENCEβ if the context has an asynchronous operation already pending. One thing at a time, bestie π€TSS2_ESYS_RC_INSUFFICIENT_RESPONSEβ if the TPM's response does not at least contain the tag, response length, and response code.TSS2_ESYS_RC_MALFORMED_RESPONSEβ if the TPM's response is corrupted.TSS2_ESYS_RC_RSP_AUTH_FAILEDβ if the response HMAC from the TPM did not verify. Not the HMAC πTSS2_ESYS_RC_MULTIPLE_DECRYPT_SESSIONSβ if more than one session has the 'decrypt' attribute bit set.TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONSβ if more than one session has the 'encrypt' attribute bit set.TSS2_ESYS_RC_BAD_TRβ if any of theESYS_TRobjects are unknown to theESYS_CONTEXTor are of the wrong type or if requiredESYS_TRobjects areESYS_TR_NONE.TSS2_ESYS_RC_NO_DECRYPT_PARAMβ if one of the sessions has the 'decrypt' attribute set and the command does not support encryption of the first command parameter.TSS2_ESYS_RC_NO_ENCRYPT_PARAMβ if one of the sessions has the 'encrypt' attribute set and the command does not support encryption of the first response parameter.TSS2_RCs produced by lower layers of the software stack β may be returned to the caller unaltered unless handled internally. The lower layers said "we're not changing, this is who we are" πββοΈ
π TSS2_RC Esys_PCR_Allocate_Async (ESYS_CONTEXT * esysContext, ESYS_TR authHandle, ESYS_TR shandle1, ESYS_TR shandle2, ESYS_TR shandle3, const TPML_PCR_SELECTION * pcrAllocation)
Asynchronous function for TPM2_PCR_Allocate
This one invokes the TPM2_PCR_Allocate command in a asynchronous variant, meaning the function will return as soon as the command has been sent downwards the stack to the TPM. She's fast, she's efficient, she doesn't wait around πββοΈπ¨ All input parameters are const. In order to retrieve the TPM's response, call Esys_PCR_Allocate_Finish β that's the whole two-step, iykyk π
Parameters
esysContextβ theESYS_CONTEXT.authHandleβTPM2_RH_PLATFORM+{PP}.shandle1β session handle for authorization ofauthHandleπshandle2β second session handle.shandle3β third session handle.pcrAllocationβ the requested allocation.
Return values
ESYS_RC_SUCCESSβ if the function call was a success. (Notice it'sESYS_RC_SUCCESShere, notTSS2_RC_SUCCESSβ we keep it exactly as written, no editing the source, bestie π)TSS2_ESYS_RC_BAD_REFERENCEβ if theesysContextor required input pointers or required output handle references areNULL.TSS2_ESYS_RC_BAD_CONTEXTβ ifesysContextcorruption is detected.TSS2_ESYS_RC_MEMORYβ if the ESAPI cannot allocate enough memory for internal operations or return parameters.TSS2_RCs produced by lower layers of the software stack β may be returned to the caller unaltered unless handled internally.TSS2_ESYS_RC_MULTIPLE_DECRYPT_SESSIONSβ if more than one session has the 'decrypt' attribute bit set.TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONSβ if more than one session has the 'encrypt' attribute bit set.TSS2_ESYS_RC_BAD_TRβ if any of theESYS_TRobjects are unknown to theESYS_CONTEXTor are of the wrong type or if requiredESYS_TRobjects areESYS_TR_NONE.TSS2_ESYS_RC_NO_DECRYPT_PARAMβ if one of the sessions has the 'decrypt' attribute set and the command does not support encryption of the first command parameter.TSS2_ESYS_RC_NO_ENCRYPT_PARAMβ if one of the sessions has the 'encrypt' attribute set and the command does not support encryption of the first response parameter.
β TSS2_RC Esys_PCR_Allocate_Finish (ESYS_CONTEXT * esysContext, TPMI_YES_NO * allocationSuccess, UINT32 * maxPCR, UINT32 * sizeNeeded, UINT32 * sizeAvailable)
Asynchronous finish function for TPM2_PCR_Allocate
The grand finale π¬ This function returns the results of a TPM2_PCR_Allocate command invoked via Esys_PCR_Allocate_Finish. (Yep, the doc says it was invoked via Esys_PCR_Allocate_Finish β we're not touching that, it's canon π) All non-simple output parameters are allocated by the function's implementation. And here's the cute part: NULL can be passed for every output parameter if the value is not required β lowkey freeing, right? π¦
Parameters
esysContextβ theESYS_CONTEXT.allocationSuccessβYESif the allocation succeeded.maxPCRβ maximum number of PCR that may be in a bank.sizeNeededβ number of octets required to satisfy the request.sizeAvailableβ number of octets available. Computed before the allocation.. (double period again, iconic π)
Return values
TSS2_RC_SUCCESSβ on success πESYS_RC_SUCCESSβ if the function call was a success.TSS2_ESYS_RC_BAD_REFERENCEβ if theesysContextor required input pointers or required output handle references areNULL.TSS2_ESYS_RC_BAD_CONTEXTβ ifesysContextcorruption is detected.TSS2_ESYS_RC_MEMORYβ if the ESAPI cannot allocate enough memory for internal operations or return parameters.TSS2_ESYS_RC_BAD_SEQUENCEβ if the context has an asynchronous operation already pending.TSS2_ESYS_RC_TRY_AGAINβ if the timeout counter expires before the TPM response is received. She's not ghosting you, she's just slow πTSS2_ESYS_RC_INSUFFICIENT_RESPONSEβ if the TPM's response does not at least contain the tag, response length, and response code.TSS2_ESYS_RC_RSP_AUTH_FAILEDβ if the response HMAC from the TPM did not verify.TSS2_ESYS_RC_MALFORMED_RESPONSEβ if the TPM's response is corrupted.TSS2_RCs produced by lower layers of the software stack β may be returned to the caller unaltered unless handled internally.
β οΈ Real talk for a sec: these return codes are literally the whole map of "what went wrong." Don't sleep onTSS2_ESYS_RC_BAD_SEQUENCEandTSS2_ESYS_RC_TRY_AGAINβ they're the ones you'll actually be googling at 3am, ngl π
π Author π
Generated automatically by Doxygen for tpm2-tss from the source code. Not a human, no cap β it's a whole robot author π€β¨
π«Ά And that's the page!! Every flag, every return code, every double period, preserved with love. Byeee π
tpm2-tss β Version 4.1.5 β Esys_PCR_Allocate(3), mwah π
π¦ 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