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

Functions

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_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)
 

Detailed Description

Provides internal callbacks functions for policy execution.

Function Documentation

◆ 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_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.