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

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

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

Link: https://lore.kernel.org/r/20250630160320.2888-16-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>

+3 -14
+1 -5
lib/crypto/x86/sha512-avx-asm.S
··· 272 272 # stored in "data". 273 273 # The size of the message pointed to by "data" must be an integer multiple 274 274 # of SHA512 message blocks. 275 - # "nblocks" is the message length in SHA512 blocks 275 + # "nblocks" is the message length in SHA512 blocks. Must be >= 1. 276 276 ######################################################################## 277 277 SYM_FUNC_START(sha512_transform_avx) 278 - 279 - test msglen, msglen 280 - je .Lnowork 281 278 282 279 # Save GPRs 283 280 push %rbx ··· 359 362 pop %r12 360 363 pop %rbx 361 364 362 - .Lnowork: 363 365 RET 364 366 SYM_FUNC_END(sha512_transform_avx) 365 367
+1 -4
lib/crypto/x86/sha512-avx2-asm.S
··· 564 564 # stored in "data". 565 565 # The size of the message pointed to by "data" must be an integer multiple 566 566 # of SHA512 message blocks. 567 - # "nblocks" is the message length in SHA512 blocks 567 + # "nblocks" is the message length in SHA512 blocks. Must be >= 1. 568 568 ######################################################################## 569 569 SYM_FUNC_START(sha512_transform_rorx) 570 570 ··· 582 582 and $~(0x20 - 1), %rsp 583 583 584 584 shl $7, NUM_BLKS # convert to bytes 585 - jz .Ldone_hash 586 585 add INP, NUM_BLKS # pointer to end of data 587 586 mov NUM_BLKS, frame_INPEND(%rsp) 588 587 ··· 666 667 add $128, INP 667 668 cmp frame_INPEND(%rsp), INP 668 669 jne .Lloop0 669 - 670 - .Ldone_hash: 671 670 672 671 # Restore Stack Pointer 673 672 mov %rbp, %rsp
+1 -5
lib/crypto/x86/sha512-ssse3-asm.S
··· 271 271 # stored in "data". 272 272 # The size of the message pointed to by "data" must be an integer multiple 273 273 # of SHA512 message blocks. 274 - # "nblocks" is the message length in SHA512 blocks 274 + # "nblocks" is the message length in SHA512 blocks. Must be >= 1. 275 275 ######################################################################## 276 276 SYM_FUNC_START(sha512_transform_ssse3) 277 - 278 - test msglen, msglen 279 - je .Lnowork 280 277 281 278 # Save GPRs 282 279 push %rbx ··· 358 361 pop %r12 359 362 pop %rbx 360 363 361 - .Lnowork: 362 364 RET 363 365 SYM_FUNC_END(sha512_transform_ssse3) 364 366