Helper functions module
Feature API » Internals of Feature API

## Functions

bool | add_string_to_list (NODE_STR_T *str_list, char *string)
TSS2_RC | append_object_to_list (void *object, NODE_OBJECT_T **object_list)
void | free_string_list (NODE_STR_T *node)
char * | get_description (IFAPI_OBJECT *object)
bool | ifapi_TPM2B_DIGEST_cmp (TPM2B_DIGEST *in1, TPM2B_DIGEST *in2)
bool | ifapi_TPM2B_ECC_PARAMETER_cmp (TPM2B_ECC_PARAMETER *in1, TPM2B_ECC_PARAMETER *in2)
bool | ifapi_TPM2B_PUBLIC_KEY_RSA_cmp (TPM2B_PUBLIC_KEY_RSA *in1, TPM2B_PUBLIC_KEY_RSA *in2)
bool | ifapi_TPMS_ECC_POINT_cmp (TPMS_ECC_POINT *in1, TPMS_ECC_POINT *in2)
bool | ifapi_TPMT_PUBLIC_cmp (TPMT_PUBLIC *in1, TPMT_PUBLIC *in2)
bool | ifapi_TPMU_PUBLIC_ID_cmp (TPMU_PUBLIC_ID *in1, UINT32 selector1, TPMU_PUBLIC_ID *in2, UINT32 selector2)
TSS2_RC | ifapi_asprintf (char **str, const char *fmt,...)
TSS2_RC | ifapi_check_profile_pcr_selection (const TPML_PCR_SELECTION *pcr_profile, const TPML_PCR_SELECTION *pcr_capablity)
void | ifapi_cleanup_policy (TPMS_POLICY *policy)
bool | ifapi_cmp_public_key (TPM2B_PUBLIC *key1, TPM2B_PUBLIC *key2)
TSS2_RC | ifapi_compute_policy_digest (TPML_PCRVALUES *pcrs, TPML_PCR_SELECTION *pcr_selection, TPMI_ALG_HASH hash_alg, TPM2B_DIGEST *pcr_digest)
TPMS_POLICY * | ifapi_copy_policy (const TPMS_POLICY *from_policy)
TSS2_RC | ifapi_create_dirs (const char *supdir, const char *path)
TSS2_RC | ifapi_extend_vpcr (TPM2B_DIGEST *vpcr, TPMI_ALG_HASH bank, const IFAPI_EVENT *event)
TSS2_RC | ifapi_filter_pcr_selection_by_index (TPML_PCR_SELECTION *pcr_selection, const TPM2_HANDLE *pcr_index, size_t pcr_count)
void | ifapi_free_node_list (NODE_OBJECT_T *node)
void | ifapi_free_object_list (NODE_OBJECT_T *node)
int | ifapi_get_curl_buffer (unsigned char *url, unsigned char **buffer, size_t *buffer_size)
ESYS_TR | ifapi_get_hierary_handle (const char *path)
TSS2_RC | ifapi_get_name (TPMT_PUBLIC *publicInfo, TPM2B_NAME *name)
TSS2_RC | ifapi_get_nv_start_index (const char *path, TPM2_HANDLE *start_nv_index)
TSS2_RC | ifapi_get_quote_info (char const *quoteInfo, TPM2B_ATTEST *tpm_quoted, FAPI_QUOTE_INFO *fapi_quote_info)
bool | ifapi_hierarchy_path_p (const char *path)
void | ifapi_init_hierarchy_object (IFAPI_OBJECT *hierarchy, ESYS_TR esys_handle)
TSS2_RC | ifapi_object_cmp_name (IFAPI_OBJECT *object, void *name, bool *equal)
TSS2_RC | ifapi_object_cmp_nv_public (IFAPI_OBJECT *object, void *nv_public, bool *equal)
size_t | ifapi_path_length (NODE_STR_T *node)
TSS2_RC | ifapi_path_string (char **dest, const char *supdir, NODE_STR_T *node, char *name)
TSS2_RC | ifapi_path_string_n (char **dest, const char *supdir, NODE_STR_T *node, char *name, size_t n)
bool | ifapi_path_type_p (const char *path, const char *type)
TSS2_RC | ifapi_set_key_flags (const char *type, bool policy, IFAPI_KEY_TEMPLATE *template)
TSS2_RC | ifapi_set_nv_flags (const char *type, IFAPI_NV_TEMPLATE *template, const char *policy)
TSS2_RC | ifapi_tpm_to_fapi_signature (IFAPI_OBJECT *sig_key_object, TPMT_SIGNATURE *tpm_signature, uint8_t **signature, size_t *signatureSize)
NODE_STR_T * | init_string_list (const char *string)
bool | object_with_auth (IFAPI_OBJECT *object)
TSS2_RC | push_object_to_list (void *object, NODE_OBJECT_T **object_list)
NODE_STR_T * | split_string (const char *string, char *delimiter)
int | vasprintf (char **str, const char *fmt, va_list args)
TSS2_RC | ifapi_check_nv_index (const char *path, TPM2_HANDLE nv_index)
bool | ifapi_null_primary_p (const char *path)

## Detailed Description

Provides helper functions.

## Function Documentation

## add_string_to_list()

bool add_string_to_list | ( | NODE_STR_T * | str_list,
|  | char * | string )

Add string to the last element of a linked list of strings.

A duplicate of the passed string will be added.

Parameters

  [in,out] | str_list | The linked list.
  [in] | string | The string to be added.

Return values

  true | if the string was added to the list.
  false | if the list could not be extended.

## append_object_to_list()

TSS2_RC append_object_to_list | ( | void * | object,
|  | NODE_OBJECT_T ** | object_list )

Add a object as last element to a linked list.

Parameters

  [in] | object | The object to be added.
  [in,out] | object_list | The linked list to be extended.

Return values

  TSS2_RC_SUCCESS | if the object was added.
  TSS2_FAPI_RC_MEMORY | If memory for the list extension cannot be allocated.

## free_string_list()

void free_string_list | ( | NODE_STR_T * | node | ) |

Free linked list of strings.

Parameters

  [in] | node | the first node of the linked list.

## ifapi_asprintf()

TSS2_RC ifapi_asprintf | ( | char ** | str,
|  | const char * | fmt,
|  |  | ... )

Print to allocated string.

A list of parameters will be printed to an allocated string according to the format description in the first parameter.

Parameters

  [out] | str | The allocated output string.
  [in] | fmt | The format string (printf formats can be used.)
  [in] | ... | The list of objects to be printed.

Return values

  TSS2_RC_SUCCESS | If the printing was successful.
  TSS2_FAPI_RC_MEMORY | if not enough memory can be allocated.

## ifapi_check_nv_index()

TSS2_RC ifapi_check_nv_index | ( | const char * | path,
|  | TPM2_HANDLE | nv_index )

Check whether NV index is appropriate for NV path.

The value will be checked based on e TCG handle registry.

Parameters

  [in] | path | The path used for the NV object.
  [out] | nv_index | The NV index to be used.

Return values

  TSS2_RC_SUCCESS | If the index for the path can be determined.
  TSS2_FAPI_RC_BAD_PATH | If the path is not valid.
  TSS2_FAPI_RC_BAD_VALUE | If the nv index is not appropriate for the path.
  TSS2_FAPI_RC_MEMORY | if not enough memory can be allocated.

## ifapi_check_profile_pcr_selection()

TSS2_RC ifapi_check_profile_pcr_selection | ( | const TPML_PCR_SELECTION * | pcr_profile,
|  | const TPML_PCR_SELECTION * | pcr_capablity )

Check whether profile PCR capabilities are a subset of TPM PCR capabilities.

It has to be checked that every hash alg from the profile is available and whether the selected PCRs are available.

Parameters

  [in] | pcr_profile | The pcr profile to use as basis for the selection.
  [in] | pcr_capablity | The PCR capabilities available for TPM.

Return values

  TSS2_RC_SUCCESSS | if the conversion was successful.
  TSS2_FAPI_RC_BAD_VALUE | if profile is not subset of capabilities.

## ifapi_cleanup_policy()

void ifapi_cleanup_policy | ( | TPMS_POLICY * | policy | ) |

Free memory allocated during deserialization of policy.

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

Parameters

  [in] | policy | The policy to be cleaned up.

## ifapi_cmp_public_key()

bool ifapi_cmp_public_key | ( | TPM2B_PUBLIC * | key1,
|  | TPM2B_PUBLIC * | key2 )

Compare two public keys.

Parameters

  [in] | key1 | The first key.
  [in] | key2 | The second key.

Return values

  true | if equal false if not.

## ifapi_compute_policy_digest()

TSS2_RC ifapi_compute_policy_digest | ( | TPML_PCRVALUES * | pcrs,
|  | TPML_PCR_SELECTION * | pcr_selection,
|  | TPMI_ALG_HASH | hash_alg,
|  | TPM2B_DIGEST * | pcr_digest )

Compute PCR selection and a PCR digest for a PCR value list.

Parameters

  [in] | pcrs | The list of PCR values.
  [out] | pcr_selection | The selection computed based on the list of PCR values.
  [in] | hash_alg | The hash algorithm which is used for the policy computation.
  [out] | pcr_digest | The computed PCR digest corresponding to the passed PCR value list.

Return values

  TSS2_RC_SUCCESS | if the PCR selection and the PCR digest could be computed..
  TSS2_FAPI_RC_BAD_VALUE | If inappropriate values are detected in the input data.
  TSS2_FAPI_RC_BAD_REFERENCE | a invalid null pointer is passed.
  TSS2_FAPI_RC_MEMORY | if not enough memory can be allocated.
  TSS2_FAPI_RC_GENERAL_FAILURE | if an internal error occurred.

## ifapi_copy_policy()

TPMS_POLICY * ifapi_copy_policy | ( | const TPMS_POLICY * | from_policy | ) |

Copy policy.

Parameters

  [in] | from_policy | the policy to be copied.

Return values

  The | new policy or NULL if not enough memory was available.
  TSS2_FAPI_RC_MEMORY | if not enough memory can be allocated.
  TSS2_FAPI_RC_BAD_REFERENCE | a invalid null pointer is passed.

## ifapi_create_dirs()

TSS2_RC ifapi_create_dirs | ( | const char * | supdir,
|  | const char * | path )

Create sub-directories in a certain directory.

Parameters

  [in] | supdir | The directory in which the new directories shall be created.
  [in] | path | The path containing one or more sub-directories.

Return values

  TSS2_RC_SUCCESS | If the directories were created.
  TSS2_FAPI_RC_MEMORY | If the linked list with the sub-directories cannot be allocated.
  TSS2_FAPI_RC_BAD_VALUE | If a directory cannot be created.

## ifapi_extend_vpcr()

TSS2_RC ifapi_extend_vpcr | ( | TPM2B_DIGEST * | vpcr,
|  | TPMI_ALG_HASH | bank,
|  | const IFAPI_EVENT * | event )

Compute new PCR value from a part of an event list.

Parameters

  [in,out] | vpcr | The old and the new PCR value.
  [in] | bank | The bank corresponding to value of the event list which will be used for computation.
  [in] | event | The event list with the values which were extended for a certain bank.

Return values

  TSS2_FAPI_RC_BAD_VALUE | if the bank was not found in the event list.
  TSS2_FAPI_RC_GENERAL_FAILURE | if an error occurs in the crypto library
  TSS2_FAPI_RC_BAD_REFERENCE | a invalid null pointer is passed.
  TSS2_FAPI_RC_MEMORY | if not enough memory can be allocated.

## ifapi_filter_pcr_selection_by_index()

TSS2_RC ifapi_filter_pcr_selection_by_index | ( | TPML_PCR_SELECTION * | pcr_selection,
|  | const TPM2_HANDLE * | pcr_index,
|  | size_t | pcr_count )

Reduce a PCR selection to a single pcr.

This includes two steps: clearing all bits but the selected and clearing empty hashalg lines.

