Make sure Keccak state gets allocated aligned to 32.
This commit is contained in:
parent
e36451b6a3
commit
abda1a5258
@ -31,7 +31,11 @@
|
|||||||
QKeccakHash::QKeccakHash()
|
QKeccakHash::QKeccakHash()
|
||||||
{
|
{
|
||||||
m_initialized = false;
|
m_initialized = false;
|
||||||
m_state = new KeccakImpl::hashState;
|
m_state = (KeccakImpl::hashState*) _aligned_malloc(sizeof(KeccakImpl::hashState), 32);
|
||||||
|
if(!m_state)
|
||||||
|
{
|
||||||
|
throw "[QKeccakHash] Error: _aligned_malloc() has failed, probably out of heap space!";
|
||||||
|
}
|
||||||
memset(m_state, 0, sizeof(KeccakImpl::hashState));
|
memset(m_state, 0, sizeof(KeccakImpl::hashState));
|
||||||
m_hashResult.clear();
|
m_hashResult.clear();
|
||||||
}
|
}
|
||||||
@ -42,7 +46,7 @@ QKeccakHash::~QKeccakHash()
|
|||||||
|
|
||||||
if(m_state)
|
if(m_state)
|
||||||
{
|
{
|
||||||
delete m_state;
|
_aligned_free(m_state);
|
||||||
m_state = NULL;
|
m_state = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user