]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/Library/DxeTrEEPhysicalPresenceLib/DxeTrEEPhysicalPresenceLib.c
SecurityPkg: Convert non DOS format files to DOS format
[mirror_edk2.git] / SecurityPkg / Library / DxeTrEEPhysicalPresenceLib / DxeTrEEPhysicalPresenceLib.c
index 28b809bce46a994f9f7d78adb9b1f14ec15527f0..ea9a29c0f0818a2383b6138e3a3920d4ac7ba0b5 100644 (file)
@@ -7,7 +7,7 @@
 \r
   TrEEExecutePendingTpmRequest() will receive untrusted input and do validation.\r
 \r
-Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials \r
 are licensed and made available under the terms and conditions of the BSD License \r
 which accompanies this distribution.  The full text of the license may be found at \r
@@ -264,12 +264,12 @@ TrEEUserConfirm (
       FreePool (TmpStr1);\r
 \r
       TmpStr1 = TrEEPhysicalPresenceGetStringById (STRING_TOKEN (TPM_WARNING_CLEAR));\r
-      StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16 *)) - StrLen (ConfirmText) - 1);\r
-      StrnCat (ConfirmText, L" \n\n", (BufSize / sizeof (CHAR16 *)) - StrLen (ConfirmText) - 1);\r
+      StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);\r
+      StrnCat (ConfirmText, L" \n\n", (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);\r
       FreePool (TmpStr1);      \r
 \r
       TmpStr1 = TrEEPhysicalPresenceGetStringById (STRING_TOKEN (TPM_CAUTION_KEY));\r
-      StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16 *)) - StrLen (ConfirmText) - 1);\r
+      StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);\r
       FreePool (TmpStr1);\r
       break;\r
 \r
@@ -282,20 +282,20 @@ TrEEUserConfirm (
       FreePool (TmpStr1);\r
 \r
       TmpStr1 = TrEEPhysicalPresenceGetStringById (STRING_TOKEN (TPM_NOTE_CLEAR));\r
-      StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16 *)) - StrLen (ConfirmText) - 1);\r
+      StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);\r
       FreePool (TmpStr1);\r
 \r
       TmpStr1 = TrEEPhysicalPresenceGetStringById (STRING_TOKEN (TPM_WARNING_CLEAR));\r
-      StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16 *)) - StrLen (ConfirmText) - 1);\r
-      StrnCat (ConfirmText, L" \n\n", (BufSize / sizeof (CHAR16 *)) - StrLen (ConfirmText) - 1);\r
+      StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);\r
+      StrnCat (ConfirmText, L" \n\n", (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);\r
       FreePool (TmpStr1); \r
 \r
       TmpStr1 = TrEEPhysicalPresenceGetStringById (STRING_TOKEN (TPM_CAUTION_KEY));\r
-      StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16 *)) - StrLen (ConfirmText) - 1);\r
+      StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);\r
       FreePool (TmpStr1);\r
 \r
       TmpStr1 = TrEEPhysicalPresenceGetStringById (STRING_TOKEN (TPM_NO_PPI_INFO));\r
-      StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16 *)) - StrLen (ConfirmText) - 1);\r
+      StrnCat (ConfirmText, TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);\r
       FreePool (TmpStr1);\r
       break;\r
 \r
@@ -568,19 +568,20 @@ TrEEPhysicalPresenceLibProcessRequest (
                   &PpiFlags\r
                   );\r
   if (EFI_ERROR (Status)) {\r
-    if (Status == EFI_NOT_FOUND) {\r
-      PpiFlags = 0;\r
-      Status   = gRT->SetVariable (\r
-                        TREE_PHYSICAL_PRESENCE_FLAGS_VARIABLE,\r
-                        &gEfiTrEEPhysicalPresenceGuid,\r
-                        EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
-                        sizeof (UINT8),\r
-                        &PpiFlags\r
-                        );\r
+    PpiFlags = 0;\r
+    Status   = gRT->SetVariable (\r
+                      TREE_PHYSICAL_PRESENCE_FLAGS_VARIABLE,\r
+                      &gEfiTrEEPhysicalPresenceGuid,\r
+                      EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
+                      sizeof (UINT8),\r
+                      &PpiFlags\r
+                      );\r
+    if (EFI_ERROR (Status)) {\r
+      DEBUG ((EFI_D_ERROR, "[TPM2] Set physical presence flag failed, Status = %r\n", Status));\r
+      return ;\r
     }\r
-    ASSERT_EFI_ERROR (Status);\r
   }\r
-  DEBUG ((EFI_D_ERROR, "[TPM2] PpiFlags = %x, Status = %r\n", PpiFlags, Status));\r
+  DEBUG ((EFI_D_INFO, "[TPM2] PpiFlags = %x\n", PpiFlags));\r
 \r
   //\r
   // This flags variable controls whether physical presence is required for TPM command. \r
@@ -611,27 +612,28 @@ TrEEPhysicalPresenceLibProcessRequest (
                   &TcgPpData\r
                   );\r
   if (EFI_ERROR (Status)) {\r
-    if (Status == EFI_NOT_FOUND) {\r
-      ZeroMem ((VOID*)&TcgPpData, sizeof (TcgPpData));\r
-      DataSize = sizeof (EFI_TREE_PHYSICAL_PRESENCE);\r
-      Status   = gRT->SetVariable (\r
-                        TREE_PHYSICAL_PRESENCE_VARIABLE,\r
-                        &gEfiTrEEPhysicalPresenceGuid,\r
-                        EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
-                        DataSize,\r
-                        &TcgPpData\r
-                        );\r
+    ZeroMem ((VOID*)&TcgPpData, sizeof (TcgPpData));\r
+    DataSize = sizeof (EFI_TREE_PHYSICAL_PRESENCE);\r
+    Status   = gRT->SetVariable (\r
+                      TREE_PHYSICAL_PRESENCE_VARIABLE,\r
+                      &gEfiTrEEPhysicalPresenceGuid,\r
+                      EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
+                      DataSize,\r
+                      &TcgPpData\r
+                      );\r
+    if (EFI_ERROR (Status)) {\r
+      DEBUG ((EFI_D_ERROR, "[TPM2] Set physical presence variable failed, Status = %r\n", Status));\r
+      return ;\r
     }\r
-    ASSERT_EFI_ERROR (Status);\r
   }\r
 \r
-  DEBUG ((EFI_D_ERROR, "[TPM2] Flags=%x, PPRequest=%x (LastPPRequest=%x)\n", PpiFlags, TcgPpData.PPRequest, TcgPpData.LastPPRequest));\r
+  DEBUG ((EFI_D_INFO, "[TPM2] Flags=%x, PPRequest=%x (LastPPRequest=%x)\n", PpiFlags, TcgPpData.PPRequest, TcgPpData.LastPPRequest));\r
 \r
   //\r
   // Execute pending TPM request.\r
   //  \r
   TrEEExecutePendingTpmRequest (PlatformAuth, &TcgPpData, PpiFlags);\r
-  DEBUG ((EFI_D_ERROR, "[TPM2] PPResponse = %x (LastPPRequest=%x, Flags=%x)\n", TcgPpData.PPResponse, TcgPpData.LastPPRequest, PpiFlags));\r
+  DEBUG ((EFI_D_INFO, "[TPM2] PPResponse = %x (LastPPRequest=%x, Flags=%x)\n", TcgPpData.PPResponse, TcgPpData.LastPPRequest, PpiFlags));\r
 \r
 }\r
 \r