diff options
| author | Eric Biggers <ebiggers@kernel.org> | 2025-06-30 09:03:19 -0700 |
|---|---|---|
| committer | Eric Biggers <ebiggers@kernel.org> | 2025-06-30 09:26:20 -0700 |
| commit | 6486f2b0368dca5b7ba003d3904bfc64ff2439d5 (patch) | |
| tree | 08e95bd42899056e2392525bada4ba1b3e5467e7 /lib | |
| parent | 484c18119f4fbc6bca7c41e64b6fa84133e1057b (diff) | |
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>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/crypto/x86/sha512-avx-asm.S | 6 | ||||
| -rw-r--r-- | lib/crypto/x86/sha512-avx2-asm.S | 5 | ||||
| -rw-r--r-- | lib/crypto/x86/sha512-ssse3-asm.S | 6 |
3 files changed, 3 insertions, 14 deletions
diff --git a/lib/crypto/x86/sha512-avx-asm.S b/lib/crypto/x86/sha512-avx-asm.S index 0b5f69179d62..7732aa8fd850 100644 --- a/lib/crypto/x86/sha512-avx-asm.S +++ b/lib/crypto/x86/sha512-avx-asm.S @@ -272,13 +272,10 @@ frame_size = frame_WK + WK_SIZE # stored in "data". # The size of the message pointed to by "data" must be an integer multiple # of SHA512 message blocks. -# "nblocks" is the message length in SHA512 blocks +# "nblocks" is the message length in SHA512 blocks. Must be >= 1. ######################################################################## SYM_FUNC_START(sha512_transform_avx) - test msglen, msglen - je .Lnowork - # Save GPRs push %rbx push %r12 @@ -362,7 +359,6 @@ SYM_FUNC_START(sha512_transform_avx) pop %r12 pop %rbx -.Lnowork: RET SYM_FUNC_END(sha512_transform_avx) diff --git a/lib/crypto/x86/sha512-avx2-asm.S b/lib/crypto/x86/sha512-avx2-asm.S index 2309c01e316b..22bdbfd899d0 100644 --- a/lib/crypto/x86/sha512-avx2-asm.S +++ b/lib/crypto/x86/sha512-avx2-asm.S @@ -564,7 +564,7 @@ frame_size = frame_CTX + CTX_SIZE # stored in "data". # The size of the message pointed to by "data" must be an integer multiple # of SHA512 message blocks. -# "nblocks" is the message length in SHA512 blocks +# "nblocks" is the message length in SHA512 blocks. Must be >= 1. ######################################################################## SYM_FUNC_START(sha512_transform_rorx) @@ -582,7 +582,6 @@ SYM_FUNC_START(sha512_transform_rorx) and $~(0x20 - 1), %rsp shl $7, NUM_BLKS # convert to bytes - jz .Ldone_hash add INP, NUM_BLKS # pointer to end of data mov NUM_BLKS, frame_INPEND(%rsp) @@ -668,8 +667,6 @@ SYM_FUNC_START(sha512_transform_rorx) cmp frame_INPEND(%rsp), INP jne .Lloop0 -.Ldone_hash: - # Restore Stack Pointer mov %rbp, %rsp pop %rbp diff --git a/lib/crypto/x86/sha512-ssse3-asm.S b/lib/crypto/x86/sha512-ssse3-asm.S index 12e78142f2e3..4cae7445b2a8 100644 --- a/lib/crypto/x86/sha512-ssse3-asm.S +++ b/lib/crypto/x86/sha512-ssse3-asm.S @@ -271,13 +271,10 @@ frame_size = frame_WK + WK_SIZE # stored in "data". # The size of the message pointed to by "data" must be an integer multiple # of SHA512 message blocks. -# "nblocks" is the message length in SHA512 blocks +# "nblocks" is the message length in SHA512 blocks. Must be >= 1. ######################################################################## SYM_FUNC_START(sha512_transform_ssse3) - test msglen, msglen - je .Lnowork - # Save GPRs push %rbx push %r12 @@ -361,7 +358,6 @@ SYM_FUNC_START(sha512_transform_ssse3) pop %r12 pop %rbx -.Lnowork: RET SYM_FUNC_END(sha512_transform_ssse3) |
