Coverity finding CID 189203, 189204, 189205 (ARRAY_VS_SINGLETON)
The finding was an out-of-bounds read but Coverity does not realize the API takes a byte count, not element count. This change may produce the same finding.pull/640/head
parent
cd8c03c816
commit
11e076003a
18
scrypt.cpp
18
scrypt.cpp
|
|
@ -23,32 +23,26 @@ ANONYMOUS_NAMESPACE_BEGIN
|
||||||
using CryptoPP::byte;
|
using CryptoPP::byte;
|
||||||
using CryptoPP::word32;
|
using CryptoPP::word32;
|
||||||
using CryptoPP::word64;
|
using CryptoPP::word64;
|
||||||
|
using CryptoPP::GetWord;
|
||||||
|
using CryptoPP::PutWord;
|
||||||
using CryptoPP::Salsa20_Core;
|
using CryptoPP::Salsa20_Core;
|
||||||
using CryptoPP::rotlConstant;
|
using CryptoPP::rotlConstant;
|
||||||
using CryptoPP::AlignedSecByteBlock;
|
|
||||||
using CryptoPP::LITTLE_ENDIAN_ORDER;
|
using CryptoPP::LITTLE_ENDIAN_ORDER;
|
||||||
using CryptoPP::ConditionalByteReverse;
|
using CryptoPP::AlignedSecByteBlock;
|
||||||
|
|
||||||
static inline void LE32ENC(byte* out, word32 in)
|
static inline void LE32ENC(byte* out, word32 in)
|
||||||
{
|
{
|
||||||
word32* ptr = reinterpret_cast<word32*>(out);
|
PutWord(false, LITTLE_ENDIAN_ORDER, out, in);
|
||||||
ConditionalByteReverse(LITTLE_ENDIAN_ORDER, ptr, &in, 4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline word32 LE32DEC(const byte* in)
|
static inline word32 LE32DEC(const byte* in)
|
||||||
{
|
{
|
||||||
word32 res;
|
return GetWord<word32>(false, LITTLE_ENDIAN_ORDER, in);
|
||||||
const word32* ptr = reinterpret_cast<const word32*>(in);
|
|
||||||
ConditionalByteReverse(LITTLE_ENDIAN_ORDER, &res, ptr, 4);
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline word64 LE64DEC(const byte* in)
|
static inline word64 LE64DEC(const byte* in)
|
||||||
{
|
{
|
||||||
word64 res;
|
return GetWord<word64>(false, LITTLE_ENDIAN_ORDER, in);
|
||||||
const word64* ptr = reinterpret_cast<const word64*>(in);
|
|
||||||
ConditionalByteReverse(LITTLE_ENDIAN_ORDER, &res, ptr, 8);
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void BlockCopy(byte* dest, byte* src, size_t len)
|
static inline void BlockCopy(byte* dest, byte* src, size_t len)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue