tpm2-tss  master
TPM Software stack 2.0 TCG spec compliant implementation

Functions

void ifapi_cleanup_ifapi_duplicate (IFAPI_DUPLICATE *duplicate)
 
void ifapi_cleanup_ifapi_ext_pub_key (IFAPI_EXT_PUB_KEY *key)
 
void ifapi_cleanup_ifapi_hierarchy (IFAPI_HIERARCHY *hierarchy)
 
void ifapi_cleanup_ifapi_key (IFAPI_KEY *key)
 
void ifapi_cleanup_ifapi_keystore (IFAPI_KEYSTORE *keystore)
 
void ifapi_cleanup_ifapi_nv (IFAPI_NV *nv)
 
void ifapi_cleanup_ifapi_object (IFAPI_OBJECT *object)
 
TSS2_RC ifapi_copy_ifapi_key (IFAPI_KEY *dest, const IFAPI_KEY *src)
 
TSS2_RC ifapi_copy_ifapi_key_object (IFAPI_OBJECT *dest, const IFAPI_OBJECT *src)
 
TSS2_RC ifapi_keystore_delete (IFAPI_KEYSTORE *keystore, char *path)
 
TSS2_RC ifapi_keystore_initialize (IFAPI_KEYSTORE *keystore, const char *config_systemdir, const char *config_userdir, const char *config_defaultprofile)
 
TSS2_RC ifapi_keystore_list_all (IFAPI_KEYSTORE *keystore, const char *searchpath, char ***results, size_t *numresults)
 
TSS2_RC ifapi_keystore_load_async (IFAPI_KEYSTORE *keystore, IFAPI_IO *io, const char *path)
 
TSS2_RC ifapi_keystore_load_finish (IFAPI_KEYSTORE *keystore, IFAPI_IO *io, IFAPI_OBJECT *object)
 
TSS2_RC ifapi_keystore_remove_directories (IFAPI_KEYSTORE *keystore, const char *dir_name)
 
TSS2_RC ifapi_keystore_search_nv_obj (IFAPI_KEYSTORE *keystore, IFAPI_IO *io, TPM2B_NV_PUBLIC *nv_public, char **found_path)
 
TSS2_RC ifapi_keystore_search_obj (IFAPI_KEYSTORE *keystore, IFAPI_IO *io, TPM2B_NAME *name, char **found_path)
 
TSS2_RC ifapi_keystore_store_async (IFAPI_KEYSTORE *keystore, IFAPI_IO *io, const char *path, const IFAPI_OBJECT *object)
 
TSS2_RC ifapi_copy_ifapi_hierarchy (IFAPI_HIERARCHY *dest, const IFAPI_HIERARCHY *src)
 
TSS2_RC ifapi_copy_ifapi_hierarchy_object (IFAPI_OBJECT *dest, const IFAPI_OBJECT *src)
 
TSS2_RC ifapi_keystore_object_does_not_exist (IFAPI_KEYSTORE *keystore, const char *path, const IFAPI_OBJECT *object)
 

Detailed Description

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

Function Documentation

◆ ifapi_cleanup_ifapi_duplicate()

void ifapi_cleanup_ifapi_duplicate ( IFAPI_DUPLICATE duplicate)

Free memory allocated during deserialization of a duplicate object.

The duplicate object will not be freed (might be declared on the stack).

Parameters
[in]duplicateThe duplicate object to be cleaned up.

◆ ifapi_cleanup_ifapi_ext_pub_key()

void ifapi_cleanup_ifapi_ext_pub_key ( IFAPI_EXT_PUB_KEY key)

Free memory allocated during deserialization of a pubkey object.

The pubkey will not be freed (might be declared on the stack).

Parameters
[in]keyThe pubkey object to be cleaned up.

◆ ifapi_cleanup_ifapi_hierarchy()

void ifapi_cleanup_ifapi_hierarchy ( IFAPI_HIERARCHY hierarchy)

Free memory allocated during deserialization of a hierarchy object.

The hierarchy object will not be freed (might be declared on the stack).

Parameters
[in]hierarchyThe hierarchy object to be cleaned up.

◆ ifapi_cleanup_ifapi_key()

void ifapi_cleanup_ifapi_key ( IFAPI_KEY key)

Free memory allocated during deserialization of a key object.

The key will not be freed (might be declared on the stack).

Parameters
[in]keyThe key object to be cleaned up.

◆ ifapi_cleanup_ifapi_keystore()

void ifapi_cleanup_ifapi_keystore ( IFAPI_KEYSTORE keystore)

Free keystore related memory allocated during FAPI initialization.

The keystore object will not be freed (might be declared on the stack).

Parameters
[in]keystoreThe kystore object to be cleaned up.

◆ ifapi_cleanup_ifapi_nv()

void ifapi_cleanup_ifapi_nv ( IFAPI_NV nv)

Free memory allocated during deserialization of a nv object.

The nv object will not be freed (might be declared on the stack).

Parameters
[in]nvThe nv object to be cleaned up.

◆ ifapi_cleanup_ifapi_object()

void ifapi_cleanup_ifapi_object ( IFAPI_OBJECT object)

Free memory allocated during deserialization of object.

The object will not be freed (might be declared on the stack).

Parameters
[in]objectThe object to be cleaned up.

◆ ifapi_copy_ifapi_hierarchy()

ifapi_copy_ifapi_hierarchy ( IFAPI_HIERARCHY dest,
const IFAPI_HIERARCHY src 
)

Create a copy of a an ifapi hierarchy.

Parameters
[out]destThe caller allocated hierarchy object which will be the destination of the copy operation.
[in]srcThe source hierarchy.
Return values
TSS2_RC_SUCCESSif the function call was a success.
TSS2_FAPI_RC_BAD_REFERENCEa invalid null pointer is passed.
TSS2_FAPI_RC_MEMORYif not enough memory can be allocated.

◆ ifapi_copy_ifapi_hierarchy_object()

ifapi_copy_ifapi_hierarchy_object ( IFAPI_OBJECT dest,
const IFAPI_OBJECT src 
)

Create a copy of a an ifapi object storing a hierarchy.

The hierarchy together with the policy of the hierarchy will be copied.

Parameters
[out]destThe caller allocated hierarchy object which will be the destination of the copy operation.
[in]srcThe source hieararchy.
Return values
TSS2_RC_SUCCESSif the function call was a success.
TSS2_FAPI_RC_GENERAL_FAILUREif the source is not of type key.
TSS2_FAPI_RC_BAD_REFERENCEa invalid null pointer is passed.
TSS2_FAPI_RC_MEMORYif not enough memory can be allocated.

◆ ifapi_copy_ifapi_key()

TSS2_RC ifapi_copy_ifapi_key ( IFAPI_KEY dest,
const IFAPI_KEY src 
)

Create a copy of a an ifapi key.

Parameters
[out]destThe caller allocated key object which will be the destination of the copy operation.
[in]srcThe source key.
Return values
TSS2_RC_SUCCESSif the function call was a success.
TSS2_FAPI_RC_BAD_REFERENCEa invalid null pointer is passed.
TSS2_FAPI_RC_MEMORYif not enough memory can be allocated.

◆ ifapi_copy_ifapi_key_object()

TSS2_RC ifapi_copy_ifapi_key_object ( IFAPI_OBJECT dest,
const IFAPI_OBJECT src 
)

Create a copy of a an ifapi object storing a key.

The key together with the policy of the key will be copied.

Parameters
[out]destThe caller allocated key object which will be the destination of the copy operation.
[in]srcThe source key.
Return values
TSS2_RC_SUCCESSif the function call was a success.
TSS2_FAPI_RC_GENERAL_FAILUREif the source is not of type key.
TSS2_FAPI_RC_BAD_REFERENCEa invalid null pointer is passed.
TSS2_FAPI_RC_MEMORYif not enough memory can be allocated.

◆ ifapi_keystore_delete()

TSS2_RC ifapi_keystore_delete ( IFAPI_KEYSTORE keystore,
char *  path 
)

Remove file storing a keystore object.

Parameters
[in]keystoreThe key directories, the default profile.
[in]pathThe relative name of the object be removed.
Return values
TSS2_RC_SUCCESSOn success.
TSS2_FAPI_RC_MEMORYIf memory could not be allocated.
TSS2_FAPI_RC_IO_ERRORIf the file can't be removed.
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_BAD_VALUEif an invalid value was passed into the function.
TSS2_FAPI_RC_NOT_PROVISIONEDFAPI was not provisioned.
TSS2_FAPI_RC_BAD_REFERENCEa invalid null pointer is passed.
TSS2_FAPI_RC_BAD_PATHif the path is used in inappropriate context or contains illegal characters.

◆ ifapi_keystore_initialize()

TSS2_RC ifapi_keystore_initialize ( IFAPI_KEYSTORE keystore,
const char *  config_systemdir,
const char *  config_userdir,
const char *  config_defaultprofile 
)

Store keystore parameters in the keystore context.

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

Parameters
[out]keystoreThe keystore to be initialized.
[in]config_systemdirThe configured system directory.
[in]config_userdirThe configured user directory.
[in]config_defaultprofileThe configured profile.
Return values
TSS2_RC_SUCCESSIf the keystore can be initialized.
TSS2_FAPI_RC_IO_ERRORIf the user part of the keystore can't be initialized.
TSS2_FAPI_RC_MEMORYif memory could not be allocated.
TSS2_FAPI_RC_BAD_PATHif the home directory of the user cannot be determined.
TSS2_FAPI_RC_BAD_VALUEif an invalid value was passed into the function.

◆ ifapi_keystore_list_all()

TSS2_RC ifapi_keystore_list_all ( IFAPI_KEYSTORE keystore,
const char *  searchpath,
char ***  results,
size_t *  numresults 
)

Create a list of of objects in a certain search path.

A vector of relative paths will be computed.

Parameters
[in]keystoreThe key directories, the default profile.
[in]searchpathThe relative search path in key store.
[out]resultsThe array with pointers to the relative object paths.
[out]numresultsThe number of found objects.
Return values
TSS2_RC_SUCCESSon success.
TSS2_FAPI_RC_MEMORYif memory could not be allocated.
TSS2_FAPI_RC_BAD_REFERENCEa invalid null pointer is passed.
TSS2_FAPI_RC_BAD_PATHif the path is used in inappropriate context or contains illegal characters.
TSS2_FAPI_RC_BAD_VALUEif an invalid value was passed into the function.
TSS2_FAPI_RC_PATH_NOT_FOUNDif a FAPI object path was not found during authorization.

◆ ifapi_keystore_load_async()

TSS2_RC ifapi_keystore_load_async ( IFAPI_KEYSTORE keystore,
IFAPI_IO io,
const char *  path 
)

Start loading FAPI object from key store.

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

Parameters
[in]keystoreThe key directories and default profile.
[in]ioThe input/output context being used for file I/O.
[in]pathThe relative path of the object. For keys the path will expanded if possible.
Return values
TSS2_RC_SUCCESSIf the object can be read.
TSS2_FAPI_RC_IO_ERRORif an I/O error was encountered.
TSS2_FAPI_RC_PATH_NOT_FOUNDif the file does not exist.
TSS2_FAPI_RC_MEMORYif memory could not be allocated to hold the read data.
TSS2_FAPI_RC_KEY_NOT_FOUNDif a key was not found.
TSS2_FAPI_RC_BAD_VALUEif an invalid value was passed into the function.
TSS2_FAPI_RC_NOT_PROVISIONEDFAPI was not provisioned.
TSS2_FAPI_RC_BAD_REFERENCEa invalid null pointer is passed.
TSS2_FAPI_RC_BAD_PATHif the path is used in inappropriate context or contains illegal characters.

◆ ifapi_keystore_object_does_not_exist()

ifapi_keystore_object_does_not_exist ( IFAPI_KEYSTORE keystore,
const char *  path,
const IFAPI_OBJECT object 
)

Check whether the key path for a new object does not exist in key store.

To prevent overwriting of objects the functions returns an error if the object is already stored in key store. The FAPI path will be expanded to absolute path appropriate for the object to be checked.

Parameters
[in]keystoreThe key directories and default profile.
[in]pathThe relative path of the object. For keys the path will expanded if possible.
[in]objectThe object to be checked.
Return values
TSS2_RC_SUCCESSif the object does not exist and a new object can be written.
TSS2_FAPI_RC_PATH_ALREADY_EXISTSif the object exists in key store.
TSS2_FAPI_RC_MEMORYif memory could not be allocated to hold the output data.
TSS2_FAPI_RC_BAD_VALUEif an invalid value was passed into the function.
TSS2_FAPI_RC_BAD_REFERENCEa invalid null pointer is passed.
TSS2_FAPI_RC_BAD_PATHif the path is used in inappropriate context or contains illegal characters.
TSS2_FAPI_RC_PATH_NOT_FOUNDif a FAPI object path was not found during authorization.

◆ ifapi_keystore_remove_directories()

TSS2_RC ifapi_keystore_remove_directories ( IFAPI_KEYSTORE keystore,
const char *  dir_name 
)

Remove directories in keystore.

If the expanded directory exists in userdir and systemdir both will be deleted.

Parameters
[in]keystoreThe key directories, the default profile.
[in]dir_nameThe relative name of the directory to be removed.
Return values
TSS2_RC_SUCCESSon success.
TSS2_FAPI_RC_MEMORYIf memory could not be allocated.
TSS2_FAPI_RC_IO_ERRORIf directory can't be deleted.
TSS2_FAPI_RC_BAD_VALUEif an invalid value was passed into the function.
TSS2_FAPI_RC_BAD_REFERENCEa invalid null pointer is passed.
TSS2_FAPI_RC_BAD_PATHif the path is used in inappropriate context or contains illegal characters.
TSS2_FAPI_RC_PATH_NOT_FOUNDif a FAPI object path was not found during authorization.

◆ ifapi_keystore_search_nv_obj()

TSS2_RC ifapi_keystore_search_nv_obj ( IFAPI_KEYSTORE keystore,
IFAPI_IO io,
TPM2B_NV_PUBLIC *  nv_public,
char **  found_path 
)

Search nv object with a certain nv_index (from nv_public) in keystore.

Parameters
[in,out]keystoreThe key directories, the default profile, and the state information for the asynchronous search.
[in]ioThe input/output context being used for file I/O.
[in]nv_publicThe public data of the searched nv object.
[out]found_pathThe relative path of the found key.
Return values
TSS2_RC_SUCCESSon success.
TSS2_FAPI_RC_MEMORYif memory could not be allocated.
TSS2_FAPI_RC_KEY_NOT_FOUNDIf the key was not found in keystore.
TSS2_FAPI_RC_BAD_VALUEif an invalid value was passed into the function.
TSS2_FAPI_RC_PATH_NOT_FOUNDif a FAPI object path was not found during authorization.
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_IO_ERRORif an error occurred while accessing the object store.
TSS2_FAPI_RC_GENERAL_FAILUREif an internal error occurred.
TSS2_FAPI_RC_BAD_REFERENCEa invalid null pointer is passed.
TSS2_FAPI_RC_PATH_ALREADY_EXISTSif the object already exists in object store.
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_keystore_search_obj()

TSS2_RC ifapi_keystore_search_obj ( IFAPI_KEYSTORE keystore,
IFAPI_IO io,
TPM2B_NAME *  name,
char **  found_path 
)

Search object with a certain name in keystore.

Parameters
[in,out]keystoreThe key directories, the default profile, and the state information for the asynchronous search.
[in]ioThe input/output context being used for file I/O.
[in]nameThe name of the searched object.
[out]found_pathThe relative path of the found key.
Return values
TSS2_RC_SUCCESSon success.
TSS2_FAPI_RC_MEMORYif memory could not be allocated.
TSS2_FAPI_RC_KEY_NOT_FOUNDIf the key was not found in keystore.
TSS2_FAPI_RC_PATH_NOT_FOUNDif a FAPI object path was not found during authorization.
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_BAD_VALUEif an invalid value was passed into the function.
TSS2_FAPI_RC_IO_ERRORif an error occurred while accessing the object store.
TSS2_FAPI_RC_GENERAL_FAILUREif an internal error occurred.
TSS2_FAPI_RC_BAD_REFERENCEa invalid null pointer is passed.
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_keystore_store_async()

TSS2_RC ifapi_keystore_store_async ( IFAPI_KEYSTORE keystore,
IFAPI_IO io,
const char *  path,
const IFAPI_OBJECT object 
)

Start writing FAPI object to the key store.

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

Parameters
[in]keystoreThe key directories and default profile.
[in]ioThe input/output context being used for file I/O.
[in]pathThe relative path of the object. For keys the path will expanded if possible.
[in]objectThe object to be written to the keystore.
Return values
TSS2_RC_SUCCESSif the object is written successfully.
TSS2_FAPI_RC_IO_ERRORif an I/O error was encountered;
TSS2_FAPI_RC_MEMORYif memory could not be allocated to hold the output data.
TSS2_FAPI_RC_BAD_VALUEif an invalid value was passed into the function.
TSS2_FAPI_RC_GENERAL_FAILUREif an internal error occurred.
TSS2_FAPI_RC_BAD_REFERENCEa invalid null pointer is passed.
TSS2_FAPI_RC_BAD_PATHif the path is used in inappropriate context or contains illegal characters.
TSS2_FAPI_RC_PATH_NOT_FOUNDif a FAPI object path was not found during authorization.