grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 08/14] tpm2: adjust the input parameters of TPM2_EvictControl


From: Gary Lin
Subject: [PATCH 08/14] tpm2: adjust the input parameters of TPM2_EvictControl
Date: Wed, 22 Feb 2023 15:00:48 +0800

Per "TCG TPM2 Part3 Commands", 'persistentHandle' of TPM2_EvictControl
is in the parameter area, i.e. after the authorization command. Adjust
the order of the arguments to match the spec definition.

Signed-off-by: Gary Lin <glin@suse.com>
---
 grub-core/tpm2/tpm2.c                  | 2 +-
 include/grub/tpm2/internal/functions.h | 2 +-
 util/grub-protect.c                    | 8 ++++----
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/grub-core/tpm2/tpm2.c b/grub-core/tpm2/tpm2.c
index 7baa4c6e5..85bd4ef23 100644
--- a/grub-core/tpm2/tpm2.c
+++ b/grub-core/tpm2/tpm2.c
@@ -662,8 +662,8 @@ TPM2_Create (TPMI_DH_OBJECT parentHandle,
 TPM_RC
 TPM2_EvictControl (TPMI_RH_PROVISION auth,
                   TPMI_DH_OBJECT objectHandle,
-                  TPMI_DH_PERSISTENT persistentHandle,
                   const TPMS_AUTH_COMMAND *authCommand,
+                  TPMI_DH_PERSISTENT persistentHandle,
                   TPMS_AUTH_RESPONSE *authResponse)
 {
   struct grub_tpm2_buffer in;
diff --git a/include/grub/tpm2/internal/functions.h 
b/include/grub/tpm2/internal/functions.h
index 9d5823975..f88ea2dfe 100644
--- a/include/grub/tpm2/internal/functions.h
+++ b/include/grub/tpm2/internal/functions.h
@@ -110,8 +110,8 @@ TPM2_Create (TPMI_DH_OBJECT parentHandle,
 TPM_RC
 TPM2_EvictControl (TPMI_RH_PROVISION auth,
                   TPMI_DH_OBJECT objectHandle,
-                  TPMI_DH_PERSISTENT persistentHandle,
                   const TPMS_AUTH_COMMAND *authCommand,
+                  TPMI_DH_PERSISTENT persistentHandle,
                   TPMS_AUTH_RESPONSE *authResponse);
 
 #endif /* ! GRUB_TPM2_INTERNAL_FUNCTIONS_HEADER */
diff --git a/util/grub-protect.c b/util/grub-protect.c
index acd30642f..f0f27af0a 100644
--- a/util/grub-protect.c
+++ b/util/grub-protect.c
@@ -695,8 +695,8 @@ grub_protect_tpm2_get_srk (struct grub_protect_args *args, 
TPM_HANDLE *srk)
   /* Persist SRK */
   if (args->tpm2_persist)
     {
-      rc = TPM2_EvictControl (TPM_RH_OWNER, srkHandle, args->tpm2_srk,
-                             &authCommand, NULL);
+      rc = TPM2_EvictControl (TPM_RH_OWNER, srkHandle, &authCommand,
+                             args->tpm2_srk, NULL);
       if (rc == TPM_RC_SUCCESS)
        {
          TPM2_FlushContext (srkHandle);
@@ -877,8 +877,8 @@ grub_protect_tpm2_remove (struct grub_protect_args *args)
   /* Evict SRK */
   authCommand.sessionHandle = TPM_RS_PW;
 
-  rc = TPM2_EvictControl (TPM_RH_OWNER, args->tpm2_srk, args->tpm2_srk,
-                         &authCommand, NULL);
+  rc = TPM2_EvictControl (TPM_RH_OWNER, args->tpm2_srk, &authCommand,
+                         args->tpm2_srk, NULL);
   if (rc != TPM_RC_SUCCESS)
     {
       fprintf (stderr,
-- 
2.35.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]