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

Functions

TSS2_RC get_policy_digest_idx (TPML_DIGEST_VALUES *digest_values, TPMI_ALG_HASH hashAlg, size_t *idx)
 
TSS2_RC ifapi_extend_authorization (TPMS_POLICY *policy, TPMS_POLICYAUTHORIZATION *authorization)
 
TSS2_RC ifapi_policyeval_execute (ESYS_CONTEXT *esys_ctx, IFAPI_POLICY_EXEC_CTX *current_policy)
 
TSS2_RC ifapi_policyeval_execute_prepare (IFAPI_POLICY_EXEC_CTX *pol_ctx, TPMI_ALG_HASH hash_alg, TPMS_POLICY *policy)
 

Detailed Description

Provides internal functions for policy execution.

Function Documentation

◆ get_policy_digest_idx()

TSS2_RC get_policy_digest_idx ( TPML_DIGEST_VALUES *  digest_values,
TPMI_ALG_HASH  hashAlg,
size_t *  idx 
)

Compute the index for the current digest list and clear the digest.

The list entry with the appropriate hash algorithm will be searched. The found digest will be set to zero.

Parameters
[in,out]digest_valuesThe list of policy digests and corresponding hash algorithms.
[in]hashAlgThe hash algorithm to be searched.
[out]idxThe index of the found digest.
Return values
TSS2_RC_SUCCESSon success.
TSS2_FAPI_RC_BAD_VALUEIf no appropriate digest was found in the digest list.

◆ ifapi_extend_authorization()

TSS2_RC ifapi_extend_authorization ( TPMS_POLICY policy,
TPMS_POLICYAUTHORIZATION authorization 
)

Add a new authorization to a policy.

The the signed hash computed from the policy digest and the policyRef together with the public key of the key used for signing will be stored in the policy.

Parameters
[in,out]policyThe policy to be authorized.
[in]authorizationThe structure with the signature, the policyRef and the public key.
Return values
TSS2_RC_SUCCESSon success.
TSS2_FAPI_RC_MEMORYIf the memory for the authorization list cannot be allocated.

◆ ifapi_policyeval_execute()

TSS2_RC ifapi_policyeval_execute ( ESYS_CONTEXT esys_ctx,
IFAPI_POLICY_EXEC_CTX current_policy 
)

Execute all policy commands defined by a list of policy elements.

Return values
TSS2_RC_SUCCESSon success.
TSS2_FAPI_RC_MEMORYif not enough memory can be allocated.
TSS2_FAPI_RC_BAD_VALUEIf wrong values are detected during execution.
TSS2_FAPI_RC_IO_ERRORIf an error occurs during access to the policy store.
TSS2_FAPI_RC_POLICY_UNKNOWNIf policy search for a certain policy digest was not successful.
TSS2_FAPI_RC_BAD_TEMPLATEIn a invalid policy is loaded during execution.
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_BAD_SEQUENCEif the context has an asynchronous operation already pending.
TSS2_FAPI_RC_BAD_REFERENCEa invalid null pointer is passed.
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_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_policyeval_execute_prepare()

TSS2_RC ifapi_policyeval_execute_prepare ( IFAPI_POLICY_EXEC_CTX pol_ctx,
TPMI_ALG_HASH  hash_alg,
TPMS_POLICY policy 
)

Initialize policy element list to be executed and store policy in context.

Parameters
[in]pol_ctxContext for execution of a list of policy elements.
[in]hash_algThe hash algorithm used for the policy computation.
[in,out]policyThe policy to be executed. Some policy elements will be used to store computed parameters needed for policy execution.
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_VALUEIf the computed branch index deliverd by the callback does not identify a branch.
TSS2_FAPI_RC_MEMORYif not enough memory can be allocated.
TSS2_FAPI_RC_BAD_REFERENCEa invalid null pointer is passed.
TSS2_FAPI_RC_AUTHORIZATION_FAILEDif the authorization attempt fails.