lkml.org 
[lkml]   [2010]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v1.5 3/5] key: add tpm_send command
From
Date
On Tue, 2010-11-30 at 14:32 +0000, David Howells wrote:
> Serge Hallyn <serge.hallyn@canonical.com> wrote:
>
> > > +int tpm_send(u32 chip_num, void *cmd, size_t buflen)
> >
> > Hate to nit-pick, but any particular reason you're not following the
> > rest of the file and using 'struct tpm_cmd_t *cmd' here?
>
> Ummm... Something else I've just noticed...
>
> static ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf,
> size_t bufsiz)
>
> would suggest that buf is read-only, but tpm_transit() keeps casting it away,
> and especially, casts it away before passing it to chip->vendor.recv()...
> This would seem to indicate a logic error somewhere.
>
> Certainly, tpm_atml_recv() modifies the buffer it is given to...

as does tpm_tis_recv(). By the TCG spec, the return data should go in the
same input buffer.

> I suspect the argument and reply buffer pointers should be passed separately.

It seems more like a spurious "const" in tpm_transmit(). This has been in the
code for a long time. Good catch. I'll draft a cleanup for these and some
other nits and send to Rajiv...

thanks!
dave

> David
>



\
 
 \ /
  Last update: 2010-11-30 16:25    [W:0.353 / U:0.780 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site