Re: [PATCH v2 1/3] crypto: sahara - avoid needlessly saving and restoring sahara_ctx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Herbert,

On Mon, Jan 25, 2016 at 12:07 PM, Herbert Xu
<herbert@xxxxxxxxxxxxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux