Fapi_GetRandom(3)
π Fapi_GetRandom(3) β¨
okay so this is a page from the Library Functions Manual, bestie β yes, a real manpage, and yes it's about grabbing random bytes from your TPM. it's giving "crypto snack time". let's go π
πΈ NAME πΈ
Fapi_GetRandom β literally just Fapi_GetRandom. that's the whole name. iconic minimalism, no notes π
β¨ SYNOPSIS β¨
π¦ Functions
TSS2_RC Fapi_GetRandom (FAPI_CONTEXT *context, size_t numBytes, uint8_t
**data)
TSS2_RC Fapi_GetRandom_Async (FAPI_CONTEXT *context, size_t numBytes)
TSS2_RC Fapi_GetRandom_Finish (FAPI_CONTEXT *context, uint8_t **data)
π Detailed Description π
so these are the FAPI functions that invoke GetRandom β and you can do it either as a one-call (easy mode, one and done, slay) or in an asynchronous manner (the "start it, come back later" main-character route). pick your vibe π«Ά
π Function Documentation π
π TSS2_RC Fapi_GetRandom (FAPI_CONTEXT * context, size_t numBytes, uint8_t ** data)
the one-call function for Fapi_GetRandom β bestie, this is the whole thing in one go β¨
it creates an array with a specified number of bytes. and here's the tea: it may execute the underlying TPM command multiple times if the requested number of bytes is too big. like, the TPM's not gonna do it all in one breath, so it just... keeps asking. no cap π₯
π Parameters
contextβ theFAPI_CONTEXTnumBytesβ the number of bytes requested from the TPMdataβ the array of random bytes returned from the TPM
π Return values
TSS2_RC_SUCCESSif the function call was a success.TSS2_FAPI_RC_BAD_REFERENCEifcontextordataisNULL.TSS2_FAPI_RC_BAD_CONTEXTif context corruption is detected.TSS2_FAPI_RC_BAD_VALUEifnumBytesis0.TSS2_FAPI_RC_BAD_SEQUENCEif the context has an asynchronous operation already pending.TSS2_FAPI_RC_IO_ERRORif the data cannot be saved.TSS2_FAPI_RC_MEMORYif the FAPI cannot allocate enough memory for internal operations or return parameters.TSS2_FAPI_RC_NO_TPMif FAPI was initialized in no-TPM-mode via its config file.TSS2_FAPI_RC_PATH_NOT_FOUNDif a FAPI object path was not found during authorization.TSS2_FAPI_RC_KEY_NOT_FOUNDif a key was not found.TSS2_FAPI_RC_TRY_AGAINif an I/O operation is not finished yet and this function needs to be called again.TSS2_FAPI_RC_GENERAL_FAILUREif an internal error occurred.TSS2_FAPI_RC_AUTHORIZATION_UNKNOWNif a required authorization callback is not set.TSS2_FAPI_RC_AUTHORIZATION_FAILEDif the authorization attempt fails.TSS2_FAPI_RC_POLICY_UNKNOWNif policy search for a certain policy digest was not successful.TSS2_ESYS_RC_*possible error codes of ESAPI.TSS2_FAPI_RC_NOT_PROVISIONEDFAPI was not provisioned.TSS2_FAPI_RC_BAD_PATHif the path is used in inappropriate context or contains illegal characters.
π§ TSS2_RC Fapi_GetRandom_Async (FAPI_CONTEXT * context, size_t numBytes)
the asynchronous function for Fapi_GetRandom. same energy, but you're not waiting around for it πΈ
it creates an array with a specified number of bytes, and yeah β it may execute the underlying TPM command multiple times if the requested number of bytes is too big. same deal as before, fr fr.
π‘ call Fapi_GetRandom_Finish to finish the execution of this command. don't leave it hanging, bestie π
π Parameters
contextβ theFAPI_CONTEXTnumBytesβ the number of bytes requested from the TPM
π Return values
TSS2_RC_SUCCESSif the function call was a success.TSS2_FAPI_RC_BAD_REFERENCEifcontextisNULL.TSS2_FAPI_RC_BAD_CONTEXTif context corruption is detected.TSS2_FAPI_RC_BAD_VALUEifnumBytesis0.TSS2_FAPI_RC_BAD_SEQUENCEif the context has an asynchronous operation already pending.TSS2_FAPI_RC_IO_ERRORif the data cannot be saved.TSS2_FAPI_RC_MEMORYif the FAPI cannot allocate enough memory for internal operations or return parameters.TSS2_FAPI_RC_NO_TPMif FAPI was initialized in no-TPM-mode via its config file.TSS2_FAPI_RC_PATH_NOT_FOUNDif a FAPI object path was not found during authorization.TSS2_FAPI_RC_KEY_NOT_FOUNDif a key was not found.TSS2_FAPI_RC_NOT_PROVISIONEDFAPI was not provisioned.TSS2_FAPI_RC_BAD_PATHif the path is used in inappropriate context or contains illegal characters.
π TSS2_RC Fapi_GetRandom_Finish (FAPI_CONTEXT * context, uint8_t ** data)
the asynchronous finish function for Fapi_GetRandom β the part where you come back and collect your little gift π
π«Ά this function should be called after a previous Fapi_GetRandom_Async. like, that's the whole point, okay?
π Parameters
contextβ theFAPI_CONTEXTdataβ the array of random bytes returned from the TPM
π Return values
TSS2_RC_SUCCESSif the function call was a success.TSS2_FAPI_RC_BAD_REFERENCEifcontextordataisNULL.TSS2_FAPI_RC_BAD_CONTEXTif context corruption is detected.TSS2_FAPI_RC_BAD_SEQUENCEif the context has an asynchronous operation already pending.TSS2_FAPI_RC_IO_ERRORif the data cannot be saved.TSS2_FAPI_RC_MEMORYif the FAPI cannot allocate enough memory for internal operations or return parameters.TSS2_FAPI_RC_TRY_AGAINif the asynchronous operation is not yet complete. Call this function again later.TSS2_FAPI_RC_GENERAL_FAILUREif an internal error occurred.TSS2_FAPI_RC_BAD_VALUEif an invalid value was passed into the function.TSS2_FAPI_RC_PATH_NOT_FOUNDif a FAPI object path was not found during authorization.TSS2_FAPI_RC_KEY_NOT_FOUNDif a key was not found.TSS2_FAPI_RC_AUTHORIZATION_UNKNOWNif a required authorization callback is not set.TSS2_FAPI_RC_AUTHORIZATION_FAILEDif the authorization attempt fails.TSS2_FAPI_RC_POLICY_UNKNOWNif policy search for a certain policy digest was not successful.TSS2_ESYS_RC_*possible error codes of ESAPI.TSS2_FAPI_RC_NOT_PROVISIONEDFAPI was not provisioned.TSS2_FAPI_RC_BAD_PATHif the path is used in inappropriate context or contains illegal characters.
π¦ Author π¦
Generated automatically by Doxygen for tpm2-tss from the source code. not me being auto-generated by Doxygen π she's literally built different π
and that's the page, bestie π«Ά mwah π
this masterpiece of automated documentation is served up courtesy of tpm2-tss β Version 4.1.5 β dated on the Fapi_GetRandom(3) page, periodt β¨π
π¦ 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