summaryrefslogtreecommitdiff
path: root/randpool.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2016-01-24 23:09:28 -0500
committerJeffrey Walton <noloader@gmail.com>2016-01-24 23:09:28 -0500
commitbf3b80f25c6adedc05c876ad2e64589d8c9791ee (patch)
treec6f3579bd056be9d9176898bc5315f85acea07a2 /randpool.cpp
parent9a5dde9013da26e3031c87d7d44338d89699e5b5 (diff)
downloadcryptopp-git-bf3b80f25c6adedc05c876ad2e64589d8c9791ee.tar.gz
Cleared -Wcast-align (Issue 122)
Diffstat (limited to 'randpool.cpp')
-rw-r--r--randpool.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/randpool.cpp b/randpool.cpp
index a9480cca..2eafb5bb 100644
--- a/randpool.cpp
+++ b/randpool.cpp
@@ -39,18 +39,18 @@ void RandomPool::GenerateIntoBufferedTransformation(BufferedTransformation &targ
if (!m_keySet)
m_pCipher->SetKey(m_key, 32);
+ CRYPTOPP_COMPILE_ASSERT(sizeof(TimerWord) <= 16);
+ CRYPTOPP_COMPILE_ASSERT(sizeof(time_t) <= 8);
+
Timer timer;
TimerWord tw = timer.GetCurrentTimerValue();
- CRYPTOPP_COMPILE_ASSERT(sizeof(tw) <= 16);
- *(TimerWord *)m_seed.data() += tw;
+ *(TimerWord *)(void*)m_seed.data() += tw;
time_t t = time(NULL);
- CRYPTOPP_COMPILE_ASSERT(sizeof(t) <= 8);
// UBsan finding: signed integer overflow: 1876017710 + 1446085457 cannot be represented in type 'long int'
// *(time_t *)(m_seed.data()+8) += t;
- assert(m_seed.size() >= 16);
- word64 tt1, tt2 = (word64)t;
+ word64 tt1 = 0, tt2 = (word64)t;
memcpy(&tt1, m_seed.data()+8, 8);
memcpy(m_seed.data()+8, &(tt2 += tt1), 8);