]> git.proxmox.com Git - swtpm.git/commitdiff
swtpm: Also send TPM2_Shutdown when swtpm terminates by signal
authorStefan Berger <stefanb@linux.ibm.com>
Thu, 22 Sep 2022 00:11:12 +0000 (20:11 -0400)
committerStefan Berger <stefanb@us.ibm.com>
Thu, 22 Sep 2022 13:52:10 +0000 (09:52 -0400)
Also send TPM2_Shutdown when swtpm is terminated by a signal or due to
lost connection (--terminate option). Previously supported reasons for
sending the TPM2_Shutdown were primarily related to commands sent via
the command channel.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
src/swtpm/mainloop.c

index 1650cc418871a60af61b330d05d8215168b879f3..34fab4286eac4f27ac016bc3f9037bf3eb7aedb9 100644 (file)
@@ -366,6 +366,9 @@ skip_process:
             break;
     }
 
+    if (tpm_running && !mlp->disable_auto_shutdown)
+        tpmlib_maybe_send_tpm2_shutdown(mlp->tpmversion, &mlp->lastCommand);
+
     free(rbuffer);
     free(command);