Re: [PATCH v9 3/3] crypto: Add Inside Secure SafeXcel EIP-93 crypto engine support
From: Herbert Xu
Date: Sat Dec 21 2024 - 06:45:10 EST
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@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt