All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Kent Yoder <key@linux.vnet.ibm.com>
Cc: linux-kernel@vger.kernel.org, tpmdd-devel@lists.sourceforge.net,
	m.selhorst@sirrix.com, safford@us.ibm.com
Subject: Re: [PATCH 1/2] tpm: Move tpm_get_random api into the TPM device driver
Date: Thu, 26 Jul 2012 15:12:19 -0700	[thread overview]
Message-ID: <5011C0C3.4090009@zytor.com> (raw)
In-Reply-To: <1339094834.21398.4.camel@key-ThinkPad-W510>

On 06/07/2012 11:47 AM, Kent Yoder wrote:
> Move the tpm_get_random api from the trusted keys code into the TPM
> device driver itself so that other callers can make use of it. Also,
> change the api slightly so that the number of bytes read is returned in
> the call, since the TPM command can potentially return fewer bytes than
> requested.
>
> Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>

> +int tpm_get_random(u32 chip_num, u8 *out, size_t *max)

/* ... */

>   	case Opt_new:
> -		ret = my_get_random(payload->key, payload->key_len);
> +		ret = tpm_get_random(TPM_ANY_NUM, payload->key,
> +				     &payload->key_len);

payload->key_len is unsigned int, not size_t; this causes an overwrite 
of blob_len on 64-bit platforms.

	-hpa


-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


  parent reply	other threads:[~2012-07-26 22:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-07 18:42 [PATCH 0/2] Move the tpm_get_random api and add an hwrng driver for it Kent Yoder
2012-06-07 18:47 ` [PATCH 1/2] tpm: Move tpm_get_random api into the TPM device driver Kent Yoder
2012-06-08 19:13   ` David Safford
2012-07-26 22:12   ` H. Peter Anvin [this message]
2012-07-27 14:49     ` Kent Yoder
2012-07-27 15:07       ` H. Peter Anvin
2012-07-27  0:10   ` H. Peter Anvin
2012-07-27 14:51     ` Kent Yoder
2012-06-07 18:47 ` [PATCH 2/2] hw_random: add support for the TPM chip as a hardware RNG source Kent Yoder
2012-06-08 19:13   ` David Safford
2012-07-26 21:58   ` H. Peter Anvin
2012-07-26 22:28     ` H. Peter Anvin
2012-06-08 19:13 ` [PATCH 0/2] Move the tpm_get_random api and add an hwrng driver for it David Safford

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=5011C0C3.4090009@zytor.com \
    --to=hpa@zytor.com \
    --cc=key@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.selhorst@sirrix.com \
    --cc=safford@us.ibm.com \
    --cc=tpmdd-devel@lists.sourceforge.net \
    /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.