diff options
author | Jeffrey Walton <noloader@gmail.com> | 2017-08-20 11:19:32 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2017-08-20 11:19:32 -0400 |
commit | bac3c1cc40904407500fbc0e097ffb54b7553382 (patch) | |
tree | 600cec19b482d80ee9669feab394004cd039af78 /padlkrng.cpp | |
parent | 3db6f361d20d777ce87434a9fd3c0e3500601ebf (diff) | |
download | cryptopp-git-bac3c1cc40904407500fbc0e097ffb54b7553382.tar.gz |
Fix Asan 64-bit build
The Padlock SDK sample code leaves a lot to be desired. Regariding the 64-bit samples and instr_linux64.asm... it looks like the sample sill uses 32-bit constants, but most anything related to extended registers, like rdi, is commented out
Diffstat (limited to 'padlkrng.cpp')
-rw-r--r-- | padlkrng.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/padlkrng.cpp b/padlkrng.cpp index 5e4de194..b1fe000c 100644 --- a/padlkrng.cpp +++ b/padlkrng.cpp @@ -32,13 +32,23 @@ void PadlockRNG::GenerateBlock(byte *output, size_t size) {
__asm__ __volatile__
(
- "movl %1, %%edi ;\n"
+#if (CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64)
+ "mov %1, %%rdi ;\n"
"movl %2, %%edx ;\n"
+#else
+ "mov %1, %%edi ;\n"
+ "movl %2, %%edx ;\n"
+#endif
+
".byte 0x0f, 0xa7, 0xc0 ;\n"
"movl %%eax, %0 ;\n"
: "=g" (m_msr) : "g" (m_buffer.data()), "g" (m_divisor)
+#if (CRYPTOPP_BOOL_X3 || CRYPTOPP_BOOL_X64)
+ : "eax", "edx", "rdi", "cc"
+#else
: "eax", "edx", "edi", "cc"
+#endif
);
const size_t ret = m_msr & 0x1f;
@@ -46,7 +56,7 @@ void PadlockRNG::GenerateBlock(byte *output, size_t size) std::memcpy(output, m_buffer, rem);
size -= rem; output += rem;
}
-#elif defined(CRYPTOPP_X86_ASM_AVAILABLE) && defined(_MSC_VER)
+#elif defined(CRYPTOPP_X86_ASM_AVAILABLE) && defined(_MSC_VER) && defined(_M_IX86)
while (size)
{
word32 result, divisor = m_divisor;
|