Merge pull request #417 from c0ff/master

NULLPTR fix for blake2 tests
pull/418/head
Jeffrey Walton 2017-05-11 00:46:56 -04:00 committed by GitHub
commit b3f5bae3b9
1 changed files with 6 additions and 6 deletions

View File

@ -1477,15 +1477,15 @@ bool ValidateBLAKE2s()
// the condition is written in a way which for non-default digest sizes
// tests the BLAKE2_Base(bool treeMode, unsigned int digestSize) constructor.
// See https://github.com/weidai11/cryptopp/issues/415
if (tests[i].dlen < BLAKE2s::DIGESTSIZE && tests[i].key == NULL)
if (tests[i].dlen < BLAKE2s::DIGESTSIZE && tests[i].key == NULLPTR)
{
BLAKE2s blake2s(false, unsigned int(tests[i].dlen));
BLAKE2s blake2s(false, (unsigned int)tests[i].dlen);
blake2s.Update((const byte*)tests[i].message, tests[i].mlen);
blake2s.Final(digest);
}
else
{
BLAKE2s blake2s((const byte*)tests[i].key, tests[i].klen, NULLPTR, 0, NULLPTR, 0, false, unsigned int(tests[i].dlen));
BLAKE2s blake2s((const byte*)tests[i].key, tests[i].klen, NULLPTR, 0, NULLPTR, 0, false, (unsigned int)tests[i].dlen);
blake2s.Update((const byte*)tests[i].message, tests[i].mlen);
blake2s.Final(digest);
}
@ -1908,15 +1908,15 @@ bool ValidateBLAKE2b()
// the condition is written in a way which for non-default digest sizes
// tests the BLAKE2_Base(bool treeMode, unsigned int digestSize) constructor.
// See https://github.com/weidai11/cryptopp/issues/415
if (tests[i].dlen < BLAKE2b::DIGESTSIZE && tests[i].key == NULL)
if (tests[i].dlen < BLAKE2b::DIGESTSIZE && tests[i].key == NULLPTR)
{
BLAKE2b blake2b(false, unsigned int(tests[i].dlen));
BLAKE2b blake2b(false, (unsigned int)tests[i].dlen);
blake2b.Update((const byte*)tests[i].message, tests[i].mlen);
blake2b.Final(digest);
}
else
{
BLAKE2b blake2b((const byte*)tests[i].key, tests[i].klen, NULLPTR, 0, NULLPTR, 0, false, unsigned int(tests[i].dlen));
BLAKE2b blake2b((const byte*)tests[i].key, tests[i].klen, NULLPTR, 0, NULLPTR, 0, false, (unsigned int)tests[i].dlen);
blake2b.Update((const byte*)tests[i].message, tests[i].mlen);
blake2b.Final(digest);
}