summaryrefslogtreecommitdiff
path: root/validat0.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-09-03 11:17:57 -0400
committerJeffrey Walton <noloader@gmail.com>2017-09-03 11:17:57 -0400
commite7974c7915c90815cc00fa3500e0815ff693169f (patch)
tree6aeca13193a81ab4da78fe1c01984481fb2c72ac /validat0.cpp
parentb9e871d1e8425e9add810f837326b2c0e5a5f33c (diff)
downloadcryptopp-git-e7974c7915c90815cc00fa3500e0815ff693169f.tar.gz
Fix unaligned data in self test
AltiVec and Power8 are brutal. The SIMD units just mask-off the lower 3 address bits. They make the buffer aligned whethere it is aligned or not
Diffstat (limited to 'validat0.cpp')
-rw-r--r--validat0.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/validat0.cpp b/validat0.cpp
index 6ee466bd..43ac4f06 100644
--- a/validat0.cpp
+++ b/validat0.cpp
@@ -2467,16 +2467,16 @@ bool TestHuffmanCodes()
{
try
{
- byte data1[0xfff]; // Place on stack, avoid new
- unsigned int data2[0xff];
+ SecByteBlock data1(0xfff);
+ SecBlock<word32> data2(0xff);
unsigned int len1 = GlobalRNG().GenerateWord32(4, 0xfff);
- GlobalRNG().GenerateBlock(data1, len1);
+ GlobalRNG().GenerateBlock(data1.BytePtr(), data1.SizeInBytes());
unsigned int len2 = GlobalRNG().GenerateWord32(4, 0xff);
- GlobalRNG().GenerateBlock((byte*)data2, len2*sizeof(unsigned int));
+ GlobalRNG().GenerateBlock(data2.BytePtr(), data2.SizeInBytes());
- ArraySource source(data1, len1, false);
- HuffmanDecoder decoder(data2, len2);
+ ArraySource source(data1.BytePtr(), data1.SizeInBytes(), false);
+ HuffmanDecoder decoder(data2.begin(), data2.size());
LowFirstBitReader reader(source);
unsigned int val;