Esys_HMAC(3)

πŸ’– NAME πŸ’–

ok so bestie, welcome to Esys_HMAC(3) β€” straight out of the Library Functions Manual, and it's literally the ESAPI function for the TPM2_HMAC command. that's the whole vibe. HMACs. from your TPM. through ESAPI. slay 🫢


✨ SYNOPSIS ✨

🌈 Functions

no cap, there are exactly three of them, and here's the tea:

TSS2_RC Esys_HMAC_Async (ESYS_CONTEXT *esysContext, ESYS_TR handle,
    ESYS_TR shandle1, ESYS_TR shandle2, ESYS_TR shandle3, const
    TPM2B_MAX_BUFFER *buffer, TPMI_ALG_HASH hashAlg)
TSS2_RC Esys_HMAC (ESYS_CONTEXT *esysContext, ESYS_TR handle, ESYS_TR
    shandle1, ESYS_TR shandle2, ESYS_TR shandle3, const TPM2B_MAX_BUFFER
    *buffer, TPMI_ALG_HASH hashAlg, TPM2B_DIGEST **outHMAC)
TSS2_RC Esys_HMAC_Finish (ESYS_CONTEXT *esysContext, TPM2B_DIGEST
    **outHMAC)

🌸 Detailed Description 🌸

okay so the whole point of this page: it's the ESAPI function that invokes the TPM2_HMAC command. and you get to choose your fighter β€” either the one-call route (send it, sit there, get your answer) or the asynchronous manner (send it and bounce, come back for the answer later). two paths, both iconic. πŸ’…


πŸŽ€ Function Documentation πŸŽ€

πŸ¦‹ TSS2_RC Esys_HMAC (ESYS_CONTEXT * esysContext, ESYS_TR handle, ESYS_TR shandle1, ESYS_TR shandle2, ESYS_TR shandle3, const TPM2B_MAX_BUFFER * buffer, TPMI_ALG_HASH hashAlg, TPM2B_DIGEST ** outHMAC)

One-Call function for TPM2_HMAC β€” main character energy tbh πŸ‘‘

so this one invokes the TPM2_HMAC command in a one-call variant. what that means in group-chat terms: this function will block until the TPM response is available. yes bestie, it just sits there and waits. all input parameters are const. and the memory for non-simple output parameters? that's allocated by the function implementation β€” not your problem, not your malloc. πŸŽ€

Parameters

  • esysContext β€” The ESYS_CONTEXT. your whole context, your whole world.
  • handle β€” Handle for the symmetric signing key providing the HMAC key. iykyk, this is the key holding the actual HMAC key.
  • shandle1 β€” Session handle for authorization of handle
  • shandle2 β€” Second session handle.
  • shandle3 β€” Third session handle.
  • buffer β€” HMAC data.
  • hashAlg β€” Algorithm to use for HMAC.
  • outHMAC β€” The returned HMAC in a sized buffer. (callee-allocated)

Return values

  • TSS2_RC_SUCCESS β€” if the function call was a success. πŸŽ‰
  • TSS2_ESYS_RC_BAD_REFERENCE β€” if the esysContext or required input pointers or required output handle references are NULL.
  • TSS2_ESYS_RC_BAD_CONTEXT β€” if esysContext corruption 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. girl, wait your turn.
  • 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. 🚩
  • 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 the ESYS_TR objects are unknown to the ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects are ESYS_TR_NONE.
  • TSS2_RCs produced by lower layers of the software stack β€” may be returned to the caller unaltered unless handled internally. surprises happen, bestie.

🧚 TSS2_RC Esys_HMAC_Async (ESYS_CONTEXT * esysContext, ESYS_TR handle, ESYS_TR shandle1, ESYS_TR shandle2, ESYS_TR shandle3, const TPM2B_MAX_BUFFER * buffer, TPMI_ALG_HASH hashAlg)

Asynchronous function for TPM2_HMAC β€” the "i'll text you later" of TPM calls ✨

this one invokes the TPM2_HMAC command in a asynchronous variant. translation: the function will return as soon as the command has been sent downwards the stack to the TPM. no waiting, no blocking, no being clingy. all input parameters are const. and in order to retrieve the TPM's response, you call Esys_HMAC_Finish. that's the reunion episode. πŸ’–

Parameters

  • esysContext β€” The ESYS_CONTEXT.
  • handle β€” Handle for the symmetric signing key providing the HMAC key.
  • shandle1 β€” Session handle for authorization of handle
  • shandle2 β€” Second session handle.
  • shandle3 β€” Third session handle.
  • buffer β€” HMAC data.
  • hashAlg β€” Algorithm to use for HMAC.

Return values

  • ESYS_RC_SUCCESS β€” if the function call was a success. ⭐
  • TSS2_ESYS_RC_BAD_REFERENCE β€” if the esysContext or required input pointers or required output handle references are NULL.
  • TSS2_ESYS_RC_BAD_CONTEXT β€” if esysContext corruption 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 the ESYS_TR objects are unknown to the ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects are ESYS_TR_NONE.

πŸ“ TSS2_RC Esys_HMAC_Finish (ESYS_CONTEXT * esysContext, TPM2B_DIGEST ** outHMAC)

Asynchronous finish function for TPM2_HMAC β€” the part where you find out what happened 😭

this function returns the results of a TPM2_HMAC command invoked via Esys_HMAC_Finish. 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. don't care? don't pass it. lowkey freeing. πŸ•ŠοΈ

Parameters

  • esysContext β€” The ESYS_CONTEXT.
  • outHMAC β€” The returned HMAC in a sized buffer. (callee-allocated)

Return values

  • TSS2_RC_SUCCESS β€” on success
  • ESYS_RC_SUCCESS β€” if the function call was a success.
  • TSS2_ESYS_RC_BAD_REFERENCE β€” if the esysContext or required input pointers or required output handle references are NULL.
  • TSS2_ESYS_RC_BAD_CONTEXT β€” if esysContext corruption 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 ready yet, try again. ⏳
  • 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.
🫢 friendly reminder bestie: those error codes are the real ones, so don't go inventing new ones in your switch statements. mwah.

πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for tpm2-tss from the source code. yes, a robot wrote the source of truth and i merely gave it a personality. πŸ’…


and that's the page, babes πŸŽ€ β€” brought to you by tpm2-tss, Version 4.1.5, and this whole Esys_HMAC(3) moment. go HMAC something iconic. πŸŒˆβœ¨πŸ¦‹

πŸ“¦ where this page comes from