Policy execution functions.
Feature API » Internals of Feature API

## 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_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_values | The list of policy digests and corresponding hash algorithms.
  [in] | hashAlg | The hash algorithm to be searched.
  [out] | idx | The index of the found digest.

Return values

  TSS2_RC_SUCCESS | on success.
  TSS2_FAPI_RC_BAD_VALUE | If 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] | policy | The policy to be authorized.
  [in] | authorization | The structure with the signature, the policyRef and the public key.

Return values

  TSS2_RC_SUCCESS | on success.
  TSS2_FAPI_RC_MEMORY | If the memory for the authorization list cannot be allocated.

## 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_ctx | Context for execution of a list of policy elements.
  [in] | hash_alg | The hash algorithm used for the policy computation.
  [in,out] | policy | The policy to be executed. Some policy elements will be used to store computed parameters needed for policy execution.

Return values

  TSS2_RC_SUCCESS | on success.
  TSS2_FAPI_RC_AUTHORIZATION_UNKNOWN | If the callback for branch selection is not defined. This callback will be needed if or policies have to be executed.
  TSS2_FAPI_RC_BAD_VALUE | If the computed branch index delivered by the callback does not identify a branch.
  TSS2_FAPI_RC_MEMORY | if not enough memory can be allocated.
  TSS2_FAPI_RC_BAD_REFERENCE | a invalid null pointer is passed.
  TSS2_FAPI_RC_AUTHORIZATION_FAILED | if the authorization attempt fails.