All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tzung-Bi Shih <tzungbi@google.com>
To: Benson Leung <bleung@google.com>
Cc: ALSA development <alsa-devel@alsa-project.org>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Arnd Bergmann <arnd@arndb.de>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Eric Biggers <ebiggers@kernel.org>,
	Guenter Roeck <groeck@chromium.org>,
	Mark Brown <broonie@kernel.org>,
	Enric Balletbo i Serra <enric.balletbo@collabora.com>,
	Benson Leung <bleung@chromium.org>,
	Ard Biesheuvel <ardb@kernel.org>,
	Cheng-Yi Chiang <cychiang@chromium.org>
Subject: Re: [PATCH] SoC: cros_ec_codec: switch to library API for SHA-256
Date: Fri, 15 May 2020 10:40:19 +0800	[thread overview]
Message-ID: <CA+Px+wWps5d5qpL_0ed2jrD5bMKgd=8p1rbcRH28J-1SpgVz0Q@mail.gmail.com> (raw)
In-Reply-To: <20200514162548.GA141824@google.com>

On Fri, May 15, 2020 at 12:26 AM Benson Leung <bleung@google.com> wrote:
> On Thu, May 14, 2020 at 06:18:47PM +0200, Ard Biesheuvel wrote:
> > The CrOS EC codec driver uses SHA-256 explicitly, and not in a
> > performance critical manner, so there is really no point in using
> > the dynamic SHASH crypto API here. Let's switch to the library API
> > instead.

Pardon me if I don't understand it precisely.  What is the difference
between the two APIs?  Suppose it should calculate the same SHA256
hash with the same binary blob after switching to library API?

> > Looking at the code, I was wondering if the SHA-256 is really required
> > here? It looks like it is using it as some kind of fingerprint to decide
> > whether the provided file is identical to the one that has already been
> > loaded. If this is the case, we should probably just use CRC32 instead.

No, the binary blob carries data and possibly code.  We are not only
using the hash as a fingerprint but also an integrity check.

> > Also, do we really need to wipe the context struct? Is there any security
> > sensitive data in there?

No, not necessary as far as I know.

  reply	other threads:[~2020-05-15  2:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-14 16:18 [PATCH] SoC: cros_ec_codec: switch to library API for SHA-256 Ard Biesheuvel
2020-05-14 16:25 ` Benson Leung
2020-05-15  2:40   ` Tzung-Bi Shih [this message]
2020-05-15  6:04     ` Ard Biesheuvel
2020-05-15  6:40       ` Tzung-Bi Shih
2020-05-15  6:48         ` Tzung-Bi Shih
2020-05-15  6:50         ` Ard Biesheuvel
2020-05-15  9:02           ` Tzung-Bi Shih
2020-05-15  9:08             ` Ard Biesheuvel
2020-05-15  9:47 ` Mark Brown

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='CA+Px+wWps5d5qpL_0ed2jrD5bMKgd=8p1rbcRH28J-1SpgVz0Q@mail.gmail.com' \
    --to=tzungbi@google.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=ardb@kernel.org \
    --cc=arnd@arndb.de \
    --cc=bleung@chromium.org \
    --cc=bleung@google.com \
    --cc=broonie@kernel.org \
    --cc=cychiang@chromium.org \
    --cc=ebiggers@kernel.org \
    --cc=enric.balletbo@collabora.com \
    --cc=groeck@chromium.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=lgirdwood@gmail.com \
    /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.