On Sun, Nov 08, 2026 at 08:05:12PM +0000, Alban Munari via B4 Relay wrote:
> From: Alban Munari <[email protected]>
> 
> 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 <[email protected]>
> Signed-off-by: Alban Munari <[email protected]>
> ---
> 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/[email protected]
> 
> To: Peter Huewe <[email protected]>
> To: Jarkko Sakkinen <[email protected]>
> To: Jason Gunthorpe <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> ---
>  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 <[email protected]>
> 
> 

Thank you.


Reviewed-by: Jarkko Sakkinen <[email protected]>

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 via email to