stefanberger / swtpm

Libtpms-based TPM emulator with socket, character device, and Linux CUSE interface.
Other
564 stars 136 forks source link

swtpm: Use TPMLIB_WasManufactured to check whether profile was applied #896

Closed stefanberger closed 2 weeks ago

stefanberger commented 2 weeks ago

Use TPMLIB_WasManufactured to check whether a profile was applied since a new instance was created. If a profile was given and no new TPM 2 instance was created then display an error message and exit with an error code. This avoids silently ignoring a provided profile that was not applied since the TPM 2 instance already existed.

Make sure that a profile is only applied once by swtpm by clearing the json_profile once TPMLIB_MainInit succeeded.