summaryrefslogtreecommitdiff
path: root/extra/yassl/taocrypt/src/md5.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'extra/yassl/taocrypt/src/md5.cpp')
-rw-r--r--extra/yassl/taocrypt/src/md5.cpp50
1 files changed, 29 insertions, 21 deletions
diff --git a/extra/yassl/taocrypt/src/md5.cpp b/extra/yassl/taocrypt/src/md5.cpp
index ee0d64acc17..e9a9e8fe517 100644
--- a/extra/yassl/taocrypt/src/md5.cpp
+++ b/extra/yassl/taocrypt/src/md5.cpp
@@ -223,32 +223,32 @@ void MD5::Update(const byte* data, word32 len)
#ifdef _MSC_VER
- __declspec(naked)
+ __declspec(naked)
+#else
+ __attribute__ ((noinline))
#endif
void MD5::AsmTransform(const byte* data, word32 times)
{
#ifdef __GNUC__
- #define AS1(x) asm(#x);
- #define AS2(x, y) asm(#x ", " #y);
+ #define AS1(x) #x ";"
+ #define AS2(x, y) #x ", " #y ";"
#define PROLOG() \
- asm(".intel_syntax noprefix"); \
- AS2( movd mm3, edi ) \
- AS2( movd mm4, ebx ) \
- AS2( movd mm5, esi ) \
- AS2( movd mm6, ebp ) \
- AS2( mov ecx, DWORD PTR [ebp + 8] ) \
- AS2( mov edi, DWORD PTR [ebp + 12] ) \
- AS2( mov eax, DWORD PTR [ebp + 16] )
-
+ __asm__ __volatile__ \
+ ( \
+ ".intel_syntax noprefix;" \
+ "push ebx;" \
+ "push ebp;"
#define EPILOG() \
- AS2( movd ebp, mm6 ) \
- AS2( movd esi, mm5 ) \
- AS2( movd ebx, mm4 ) \
- AS2( mov esp, ebp ) \
- AS2( movd edi, mm3 ) \
- AS1( emms ) \
- asm(".att_syntax");
+ "pop ebp;" \
+ "pop ebx;" \
+ "emms;" \
+ ".att_syntax;" \
+ : \
+ : "c" (this), "D" (data), "a" (times) \
+ : "%esi", "%edx", "memory", "cc" \
+ );
+
#else
#define AS1(x) __asm x
#define AS2(x, y) __asm x, y
@@ -294,7 +294,11 @@ void MD5::AsmTransform(const byte* data, word32 times)
AS2( mov ecx, [esi + 8] ) // c
AS2( mov edx, [esi + 12] ) // d
-AS1(loopStart:)
+#ifdef _MSC_VER
+ AS1( loopStart: ) // loopStart
+#else
+ AS1( 0: ) // loopStart for some gas (need numeric for jump back
+#endif
// set up
AS2( mov esi, ecx )
@@ -389,7 +393,11 @@ AS1(loopStart:)
AS2( movd ebp, mm2 ) // times
AS1( dec ebp )
AS2( movd mm2, ebp )
- AS1( jnz loopStart )
+#ifdef _MSC_VER
+ AS1( jnz loopStart ) // loopStart
+#else
+ AS1( jnz 0b ) // loopStart
+#endif
EPILOG()