tpm2-tss  3.2.0
TPM Software stack 2.0 TCG spec compliant implementation
Policy callback functions.

Functions

TSS2_RC ifapi_branch_selection (TPML_POLICYBRANCHES *branches, size_t *branch_idx, void *userdata)
 
TSS2_RC ifapi_exec_auth_nv_policy (TPM2B_NV_PUBLIC *nv_public, TPMI_ALG_HASH hash_alg, void *userdata)
 
TSS2_RC ifapi_get_duplicate_name (TPM2B_NAME *name, void *userdata)
 
TSS2_RC ifapi_get_key_public (const char *path, TPMT_PUBLIC *public, void *ctx)
 
TSS2_RC ifapi_get_nv_public (const char *path, TPM2B_NV_PUBLIC *nv_public, void *ctx)
 
TSS2_RC ifapi_get_object_name (const char *path, TPM2B_NAME *name, void *ctx)
 
TSS2_RC ifapi_policy_action (const char *action, void *userdata)
 
TSS2_RC ifapi_policyeval_cbauth (TPM2B_NAME *name, ESYS_TR *object_handle, ESYS_TR *auth_handle, ESYS_TR *authSession, void *userdata)
 
TSS2_RC ifapi_read_pcr (TPMS_PCR_SELECT *pcr_select, TPML_PCR_SELECTION *pcr_selection, TPML_PCRVALUES **pcr_values, void *ctx)
 

Detailed Description

Provides internal callbacks functions for policy execution.

Function Documentation

◆ ifapi_branch_selection()

TSS2_RC ifapi_branch_selection ( TPML_POLICYBRANCHES branches,
size_t *  branch_idx,
void *  userdata 
)

Callback for branch selection of policy or.

Parameters
[in]branchesThe list of policy branches.
[out]branch_idxThe index of the selcted branch.
[in,out]userdataThe Fapi context which will be used for keystore access, and storing the policy execution state. the io state.
Return values
TSS2_RC_SUCCESSon success.
TSS2_FAPI_RC_BAD_REFERENCEif context is NULL.
TSS2_FAPI_RC_AUTHORIZATION_UNKNOWNif no branch selection callback is defined. This callback will be needed of or policies which have to be executed.
TSS2_FAPI_RC_AUTHORIZATION_FAILEDif the computed branch index delivered by the callback does not identify a branch.

◆ ifapi_exec_auth_nv_policy()

TSS2_RC ifapi_exec_auth_nv_policy ( TPM2B_NV_PUBLIC *  nv_public,
TPMI_ALG_HASH  hash_alg,
void *  userdata 
)

Callback for executing a policy identified by a digest stored in a nv object.

Parameters
[in]nv_publicthe public data of the nv object which stores the digest of the authorized policy.
[in]hash_algThe hash algorithm used for policy computation.
[in]userdataThe user context to retrieve the policy.
Return values
TSS2_RC_SUCCESSon success.
TSS2_FAPI_RC_MEMORYif it's not possible to allocate enough memory.
TSS2_FAPI_RC_BAD_REFERENCEIf no user data id passed or context stack is not initialized.
TSS2_FAPI_RC_IO_ERRORIf an error occurs during access to the policy store.
TSS2_FAPI_RC_PATH_NOT_FOUNDIf a policy for a certain path was not found.
TSS2_FAPI_RC_POLICY_UNKNOWNIf policy search for a certain policy digest was not successful.
TPM2_RC_BAD_AUTHIf the authentication for an object needed for policy execution fails.
TSS2_FAPI_RC_BAD_VALUEif an invalid value was passed into the function.
TSS2_FAPI_RC_TRY_AGAINif an I/O operation is not finished yet and this function needs to be called again.
TSS2_FAPI_RC_BAD_SEQUENCEif the context has an asynchronous operation already pending.
TSS2_FAPI_RC_KEY_NOT_FOUNDif a key was not found.
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_ESYS_RC_*possible error codes of ESAPI.
TSS2_FAPI_RC_BAD_PATHif the path is used in inappropriate context or contains illegal characters.
TSS2_FAPI_RC_NOT_PROVISIONEDFAPI was not provisioned.

◆ ifapi_get_duplicate_name()

TSS2_RC ifapi_get_duplicate_name ( TPM2B_NAME *  name,
void *  userdata 
)

Callback for getting the name of a key to be duplicated.

Parameters
[out]namethe name of the object to be duplicated.
[in]userdataThe user context to retrieve the key.
Return values
TSS2_RC_SUCCESSon success.
TSS2_FAPI_RC_BAD_REFERENCEif the context is not passed or the object to be duplicated is not set.

◆ ifapi_get_key_public()

TSS2_RC ifapi_get_key_public ( const char *  path,
TPMT_PUBLIC *  public,
void *  ctx 
)

Get public data of a key from keystore.

Parameters
[in]pathThe relative path of the key.
[out]publicThe caller allocated public structure.
[in,out]ctxThe context to access io and keystore module and to store the io state.
Return values
TSS2_RC_SUCCESSon success.
TSS2_FAPI_RC_IO_ERRORif the data cannot be loaded.
TSS2_FAPI_RC_MEMORYif the FAPI cannot allocate enough memory for internal operations or return parameters.
TSS2_FAPI_RC_BAD_TEMPLATEIf the loaded template is not appropriate for this operation.
TSS2_FAPI_RC_BAD_VALUEif an invalid value was passed into the function.
TSS2_FAPI_RC_TRY_AGAINif an I/O operation is not finished yet and this function needs to be called again.
TSS2_FAPI_RC_BAD_SEQUENCEif the context has an asynchronous operation already pending.
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_GENERAL_FAILUREif an internal error occurred.
TSS2_FAPI_RC_BAD_REFERENCEa invalid null pointer is passed.
TSS2_FAPI_RC_NOT_PROVISIONEDFAPI was not provisioned.
TSS2_FAPI_RC_BAD_PATHif the path is used in inappropriate context or contains illegal characters.

◆ ifapi_get_nv_public()

TSS2_RC ifapi_get_nv_public ( const char *  path,
TPM2B_NV_PUBLIC *  nv_public,
void *  ctx 
)

Get public data of a NV object from keystore.

Parameters
[in]pathThe relative path of the NV object.
[out]nv_publicThe caller allocated public structure.
[in,out]ctxThe context to access io and keystore module and to store the io state.
Return values
TSS2_RC_SUCCESSon success.
TSS2_FAPI_RC_IO_ERRORif the data cannot be loaded.
TSS2_FAPI_RC_MEMORYif the FAPI cannot allocate enough memory for internal operations or return parameters.
TSS2_FAPI_RC_BAD_TEMPLATEIf the loaded template is not appropriate for this operation.
TSS2_FAPI_RC_BAD_VALUEif an invalid value was passed into the function.
TSS2_FAPI_RC_TRY_AGAINif an I/O operation is not finished yet and this function needs to be called again.
TSS2_FAPI_RC_BAD_SEQUENCEif the context has an asynchronous operation already pending.
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_GENERAL_FAILUREif an internal error occurred.
TSS2_FAPI_RC_BAD_REFERENCEa invalid null pointer is passed.
TSS2_FAPI_RC_NOT_PROVISIONEDFAPI was not provisioned.
TSS2_FAPI_RC_BAD_PATHif the path is used in inappropriate context or contains illegal characters.

◆ ifapi_get_object_name()

TSS2_RC ifapi_get_object_name ( const char *  path,
TPM2B_NAME *  name,
void *  ctx 
)

Get TPM name of an object from key keystore.

