Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

lib/crypto: x86/sha256: Remove unnecessary checks for nblocks==0

Since sha256_blocks() is called only with nblocks >= 1, remove
unnecessary checks for nblocks == 0 from the x86 SHA-256 assembly code.

Acked-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20250704023958.73274-3-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>

-10
-3
lib/crypto/x86/sha256-avx-asm.S
··· 357 357 and $~15, %rsp # align stack pointer 358 358 359 359 shl $6, NUM_BLKS # convert to bytes 360 - jz .Ldone_hash 361 360 add INP, NUM_BLKS # pointer to end of data 362 361 mov NUM_BLKS, _INP_END(%rsp) 363 362 ··· 444 445 add $64, INP 445 446 cmp _INP_END(%rsp), INP 446 447 jne .Lloop0 447 - 448 - .Ldone_hash: 449 448 450 449 mov %rbp, %rsp 451 450 popq %rbp
-1
lib/crypto/x86/sha256-avx2-asm.S
··· 535 535 and $-32, %rsp # align rsp to 32 byte boundary 536 536 537 537 shl $6, NUM_BLKS # convert to bytes 538 - jz .Ldone_hash 539 538 lea -64(INP, NUM_BLKS), NUM_BLKS # pointer to last block 540 539 mov NUM_BLKS, _INP_END(%rsp) 541 540
-3
lib/crypto/x86/sha256-ni-asm.S
··· 112 112 SYM_FUNC_START(sha256_ni_transform) 113 113 114 114 shl $6, NUM_BLKS /* convert to bytes */ 115 - jz .Ldone_hash 116 115 add DATA_PTR, NUM_BLKS /* pointer to end of data */ 117 116 118 117 /* ··· 161 162 162 163 movdqu STATE1, 0*16(STATE_PTR) 163 164 movdqu STATE0, 1*16(STATE_PTR) 164 - 165 - .Ldone_hash: 166 165 167 166 RET 168 167 SYM_FUNC_END(sha256_ni_transform)
-3
lib/crypto/x86/sha256-ssse3-asm.S
··· 364 364 and $~15, %rsp 365 365 366 366 shl $6, NUM_BLKS # convert to bytes 367 - jz .Ldone_hash 368 367 add INP, NUM_BLKS 369 368 mov NUM_BLKS, _INP_END(%rsp) # pointer to end of data 370 369 ··· 455 456 add $64, INP 456 457 cmp _INP_END(%rsp), INP 457 458 jne .Lloop0 458 - 459 - .Ldone_hash: 460 459 461 460 mov %rbp, %rsp 462 461 popq %rbp