public inbox for linux-crypto@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Jarkko Sakkinen <jarkko@kernel.org>
Cc: keyrings@vger.kernel.org, David Howells <dhowells@redhat.com>,
	Denis Kenzior <denkenz@gmail.com>,
	Marcel Holtmann <marcel@holtmann.org>,
	James Morris <james.morris@microsoft.com>,
	linux-crypto@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH 1/3] KEYS: asym_tpm: fix buffer overreads in extract_key_parameters()
Date: Tue, 18 Jan 2022 16:59:47 -0800	[thread overview]
Message-ID: <Yedigyl+WNhB58MO@sol.localdomain> (raw)
In-Reply-To: <YeM/YIUTEwL4jNf3@iki.fi>

On Sat, Jan 15, 2022 at 11:40:48PM +0200, Jarkko Sakkinen wrote:
> > 
> > - Avoid integer overflows when validating size fields; 'sz + 12' and
> >   '4 + sz' overflowed if 'sz' is near U32_MAX.
> 
> So we have a struct tpm_header in include/linux/tpm.h. It would be way
> more informative to use sizeof(struct tpm_header) than number 12, even
> if the patch does not otherwise use the struct. It tells what it is, 12
> does not.

I don't think that would be an improvement, given that the code is using
hard-coded offsets.  If it's reading 4 bytes from cur + 8, it's much easier to
understand that it needs 12 bytes than 'sizeof(struct tpm_header)' bytes.

I'd certainly encourage whoever is maintaining this code to change it to use
structs instead, but that's not what this patch is meant to do.

- Eric

  reply	other threads:[~2022-01-19  0:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-13 23:54 [PATCH 0/3] KEYS: fixes for asym_tpm keys Eric Biggers
2022-01-13 23:54 ` [PATCH 1/3] KEYS: asym_tpm: fix buffer overreads in extract_key_parameters() Eric Biggers
2022-01-15 21:40   ` Jarkko Sakkinen
2022-01-19  0:59     ` Eric Biggers [this message]
2022-01-26 14:21       ` Jarkko Sakkinen
2022-01-26 14:22         ` Jarkko Sakkinen
2022-01-28 19:00           ` Eric Biggers
2022-02-08  9:30             ` Jarkko Sakkinen
2022-01-13 23:54 ` [PATCH 2/3] KEYS: asym_tpm: fix incorrect comment Eric Biggers
2022-01-15 19:12   ` Jarkko Sakkinen
2022-01-13 23:54 ` [PATCH 3/3] KEYS: asym_tpm: rename derive_pub_key() Eric Biggers
2022-01-15 19:09   ` Jarkko Sakkinen
2022-01-14 14:54 ` [PATCH 0/3] KEYS: fixes for asym_tpm keys Denis Kenzior
2022-01-15 21:42 ` Jarkko Sakkinen

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=Yedigyl+WNhB58MO@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=denkenz@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=james.morris@microsoft.com \
    --cc=jarkko@kernel.org \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=stable@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox