Merge pull request #376 from jcowgill/x32

Support for x32
This commit is contained in:
Paul Bakker 2016-05-11 20:40:08 +02:00
commit 9edf1eb062
2 changed files with 6 additions and 13 deletions

View file

@ -162,10 +162,6 @@
#define MULADDC_INIT \ #define MULADDC_INIT \
asm( \ asm( \
"movq %3, %%rsi \n\t" \
"movq %4, %%rdi \n\t" \
"movq %5, %%rcx \n\t" \
"movq %6, %%rbx \n\t" \
"xorq %%r8, %%r8 \n\t" "xorq %%r8, %%r8 \n\t"
#define MULADDC_CORE \ #define MULADDC_CORE \
@ -181,12 +177,9 @@
"addq $8, %%rdi \n\t" "addq $8, %%rdi \n\t"
#define MULADDC_STOP \ #define MULADDC_STOP \
"movq %%rcx, %0 \n\t" \ : "+c" (c), "+D" (d), "+S" (s) \
"movq %%rdi, %1 \n\t" \ : "b" (b) \
"movq %%rsi, %2 \n\t" \ : "rax", "rdx", "r8" \
: "=m" (c), "=m" (d), "=m" (s) \
: "m" (s), "m" (d), "m" (c), "m" (b) \
: "rax", "rcx", "rdx", "rbx", "rsi", "rdi", "r8" \
); );
#endif /* AMD64 */ #endif /* AMD64 */

View file

@ -100,7 +100,7 @@ int mbedtls_aesni_crypt_ecb( mbedtls_aes_context *ctx,
asm( "movdqu (%3), %%xmm0 \n\t" // load input asm( "movdqu (%3), %%xmm0 \n\t" // load input
"movdqu (%1), %%xmm1 \n\t" // load round key 0 "movdqu (%1), %%xmm1 \n\t" // load round key 0
"pxor %%xmm1, %%xmm0 \n\t" // round 0 "pxor %%xmm1, %%xmm0 \n\t" // round 0
"addq $16, %1 \n\t" // point to next round key "add $16, %1 \n\t" // point to next round key
"subl $1, %0 \n\t" // normal rounds = nr - 1 "subl $1, %0 \n\t" // normal rounds = nr - 1
"test %2, %2 \n\t" // mode? "test %2, %2 \n\t" // mode?
"jz 2f \n\t" // 0 = decrypt "jz 2f \n\t" // 0 = decrypt
@ -108,7 +108,7 @@ int mbedtls_aesni_crypt_ecb( mbedtls_aes_context *ctx,
"1: \n\t" // encryption loop "1: \n\t" // encryption loop
"movdqu (%1), %%xmm1 \n\t" // load round key "movdqu (%1), %%xmm1 \n\t" // load round key
AESENC xmm1_xmm0 "\n\t" // do round AESENC xmm1_xmm0 "\n\t" // do round
"addq $16, %1 \n\t" // point to next round key "add $16, %1 \n\t" // point to next round key
"subl $1, %0 \n\t" // loop "subl $1, %0 \n\t" // loop
"jnz 1b \n\t" "jnz 1b \n\t"
"movdqu (%1), %%xmm1 \n\t" // load round key "movdqu (%1), %%xmm1 \n\t" // load round key
@ -118,7 +118,7 @@ int mbedtls_aesni_crypt_ecb( mbedtls_aes_context *ctx,
"2: \n\t" // decryption loop "2: \n\t" // decryption loop
"movdqu (%1), %%xmm1 \n\t" "movdqu (%1), %%xmm1 \n\t"
AESDEC xmm1_xmm0 "\n\t" // do round AESDEC xmm1_xmm0 "\n\t" // do round
"addq $16, %1 \n\t" "add $16, %1 \n\t"
"subl $1, %0 \n\t" "subl $1, %0 \n\t"
"jnz 2b \n\t" "jnz 2b \n\t"
"movdqu (%1), %%xmm1 \n\t" // load round key "movdqu (%1), %%xmm1 \n\t" // load round key