summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@iki.fi>2013-06-27 14:40:12 +0300
committerJussi Kivilinna <jussi.kivilinna@iki.fi>2013-07-10 22:02:08 +0300
commited0a598172208ec67234a4edd73189bf6808fd04 (patch)
treea43edc3af41965bfa82dfb2d093e37dce6e6f6ee
parentc3902a6b5cea9acef2e15fbee24eb601eeb25168 (diff)
downloadlibgcrypt-ed0a598172208ec67234a4edd73189bf6808fd04.tar.gz
Fix i386/amd64 inline assembly "cc" clobbers
* cipher/bithelp.h [__GNUC__, __i386__] (rol, ror): add "cc" globber for inline assembly. * cipher/cast5.c [__GNUC__, __i386__] (rol): Ditto. * random/rndhw.c [USE_DRNG] (rdrand_long): Ditto. * src/hmac256.c [__GNUC__, __i386__] (ror): Ditto. * mpi/longlong.c [__i386__] (add_ssaaaa, sub_ddmmss, umul_ppmm) (udiv_qrnnd, count_leading_zeros, count_trailing_zeros): Ditto. -- These assembly snippets modify cflags but do not mark "cc" clobber. Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
-rw-r--r--cipher/bithelp.h6
-rw-r--r--cipher/cast5.c3
-rw-r--r--mpi/longlong.h17
-rw-r--r--random/rndhw.c3
-rw-r--r--src/hmac256.c3
5 files changed, 21 insertions, 11 deletions
diff --git a/cipher/bithelp.h b/cipher/bithelp.h
index 15053243..785701e3 100644
--- a/cipher/bithelp.h
+++ b/cipher/bithelp.h
@@ -30,7 +30,8 @@ rol( u32 x, int n)
{
__asm__("roll %%cl,%0"
:"=r" (x)
- :"0" (x),"c" (n));
+ :"0" (x),"c" (n)
+ :"cc");
return x;
}
#else
@@ -43,7 +44,8 @@ ror(u32 x, int n)
{
__asm__("rorl %%cl,%0"
:"=r" (x)
- :"0" (x),"c" (n));
+ :"0" (x),"c" (n)
+ :"cc");
return x;
}
#else
diff --git a/cipher/cast5.c b/cipher/cast5.c
index 41bc9ffa..6017bf06 100644
--- a/cipher/cast5.c
+++ b/cipher/cast5.c
@@ -393,7 +393,8 @@ rol(int n, u32 x)
{
__asm__("roll %%cl,%0"
:"=r" (x)
- :"0" (x),"c" (n));
+ :"0" (x),"c" (n)
+ :"cc");
return x;
}
#else
diff --git a/mpi/longlong.h b/mpi/longlong.h
index 699b6b3f..773d1c78 100644
--- a/mpi/longlong.h
+++ b/mpi/longlong.h
@@ -473,7 +473,8 @@ extern USItype __udiv_qrnnd ();
: "%0" ((USItype)(ah)), \
"g" ((USItype)(bh)), \
"%1" ((USItype)(al)), \
- "g" ((USItype)(bl)))
+ "g" ((USItype)(bl)) \
+ __CLOBBER_CC)
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
__asm__ ("subl %5,%1\n" \
"sbbl %3,%0" \
@@ -482,29 +483,33 @@ extern USItype __udiv_qrnnd ();
: "0" ((USItype)(ah)), \
"g" ((USItype)(bh)), \
"1" ((USItype)(al)), \
- "g" ((USItype)(bl)))
+ "g" ((USItype)(bl)) \
+ __CLOBBER_CC)
#define umul_ppmm(w1, w0, u, v) \
__asm__ ("mull %3" \
: "=a" ((USItype)(w0)), \
"=d" ((USItype)(w1)) \
: "%0" ((USItype)(u)), \
- "rm" ((USItype)(v)))
+ "rm" ((USItype)(v)) \
+ __CLOBBER_CC)
#define udiv_qrnnd(q, r, n1, n0, d) \
__asm__ ("divl %4" \
: "=a" ((USItype)(q)), \
"=d" ((USItype)(r)) \
: "0" ((USItype)(n0)), \
"1" ((USItype)(n1)), \
- "rm" ((USItype)(d)))
+ "rm" ((USItype)(d)) \
+ __CLOBBER_CC)
#define count_leading_zeros(count, x) \
do { \
USItype __cbtmp; \
__asm__ ("bsrl %1,%0" \
- : "=r" (__cbtmp) : "rm" ((USItype)(x))); \
+ : "=r" (__cbtmp) : "rm" ((USItype)(x)) \
+ __CLOBBER_CC); \
(count) = __cbtmp ^ 31; \
} while (0)
#define count_trailing_zeros(count, x) \
- __asm__ ("bsfl %1,%0" : "=r" (count) : "rm" ((USItype)(x)))
+ __asm__ ("bsfl %1,%0" : "=r" (count) : "rm" ((USItype)(x)) __CLOBBER_CC)
#ifndef UMUL_TIME
#define UMUL_TIME 40
#endif
diff --git a/random/rndhw.c b/random/rndhw.c
index cbb28d1a..ca99c5f8 100644
--- a/random/rndhw.c
+++ b/random/rndhw.c
@@ -138,7 +138,8 @@ rdrand_long (unsigned long *v)
"jnz 1b\n\t"
"2:"
: "=r" (ok), "=a" (*v)
- : "0" (RDRAND_RETRY_LOOPS));
+ : "0" (RDRAND_RETRY_LOOPS)
+ : "cc");
return ok;
}
diff --git a/src/hmac256.c b/src/hmac256.c
index 34def769..2fda47bf 100644
--- a/src/hmac256.c
+++ b/src/hmac256.c
@@ -104,7 +104,8 @@ ror(u32 x, int n)
{
__asm__("rorl %%cl,%0"
:"=r" (x)
- :"0" (x),"c" (n));
+ :"0" (x),"c" (n)
+ :"cc");
return x;
}
#else