[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
- [PATCH 00/14] Automatic Disk Unlock with TPM2, Gary Lin, 2023/02/22
- [PATCH 01/14] protectors: Add key protectors framework, Gary Lin, 2023/02/22
- [PATCH 02/14] tpm2: Add TPM Software Stack (TSS), Gary Lin, 2023/02/22
- [PATCH 03/14] protectors: Add TPM2 Key Protector, Gary Lin, 2023/02/22
- [PATCH 05/14] util/grub-protect: Add new tool, Gary Lin, 2023/02/22
- [PATCH 07/14] tpm2: Don't measure the sealed key, Gary Lin, 2023/02/22
- [PATCH 09/14] tpm2: declare the input arguments of TPM2 functions as const, Gary Lin, 2023/02/22
- [PATCH 13/14] tpm2: allow some command parameters to be NULL, Gary Lin, 2023/02/22
- [PATCH 14/14] tpm2: remove the unnecessary variables,
Gary Lin <=
- [PATCH 04/14] cryptodisk: Support key protectors, Gary Lin, 2023/02/22
- [PATCH 06/14] crytodisk: fix cryptodisk module looking up, Gary Lin, 2023/02/22
- [PATCH 08/14] tpm2: adjust the input parameters of TPM2_EvictControl, Gary Lin, 2023/02/22
- [PATCH 11/14] tpm2: check the command parameters of TPM2 commands, Gary Lin, 2023/02/22
- [PATCH 10/14] tpm2: resend the command on TPM_RC_RETRY, Gary Lin, 2023/02/22
- [PATCH 12/14] tpm2: pack the missing authorization command for TPM2_PCR_Read, Gary Lin, 2023/02/22
- Re: [PATCH 00/14] Automatic Disk Unlock with TPM2, Daniel Kiper, 2023/02/28