diff options
author | Jussi Kivilinna <jussi.kivilinna@mbnet.fi> | 2012-11-27 23:44:13 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2012-11-28 09:35:41 +0100 |
commit | 99e272d938fe23efec25af409bdb91dae0e659e5 (patch) | |
tree | d7aef3b826aad49d8051b8c0c3429995cba5d8f0 | |
parent | faec12e23f03c7cd1614594bfdd51f1302cadb42 (diff) | |
download | libgcrypt-99e272d938fe23efec25af409bdb91dae0e659e5.tar.gz |
Fix building with Clang on x86-64 and i386
* cipher/rijndael.c [USE_AESNI] (do_aesni_enc_aligned)
(do_aesni_dec_vec4, do_aesni_cfb, do_aesni_ctr, do_aesni_ctr_4): Add
explicit suffix to 'cmp' instructions.
--
Clang throws errors on missing instruction suffixes, such as:
rijndael.c:1091:39: error: ambiguous instructions require an explicit suffix (could be 'cmpb', 'cmpw', 'cmpl', or 'cmpq')
<inline asm>:39:2: note: instantiated into assembly here
cmp $1, -44(%rbp)
With this patch building on x86-64 works fine. Other issues still exists on i386,
namely with MPI, which can be overcome with 'clang -fheinous-gnu-extensions'.
[v2]:
- remove do_aesni_enc_vec4 modification as that function didn't make it to upstream.
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
NB: I still believe it is a bad idea of clang to define __GNUC__
and not being 100% compatible to gcc. [wk]
-rw-r--r-- | cipher/rijndael.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/cipher/rijndael.c b/cipher/rijndael.c index 860dcf8f..0f5e07cb 100644 --- a/cipher/rijndael.c +++ b/cipher/rijndael.c @@ -742,13 +742,13 @@ do_aesni_enc_aligned (const RIJNDAEL_context *ctx, "movdqa 0x90(%[key]), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0xa0(%[key]), %%xmm1\n\t" - "cmp $10, %[rounds]\n\t" + "cmpl $10, %[rounds]\n\t" "jz .Lenclast%=\n\t" aesenc_xmm1_xmm0 "movdqa 0xb0(%[key]), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0xc0(%[key]), %%xmm1\n\t" - "cmp $12, %[rounds]\n\t" + "cmpl $12, %[rounds]\n\t" "jz .Lenclast%=\n\t" aesenc_xmm1_xmm0 "movdqa 0xd0(%[key]), %%xmm1\n\t" @@ -796,13 +796,13 @@ do_aesni_dec_aligned (const RIJNDAEL_context *ctx, "movdqa 0x90(%[key]), %%xmm1\n\t" aesdec_xmm1_xmm0 "movdqa 0xa0(%[key]), %%xmm1\n\t" - "cmp $10, %[rounds]\n\t" + "cmpl $10, %[rounds]\n\t" "jz .Ldeclast%=\n\t" aesdec_xmm1_xmm0 "movdqa 0xb0(%[key]), %%xmm1\n\t" aesdec_xmm1_xmm0 "movdqa 0xc0(%[key]), %%xmm1\n\t" - "cmp $12, %[rounds]\n\t" + "cmpl $12, %[rounds]\n\t" "jz .Ldeclast%=\n\t" aesdec_xmm1_xmm0 "movdqa 0xd0(%[key]), %%xmm1\n\t" @@ -886,7 +886,7 @@ do_aesni_dec_vec4 (const RIJNDAEL_context *ctx) aesdec_xmm0_xmm3 aesdec_xmm0_xmm4 "movdqa 0xa0(%[key]), %%xmm0\n\t" - "cmp $10, %[rounds]\n\t" + "cmpl $10, %[rounds]\n\t" "jz .Ldeclast%=\n\t" aesdec_xmm0_xmm1 aesdec_xmm0_xmm2 @@ -898,7 +898,7 @@ do_aesni_dec_vec4 (const RIJNDAEL_context *ctx) aesdec_xmm0_xmm3 aesdec_xmm0_xmm4 "movdqa 0xc0(%[key]), %%xmm0\n\t" - "cmp $12, %[rounds]\n\t" + "cmpl $12, %[rounds]\n\t" "jz .Ldeclast%=\n\t" aesdec_xmm0_xmm1 aesdec_xmm0_xmm2 @@ -963,13 +963,13 @@ do_aesni_cfb (const RIJNDAEL_context *ctx, int decrypt_flag, "movdqa 0x90(%[key]), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0xa0(%[key]), %%xmm1\n\t" - "cmp $10, %[rounds]\n\t" + "cmpl $10, %[rounds]\n\t" "jz .Lenclast%=\n\t" aesenc_xmm1_xmm0 "movdqa 0xb0(%[key]), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0xc0(%[key]), %%xmm1\n\t" - "cmp $12, %[rounds]\n\t" + "cmpl $12, %[rounds]\n\t" "jz .Lenclast%=\n\t" aesenc_xmm1_xmm0 "movdqa 0xd0(%[key]), %%xmm1\n\t" @@ -981,7 +981,7 @@ do_aesni_cfb (const RIJNDAEL_context *ctx, int decrypt_flag, "movdqu %[src], %%xmm1\n\t" /* Save input. */ "pxor %%xmm1, %%xmm0\n\t" /* xmm0 = input ^ IV */ - "cmp $1, %[decrypt]\n\t" + "cmpl $1, %[decrypt]\n\t" "jz .Ldecrypt_%=\n\t" "movdqa %%xmm0, %[iv]\n\t" /* [encrypt] Store IV. */ "jmp .Lleave_%=\n" @@ -1058,13 +1058,13 @@ do_aesni_ctr (const RIJNDAEL_context *ctx, "movdqa 0x90(%[key]), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0xa0(%[key]), %%xmm1\n\t" - "cmp $10, %[rounds]\n\t" + "cmpl $10, %[rounds]\n\t" "jz .Lenclast%=\n\t" aesenc_xmm1_xmm0 "movdqa 0xb0(%[key]), %%xmm1\n\t" aesenc_xmm1_xmm0 "movdqa 0xc0(%[key]), %%xmm1\n\t" - "cmp $12, %[rounds]\n\t" + "cmpl $12, %[rounds]\n\t" "jz .Lenclast%=\n\t" aesenc_xmm1_xmm0 "movdqa 0xd0(%[key]), %%xmm1\n\t" @@ -1219,7 +1219,7 @@ do_aesni_ctr_4 (const RIJNDAEL_context *ctx, aesenc_xmm1_xmm3 aesenc_xmm1_xmm4 "movdqa 0xa0(%[key]), %%xmm1\n\t" - "cmp $10, %[rounds]\n\t" + "cmpl $10, %[rounds]\n\t" "jz .Lenclast%=\n\t" aesenc_xmm1_xmm0 aesenc_xmm1_xmm2 @@ -1231,7 +1231,7 @@ do_aesni_ctr_4 (const RIJNDAEL_context *ctx, aesenc_xmm1_xmm3 aesenc_xmm1_xmm4 "movdqa 0xc0(%[key]), %%xmm1\n\t" - "cmp $12, %[rounds]\n\t" + "cmpl $12, %[rounds]\n\t" "jz .Lenclast%=\n\t" aesenc_xmm1_xmm0 aesenc_xmm1_xmm2 |