vtpmmgr: Flush all transient keys
authorJason Andryuk <jandryuk@gmail.com>
Thu, 6 May 2021 13:59:17 +0000 (09:59 -0400)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 10 May 2021 13:49:01 +0000 (14:49 +0100)
We're only flushing 2 transients, but there are 3 handles.  Use <= to also
flush the third handle since TRANSIENT_LAST is inclusive

The number of transient handles/keys is hardware dependent, so this
should query for the limit.  And assignment of handles is assumed to be
sequential from the minimum.  That may not be guaranteed, but seems okay
with my tpm2.

Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
stubdom/vtpmmgr/init.c

index 56b4be85b38d3a15455d47cb4d90070c4ea974b6..4ae34a4fcbb46c3c357cb00860ffd2e007c2d790 100644 (file)
@@ -656,7 +656,7 @@ static TPM_RC flush_tpm2(void)
 {
     int i;
 
-    for (i = TRANSIENT_FIRST; i < TRANSIENT_LAST; i++)
+    for (i = TRANSIENT_FIRST; i <= TRANSIENT_LAST; i++)
          TPM2_FlushContext(i);
 
     return TPM_SUCCESS;