Commit 23b9cf22 authored by Niels Möller's avatar Niels Möller

Use explicit .byte sequences when assembling aes instructions.

parent 2185ed0d
2015-01-13 Niels Möller <nisse@lysator.liu.se> 2015-01-13 Niels Möller <nisse@lysator.liu.se>
* x86_64/aesni/aes-encrypt-internal.asm: Use explicit .byte
sequences for aes instructions, don't rely on assembler support.
* x86_64/aesni/aes-decrypt-internal.asm: Likewise.
* aclocal.m4 (NETTLE_CHECK_IFUNC): New macro, checking for ifunc * aclocal.m4 (NETTLE_CHECK_IFUNC): New macro, checking for ifunc
and settting HAVE_LINK_IFUNC if working. and settting HAVE_LINK_IFUNC if working.
* configure.ac: Use it. * configure.ac: Use it.
......
...@@ -44,7 +44,11 @@ define(<CNT>, <%rdx>) ...@@ -44,7 +44,11 @@ define(<CNT>, <%rdx>)
C Subkey pointer C Subkey pointer
define(<KEY>, <%rax>) define(<KEY>, <%rax>)
.arch bdver2 dnl aesdec %xmm1, %xmm0
define(<AESDEC>, <.byte 0x66, 0x0f, 0x38, 0xde, 0xc1>)
dnl aesdeclast %xmm1, %xmm0
define(<AESDECLAST>, <.byte 0x66, 0x0f, 0x38, 0xdf, 0xc1>)
.file "aes-decrypt-internal.asm" .file "aes-decrypt-internal.asm"
C _aes_decrypt(unsigned rounds, const uint32_t *keys, C _aes_decrypt(unsigned rounds, const uint32_t *keys,
...@@ -77,12 +81,12 @@ PROLOGUE(_nettle_aes_decrypt) ...@@ -77,12 +81,12 @@ PROLOGUE(_nettle_aes_decrypt)
add $16, KEY add $16, KEY
movups (KEY), %xmm1 movups (KEY), %xmm1
aesdec %xmm1, %xmm0 AESDEC C %xmm1, %xmm0
decl XREG(CNT) decl XREG(CNT)
jnz .Lround_loop jnz .Lround_loop
movups 16(KEY), %xmm1 movups 16(KEY), %xmm1
aesdeclast %xmm1, %xmm0 AESDECLAST C %xmm1, %xmm0
movups %xmm0, (DST) movups %xmm0, (DST)
add $16, SRC add $16, SRC
......
...@@ -44,7 +44,11 @@ define(<CNT>, <%rdx>) ...@@ -44,7 +44,11 @@ define(<CNT>, <%rdx>)
C Subkey pointer C Subkey pointer
define(<KEY>, <%rax>) define(<KEY>, <%rax>)
.arch bdver2 dnl aesenc %xmm1, %xmm0
define(<AESENC>, <.byte 0x66, 0x0f, 0x38, 0xdc, 0xc1>)
dnl aesenclast %xmm1, %xmm0
define(<AESENCLAST>, <.byte 0x66, 0x0f, 0x38, 0xdd, 0xc1>)
.file "aes-encrypt-internal.asm" .file "aes-encrypt-internal.asm"
C _aes_encrypt(unsigned rounds, const uint32_t *keys, C _aes_encrypt(unsigned rounds, const uint32_t *keys,
...@@ -77,12 +81,12 @@ PROLOGUE(_nettle_aes_encrypt) ...@@ -77,12 +81,12 @@ PROLOGUE(_nettle_aes_encrypt)
add $16, KEY add $16, KEY
movups (KEY), %xmm1 movups (KEY), %xmm1
aesenc %xmm1, %xmm0 AESENC C %xmm1, %xmm0
decl XREG(CNT) decl XREG(CNT)
jnz .Lround_loop jnz .Lround_loop
movups 16(KEY), %xmm1 movups 16(KEY), %xmm1
aesenclast %xmm1, %xmm0 AESENCLAST C %xmm1, %xmm0
movups %xmm0, (DST) movups %xmm0, (DST)
add $16, SRC add $16, SRC
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment