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

Functions

TSS2_RC ifapi_io_check_file_writeable (const char *file)
 
TSS2_RC ifapi_io_dirfiles (const char *dirname, char ***files, size_t *numfiles)
 
TSS2_RC ifapi_io_dirfiles_all (const char *searchPath, char ***pathlist, size_t *numPaths)
 
bool ifapi_io_path_exists (const char *path)
 
TSS2_RC ifapi_io_poll (IFAPI_IO *io)
 
TSS2_RC ifapi_io_poll_handles (IFAPI_IO *io, FAPI_POLL_HANDLE **handles, size_t *num_handles)
 
TSS2_RC ifapi_io_read_async (struct IFAPI_IO *io, const char *filename)
 
TSS2_RC ifapi_io_read_finish (struct IFAPI_IO *io, uint8_t **buffer, size_t *length)
 
TSS2_RC ifapi_io_remove_file (const char *file)
 
TSS2_RC ifapi_io_write_async (struct IFAPI_IO *io, const char *filename, const uint8_t *buffer, size_t length)
 
TSS2_RC ifapi_io_write_finish (struct IFAPI_IO *io)
 

Detailed Description

Provides internal basic IO functions for policy and key store module.

Function Documentation

◆ ifapi_io_check_file_writeable()

TSS2_RC ifapi_io_check_file_writeable ( const char *  file)

Check whether a file is writeable.

Parameters
[in]fileThe name of the fileto be checked.
Return values
TSS2_RC_SUCCESSif the directories existed or were successfully created
TSS2_FAPI_RC_IO_ERRORif an I/O error occurred

◆ ifapi_io_dirfiles()

TSS2_RC ifapi_io_dirfiles ( const char *  dirname,
char ***  files,
size_t *  numfiles 
)

Enumerate the list of files in a directory.

Enumerage the regular files (no directories, symlinks etc) from a given directory.

Parameters
[in]dirnameThe directory to list files from.
[out]filesThe list of file names.
[out]numfilesThe size of files.
Return values
TSS2_RC_SUCCESSif the directories were successfully removed
TSS2_FAPI_RC_IO_ERRORif an I/O error occurred
TSS2_FAPI_RC_MEMORYif memory could not be allocated to hold the read data.
TSS2_FAPI_RC_BAD_REFERENCEa invalid null pointer is passed.

◆ ifapi_io_dirfiles_all()

TSS2_RC ifapi_io_dirfiles_all ( const char *  searchPath,
char ***  pathlist,
size_t *  numPaths 
)

Recursive enumerate the list of files in a directory.

Enumerage the regular files (no directories, symlinks etc) from a given directory.

Parameters
[in]searchPathThe directory to list files from.
[out]pathlistThe list of file names.
[out]numPathsThe size of files.
Return values
TSS2_RC_SUCCESSif the directories were successfully removed
TSS2_FAPI_RC_IO_ERRORif an I/O error occurred
TSS2_FAPI_RC_MEMORYif memory could not be allocated to hold the read data.

◆ ifapi_io_path_exists()

bool ifapi_io_path_exists ( const char *  path)

Determine whether a path exists.

Parameters
[in]pathThe absolute path of the file.
Return values
trueThe file exists.
falseThe file does not exist.

◆ ifapi_io_poll()

TSS2_RC ifapi_io_poll ( IFAPI_IO io)

Wait for file I/O to be ready.

If FAPI state automata are in a file I/O state it will be waited for an event on a file descriptor.

Parameters
[in]ioThe input/output context being used for file I/O.
Return values
TSS2_RC_SUCCESSAfter the end of the wait.
TSS2_FAPI_RC_IO_ERRORif the poll function returns an error.
TSS2_FAPI_RC_BAD_REFERENCEa invalid null pointer is passed.

◆ ifapi_io_poll_handles()

TSS2_RC ifapi_io_poll_handles ( IFAPI_IO io,
FAPI_POLL_HANDLE **  handles,
size_t *  num_handles 
)

Get a list of poll handles.

Parameters
[in]ioThe input/output context being used for file I/O.
[out]handlesThe array with the poll handles.
[out]num_handlesThe number of poll handles.
Return values
TSS2_RC_SUCCESSon success.
TSS2_FAPI_RC_NO_HANDLEIn no poll events are stored in IO context.
TSS2_FAPI_RC_MEMORYIf the output data cannot be allocated.
TSS2_FAPI_RC_BAD_REFERENCEa invalid null pointer is passed.

◆ ifapi_io_read_async()

TSS2_RC ifapi_io_read_async ( struct IFAPI_IO io,
const char *  filename 
)

Start reading a file's complete content into memory in an asynchronous way.

Parameters
[in,out]ioThe input/output context being used for file I/O.
[in]filenameThe name of the file to be read into memory.
Return values
TSS2_RC_SUCCESSif the function call was a success.
TSS2_FAPI_RC_IO_ERRORif an I/O error was encountered; such as the file was not found.
TSS2_FAPI_RC_MEMORYif memory could not be allocated to hold the read data.

◆ ifapi_io_read_finish()

TSS2_RC ifapi_io_read_finish ( struct IFAPI_IO io,
uint8_t **  buffer,
size_t *  length 
)

Finish reading a file's complete content into memory in an asynchronous way.

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

Parameters
[in,out]ioThe input/output context being used for file I/O.
[out]bufferThe data that was read from file. (callee-allocated; use free())
[out]lengthThe length of the data that was read from file.
Return values
TSS2_RC_SUCCESSif the function call was a success.
TSS2_FAPI_RC_IO_ERRORif an I/O error was encountered; such as the file was not found.
TSS2_FAPI_RC_TRY_AGAINif the asynchronous operation is not yet complete. Call this function again later.

◆ ifapi_io_remove_file()

TSS2_RC ifapi_io_remove_file ( const char *  file)

Remove a file.

Parameters
[in]fileThe absolute path of the file to be removed.
Return values
TSS2_RC_SUCCESSIf the file was successfully removed
TSS2_FAPI_RC_IO_ERRORIf the file could not be removed.

◆ ifapi_io_write_async()

TSS2_RC ifapi_io_write_async ( struct IFAPI_IO io,
const char *  filename,
const uint8_t *  buffer,
size_t  length 
)

Start writing a buffer into a file in an asynchronous way.

Parameters
[in,out]ioThe input/output context being used for file I/O.
[in]filenameThe name of the file to be read into memory.
[in]bufferThe buffer to be written.
[in]lengthThe number of bytes to be written.
Return values
TSS2_RC_SUCCESSif the function call was a success.
TSS2_FAPI_RC_IO_ERRORif an I/O error was encountered; such as the file was not found.
TSS2_FAPI_RC_MEMORYif memory could not be allocated to hold the read data.

◆ ifapi_io_write_finish()

TSS2_RC ifapi_io_write_finish ( struct IFAPI_IO io)

Finish writing a buffer into a file in an asynchronous way.

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

Parameters
[in,out]ioThe input/output context being used for file I/O.
Return values
TSS2_RC_SUCCESSif the function call was a success.
TSS2_FAPI_RC_IO_ERRORif an I/O error was encountered; such as the file was not found.
TSS2_FAPI_RC_TRY_AGAINif the asynchronous operation is not yet complete. Call this function again later.