Re: [PATCH v1.3 3/4] keys: add new trusted key-type

From: David Safford
Date: Fri Nov 12 2010 - 08:00:05 EST


On Thu, 2010-11-11 at 21:57 +0000, David Howells wrote:
> Mimi Zohar <zohar@xxxxxxxxxxxxxxxxxx> wrote:

Thanks for the helpful comments - much appreciated.
Willdo on all of them - just one question on the last comment:

> > +/*
> > + * Have the TPM seal(encrypt) the trusted key, possibly based on
> > + * Platform Configuration Registers (PCRs). AUTH1 for sealing key.
> > + */
> > +static int tpm_seal(struct tpm_buf *tb, uint16_t keytype,
> > + uint32_t keyhandle, unsigned char *keyauth,
> > + unsigned char *data, uint32_t datalen,
> > + unsigned char *blob, uint32_t * bloblen,
> > + unsigned char *blobauth,
> > + unsigned char *pcrinfo, uint32_t pcrinfosize)
> > +{
> > + struct osapsess sess;
> > + unsigned char encauth[TPM_HASH_SIZE];
> > + unsigned char pubauth[TPM_HASH_SIZE];
> > + unsigned char xorwork[TPM_HASH_SIZE * 2];
> > + unsigned char xorhash[TPM_HASH_SIZE];
> > + unsigned char nonceodd[TPM_NONCE_SIZE];
>
> That's quite a lot of stack space, and you're calling other functions that
> also allocate chunks of stack space.

checkstack showed that the max stack usage was for tpm_seal, at 530
bytes. (The rest were 300 or less.) I can certainly throw the hashes
and nonce (120 bytes) into a dynamically allocated struct, if you
think it is worth the extra code...

thanks
dave
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/