diff --git a/lib/crypto/x86/sha512-avx-asm.S b/lib/crypto/x86/sha512-avx-asm.S index 7732aa8fd850..a17dfedc1c51 100644 --- a/lib/crypto/x86/sha512-avx-asm.S +++ b/lib/crypto/x86/sha512-avx-asm.S @@ -276,6 +276,9 @@ frame_size = frame_WK + WK_SIZE ######################################################################## SYM_FUNC_START(sha512_transform_avx) + push %rbp + mov %rsp, %rbp + # Save GPRs push %rbx push %r12 @@ -284,8 +287,6 @@ SYM_FUNC_START(sha512_transform_avx) push %r15 # Allocate Stack Space - push %rbp - mov %rsp, %rbp sub $frame_size, %rsp and $~(0x20 - 1), %rsp @@ -348,9 +349,8 @@ SYM_FUNC_START(sha512_transform_avx) dec msglen jnz .Lupdateblock - # Restore Stack Pointer - mov %rbp, %rsp - pop %rbp + # Deallocate Stack Space + lea -40(%rbp), %rsp # Restore GPRs pop %r15 @@ -358,6 +358,7 @@ SYM_FUNC_START(sha512_transform_avx) pop %r13 pop %r12 pop %rbx + pop %rbp 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 22bdbfd899d0..2256d51297e1 100644 --- a/lib/crypto/x86/sha512-avx2-asm.S +++ b/lib/crypto/x86/sha512-avx2-asm.S @@ -568,6 +568,9 @@ frame_size = frame_CTX + CTX_SIZE ######################################################################## SYM_FUNC_START(sha512_transform_rorx) + push %rbp + mov %rsp, %rbp + # Save GPRs push %rbx push %r12 @@ -576,8 +579,6 @@ SYM_FUNC_START(sha512_transform_rorx) push %r15 # Allocate Stack Space - push %rbp - mov %rsp, %rbp sub $frame_size, %rsp and $~(0x20 - 1), %rsp @@ -667,9 +668,8 @@ SYM_FUNC_START(sha512_transform_rorx) cmp frame_INPEND(%rsp), INP jne .Lloop0 - # Restore Stack Pointer - mov %rbp, %rsp - pop %rbp + # Deallocate Stack Space + lea -40(%rbp), %rsp # Restore GPRs pop %r15 @@ -677,6 +677,7 @@ SYM_FUNC_START(sha512_transform_rorx) pop %r13 pop %r12 pop %rbx + pop %rbp vzeroupper RET diff --git a/lib/crypto/x86/sha512-ssse3-asm.S b/lib/crypto/x86/sha512-ssse3-asm.S index 4cae7445b2a8..1a37b7a735cf 100644 --- a/lib/crypto/x86/sha512-ssse3-asm.S +++ b/lib/crypto/x86/sha512-ssse3-asm.S @@ -275,6 +275,9 @@ frame_size = frame_WK + WK_SIZE ######################################################################## SYM_FUNC_START(sha512_transform_ssse3) + push %rbp + mov %rsp, %rbp + # Save GPRs push %rbx push %r12 @@ -283,8 +286,6 @@ SYM_FUNC_START(sha512_transform_ssse3) push %r15 # Allocate Stack Space - push %rbp - mov %rsp, %rbp sub $frame_size, %rsp and $~(0x20 - 1), %rsp @@ -347,9 +348,8 @@ SYM_FUNC_START(sha512_transform_ssse3) dec msglen jnz .Lupdateblock - # Restore Stack Pointer - mov %rbp, %rsp - pop %rbp + # Deallocate Stack Space + lea -40(%rbp), %rsp # Restore GPRs pop %r15 @@ -357,6 +357,7 @@ SYM_FUNC_START(sha512_transform_ssse3) pop %r13 pop %r12 pop %rbx + pop %rbp RET SYM_FUNC_END(sha512_transform_ssse3)