grub-devel
[Top][All Lists]
Advanced

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

[PATCH 14/14] tpm2: remove the unnecessary variables


From: Gary Lin
Subject: [PATCH 14/14] tpm2: remove the unnecessary variables
Date: Wed, 22 Feb 2023 15:00:54 +0800

Since the NULL 'encryptedSalt' of 'TPM2_StartAuthSession' is handled as
an empty TPM2B structure, there is no need to declare an empty salt.
As for 'nonceTPM', we don't use in the following TPM2 commands, so we
can safely ignore it.

Signed-off-by: Gary Lin <glin@suse.com>
---
 grub-core/tpm2/module.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/grub-core/tpm2/module.c b/grub-core/tpm2/module.c
index bebdecd1c..580c1f972 100644
--- a/grub-core/tpm2/module.c
+++ b/grub-core/tpm2/module.c
@@ -311,9 +311,7 @@ grub_tpm2_protector_srk_recover (const struct 
grub_tpm2_protector_context *ctx,
   grub_size_t sealed_key_size;
   TPM_HANDLE srk_handle;
   TPM2B_NONCE nonceCaller = { 0 };
-  TPM2B_ENCRYPTED_SECRET salt = { 0 };
   TPMT_SYM_DEF symmetric = { 0 };
-  TPM2B_NONCE nonceTPM = { 0 };
   TPMI_SH_AUTH_SESSION session;
   TPML_PCR_SELECTION pcrSel = {
     .count = 1,
@@ -364,9 +362,9 @@ grub_tpm2_protector_srk_recover (const struct 
grub_tpm2_protector_context *ctx,
   nonceCaller.size = TPM_SHA256_DIGEST_SIZE;
   symmetric.algorithm = TPM_ALG_NULL;
 
-  rc = TPM2_StartAuthSession (TPM_RH_NULL, TPM_RH_NULL, 0, &nonceCaller, &salt,
+  rc = TPM2_StartAuthSession (TPM_RH_NULL, TPM_RH_NULL, NULL, &nonceCaller, 
NULL,
                              TPM_SE_POLICY, &symmetric, TPM_ALG_SHA256,
-                             &session, &nonceTPM, 0);
+                             &session, NULL, NULL);
   if (rc)
     {
       grub_error (err, N_("Failed to start auth session (TPM2_StartAuthSession 
"
-- 
2.35.3




reply via email to

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