Save/restore 64-bit registers for Padlock on x86_64

pull/696/head
Jeffrey Walton 2018-07-27 11:21:54 -04:00
parent 5ea410c1d3
commit 7afd05c336
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
1 changed files with 4 additions and 6 deletions

View File

@ -23,14 +23,12 @@ std::string PadlockRNG::AlgorithmProvider() const
} }
PadlockRNG::PadlockRNG(word32 divisor) PadlockRNG::PadlockRNG(word32 divisor)
: m_divisor(DivisorHelper(divisor)), m_msr(0) : m_divisor(DivisorHelper(divisor)), m_msr(0)
{ {
#if defined(CRYPTOPP_X86_ASM_AVAILABLE) #if defined(CRYPTOPP_X86_ASM_AVAILABLE)
if (!HasPadlockRNG()) if (!HasPadlockRNG())
throw PadlockRNG_Err("PadlockRNG", "PadlockRNG generator not available");
#else
throw PadlockRNG_Err("PadlockRNG", "PadlockRNG generator not available");
#endif #endif
throw PadlockRNG_Err("PadlockRNG", "PadlockRNG generator not available");
} }
void PadlockRNG::GenerateBlock(byte *output, size_t size) void PadlockRNG::GenerateBlock(byte *output, size_t size)
@ -54,9 +52,9 @@ void PadlockRNG::GenerateBlock(byte *output, size_t size)
: "=g" (m_msr) : "g" (m_buffer.data()), "g" (m_divisor) : "=g" (m_msr) : "g" (m_buffer.data()), "g" (m_divisor)
#if (CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64) #if (CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64)
: "eax", "edx", "rdi", "cc" : "rax", "rbx", "rdx", "rdi", "cc"
#else #else
: "eax", "edx", "edi", "cc" : "eax", "ebx", "edx", "edi", "cc"
#endif #endif
); );