Parameters

  [in,out] | pcr_selection | The pcr selection to be filtered.
  [in] | pcr_index | The only PCR to remain selected.
  [in] | pcr_count | The size of the pcr list.

Return values

  TSS2_RC_SUCCESS | if the filtering was successful.
  TSS2_FAPI_RC_BAD_VALUE | if no pcr remain selected or the pcr selection is malformed.

## ifapi_free_node_list()

void ifapi_free_node_list | ( | NODE_OBJECT_T * | node | ) |

Free linked list of IFAPI objects (link nodes only).

Parameters

  [in] | node | the first node of the linked list.

## ifapi_free_object_list()

void ifapi_free_object_list | ( | NODE_OBJECT_T * | node | ) |

Free linked list of IFAPI objects.

Parameters

  [in] | node | the first node of the linked list.

## ifapi_get_curl_buffer()

int ifapi_get_curl_buffer | ( | unsigned char * | url,
|  | unsigned char ** | buffer,
|  | size_t * | buffer_size )

Get byte buffer from file system or web via curl.

Parameters

  [in] | url | The url of the resource.
  [out] | buffer | The buffer retrieved via the url.
  [out] | buffer_size | The size of the retrieved object.

Return values

  0 | if buffer could be retrieved.
  -1 | if an error did occur

## ifapi_get_hierary_handle()

ESYS_TR ifapi_get_hierary_handle | ( | const char * | path | ) |

Get ESYS handle for a hierarchy path.

Parameters

  [in] | path | The path to be checked.

Return values

  The | ESAPI handle for the hierarchy defined in path.
  0 | if not handle can be assigned.

## ifapi_get_name()

TSS2_RC ifapi_get_name | ( | TPMT_PUBLIC * | publicInfo,
|  | TPM2B_NAME * | name )

Compute the name of a TPM transient or persistent object.

Parameters

  [in] | publicInfo | The public information of the TPM object.
  [out] | name | The computed name.

Return values

  TPM2_RC_SUCCESS | or one of the possible errors TSS2_FAPI_RC_BAD_VALUE, TSS2_FAPI_RC_MEMORY, TSS2_FAPI_RC_GENERAL_FAILURE. or return codes of SAPI errors.
  TSS2_FAPI_RC_BAD_REFERENCE | a invalid null pointer is passed.
  TSS2_FAPI_RC_MEMORY | if not enough memory can be allocated.
  TSS2_FAPI_RC_BAD_VALUE | if an invalid value was passed into the function.
  TSS2_FAPI_RC_GENERAL_FAILURE | if an internal error occurred.

## ifapi_get_nv_start_index()

TSS2_RC ifapi_get_nv_start_index | ( | const char * | path,
|  | TPM2_HANDLE * | start_nv_index )

Determine start index for NV object depending on type.

The value will be determined based on e TCG handle registry.

Parameters

  [in] | path | The path used for the NV object.
  [out] | start_nv_index | The first possible NV index for this type.

Return values

  TSS2_RC_SUCCESS | If the index for the path can be determined.
  TSS2_FAPI_RC_BAD_PATH | If no handle can be assigned.
  TSS2_FAPI_RC_MEMORY | if not enough memory can be allocated.

## ifapi_get_quote_info()

TSS2_RC ifapi_get_quote_info | ( | char const * | quoteInfo,
|  | TPM2B_ATTEST * | tpm_quoted,
|  | FAPI_QUOTE_INFO * | fapi_quote_info )

Deserialize the JSON representation of FAPI quote information.

The JSON representation of FAPI quote information will be deserialized to a FAPI_QUOTE_INFO structure and also the TPM2B version of the attest will be created.

Parameters

  [in] | quoteInfo | The JSON representation if the quote information.
  [out] | tpm_quoted | The marhaled version of the attest structure.
  [out] | fapi_quote_info | The quote information structure used by FAPI.

Return values

  TSS2_RC_SUCCESS | If the deserialization was successful.
  TSS2_FAPI_RC_BAD_VALUE | If an invalid value is detected during deserialisation.
  Possible | error codes of the marshaling function.
  TSS2_FAPI_RC_BAD_REFERENCE | a invalid null pointer is passed.

