Re: [PATCH] lib/crypto: x86/aes-ctr: Remove some unreachable code
From: Ard Biesheuvel
Date: Fri Oct 02 2026 - 05:47:13 EST
On Fri, 2 Oct 2026, at 05:44, Eric Biggers wrote:
> In the AES-CTR and AES-XCTR code that handles a remainder of '4*VL < LEN
> < 8*VL', first 4 full vectors are processed, leaving 0 < LEN < 4*VL.
> After that, five different cases are handled depending on whether there
> are 0, 1, 2, 3, or 4 full vectors remaining. But the case of 4 vectors
> is never reached there, making the code handling it unused. Remove it.
>
> With that done, the '.Lxor_tail_partial_vec_3\@' block would be reached
> only via an unconditional jump. Therefore, relocate it to the only
> place that jumps to it. This allows removing the jump at the end of the
> '.Lxor_tail_partial_vec_2\@' block and making it fall through.
>
> Signed-off-by: Eric Biggers <ebiggers@xxxxxxxxxx>
> ---
> lib/crypto/x86/aes-ctr-avx-x86_64.S | 18 ++++++------------
> 1 file changed, 6 insertions(+), 12 deletions(-)
>
Reviewed-by: Ard Biesheuvel <ardb@xxxxxxxxxx>