mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alban Munari via B4 Relay <devnull+alban.kernel.gmail.com@kernel.org>
To: Peter Huewe <peterhuewe@gmx.de>,
	Jarkko Sakkinen <jarkko@kernel.org>,
	 Jason Gunthorpe <jgg@ziepe.ca>,
	 James Bottomley <James.Bottomley@HansenPartnership.com>,
	 Ard Biesheuvel <ardb@kernel.org>
Cc: linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Alban Munari <alban.kernel@gmail.com>
Subject: [PATCH v2] tpm: Remove enum tpm2_session_types
Date: Sun, 08 Nov 2026 20:05:12 +0000	[thread overview]
Message-ID: <20261108-tpm-se-trial-v2-1-92c2090351d7@gmail.com> (raw)

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>



             reply	other threads:[~2026-11-08 20:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-08 20:05 Alban Munari via B4 Relay [this message]
2026-11-08 22:32 ` Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261108-tpm-se-trial-v2-1-92c2090351d7@gmail.com \
    --to=devnull+alban.kernel.gmail.com@kernel.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=alban.kernel@gmail.com \
    --cc=ardb@kernel.org \
    --cc=jarkko@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®