Policy callback functions.
Feature API » Internals of Feature API

## 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] | name | the name of the object to be duplicated.
  [in] | userdata | The user context to retrieve the key.

Return values

  TSS2_RC_SUCCESS | on success.
  TSS2_FAPI_RC_BAD_REFERENCE | if 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] | path | The relative path of the key.
  [out] | public | The caller allocated public structure.
  [in,out] | ctx | The context to access io and keystore module and to store the io state.

Return values

  TSS2_RC_SUCCESS | on success.
  TSS2_FAPI_RC_IO_ERROR | if the data cannot be loaded.
  TSS2_FAPI_RC_MEMORY | if the FAPI cannot allocate enough memory for internal operations or return parameters.
  TSS2_FAPI_RC_BAD_TEMPLATE | If the loaded template is not appropriate for this operation.
  TSS2_FAPI_RC_BAD_VALUE | if an invalid value was passed into the function.
  TSS2_FAPI_RC_TRY_AGAIN | if an I/O operation is not finished yet and this function needs to be called again.
  TSS2_FAPI_RC_BAD_SEQUENCE | if the context has an asynchronous operation already pending.
  TSS2_FAPI_RC_PATH_NOT_FOUND | if a FAPI object path was not found during authorization.
  TSS2_FAPI_RC_KEY_NOT_FOUND | if a key was not found.
  TSS2_FAPI_RC_GENERAL_FAILURE | if an internal error occurred.
  TSS2_FAPI_RC_BAD_REFERENCE | a invalid null pointer is passed.
  TSS2_FAPI_RC_NOT_PROVISIONED | FAPI was not provisioned.
  TSS2_FAPI_RC_BAD_PATH | if 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] | path | The relative path of the object.
  [out] | name | The caller allocate public structure.
  [in,out] | ctx | The context to access io and keystore module and to store the io state.

Return values

  TSS2_RC_SUCCESS | on success.
  TSS2_FAPI_RC_IO_ERROR | if the data cannot be loaded.
  TSS2_FAPI_RC_MEMORY | if the FAPI cannot allocate enough memory for internal operations or return parameters.
  TSS2_FAPI_RC_BAD_TEMPLATE | If the loaded template is not appropriate for this operation.
  TSS2_FAPI_RC_BAD_VALUE | if an invalid value was passed into the function.
  TSS2_FAPI_RC_TRY_AGAIN | if an I/O operation is not finished yet and this function needs to be called again.
  TSS2_FAPI_RC_BAD_SEQUENCE | if the context has an asynchronous operation already pending.
  TSS2_FAPI_RC_PATH_NOT_FOUND | if a FAPI object path was not found during authorization.
  TSS2_FAPI_RC_KEY_NOT_FOUND | if a key was not found.
  TSS2_FAPI_RC_GENERAL_FAILURE | if an internal error occurred.
  TSS2_FAPI_RC_BAD_REFERENCE | a invalid null pointer is passed.
  TSS2_FAPI_RC_NOT_PROVISIONED | FAPI was not provisioned.
  TSS2_FAPI_RC_BAD_PATH | if 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] | action | The name of the policy action.
  [in,out] | userdata | The Fapi context which will be used for keystore access, and storing the policy execution state. the io state.

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 of or policies have to be executed.
  TSS2_FAPI_RC_BAD_REFERENCE | If 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] | name | The name of the object to be authorized.
  [in] | object_handle | The ESYS handle of the used object.
  [in] | auth_handle | will be used for object authorization. For keys it will we equal to the object handle.
  [out] | authSession | The session used for object authorization.
  [in,out] | userdata | The Fapi context which will be used for keystore access, and storing the policy execution state. the io state.

Return values

  TSS2_RC_SUCCESS | on success.
  TSS2_FAPI_RC_BAD_REFERENCE | if context or policy is NULL.
  TSS2_FAPI_RC_MEMORY | if memory allocation failed.
  TSS2_FAPI_RC_TRY_AGAIN | if the asynchronous operation is not yet complete. Call this function again later.
  TSS2_FAPI_RC_BAD_SEQUENCE | if the context has an asynchronous operation already pending.
  TSS2_FAPI_RC_PATH_NOT_FOUND | If a policy was not found.
  TSS2_FAPI_RC_KEY_NOT_FOUND | If a key was not found.
  TSS2_FAPI_RC_IO_ERROR | If an IO error occurred during reading a policy or a key.
  TSS2_FAPI_RC_GENERAL_FAILURE | If an error in an used library occurred.
  TSS2_FAPI_RC_BAD_VALUE | if an invalid value was passed into the function.
  TSS2_FAPI_RC_AUTHORIZATION_UNKNOWN | if a required authorization callback is not set.
  TSS2_FAPI_RC_AUTHORIZATION_FAILED | if the authorization attempt fails.
  TSS2_FAPI_RC_POLICY_UNKNOWN | if policy search for a certain policy digest was not successful.
  TSS2_ESYS_RC_* | possible error codes of ESAPI.
  TSS2_FAPI_RC_BAD_PATH | if the path is used in inappropriate context or contains illegal characters.
  TSS2_FAPI_RC_NOT_PROVISIONED | FAPI was not provisioned.