lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.1810200408350.9963@jsakkine-mobl1>
Date:   Sat, 20 Oct 2018 04:09:13 +0300 (EEST)
From:   Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
To:     Tomas Winkler <tomas.winkler@...el.com>
cc:     Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>,
        Jason Gunthorpe <jgg@...pe.ca>,
        Nayna Jain <nayna@...ux.vnet.ibm.com>,
        Alexander Usyskin <alexander.usyskin@...el.com>,
        Tadeusz Struk <tadeusz.struk@...el.com>,
        linux-integrity@...r.kernel.org,
        linux-security-module@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v7 13/21] tpm: add tpm_auto_startup() into
 tpm-interface.c

On Fri, 19 Oct 2018, Tomas Winkler wrote:
> Add wrapper tpm_auto_startup() to tpm-interface.c
> instead of open coded decision between TPM 1.x and TPM 2.x
> in tpm-chip.c
>
> Signed-off-by: Tomas Winkler <tomas.winkler@...el.com>
> Tested-by: Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
> ---
> V3: New in the series.
> V4: Fix the commit message.
> V5-7: Resend.
>
> drivers/char/tpm/tpm-chip.c      | 11 +++--------
> drivers/char/tpm/tpm-interface.c | 15 +++++++++++++++
> drivers/char/tpm/tpm.h           |  1 +
> 3 files changed, 19 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
> index 46caadca916a..32db84683c40 100644
> --- a/drivers/char/tpm/tpm-chip.c
> +++ b/drivers/char/tpm/tpm-chip.c
> @@ -451,14 +451,9 @@ int tpm_chip_register(struct tpm_chip *chip)
> {
> 	int rc;
>
> -	if (chip->ops->flags & TPM_OPS_AUTO_STARTUP) {
> -		if (chip->flags & TPM_CHIP_FLAG_TPM2)
> -			rc = tpm2_auto_startup(chip);
> -		else
> -			rc = tpm1_auto_startup(chip);
> -		if (rc)
> -			return rc;
> -	}
> +	rc = tpm_auto_startup(chip);
> +	if (rc)
> +		return rc;
>
> 	tpm_sysfs_add_device(chip);
>
> diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
> index 54b81700561b..69e007a198ce 100644
> --- a/drivers/char/tpm/tpm-interface.c
> +++ b/drivers/char/tpm/tpm-interface.c
> @@ -545,6 +545,21 @@ int tpm_send(struct tpm_chip *chip, void *cmd, size_t buflen)
> }
> EXPORT_SYMBOL_GPL(tpm_send);
>
> +int tpm_auto_startup(struct tpm_chip *chip)
> +{
> +	int rc;
> +
> +	if (!(chip->ops->flags & TPM_OPS_AUTO_STARTUP))
> +		return 0;
> +
> +	if (chip->flags & TPM_CHIP_FLAG_TPM2)
> +		rc = tpm2_auto_startup(chip);
> +	else
> +		rc = tpm1_auto_startup(chip);
> +
> +	return rc;
> +}
> +
> /*
>  * We are about to suspend. Save the TPM state
>  * so that it can be restored.
> diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
> index 2eb73f6966c3..daca1d0190b1 100644
> --- a/drivers/char/tpm/tpm.h
> +++ b/drivers/char/tpm/tpm.h
> @@ -541,6 +541,7 @@ ssize_t tpm_transmit_cmd(struct tpm_chip *chip, struct tpm_space *space,
> 			 size_t min_rsp_body_length, unsigned int flags,
> 			 const char *desc);
> int tpm_get_timeouts(struct tpm_chip *);
> +int tpm_auto_startup(struct tpm_chip *chip);
>
> int tpm1_pm_suspend(struct tpm_chip *chip, int tpm_suspend_pcr);
> int tpm1_auto_startup(struct tpm_chip *chip);
> -- 
> 2.14.4
>
>

Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>

/Jarkko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