diff options
author | Andy Polyakov <appro@openssl.org> | 2017-02-03 12:07:16 +0100 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2017-02-06 08:21:42 +0100 |
commit | 384e6de4c7e35e37fb3d6fbeb32ddcb5eb0d3d3f (patch) | |
tree | 3eba1883b51094452284e267b6772b261db622b4 /crypto/modes | |
parent | e1dbf7f431b996010844e220d3200cbf2122dbb3 (diff) |
x86_64 assembly pack: Win64 SEH face-lift.
- harmonize handlers with guidelines and themselves;
- fix some bugs in handlers;
- add missing handlers in chacha and ecp_nistz256 modules;
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/modes')
-rw-r--r-- | crypto/modes/asm/ghash-x86_64.pl | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/crypto/modes/asm/ghash-x86_64.pl b/crypto/modes/asm/ghash-x86_64.pl index c782edcbb8..caa9ced696 100644 --- a/crypto/modes/asm/ghash-x86_64.pl +++ b/crypto/modes/asm/ghash-x86_64.pl @@ -237,8 +237,12 @@ $code=<<___; .align 16 gcm_gmult_4bit: push %rbx - push %rbp # %rbp and %r12 are pushed exclusively in + push %rbp # %rbp and others are pushed exclusively in push %r12 # order to reuse Win64 exception handler... + push %r13 + push %r14 + push %r15 + sub \$280,%rsp .Lgmult_prologue: movzb 15($Xi),$Zlo @@ -249,8 +253,9 @@ $code.=<<___; mov $Zlo,8($Xi) mov $Zhi,($Xi) - mov 16(%rsp),%rbx - lea 24(%rsp),%rsp + lea 280+48(%rsp),%rsi + mov -8(%rsi),%rbx + lea (%rsi),%rsp .Lgmult_epilogue: ret .size gcm_gmult_4bit,.-gcm_gmult_4bit @@ -400,14 +405,14 @@ $code.=<<___; mov $Zlo,8($Xi) mov $Zhi,($Xi) - lea 280(%rsp),%rsi - mov 0(%rsi),%r15 - mov 8(%rsi),%r14 - mov 16(%rsi),%r13 - mov 24(%rsi),%r12 - mov 32(%rsi),%rbp - mov 40(%rsi),%rbx - lea 48(%rsi),%rsp + lea 280+48(%rsp),%rsi + mov -48(%rsi),%r15 + mov -40(%rsi),%r14 + mov -32(%rsi),%r13 + mov -24(%rsi),%r12 + mov -16(%rsi),%rbp + mov -8(%rsi),%rbx + lea 0(%rsi),%rsp .Lghash_epilogue: ret .size gcm_ghash_4bit,.-gcm_ghash_4bit @@ -1648,14 +1653,20 @@ se_handler: cmp %r10,%rbx # context->Rip>=epilogue label jae .Lin_prologue - lea 24(%rax),%rax # adjust "rsp" + lea 48+280(%rax),%rax # adjust "rsp" mov -8(%rax),%rbx mov -16(%rax),%rbp mov -24(%rax),%r12 + mov -32(%rax),%r13 + mov -40(%rax),%r14 + mov -48(%rax),%r15 mov %rbx,144($context) # restore context->Rbx mov %rbp,160($context) # restore context->Rbp mov %r12,216($context) # restore context->R12 + mov %r13,224($context) # restore context->R13 + mov %r14,232($context) # restore context->R14 + mov %r15,240($context) # restore context->R15 .Lin_prologue: mov 8(%rax),%rdi |