aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/block/aes/aes.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-10-15 11:32:46 -0400
committerJack Lloyd <[email protected]>2017-10-15 11:32:46 -0400
commit51d7b7a96ccb01e0c5ccdec4ceab92db844792f1 (patch)
tree7a4c7e65b4cec9ecca88ed077725a5e124e8fc1c /src/lib/block/aes/aes.cpp
parent96ed1bf7f001e8302bdaa42ab37555ee5c0f9edb (diff)
Correct usage of std::aligned_storage
This ended up allocating 256 KiB!
Diffstat (limited to 'src/lib/block/aes/aes.cpp')
-rw-r--r--src/lib/block/aes/aes.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/block/aes/aes.cpp b/src/lib/block/aes/aes.cpp
index 6afa5133a..8a82ad942 100644
--- a/src/lib/block/aes/aes.cpp
+++ b/src/lib/block/aes/aes.cpp
@@ -124,7 +124,7 @@ const uint32_t* AES_TE()
public:
TE_Table()
{
- uint32_t* p = reinterpret_cast<uint32_t*>(data);
+ uint32_t* p = reinterpret_cast<uint32_t*>(&data);
for(size_t i = 0; i != 256; ++i)
{
const uint8_t s = SE[i];
@@ -134,10 +134,10 @@ const uint32_t* AES_TE()
const uint32_t* ptr() const
{
- return reinterpret_cast<const uint32_t*>(data);
+ return reinterpret_cast<const uint32_t*>(&data);
}
private:
- std::aligned_storage<256*sizeof(uint32_t), 64>::type data[256];
+ std::aligned_storage<256*sizeof(uint32_t), 64>::type data;
};
static TE_Table table;
@@ -151,7 +151,7 @@ const uint32_t* AES_TD()
public:
TD_Table()
{
- uint32_t* p = reinterpret_cast<uint32_t*>(data);
+ uint32_t* p = reinterpret_cast<uint32_t*>(&data);
for(size_t i = 0; i != 256; ++i)
{
const uint8_t s = SD[i];
@@ -161,10 +161,10 @@ const uint32_t* AES_TD()
const uint32_t* ptr() const
{
- return reinterpret_cast<const uint32_t*>(data);
+ return reinterpret_cast<const uint32_t*>(&data);
}
private:
- std::aligned_storage<sizeof(uint32_t), 1024>::type data[256];
+ std::aligned_storage<256*sizeof(uint32_t), 64>::type data;
};
static TD_Table table;