All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabio Estevam <festevam@gmail.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "Marek Vašut" <marex@denx.de>,
	"Steffen Trumtrar" <s.trumtrar@pengutronix.de>,
	"Tom Lendacky" <thomas.lendacky@amd.com>,
	"Russell King" <linux@arm.linux.org.uk>,
	linux-crypto@vger.kernel.org,
	"Fabio Estevam" <fabio.estevam@nxp.com>
Subject: Re: [PATCH v2 1/3] crypto: sahara - avoid needlessly saving and restoring sahara_ctx
Date: Tue, 2 Feb 2016 11:41:56 -0200	[thread overview]
Message-ID: <CAOMZO5BE49yzqpEy3TAGAyY52XR_sq6NtFa6e1fdkDAP9Xt4Ow@mail.gmail.com> (raw)
In-Reply-To: <20160125140728.GA8414@gondor.apana.org.au>

Hi Herbert,

On Mon, Jan 25, 2016 at 12:07 PM, Herbert Xu
<herbert@gondor.apana.org.au> wrote:

> Very good.  Not only is it a waste, it's a gaping security hole
> because modifying the tfm from import will corrupt it.
>
> But this is not enough, you're still copying things like the mutex
> which should not be copied but instead should be reinitialised in
> import.

So import() will look like this?

static int sahara_sha_import(struct ahash_request *req, const void *in)
{
    struct sahara_sha_reqctx *rctx = ahash_request_ctx(req);

    mutex_init(&rctx->mutex);
    memcpy(rctx, in, sizeof(struct sahara_sha_reqctx));

    return 0;
}

Thanks

  reply	other threads:[~2016-02-02 13:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-13 17:52 [PATCH v2 1/3] crypto: sahara - avoid needlessly saving and restoring sahara_ctx Fabio Estevam
2016-01-13 17:52 ` [PATCH v2 2/3] crypto: sahara - fill the statesize field Fabio Estevam
2016-01-13 17:52 ` [PATCH v2 3/3] crypto: mxs-dcp - provide statesize and import/export() Fabio Estevam
2016-01-25 14:10   ` Herbert Xu
2016-01-25 14:07 ` [PATCH v2 1/3] crypto: sahara - avoid needlessly saving and restoring sahara_ctx Herbert Xu
2016-02-02 13:41   ` Fabio Estevam [this message]
2016-02-02 14:43     ` Herbert Xu
2016-02-02 17:18       ` Fabio Estevam
2016-02-03 11:22         ` Herbert Xu

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=CAOMZO5BE49yzqpEy3TAGAyY52XR_sq6NtFa6e1fdkDAP9Xt4Ow@mail.gmail.com \
    --to=festevam@gmail.com \
    --cc=fabio.estevam@nxp.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=marex@denx.de \
    --cc=s.trumtrar@pengutronix.de \
    --cc=thomas.lendacky@amd.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.