[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240917154444.702370-8-jarkko@kernel.org>
Date: Tue, 17 Sep 2024 18:44:36 +0300
From: Jarkko Sakkinen <jarkko@...nel.org>
To: linux-integrity@...r.kernel.org
Cc: James.Bottomley@...senPartnership.com,
roberto.sassu@...wei.com,
mapengyu@...il.com,
Jarkko Sakkinen <jarkko@...nel.org>,
Mimi Zohar <zohar@...ux.ibm.com>,
David Howells <dhowells@...hat.com>,
Paul Moore <paul@...l-moore.com>,
James Morris <jmorris@...ei.org>,
"Serge E. Hallyn" <serge@...lyn.com>,
keyrings@...r.kernel.org,
linux-security-module@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v3 7/7] tpm: open code tpm2_create_null_primary()
As tpm2_sessions_init() has been shrunk only as a single and only call
site for tpm2_create_null_primary(), open code it to the call site.
Signed-off-by: Jarkko Sakkinen <jarkko@...nel.org>
---
v3:
- A new patch.
---
drivers/char/tpm/tpm2-sessions.c | 26 +++++++-------------------
1 file changed, 7 insertions(+), 19 deletions(-)
diff --git a/drivers/char/tpm/tpm2-sessions.c b/drivers/char/tpm/tpm2-sessions.c
index d240039d0849..72c83eb3f665 100644
--- a/drivers/char/tpm/tpm2-sessions.c
+++ b/drivers/char/tpm/tpm2-sessions.c
@@ -1281,7 +1281,13 @@ static int tpm2_create_primary(struct tpm_chip *chip, u32 hierarchy,
return rc;
}
-static int tpm2_create_null_primary(struct tpm_chip *chip)
+/**
+ * tpm2_sessions_init() - Initialize the null keypair for authenticated sessions
+ * @chip: a &tpm_chip instance
+ *
+ * Return: 0 on success and -ENODEV on failure.
+ */
+int tpm2_sessions_init(struct tpm_chip *chip)
{
u32 null_key;
int rc;
@@ -1308,23 +1314,5 @@ static int tpm2_create_null_primary(struct tpm_chip *chip)
/* Map all errors to -ENODEV: */
return rc ? -ENODEV : rc;
}
-
-/**
- * tpm2_sessions_init() - start of day initialization for the sessions code
- * @chip: TPM chip
- *
- * Derive and context save the null primary and allocate memory in the
- * struct tpm_chip for the authorizations.
- */
-int tpm2_sessions_init(struct tpm_chip *chip)
-{
- int rc;
-
- rc = tpm2_create_null_primary(chip);
- if (rc)
- return rc;
-
- return rc;
-}
EXPORT_SYMBOL(tpm2_sessions_init);
#endif /* CONFIG_TCG_TPM2_HMAC */
--
2.46.0
Powered by blists - more mailing lists