src/headers/tomcrypt_macros.h@1.22, 2015-06-09 09:27:59-04:00, wscott@bitkeeper.com
x86 only allows variable shifts and rotates with the CL register.
Change the inline asm to use CL explicitly and update the constraints to
reflect that.
===== tomcrypt_macros.h 1.21 vs 1.22 =====
--- 1.21/src/tomcrypt/src/headers/tomcrypt_macros.h 2015-03-24 14:45:42 -04:00
+++ 1.22/src/tomcrypt/src/headers/tomcrypt_macros.h 2015-06-09 09:27:59 -04:00
@@ -264,17 +264,17 @@ static inline unsigned ROLc(unsigned wor
static inline unsigned ROLc(unsigned word, const int i)
{
- asm ("roll %2,%0"
+ asm ("roll %%cl,%0"
:"=r" (word)
- :"0" (word),"I" (i));
+ :"0" (word),"c" (i));
return word;
}
static inline unsigned RORc(unsigned word, const int i)
{
- asm ("rorl %2,%0"
+ asm ("rorl %%cl,%0"
:"=r" (word)
- :"0" (word),"I" (i));
+ :"0" (word),"c" (i));
return word;
}
@@ -363,17 +363,17 @@ static inline unsigned long ROL64c(unsig
static inline unsigned long ROL64c(unsigned long word, const int i)
{
- asm("rolq %2,%0"
+ asm("rolq %%cl,%0"
:"=r" (word)
- :"0" (word),"J" (i));
+ :"0" (word),"c" (i));
return word;
}
static inline unsigned long ROR64c(unsigned long word, const int i)
{
- asm("rorq %2,%0"
+ asm("rorq %%cl,%0"
:"=r" (word)
- :"0" (word),"J" (i));
+ :"0" (word),"c" (i));
return word;
}