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: <20170428120149.jjxwbp6nmthk4y3q@intel.com>
Date:   Fri, 28 Apr 2017 15:01:49 +0300
From:   Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
To:     Jerry Snitselaar <jsnitsel@...hat.com>
Cc:     tpmdd-devel@...ts.sourceforge.net, linux-kernel@...r.kernel.org,
        Peter Huewe <peterhuewe@....de>,
        Marcel Selhorst <tpmdd@...horst.net>,
        Jason Gunthorpe <jgunthorpe@...idianresearch.com>
Subject: Re: [PATCH] tpm: print tpm error code in hex for TPM2.0 devices

On Wed, Apr 26, 2017 at 03:39:54PM -0700, Jerry Snitselaar wrote:
> For easier decoding, output the error code returned
> from the tpm device in hex when the device is TPM2.0.
> 
> Cc: Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
> Cc: Peter Huewe <peterhuewe@....de>
> Cc: Marcel Selhorst <tpmdd@...horst.net>
> Cc: Jason Gunthorpe <jgunthorpe@...idianresearch.com>
> Reported-by: Ken Goldman <kgoldman@...ibm.com>
> Signed-off-by: Jerry Snitselaar <jsnitsel@...hat.com>
> ---
>  drivers/char/tpm/tpm-interface.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
> index bd2128e0b56c..b6c67eef9ae7 100644
> --- a/drivers/char/tpm/tpm-interface.c
> +++ b/drivers/char/tpm/tpm-interface.c
> @@ -453,9 +453,14 @@ ssize_t tpm_transmit_cmd(struct tpm_chip *chip, const void *buf,
>  		return -EFAULT;
>  
>  	err = be32_to_cpu(header->return_code);
> -	if (err != 0 && desc)
> -		dev_err(&chip->dev, "A TPM error (%d) occurred %s\n", err,
> -			desc);
> +	if (err != 0 && desc) {
> +		if (chip->flags & TPM_CHIP_FLAG_TPM2)
> +			dev_err(&chip->dev, "A TPM 2.0 error (0x%x) occurred %s\n",
> +				err, desc);
> +		else
> +			dev_err(&chip->dev, "A TPM error (%d) occurred %s\n",
> +				err, desc);
> +	}

Is there a reason for not to apply this also to TPM 1.2?

/Jarkko

>  	if (err)
>  		return err;
>  
> -- 
> 2.13.0.rc0.45.ge2cb6ab84
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