]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.c
SecurityPkg: Clear LocalAuthSession content after use.
[mirror_edk2.git] / SecurityPkg / Library / DxeTcg2PhysicalPresenceLib / DxeTcg2PhysicalPresenceLib.c
index 8912ee4108e329e367b5679198fe4d572d650536..e34fd8da25720e4bb2dfccf93686659f3c32d463 100644 (file)
@@ -225,7 +225,7 @@ Tpm2CommandAllocPcr (
              );\r
   DEBUG ((EFI_D_INFO, "Tpm2PcrAllocate - %r\n", Status));\r
   if (EFI_ERROR (Status)) {\r
              );\r
   DEBUG ((EFI_D_INFO, "Tpm2PcrAllocate - %r\n", Status));\r
   if (EFI_ERROR (Status)) {\r
-    return Status;\r
+    goto Done;\r
   }\r
 \r
   DEBUG ((EFI_D_INFO, "AllocationSuccess - %02x\n", AllocationSuccess));\r
   }\r
 \r
   DEBUG ((EFI_D_INFO, "AllocationSuccess - %02x\n", AllocationSuccess));\r
@@ -233,7 +233,9 @@ Tpm2CommandAllocPcr (
   DEBUG ((EFI_D_INFO, "SizeNeeded        - %08x\n", SizeNeeded));\r
   DEBUG ((EFI_D_INFO, "SizeAvailable     - %08x\n", SizeAvailable));\r
 \r
   DEBUG ((EFI_D_INFO, "SizeNeeded        - %08x\n", SizeNeeded));\r
   DEBUG ((EFI_D_INFO, "SizeAvailable     - %08x\n", SizeAvailable));\r
 \r
-  return EFI_SUCCESS;\r
+Done:\r
+  ZeroMem(&LocalAuthSession.hmac, sizeof(LocalAuthSession.hmac));\r
+  return Status;\r
 }\r
 \r
 /**\r
 }\r
 \r
 /**\r
@@ -264,6 +266,8 @@ Tpm2CommandChangeEps (
 \r
   Status = Tpm2ChangeEPS (TPM_RH_PLATFORM, AuthSession);\r
   DEBUG ((EFI_D_INFO, "Tpm2ChangeEPS - %r\n", Status));\r
 \r
   Status = Tpm2ChangeEPS (TPM_RH_PLATFORM, AuthSession);\r
   DEBUG ((EFI_D_INFO, "Tpm2ChangeEPS - %r\n", Status));\r
+\r
+  ZeroMem(&LocalAuthSession.hmac, sizeof(LocalAuthSession.hmac));\r
   return Status;\r
 }\r
 \r
   return Status;\r
 }\r
 \r