public inbox for linux-crypto@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: authencesn - Fix src offset when decrypting in-place
       [not found] ` <b397c5b34ed7484aad6e0acf7e1319c6@stwm.de>
@ 2026-04-14 23:39   ` Herbert Xu
  2026-04-15 19:54     ` Wolfgang Walter
  0 siblings, 1 reply; 2+ messages in thread
From: Herbert Xu @ 2026-04-14 23:39 UTC (permalink / raw)
  To: Wolfgang Walter
  Cc: Greg Kroah-Hartman, linux-kernel, stable, Sasha Levin,
	Linux Crypto Mailing List

On Tue, Apr 14, 2026 at 06:52:22PM +0200, Wolfgang Walter wrote:
> Hello,
> 
> with 6.12.18 ipsec stopped working for us. After reverting commit
> 
> commit 153d5520c3f9fd62e71c7e7f9e34b59cf411e555.
> Author: Herbert Xu <herbert@gondor.apana.org.au>
> Date:   Fri Mar 27 15:04:17 2026 +0900
> 
>     crypto: authencesn - Do not place hiseq at end of dst for out-of-place
> decryption

Yes this is broken.  Please try this patch:

---8<---
The src SG list offset wasn't set properly when decrypting in-place,
fix it.

Reported-by: Wolfgang Walter <linux@stwm.de>
Fixes: e02494114ebf ("crypto: authencesn - Do not place hiseq at end of dst for out-of-place decryption")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

diff --git a/crypto/authencesn.c b/crypto/authencesn.c
index c0a01d738d9b..af3d584e584f 100644
--- a/crypto/authencesn.c
+++ b/crypto/authencesn.c
@@ -228,9 +228,11 @@ static int crypto_authenc_esn_decrypt_tail(struct aead_request *req,
 
 decrypt:
 
-	if (src != dst)
-		src = scatterwalk_ffwd(areq_ctx->src, src, assoclen);
 	dst = scatterwalk_ffwd(areq_ctx->dst, dst, assoclen);
+	if (req->src == req->dst)
+		src = dst;
+	else
+		src = scatterwalk_ffwd(areq_ctx->src, src, assoclen);
 
 	skcipher_request_set_tfm(skreq, ctx->enc);
 	skcipher_request_set_callback(skreq, flags,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] crypto: authencesn - Fix src offset when decrypting in-place
  2026-04-14 23:39   ` [PATCH] crypto: authencesn - Fix src offset when decrypting in-place Herbert Xu
@ 2026-04-15 19:54     ` Wolfgang Walter
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Walter @ 2026-04-15 19:54 UTC (permalink / raw)
  To: Herbert Xu
  Cc: Greg Kroah-Hartman, linux-kernel, stable, Sasha Levin,
	Linux Crypto Mailing List

Hello,

Am 2026-04-15 01:39, schrieb Herbert Xu:
> On Tue, Apr 14, 2026 at 06:52:22PM +0200, Wolfgang Walter wrote:
>> Hello,
>> 
>> with 6.12.18 ipsec stopped working for us. After reverting commit
>> 
>> commit 153d5520c3f9fd62e71c7e7f9e34b59cf411e555.
>> Author: Herbert Xu <herbert@gondor.apana.org.au>
>> Date:   Fri Mar 27 15:04:17 2026 +0900
>> 
>>     crypto: authencesn - Do not place hiseq at end of dst for 
>> out-of-place
>> decryption
> 
> Yes this is broken.  Please try this patch:
> 
> ---8<---
> The src SG list offset wasn't set properly when decrypting in-place,
> fix it.
> 
> Reported-by: Wolfgang Walter <linux@stwm.de>
> Fixes: e02494114ebf ("crypto: authencesn - Do not place hiseq at end of 
> dst for out-of-place decryption")
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
> 
> diff --git a/crypto/authencesn.c b/crypto/authencesn.c
> index c0a01d738d9b..af3d584e584f 100644
> --- a/crypto/authencesn.c
> +++ b/crypto/authencesn.c
> @@ -228,9 +228,11 @@ static int crypto_authenc_esn_decrypt_tail(struct 
> aead_request *req,
> 
>  decrypt:
> 
> -	if (src != dst)
> -		src = scatterwalk_ffwd(areq_ctx->src, src, assoclen);
>  	dst = scatterwalk_ffwd(areq_ctx->dst, dst, assoclen);
> +	if (req->src == req->dst)
> +		src = dst;
> +	else
> +		src = scatterwalk_ffwd(areq_ctx->src, src, assoclen);
> 
>  	skcipher_request_set_tfm(skreq, ctx->enc);
>  	skcipher_request_set_callback(skreq, flags,

Applied the patch on v6.18.22, and ipsec works again.

Thanks,
-- 
Wolfgang Walter
Studierendenwerk München Oberbayern
Anstalt des öffentlichen Rechts

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-04-15 19:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <2026041152-boaster-patrol-1918@gregkh>
     [not found] ` <b397c5b34ed7484aad6e0acf7e1319c6@stwm.de>
2026-04-14 23:39   ` [PATCH] crypto: authencesn - Fix src offset when decrypting in-place Herbert Xu
2026-04-15 19:54     ` Wolfgang Walter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox