summaryrefslogtreecommitdiff
path: root/rdrand.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2016-07-31 03:02:45 -0400
committerJeffrey Walton <noloader@gmail.com>2016-09-07 13:27:04 -0400
commitd317881da9b2e3ecbba86fa55dfd861c07fc9606 (patch)
tree30dbb90adf883629e9dbfb4c7084ab07930d4d02 /rdrand.cpp
parent53bc3f146ac5a8a11834fc8cd1348c7bd5144fb5 (diff)
downloadcryptopp-git-d317881da9b2e3ecbba86fa55dfd861c07fc9606.tar.gz
Fix GCC compile error under LP64 data model (Issue 236)
Diffstat (limited to 'rdrand.cpp')
-rw-r--r--rdrand.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/rdrand.cpp b/rdrand.cpp
index 637f5cab..cc18cc43 100644
--- a/rdrand.cpp
+++ b/rdrand.cpp
@@ -175,7 +175,8 @@ static int ALL_RRI_GenerateBlock(byte *output, size_t size, unsigned int safety)
#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32
if (_rdrand32_step((word32*)output))
#else
- if (_rdrand64_step((word64*)output))
+ // Cast due to GCC, http://github.com/weidai11/cryptopp/issues/236
+ if (_rdrand64_step(reinterpret_cast<unsigned long long*>(output)))
#endif
{
output += sizeof(val);
@@ -196,7 +197,8 @@ static int ALL_RRI_GenerateBlock(byte *output, size_t size, unsigned int safety)
#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32
if (_rdrand32_step(&val))
#else
- if (_rdrand64_step(&val))
+ // Cast due to GCC, http://github.com/weidai11/cryptopp/issues/236
+ if (_rdrand64_step(reinterpret_cast<unsigned long long*>(&val)))
#endif
{
memcpy(output, &val, size);
@@ -348,7 +350,8 @@ static int ALL_RSI_GenerateBlock(byte *output, size_t size, unsigned int safety)
#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32
if (_rdseed32_step((word32*)output))
#else
- if (_rdseed64_step((word64*)output))
+ // Cast due to GCC, http://github.com/weidai11/cryptopp/issues/236
+ if (_rdseed64_step(reinterpret_cast<unsigned long long*>(output)))
#endif
{
output += sizeof(val);
@@ -369,7 +372,8 @@ static int ALL_RSI_GenerateBlock(byte *output, size_t size, unsigned int safety)
#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32
if (_rdseed32_step(&val))
#else
- if (_rdseed64_step(&val))
+ // Cast due to GCC, http://github.com/weidai11/cryptopp/issues/236
+ if (_rdseed64_step(reinterpret_cast<unsigned long long*>(&val)))
#endif
{
memcpy(output, &val, size);