Parameters
[in]pathThe relative path of the object.
[out]nameThe caller allocate public structure.
[in,out]ctxThe context to access io and keystore module and to store the io state.
Return values
TSS2_RC_SUCCESSon success.
TSS2_FAPI_RC_IO_ERRORif the data cannot be loaded.
TSS2_FAPI_RC_MEMORYif the FAPI cannot allocate enough memory for internal operations or return parameters.
TSS2_FAPI_RC_BAD_TEMPLATEIf the loaded template is not appropriate for this operation.
TSS2_FAPI_RC_BAD_VALUEif an invalid value was passed into the function.
TSS2_FAPI_RC_TRY_AGAINif an I/O operation is not finished yet and this function needs to be called again.
TSS2_FAPI_RC_BAD_SEQUENCEif the context has an asynchronous operation already pending.
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_GENERAL_FAILUREif an internal error occurred.
TSS2_FAPI_RC_BAD_REFERENCEa invalid null pointer is passed.
TSS2_FAPI_RC_NOT_PROVISIONEDFAPI was not provisioned.
TSS2_FAPI_RC_BAD_PATHif the path is used in inappropriate context or contains illegal characters.

◆ ifapi_policy_action()

TSS2_RC ifapi_policy_action ( const char *  action,
void *  userdata 
)

Callback for policy action.

Parameters
[in]actionThe name of the policy action.
[in,out]userdataThe Fapi context which will be used for keystore access, and storing the policy execution state. the io state.
Return values
TSS2_RC_SUCCESSon success.
TSS2_FAPI_RC_AUTHORIZATION_UNKNOWNIf the callback for branch selection is not defined. This callback will be needed of or policies have to be executed.
TSS2_FAPI_RC_BAD_REFERENCEIf no user data is passed.

◆ ifapi_policyeval_cbauth()

TSS2_RC ifapi_policyeval_cbauth ( TPM2B_NAME *  name,
ESYS_TR object_handle,
ESYS_TR auth_handle,
ESYS_TR authSession,
void *  userdata 
)

Callback for authorization of objects used by policy.

Parameters
[in]nameThe name of the object to be authorized.
[in]object_handleThe ESYS handle of the used object.
[in]auth_handlewill be used for object authorization. For keys it will we equal to the object handle.
[out]authSessionThe session used for object authorization.
[in,out]userdataThe Fapi context which will be used for keystore access, and storing the policy execution state. the io state.
Return values
TSS2_RC_SUCCESSon success.
TSS2_FAPI_RC_BAD_REFERENCEif context or policy is NULL.
TSS2_FAPI_RC_MEMORYif memory allocation failed.
TSS2_FAPI_RC_TRY_AGAINif the asynchronous operation is not yet complete. Call this function again later.
TSS2_FAPI_RC_BAD_SEQUENCEif the context has an asynchronous operation already pending.
TSS2_FAPI_RC_PATH_NOT_FOUNDIf a policy was not found.
TSS2_FAPI_RC_KEY_NOT_FOUNDIf a key was not found.
TSS2_FAPI_RC_IO_ERRORIf an IO error occurred during reading a policy or a key.
TSS2_FAPI_RC_GENERAL_FAILUREIf an error in an used library occurred.
TSS2_FAPI_RC_BAD_VALUEif an invalid value was passed into the function.
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_BAD_PATHif the path is used in inappropriate context or contains illegal characters.
TSS2_FAPI_RC_NOT_PROVISIONEDFAPI was not provisioned.

◆ ifapi_read_pcr()

TSS2_RC ifapi_read_pcr ( TPMS_PCR_SELECT *  pcr_select,
TPML_PCR_SELECTION *  pcr_selection,
TPML_PCRVALUES **  pcr_values,
void *  ctx 
)

Read values of PCR registers and clear selection.

Parameters
[in,out]pcr_selectThe registers to be read (bank selection from profile).
[in,out]pcr_selectionThe registers to be read (with bank selection).
[out]pcr_valuesThe callee-allocated public structure.
[in,out]ctxThe context to access io and keystore module and to store the io state.
Return values
TSS2_RC_SUCCESSon success.
TSS2_FAPI_RC_BAD_VALUEif the input parameters had inappropriate values.
TSS2_FAPI_RC_TRY_AGAINif the asynchronous operation is not yet complete. Call this function again later.
TSS2_FAPI_RC_MEMORYif memory allocation failed.
TSS2_FAPI_RC_BAD_SEQUENCEif the context has an asynchronous operation already pending.