[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <922603265d61011dbb23f18a04525ae973b83ffd.camel@HansenPartnership.com>
Date: Wed, 03 Jul 2024 16:11:10 -0400
From: James Bottomley <James.Bottomley@...senPartnership.com>
To: Jarkko Sakkinen <jarkko@...nel.org>, linux-integrity@...r.kernel.org
Cc: Thorsten Leemhuis <regressions@...mhuis.info>, Linus Torvalds
<torvalds@...ux-foundation.org>, stable@...r.kernel.org, Stefan Berger
<stefanb@...ux.ibm.com>, Peter Huewe <peterhuewe@....de>, Jason Gunthorpe
<jgg@...pe.ca>, 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>, Ard Biesheuvel
<ardb@...nel.org>, Mario Limonciello <mario.limonciello@....com>,
linux-kernel@...r.kernel.org, keyrings@...r.kernel.org,
linux-security-module@...r.kernel.org
Subject: Re: [PATCH v2 2/3] tpm: Address !chip->auth in tpm_buf_append_name()
On Wed, 2024-07-03 at 21:24 +0300, Jarkko Sakkinen wrote:
[...]
> diff --git a/include/linux/tpm.h b/include/linux/tpm.h
> index 21a67dc9efe8..2844fea4a12a 100644
> --- a/include/linux/tpm.h
> +++ b/include/linux/tpm.h
> @@ -211,8 +211,8 @@ struct tpm_chip {
> u8 null_key_name[TPM2_NAME_SIZE];
> u8 null_ec_key_x[EC_PT_SZ];
> u8 null_ec_key_y[EC_PT_SZ];
> - struct tpm2_auth *auth;
> #endif
> + struct tpm2_auth *auth;
> };
Since auth should only be present if CONFIG_TCG_TPM2_HMAC this is
clearly an undesirable thing to do. I think you did it because in a
later patch you want to collapse the hmac sessions to use a single
routine, but you can make that check with the preprocessor __and
function defined in kconfig.h:
if (__and(IS_ENABLED(CONFIG_TCG_TPM2_HMAC), chip->auth))
Which will become 0 if the config is not enabled and chip->auth if it
is, thus eliminating the code in the former case while not causing the
compiler to complain about chip->auth not being defined even if it's
under the config parameter.
James
Powered by blists - more mailing lists