Save/restore 64-bit registers for Padlock on x86_64
parent
5ea410c1d3
commit
7afd05c336
10
padlkrng.cpp
10
padlkrng.cpp
|
|
@ -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
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue