From 7afd05c3366a1dfc28fed603e32a281b2912b7a1 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Fri, 27 Jul 2018 11:21:54 -0400 Subject: Save/restore 64-bit registers for Padlock on x86_64 --- padlkrng.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'padlkrng.cpp') diff --git a/padlkrng.cpp b/padlkrng.cpp index f1401543..e7e1cc2b 100644 --- a/padlkrng.cpp +++ b/padlkrng.cpp @@ -23,14 +23,12 @@ std::string PadlockRNG::AlgorithmProvider() const } 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 (!HasPadlockRNG()) - throw PadlockRNG_Err("PadlockRNG", "PadlockRNG generator not available"); -#else - throw PadlockRNG_Err("PadlockRNG", "PadlockRNG generator not available"); #endif + throw PadlockRNG_Err("PadlockRNG", "PadlockRNG generator not available"); } 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) #if (CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64) - : "eax", "edx", "rdi", "cc" + : "rax", "rbx", "rdx", "rdi", "cc" #else - : "eax", "edx", "edi", "cc" + : "eax", "ebx", "edx", "edi", "cc" #endif ); -- cgit v1.2.1