Re: [PATCH] crypto: algif_skcipher - snapshot IV for async skcipher requests

From: Herbert Xu

Date: Fri May 29 2026 - 01:14:19 EST


On Mon, May 18, 2026 at 07:35:39PM -0400, Max Clinton wrote:
>
> diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c
> index ba0a17fd9..519ff8d17 100644
> --- a/crypto/algif_skcipher.c
> +++ b/crypto/algif_skcipher.c
> @@ -23,6 +23,7 @@
> * the RX SGL release.
> */
>
> +#include <crypto/internal/skcipher.h>

There is no need for the internal header.

> @@ -116,10 +119,14 @@ static int _skcipher_recvmsg(struct socket *sock, struct msghdr *msg,
>
> /* Allocate cipher request for current operation. */
> areq = af_alg_alloc_areq(sk, sizeof(struct af_alg_async_req) +
> - crypto_skcipher_reqsize(tfm));
> + crypto_skcipher_reqsize(tfm) + ivsize);
> if (IS_ERR(areq))
> return PTR_ERR(areq);
>
> + iv = (u8 *)skcipher_request_ctx(&areq->cra_u.skcipher_req) +
> + crypto_skcipher_reqsize(tfm);

You can rewrite this as

iv = (u8 *)(areq + 1) + crypto_skcipher_reqsize(tfm);

Thanks,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt