Add additional asserts in Scrypt::ValidateParameters (GH #842)
We still need to figure out what to do, but we can start warning users immediately.pull/853/head
parent
e3788aacc5
commit
2c0455edf8
|
|
@ -184,6 +184,12 @@ size_t Scrypt::GetValidDerivedLength(size_t keylength) const
|
||||||
|
|
||||||
void Scrypt::ValidateParameters(size_t derivedLen, word64 cost, word64 blockSize, word64 parallelization) const
|
void Scrypt::ValidateParameters(size_t derivedLen, word64 cost, word64 blockSize, word64 parallelization) const
|
||||||
{
|
{
|
||||||
|
// https://github.com/weidai11/cryptopp/issues/842
|
||||||
|
CRYPTOPP_ASSERT(derivedLen != 0);
|
||||||
|
CRYPTOPP_ASSERT(cost != 0);
|
||||||
|
CRYPTOPP_ASSERT(blockSize != 0);
|
||||||
|
CRYPTOPP_ASSERT(parallelization != 0);
|
||||||
|
|
||||||
// Optimizer should remove this on 32-bit platforms
|
// Optimizer should remove this on 32-bit platforms
|
||||||
if (std::numeric_limits<size_t>::max() > std::numeric_limits<word32>::max())
|
if (std::numeric_limits<size_t>::max() > std::numeric_limits<word32>::max())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue