From: Christian Marangi <ansuelsmth@gmail.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Antoine Tenart <atenart@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
Waiman Long <longman@redhat.com>,
Boqun Feng <boqun.feng@gmail.com>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
linux-crypto@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
upstream@airoha.com, Richard van Schagen <vschagen@icloud.com>
Subject: Re: [PATCH v9 3/3] crypto: Add Inside Secure SafeXcel EIP-93 crypto engine support
Date: Sat, 4 Jan 2025 17:26:28 +0100 [thread overview]
Message-ID: <6779613a.050a0220.184c1c.c90e@mx.google.com> (raw)
In-Reply-To: <Z2aqHmrVAm3adVG6@gondor.apana.org.au>
On Sat, Dec 21, 2024 at 07:44:30PM +0800, Herbert Xu wrote:
> 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);
>
Hi Herbert,
I'm a bit confused by this... I can't find any reference of
CRYPTO_ALG_SYNC, is this something new? Any hint on where to look for
it? Can't find it in include/linux/crypto.h
Following the codeflow of crypto_alloc_ahash is a bit problematic.
--
Ansuel
next prev parent reply other threads:[~2025-01-04 16:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-14 13:27 [PATCH v9 0/3] crypto: Add EIP-93 crypto engine support Christian Marangi
2024-12-14 13:27 ` [PATCH v9 1/3] spinlock: extend guard with spinlock_bh variants Christian Marangi
2024-12-14 13:27 ` [PATCH v9 2/3] dt-bindings: crypto: Add Inside Secure SafeXcel EIP-93 crypto engine Christian Marangi
2024-12-14 13:27 ` [PATCH v9 3/3] crypto: Add Inside Secure SafeXcel EIP-93 crypto engine support Christian Marangi
2024-12-21 11:44 ` Herbert Xu
2025-01-04 16:26 ` Christian Marangi [this message]
2025-01-04 23:27 ` 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=6779613a.050a0220.184c1c.c90e@mx.google.com \
--to=ansuelsmth@gmail.com \
--cc=atenart@kernel.org \
--cc=boqun.feng@gmail.com \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=justinstitt@google.com \
--cc=krzk+dt@kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=peterz@infradead.org \
--cc=robh@kernel.org \
--cc=upstream@airoha.com \
--cc=vschagen@icloud.com \
--cc=will@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