swtpm: Implement storage functions to restore a state backup file

When the users specifies that a backup file is to be made and the permanent
state file is missing when the NVRAM is initialized (SWPTM_NVRAM_Init), but
the backup state file exists, then swtpm will permanently rename the backup
file to permanent state file and attempt to start with it. Otherwise, it
will try to start with the 'normal' permanent state file first and if this
fails, it will rename the backup file to the permanent state file and
attempt to start with it. If both cases fail, it will revert any renaming.

Only support for the directory-backend is implemented.

Extend the swtpm man page with a description of this behavior.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
5 files changed