All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: alban.kernel@gmail.com
Cc: Peter Huewe <peterhuewe@gmx.de>, Jason Gunthorpe <jgg@ziepe.ca>,
	James Bottomley <James.Bottomley@hansenpartnership.com>,
	Ard Biesheuvel <ardb@kernel.org>,
	linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] tpm: Remove enum tpm2_session_types
Date: Mon, 9 Nov 2026 00:32:15 +0200	[thread overview]
Message-ID: <avD4b1i8rfvEuY34@kernel.org> (raw)
In-Reply-To: <20261108-tpm-se-trial-v2-1-92c2090351d7@gmail.com>

On Sun, Nov 08, 2026 at 08:05:12PM +0000, Alban Munari via B4 Relay wrote:
> 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>
> 
> 

Thank you.


Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

I mean think about it:

1. V1: Fixes a thing that does not cause any issues.
2. V2: Removes essentially a dead type definition.

There's a factor of a difference in the value of the change.

Br, Jarkko

      reply	other threads:[~2026-11-08 22:32 UTC|newest]

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

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=avD4b1i8rfvEuY34@kernel.org \
    --to=jarkko@kernel.org \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=alban.kernel@gmail.com \
    --cc=ardb@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.