Policy store module
Feature API » Internals of Feature API

## Functions

TSS2_RC | ifapi_policy_delete (IFAPI_POLICY_STORE *pstore, char *path)
TSS2_RC | ifapi_policy_store_initialize (IFAPI_POLICY_STORE *pstore, const char *config_policydir)
TSS2_RC | ifapi_policy_store_load_async (IFAPI_POLICY_STORE *pstore, IFAPI_IO *io, const char *path)
TSS2_RC | ifapi_policy_store_load_finish (IFAPI_POLICY_STORE *pstore, IFAPI_IO *io, TPMS_POLICY *policy)
TSS2_RC | ifapi_policy_store_store_async (IFAPI_POLICY_STORE *pstore, IFAPI_IO *io, const char *path, const TPMS_POLICY *policy)
TSS2_RC | ifapi_policy_store_store_finish (IFAPI_POLICY_STORE *pstore, IFAPI_IO *io)

## Detailed Description

Provides internal fapi functions for reading and writing to the policy store.

## Function Documentation

## ifapi_policy_delete()

TSS2_RC ifapi_policy_delete | ( | IFAPI_POLICY_STORE * | pstore,
|  | char * | path )

Remove file storing a policy object.

Parameters

  [in] | pstore | The policy directory.
  [in] | path | The relative name of the object be removed.

Return values

  TSS2_RC_SUCCESS | On success.
  TSS2_FAPI_RC_MEMORY | If memory could not be allocated.
  TSS2_FAPI_RC_PATH_NOT_FOUND | If no file is found in policy store.
  TSS2_FAPI_RC_IO_ERROR | If the file can't be removed.

## ifapi_policy_store_initialize()

TSS2_RC ifapi_policy_store_initialize | ( | IFAPI_POLICY_STORE * | pstore,
|  | const char * | config_policydir )

Store policy store parameters in the policy store context.

Also the user directory will be created if it does not exist.

Parameters

  [out] | pstore | The keystore to be initialized.
  [in] | config_policydir | The configured policy directory.

Return values

  TSS2_RC_SUCCESS | If the keystore can be initialized.
  TSS2_FAPI_RC_IO_ERROR | If the policy store can't be initialized.
  TSS2_FAPI_RC_MEMORY | if memory could not be allocated.
  TSS2_FAPI_RC_BAD_VALUE | if an invalid value was passed into the function.
  TSS2_FAPI_RC_BAD_REFERENCE | a invalid null pointer is passed.

## ifapi_policy_store_load_async()

TSS2_RC ifapi_policy_store_load_async | ( | IFAPI_POLICY_STORE * | pstore,
|  | IFAPI_IO * | io,
|  | const char * | path )

Start loading FAPI policy from policy store.

Keys objects, NV objects, and hierarchies can be loaded.

Parameters

  [in] | pstore | The policy directory.
  [in] | io | The input/output context being used for file I/O.
  [in] | path | The relative path of the object. For keys the path will expanded if possible.

Return values

  TSS2_RC_SUCCESS | If the object can be read.
  TSS2_FAPI_RC_IO_ERROR | if an I/O error was encountered.
  TSS2_FAPI_RC_PATH_NOT_FOUND | if the file does not exist.
  TSS2_FAPI_RC_MEMORY | if memory could not be allocated to hold the read data.

## ifapi_policy_store_load_finish()

TSS2_RC ifapi_policy_store_load_finish | ( | IFAPI_POLICY_STORE * | pstore,
|  | IFAPI_IO * | io,
|  | TPMS_POLICY * | policy )

Finish loading FAPI policy from policy store.

This function needs to be called repeatedly until it does not return TSS2_FAPI_RC_TRY_AGAIN.

Parameters

  [in] | pstore | The policy context with the policy directory.
  [in,out] | io | The input/output context being used for file I/O.
  [in] | policy | The caller allocated policy which will loaded from policy store.

Return values

  TSS2_RC_SUCCESS | After successfully loading the object.
  TSS2_FAPI_RC_IO_ERROR | if an I/O error was encountered; such as the file was not found.
  TSS2_FAPI_RC_TRY_AGAIN | if the asynchronous operation is not yet complete.
  TSS2_FAPI_RC_GENERAL_FAILURE | if an internal error occurred.
  TSS2_FAPI_RC_BAD_REFERENCE | a invalid null pointer is passed.
  TSS2_FAPI_RC_BAD_VALUE | if an invalid value was passed into the function.
  TSS2_FAPI_RC_MEMORY | if not enough memory can be allocated.

## ifapi_policy_store_store_async()

TSS2_RC ifapi_policy_store_store_async | ( | IFAPI_POLICY_STORE * | pstore,
|  | IFAPI_IO * | io,
|  | const char * | path,
|  | const TPMS_POLICY * | policy )

Start writing FAPI object to the key store.

The relative path will be expanded, if the default policy directory (/policy) is not part of the path.

Parameters

  [in] | pstore | The policy context with the policy directory.
  [in] | io | The input/output context being used for file I/O.
  [in] | path | The relative path of the policy.
  [in] | policy | The policy to be written to the policy store.

Return values

  TSS2_RC_SUCCESS | If the policy is written successfully.
  TSS2_FAPI_RC_IO_ERROR | If an I/O error was encountered;
  TSS2_FAPI_RC_MEMORY | If memory could not be allocated to hold the output data.
  TSS2_FAPI_RC_BAD_REFERENCE | a invalid null pointer is passed.
  TSS2_FAPI_RC_BAD_VALUE | if an invalid value was passed into the function.

## ifapi_policy_store_store_finish()

TSS2_RC ifapi_policy_store_store_finish | ( | IFAPI_POLICY_STORE * | pstore,
|  | IFAPI_IO * | io )

Finish writing a FAPI policy object to the policy store.

This function needs to be called repeatedly until it does not return TSS2_FAPI_RC_TRY_AGAIN.

Parameters

  [in] | pstore | The policy context with the policy directory.
  [in,out] | io | The input/output context being used for file I/O.

Return values

  TSS2_RC_SUCCESS | if the function call was a success.
  TSS2_FAPI_RC_IO_ERROR | if an I/O error was encountered; such as the file was not found.
  TSS2_FAPI_RC_TRY_AGAIN | if the asynchronous operation is not yet complete. Call this function again later.