## ifapi_hierarchy_path_p()

bool ifapi_hierarchy_path_p | ( | const char * | path | ) |

Determine whether path describes a hierarchy object.

It will be checked whether the path describes a hierarch. A key path with a hierarchy will not deliver true.

Parameters

  [in] | path | The path to be checked.

Return values

  true | if the path describes a hierarchy.
  false | if not.

## ifapi_init_hierarchy_object()

void ifapi_init_hierarchy_object | ( | IFAPI_OBJECT * | hierarchy,
|  | ESYS_TR | esys_handle )

Initialize the internal representation of a FAPI hierarchy object.

The object will be cleared and the type of the general fapi object will be set to hierarchy.

Parameters

  [in,out] | hierarchy | The caller allocated hierarchy object. The name of the object will be computed.
  [in] | esys_handle | The ESAPI handle of the hierarchy which will be added to to the object.

## ifapi_null_primary_p()

bool ifapi_null_primary_p | ( | const char * | path | ) |

Determine whether path is a primary in the null hierarchy.

Parameters

  [in] | path | The path to be checked.

Return values

  true | if the path describes a null hierarchy primary.
  false | if not.

## ifapi_object_cmp_name()

TSS2_RC ifapi_object_cmp_name | ( | IFAPI_OBJECT * | object,
|  | void * | name,
|  | bool * | equal )

Check whether a nv or key object has a certain name.

Parameters

  [in] | object | The object (has to be checked whether it's a key).
  [in] | name | The name to be compared.
  [out] | equal | If the two names are equal.

Return values

  TSS2_RC_SUCCESSS | if name of object can be deserialized.
  TSS2_FAPI_RC_BAD_REFERENCE | a invalid null pointer is passed.
  TSS2_FAPI_RC_MEMORY | if not enough memory can be allocated.
  TSS2_FAPI_RC_BAD_VALUE | if an invalid value was passed into the function.
  TSS2_FAPI_RC_GENERAL_FAILURE | if an internal error occurred.

## ifapi_object_cmp_nv_public()

TSS2_RC ifapi_object_cmp_nv_public | ( | IFAPI_OBJECT * | object,
|  | void * | nv_public,
|  | bool * | equal )

Check whether a nv object has a certain public info.

Parameters

  [in] | object | The object (has to be checked whether it's a key).
  [in] | nv_public | The NV public data with the NV index.
  [out] | equal | If the two names are equal.

Return values

  TSS2_RC_SUCCESSS | if name of object can be deserialized.

## ifapi_path_length()

size_t ifapi_path_length | ( | NODE_STR_T * | node | ) |

Compute the number on nodes in a linked list.

Parameters

  [in] | node | the first node of the linked list.

Return values

  the | number on nodes.

## ifapi_path_string()

TSS2_RC ifapi_path_string | ( | char ** | dest,
|  | const char * | supdir,
|  | NODE_STR_T * | node,
|  | char * | name )

Compute a pathname based on a linked list of strings.

Parameters

  [out] | dest | The pointer to the generated pathname (callee allocated).
  [in] | supdir | A sup directory will be the prefix of the pathname.
  [in] | node | The linked list.
  [in] | name | A name which is appended to the result if not NULL.

Return values

  TSS2_RC_SUCCESS | if the function call was a success.
  TSS2_FAPI_RC_MEMORY | if the memory for the pathname can't be allocated.

## ifapi_path_string_n()

TSS2_RC ifapi_path_string_n | ( | char ** | dest,
|  | const char * | supdir,
|  | NODE_STR_T * | node,
|  | char * | name,
|  | size_t | n )

Compute a pathname based on the first n elements of a linked list of strings.

Parameters

  [out] | dest | the pointer to the pathname (callee allocated).
  [in] | supdir | a sup directory will be the prefix of the pathname. (can be NULL).
  [in] | node | the linked list.
  [in] | name | the filename (can be NULL).
  [in] | n | the number of the first elements which will bes used for concatenation.

Return values

  TSS2_RC_SUCCESS | if the function call was a success.
  TSS2_FAPI_RC_MEMORY | if the memory for the pathname can't be allocated.

## ifapi_path_type_p()

bool ifapi_path_type_p | ( | const char * | path,
|  | const char * | type )

Determine whether path is of certain type.

Parameters

  [in] | path | The path to be checked.
  [in] | type | sub-string at the beginning of the path to be checked.

Return values

  true | if the path name starts with type.
  false | if not.

## ifapi_set_key_flags()

TSS2_RC ifapi_set_key_flags | ( | const char * | type,
|  | bool | policy,
|  | IFAPI_KEY_TEMPLATE * | template )

Create template for key creation based on type flags.

Based on passed flags the TPM2B_PUBLIC data which is used for key creation will be adapted.

Parameters

  [in] | type | The flags describing the key type.
  [in] | policy | The flag whether a policy is used.
  [out] | template | The template including the TPM2B_PUBLIC which will be used for key creation.

Return values

  TSS2_RC_SUCCESS | if the template can be generated.
  TSS2_FAPI_RC_BAD_VALUE | If an invalid combination of flags was used.
  TSS2_FAPI_RC_MEMORY | if not enough memory can be allocated.

## ifapi_set_nv_flags()

TSS2_RC ifapi_set_nv_flags | ( | const char * | type,
|  | IFAPI_NV_TEMPLATE * | template,
|  | const char * | policy )

Create template for nv object creation based on type flags.

Based on passed flags the TPM2B_NV_PUBLIC data which is used for key creation will be adapted.

Parameters

  [in] | type | The flags describing the nv object type.
  [in] | policy | The flag whether a policy is used.
  [out] | template | The template including the TPM2B_NV_PUBLIC which will be used for nv object creation.

Return values

  TSS2_RC_SUCCESS | if the template can be generated.
  TSS2_FAPI_RC_BAD_VALUE | If an invalid combination of flags was used.
  TSS2_FAPI_RC_MEMORY | if not enough memory can be allocated.

## ifapi_TPM2B_DIGEST_cmp()

bool ifapi_TPM2B_DIGEST_cmp | ( | TPM2B_DIGEST * | in1,
|  | TPM2B_DIGEST * | in2 )

Compare two variables of type TPM2B_DIGEST.

Parameters

  [in] | in1 | variable to be compared with in2.
  [in] | in2 | variable to be compared with in1.

Return values

  true | if the variables are equal.
  false | if not.

## ifapi_TPM2B_ECC_PARAMETER_cmp()

bool ifapi_TPM2B_ECC_PARAMETER_cmp | ( | TPM2B_ECC_PARAMETER * | in1,
|  | TPM2B_ECC_PARAMETER * | in2 )

Compare two variables of type TPM2B_ECC_PARAMETER.

Parameters

  [in] | in1 | variable to be compared with in2.
  [in] | in2 | variable to be compared with in1.

Return values

  true | if the variables are equal.
  false | if not.

## ifapi_TPM2B_PUBLIC_KEY_RSA_cmp()

bool ifapi_TPM2B_PUBLIC_KEY_RSA_cmp | ( | TPM2B_PUBLIC_KEY_RSA * | in1,
|  | TPM2B_PUBLIC_KEY_RSA * | in2 )

Compare two variables of type TPM2B_PUBLIC_KEY_RSA.

Parameters

  [in] | in1 | variable to be compared with in2
  [in] | in2 | variable to be compared with in1

Return values

  true | if the variables are equal.
  false | if not.

## ifapi_tpm_to_fapi_signature()

TSS2_RC ifapi_tpm_to_fapi_signature | ( | IFAPI_OBJECT * | sig_key_object,
|  | TPMT_SIGNATURE * | tpm_signature,
|  | uint8_t ** | signature,
|  | size_t * | signatureSize )

Compute signature as byte array and signature size in DER format.

For ECC signatures the conversion to DER is necessary, for RSA the buffer of the TPM2B has already DER format. parameters.

Parameters

  [in] | sig_key_object | The signing key.
  [in] | tpm_signature | the signature in TPM format.
  [out] | signature | The byte array of the signature (callee allocated).
  [out] | signatureSize | The size of the byte array.

Return values

  TSS2_RC_SUCCESSS | if the conversion was successful.
  TSS2_FAPI_RC_MEMORY | if not enough memory can be allocated.
  TSS2_FAPI_RC_GENERAL_FAILURE | If an internal error occurs, which is not covered by other return codes (e.g. a unexpected openssl error).
  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_TPMS_ECC_POINT_cmp()

bool ifapi_TPMS_ECC_POINT_cmp | ( | TPMS_ECC_POINT * | in1,
|  | TPMS_ECC_POINT * | in2 )

Compare two variables of type TPMS_ECC_POINT.

Parameters

  [in] | in1 | variable to be compared with in2.
  [in] | in2 | variable to be compared with in1.

Return values

  true | if the variables are equal.
  false | if not.

## ifapi_TPMT_PUBLIC_cmp()

bool ifapi_TPMT_PUBLIC_cmp | ( | TPMT_PUBLIC * | in1,
|  | TPMT_PUBLIC * | in2 )

Compare the PUBLIC_ID stored in two TPMT_PUBLIC structures.

Parameters

  [in] | in1 | the public data with the unique data to be compared with:
  [in] | in2 |

Return values

  true | if the variables are equal.
  false | if not.

## ifapi_TPMU_PUBLIC_ID_cmp()

bool ifapi_TPMU_PUBLIC_ID_cmp | ( | TPMU_PUBLIC_ID * | in1,
|  | UINT32 | selector1,
|  | TPMU_PUBLIC_ID * | in2,
|  | UINT32 | selector2 )

Compare two variables of type TPMU_PUBLIC_ID.

Parameters

  [in] | in1 | variable to be compared with in2.
  [in] | selector1 | key type of first key.
  [in] | in2 | variable to be compared with in1.
  [in] | selector2 | key type of second key.

Returns
  true if variables are equal.
  false if not.

## init_string_list()

NODE_STR_T * init_string_list | ( | const char * | string | ) |

Initialize a linked list of strings.

free string in the list object will be set to true. If the list will be extended by sub-string which are part of this strin free_string has to be set to false.

Parameters

  [in] | string | The string for the first element.

Return values

  the | initial node of the linked list.
  NULL | if the list cannot be created.

## object_with_auth()

bool object_with_auth | ( | IFAPI_OBJECT * | object | ) |

Determine whether authentication with an auth value is needed ro an object..

In the key store the information whether an auth value was provided for an object is saved. Thus the it is possible to decide whether the auth value callback is required for authentication.

Parameters

  [in] | object | The object which has to be checked..

Return values

  true | If an auth value was provided.
  false | If not.

## push_object_to_list()

TSS2_RC push_object_to_list | ( | void * | object,
|  | NODE_OBJECT_T ** | object_list )

Add a object as first element to a linked list.

Parameters

  [in] | object | The object to be added.
  [in,out] | object_list | The linked list to be extended.

Return values

  TSS2_RC_SUCCESS | if the object was added.
  TSS2_FAPI_RC_MEMORY | If memory for the list extension cannot be allocated.

## split_string()

NODE_STR_T * split_string | ( | const char * | string,
|  | char * | delimiter )

Divides str into substrings based on a delimiter.

Parameters

  [in] | string | the string to split.
  [in] | delimiter | the delimiter.

Return values

  The | linked list of substrings.
  NULL | if the list cannot be created.

## vasprintf()

int vasprintf | ( | char ** | str,
|  | const char * | fmt,
|  | va_list | args )

Print to allocated string.

A list of parameters will be printed to an allocated string according to the format description in the first parameter.

Parameters

  [out] | str | The allocated output string.
  [in] | fmt | The format string (printf formats can be used.)
  [in] | args | The list of objects to be printed.

Return values

  int | The size of the string ff the printing was successful.
  -1 | if not enough memory can be allocated.