[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z2aqHmrVAm3adVG6@gondor.apana.org.au>
Date: Sat, 21 Dec 2024 19:44:30 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Christian Marangi <ansuelsmth@...il.com>
Cc: "David S. Miller" <davem@...emloft.net>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Antoine Tenart <atenart@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>,
Waiman Long <longman@...hat.com>, Boqun Feng <boqun.feng@...il.com>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Bill Wendling <morbo@...gle.com>,
Justin Stitt <justinstitt@...gle.com>, linux-crypto@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev, upstream@...oha.com,
Richard van Schagen <vschagen@...oud.com>
Subject: Re: [PATCH v9 3/3] crypto: Add Inside Secure SafeXcel EIP-93 crypto
engine support
On Sat, Dec 14, 2024 at 02:27:54PM +0100, Christian Marangi wrote:
>
> + ahash_tfm = crypto_alloc_ahash(alg_name, 0, 0);
> + if (IS_ERR(ahash_tfm))
> + return PTR_ERR(ahash_tfm);
> +
> + req = ahash_request_alloc(ahash_tfm, GFP_ATOMIC);
> + if (!req) {
> + ret = -ENOMEM;
> + goto err_ahash;
> + }
> +
> + rctx = ahash_request_ctx_dma(req);
> + crypto_init_wait(&wait);
> + ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
> + crypto_req_done, &wait);
> +
> + /* Hash the key if > SHA256_BLOCK_SIZE */
> + if (keylen > SHA256_BLOCK_SIZE) {
> + sg_init_one(&sg[0], key, keylen);
> +
> + ahash_request_set_crypt(req, sg, ipad, keylen);
> + ret = crypto_wait_req(crypto_ahash_digest(req), &wait);
Sleeping in setkey is no longer allowed. I don't think it's
fatal yet because the main user driving this currently uses
sync ahashes only. But we should avoid this in all new driver
code.
Easiest fix would be to allocate a sync ahash:
ahash_tfm = crypto_alloc_ahash(alg_name, 0, CRYPTO_ALG_SYNC);
Thanks,
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists