Use _rdrand32_step for X32. Whitespace

pull/211/head
root 2016-06-21 21:22:50 -04:00
parent 8576762836
commit d21248b995
2 changed files with 76 additions and 76 deletions

View File

@ -179,18 +179,18 @@ NAMESPACE_BEGIN(CryptoPP)
static int ALL_RRI_GenerateBlock(byte *output, size_t size, unsigned int safety) static int ALL_RRI_GenerateBlock(byte *output, size_t size, unsigned int safety)
{ {
assert((output && size) || !(output || size)); assert((output && size) || !(output || size));
#if CRYPTOPP_BOOL_X64 || CRYTPOPP_BOOL_X32 #if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32
word64 val;
#else
word32 val; word32 val;
#else
word64 val;
#endif #endif
while (size >= sizeof(val)) while (size >= sizeof(val))
{ {
#if CRYPTOPP_BOOL_X64 || CRYTPOPP_BOOL_X32 #if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32
if (_rdrand64_step((word64*)output))
#else
if (_rdrand32_step((word32*)output)) if (_rdrand32_step((word32*)output))
#else
if (_rdrand64_step((word64*)output))
#endif #endif
{ {
output += sizeof(val); output += sizeof(val);
@ -208,10 +208,10 @@ static int ALL_RRI_GenerateBlock(byte *output, size_t size, unsigned int safety)
if (size) if (size)
{ {
#if CRYPTOPP_BOOL_X64 || CRYTPOPP_BOOL_X32 #if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32
if (_rdrand64_step(&val))
#else
if (_rdrand32_step(&val)) if (_rdrand32_step(&val))
#else
if (_rdrand64_step(&val))
#endif #endif
{ {
memcpy(output, &val, size); memcpy(output, &val, size);
@ -227,10 +227,10 @@ static int ALL_RRI_GenerateBlock(byte *output, size_t size, unsigned int safety)
} }
} }
#if CRYPTOPP_BOOL_X64 || CRYTPOPP_BOOL_X32 #if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32
*((volatile word64*)&val) = 0;
#else
*((volatile word32*)&val) = 0; *((volatile word32*)&val) = 0;
#else
*((volatile word64*)&val) = 0;
#endif #endif
return int(size == 0); return int(size == 0);
@ -360,18 +360,18 @@ void RDRAND::DiscardBytes(size_t n)
static int ALL_RSI_GenerateBlock(byte *output, size_t size, unsigned int safety) static int ALL_RSI_GenerateBlock(byte *output, size_t size, unsigned int safety)
{ {
assert((output && size) || !(output || size)); assert((output && size) || !(output || size));
#if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32 #if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32
word64 val;
#else
word32 val; word32 val;
#else
word64 val;
#endif #endif
while (size >= sizeof(val)) while (size >= sizeof(val))
{ {
#if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32 #if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32
if (_rdseed64_step((word64*)output))
#else
if (_rdseed32_step((word32*)output)) if (_rdseed32_step((word32*)output))
#else
if (_rdseed64_step((word64*)output))
#endif #endif
{ {
output += sizeof(val); output += sizeof(val);
@ -389,10 +389,10 @@ static int ALL_RSI_GenerateBlock(byte *output, size_t size, unsigned int safety)
if (size) if (size)
{ {
#if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32 #if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32
if (_rdseed64_step(&val))
#else
if (_rdseed32_step(&val)) if (_rdseed32_step(&val))
#else
if (_rdseed64_step(&val))
#endif #endif
{ {
memcpy(output, &val, size); memcpy(output, &val, size);
@ -408,10 +408,10 @@ static int ALL_RSI_GenerateBlock(byte *output, size_t size, unsigned int safety)
} }
} }
#if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32 #if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32
*((volatile word64*)&val) = 0;
#else
*((volatile word32*)&val) = 0; *((volatile word32*)&val) = 0;
#else
*((volatile word64*)&val) = 0;
#endif #endif
return int(size == 0); return int(size == 0);