lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z_9WPwz-xVdVDMMw@gondor.apana.org.au>
Date: Wed, 16 Apr 2025 15:03:27 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: T Pratham <t-pratham@...com>
Cc: "David S. Miller" <davem@...emloft.net>,
	Kamlesh Gurudasani <kamlesh@...com>,
	Praneeth Bajjuri <praneeth@...com>,
	Vignesh Raghavendra <vigneshr@...com>,
	Manorit Chawdhry <m-chawdhry@...com>, linux-kernel@...r.kernel.org,
	linux-crypto@...r.kernel.org
Subject: Re: [PATCH v2 2/2] crypto: ti: Add driver for DTHE V2 AES Engine
 (ECB, CBC)

On Fri, Apr 11, 2025 at 02:43:22PM +0530, T Pratham wrote:
>
> +	// Need to do a timeout to ensure mutex gets unlocked if DMA callback fails for any reason
> +	ret = wait_for_completion_timeout(&actx->aes_compl, msecs_to_jiffies(DTHE_DMA_TIMEOUT_MS));

You cannot wait here.  The preferred method of indicating completion
is through an interrupt.  If you hardware can't do that, then you need
to use crypto_engine and poll in that thread.

> +static int dthe_aes_crypt(struct skcipher_request *req, int enc)
> +{
> +	struct dthe_tfm_ctx *ctx = crypto_skcipher_ctx(crypto_skcipher_reqtfm(req));
> +
> +	/*
> +	 * If data is not a multiple of AES_BLOCK_SIZE, need to return -EINVAL
> +	 * If data length input is zero, no need to do any operation.
> +	 */
> +	if (req->cryptlen % AES_BLOCK_SIZE) {
> +		skcipher_request_complete(req, -EINVAL);

The completion function must not be called unless you first
returned EINPROGRESS.

PS Please set the bit KERN_DRIVER_ONLY in cra_flags.

Cheers,
-- 
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