mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] tpm: Remove enum tpm2_session_types
@ 2026-11-08 20:05 Alban Munari via B4 Relay
  2026-11-08 22:32 ` Jarkko Sakkinen
  0 siblings, 1 reply; 2+ messages in thread
From: Alban Munari via B4 Relay @ 2026-11-08 20:05 UTC (permalink / raw)
  To: Peter Huewe, Jarkko Sakkinen, Jason Gunthorpe, James Bottomley,
	Ard Biesheuvel
  Cc: linux-integrity, linux-kernel, Alban Munari

From: Alban Munari <alban.kernel@gmail.com>

TPM2_SE_TRIAL is defined as 0x02, while the TPM 2.0 Library
specification, Part 2: Structures, revision 01.83, section 6.11, Table
21, defines TPM_SE_TRIAL as 0x03.

The only user of enum tpm2_session_types is tpm2_start_auth_session(),
which starts an HMAC session. Remove the enum and pass the session type
there as a literal, rather than fix a constant that nothing uses.

Suggested-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Alban Munari <alban.kernel@gmail.com>
---
Changes in v2:
- Remove the enum instead of fixing TPM2_SE_TRIAL (Jarkko).
- Refer to the section of the TCG specification.
- Drop the Fixes tag: no code used the wrong value.
- Link to v1: https://patch.msgid.link/20261108-tpm-se-trial-v1-1-492218f9de41@gmail.com

To: Peter Huewe <peterhuewe@gmx.de>
To: Jarkko Sakkinen <jarkko@kernel.org>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: linux-integrity@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/char/tpm/tpm2-sessions.c | 2 +-
 include/linux/tpm_command.h      | 6 ------
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/char/tpm/tpm2-sessions.c b/drivers/char/tpm/tpm2-sessions.c
index ca1e2bf424e1..63e1dd596bc5 100644
--- a/drivers/char/tpm/tpm2-sessions.c
+++ b/drivers/char/tpm/tpm2-sessions.c
@@ -1043,7 +1043,7 @@ int tpm2_start_auth_session(struct tpm_chip *chip)
 		return rc;
 	}
 	/* session type (HMAC, audit or policy) */
-	tpm_buf_append_u8(buf, TPM2_SE_HMAC);
+	tpm_buf_append_u8(buf, 0x00 /* HMAC */);
 
 	/* symmetric encryption parameters */
 	/* symmetric algorithm */
diff --git a/include/linux/tpm_command.h b/include/linux/tpm_command.h
index fc446a1282e2..c9988fcff916 100644
--- a/include/linux/tpm_command.h
+++ b/include/linux/tpm_command.h
@@ -168,12 +168,6 @@ struct tpm1_get_random_out {
 /* TPM2 specific constants. */
 #define TPM2_SPACE_BUFFER_SIZE		16384 /* 16 kB */
 
-enum tpm2_session_types {
-	TPM2_SE_HMAC	= 0x00,
-	TPM2_SE_POLICY	= 0x01,
-	TPM2_SE_TRIAL	= 0x02,
-};
-
 enum tpm2_timeouts {
 	TPM2_TIMEOUT_A		= 750,
 	TPM2_TIMEOUT_B		= 4000,

---
base-commit: 05441d697f7f9a927264f4058cbbc6a03dfcac9d
change-id: 20261108-tpm-se-trial-580bef9b4f17

Best regards,
--  
Alban Munari <alban.kernel@gmail.com>



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-08 22:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-08 20:05 [PATCH v2] tpm: Remove enum tpm2_session_types Alban Munari via B4 Relay
2026-11-08 22:32 ` Jarkko Sakkinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®