diff options
Diffstat (limited to 'src/Crypto/Aes_hw_cpu.asm')
-rw-r--r-- | src/Crypto/Aes_hw_cpu.asm | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/src/Crypto/Aes_hw_cpu.asm b/src/Crypto/Aes_hw_cpu.asm index edc20b29..c8df89f3 100644 --- a/src/Crypto/Aes_hw_cpu.asm +++ b/src/Crypto/Aes_hw_cpu.asm @@ -7,13 +7,13 @@ ; %ifidn __BITS__, 16 - %define R e + %define R(x) e %+ x %elifidn __BITS__, 32 - %define R e + %define R(x) e %+ x %elifidn __BITS__, 64 - %define R r + %define R(x) r %+ x %endif %macro export_function 1-2 0 @@ -104,27 +104,27 @@ ; Load data blocks %assign block 1 %rep BLOCK_COUNT - movdqu xmm%[block], [%[R]dx + 16 * (block - 1)] + movdqu xmm %+ block, [R(dx) + 16 * (block - 1)] %assign block block+1 %endrep ; Encrypt/decrypt data blocks %assign round 0 %rep 15 - movdqu xmm0, [%[R]cx + 16 * round] + movdqu xmm0, [R(cx) + 16 * round] %assign block 1 %rep BLOCK_COUNT %if round = 0 - pxor xmm%[block], xmm0 + pxor xmm %+ block, xmm0 %else %if round < 14 - aes%[OPERATION] xmm%[block], xmm0 + aes %+ OPERATION xmm %+ block, xmm0 %else - aes%[OPERATION]last xmm%[block], xmm0 + aes %+ OPERATION %+ last xmm %+ block, xmm0 %endif %endif %assign block block+1 @@ -135,9 +135,9 @@ ; Store data blocks %assign block 1 %rep BLOCK_COUNT - movdqu [%[R]dx + 16 * (block - 1)], xmm%[block] + movdqu [R(dx) + 16 * (block - 1)], xmm %+ block %assign block block+1 %endrep %undef OPERATION @@ -161,16 +161,16 @@ %endif mov eax, 32 / MAX_REG_BLOCK_COUNT .1: - aes_hw_cpu %[OPERATION_32_BLOCKS], MAX_REG_BLOCK_COUNT + aes_hw_cpu OPERATION_32_BLOCKS, MAX_REG_BLOCK_COUNT - add %[R]dx, 16 * MAX_REG_BLOCK_COUNT + add R(dx), 16 * MAX_REG_BLOCK_COUNT dec eax jnz .1 %if (32 % MAX_REG_BLOCK_COUNT) != 0 - aes_hw_cpu %[OPERATION_32_BLOCKS], (32 % MAX_REG_BLOCK_COUNT) + aes_hw_cpu OPERATION_32_BLOCKS, (32 % MAX_REG_BLOCK_COUNT) %endif %ifidn __OUTPUT_FORMAT__, win64 %if MAX_REG_BLOCK_COUNT > 5 @@ -200,11 +200,11 @@ ; void aes_hw_cpu_enable_sse (); export_function aes_hw_cpu_enable_sse - mov %[R]ax, cr4 + mov R(ax), cr4 or ax, 1 << 9 - mov cr4, %[R]ax + mov cr4, R(ax) ret %ifidn __BITS__, 16 @@ -289,17 +289,17 @@ ; We comment this since we have an alternative C implementation ; that supports Hyper-V detection workaround ; ; export_function is_aes_hw_cpu_supported -; push %[R]bx +; push R(bx) ; ; mov eax, 1 ; cpuid ; mov eax, ecx ; shr eax, 25 ; and eax, 1 ; -; pop %[R]bx +; pop R(bx) ; ret ; void aes_hw_cpu_decrypt (const byte *ks, byte *data); @@ -330,4 +330,15 @@ aes_function_exit %endif ; __BITS__ != 16 + +%ifidn __OUTPUT_FORMAT__,elf +section .note.GNU-stack noalloc noexec nowrite progbits +%endif +%ifidn __OUTPUT_FORMAT__,elf32 +section .note.GNU-stack noalloc noexec nowrite progbits +%endif +%ifidn __OUTPUT_FORMAT__,elf64 +section .note.GNU-stack noalloc noexec nowrite progbits +%endif + |