diff options
author | Eric Biggers <ebiggers@kernel.org> | 2025-07-03 19:39:58 -0700 |
---|---|---|
committer | Eric Biggers <ebiggers@kernel.org> | 2025-07-04 10:23:56 -0700 |
commit | 57b15e9260a31438e91cf83dbfcb63333b24c684 (patch) | |
tree | ce2bc5d55122ecf8364b0761374a5d24f90c50fa | |
parent | a8c60a9aca778d7fd22d6c9b1af702d6f952b87f (diff) |
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>
-rw-r--r-- | lib/crypto/x86/sha256-avx-asm.S | 3 | ||||
-rw-r--r-- | lib/crypto/x86/sha256-avx2-asm.S | 1 | ||||
-rw-r--r-- | lib/crypto/x86/sha256-ni-asm.S | 3 | ||||
-rw-r--r-- | lib/crypto/x86/sha256-ssse3-asm.S | 3 |
4 files changed, 0 insertions, 10 deletions
diff --git a/lib/crypto/x86/sha256-avx-asm.S b/lib/crypto/x86/sha256-avx-asm.S index 798a7f07fa01..c1aceb3ba3a3 100644 --- a/lib/crypto/x86/sha256-avx-asm.S +++ b/lib/crypto/x86/sha256-avx-asm.S @@ -357,7 +357,6 @@ SYM_FUNC_START(sha256_transform_avx) and $~15, %rsp # align stack pointer shl $6, NUM_BLKS # convert to bytes - jz .Ldone_hash add INP, NUM_BLKS # pointer to end of data mov NUM_BLKS, _INP_END(%rsp) @@ -446,8 +445,6 @@ SYM_FUNC_START(sha256_transform_avx) cmp _INP_END(%rsp), INP jne .Lloop0 -.Ldone_hash: - mov %rbp, %rsp popq %rbp popq %r15 diff --git a/lib/crypto/x86/sha256-avx2-asm.S b/lib/crypto/x86/sha256-avx2-asm.S index 62a46993359e..eb8836fb9695 100644 --- a/lib/crypto/x86/sha256-avx2-asm.S +++ b/lib/crypto/x86/sha256-avx2-asm.S @@ -535,7 +535,6 @@ SYM_FUNC_START(sha256_transform_rorx) and $-32, %rsp # align rsp to 32 byte boundary shl $6, NUM_BLKS # convert to bytes - jz .Ldone_hash lea -64(INP, NUM_BLKS), NUM_BLKS # pointer to last block mov NUM_BLKS, _INP_END(%rsp) diff --git a/lib/crypto/x86/sha256-ni-asm.S b/lib/crypto/x86/sha256-ni-asm.S index 9ebbacbb9c13..4bd9490ffc66 100644 --- a/lib/crypto/x86/sha256-ni-asm.S +++ b/lib/crypto/x86/sha256-ni-asm.S @@ -112,7 +112,6 @@ SYM_FUNC_START(sha256_ni_transform) shl $6, NUM_BLKS /* convert to bytes */ - jz .Ldone_hash add DATA_PTR, NUM_BLKS /* pointer to end of data */ /* @@ -163,8 +162,6 @@ SYM_FUNC_START(sha256_ni_transform) movdqu STATE1, 0*16(STATE_PTR) movdqu STATE0, 1*16(STATE_PTR) -.Ldone_hash: - RET SYM_FUNC_END(sha256_ni_transform) diff --git a/lib/crypto/x86/sha256-ssse3-asm.S b/lib/crypto/x86/sha256-ssse3-asm.S index 820fc8bbc29f..383b8eec7ebe 100644 --- a/lib/crypto/x86/sha256-ssse3-asm.S +++ b/lib/crypto/x86/sha256-ssse3-asm.S @@ -364,7 +364,6 @@ SYM_FUNC_START(sha256_transform_ssse3) and $~15, %rsp shl $6, NUM_BLKS # convert to bytes - jz .Ldone_hash add INP, NUM_BLKS mov NUM_BLKS, _INP_END(%rsp) # pointer to end of data @@ -457,8 +456,6 @@ SYM_FUNC_START(sha256_transform_ssse3) cmp _INP_END(%rsp), INP jne .Lloop0 -.Ldone_hash: - mov %rbp, %rsp popq %rbp popq %r15 |