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.
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.