mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2024-11-23 09:59:42 +00:00
Cleared UBsan finding in Default's GenerateKeyIV
passed: 128 deflates and inflates passed: 128 zlib decompress and compress default.cpp:69:2: runtime error: null pointer passed as argument 2, which is declared to never be null /usr/include/x86_64-linux-gnu/bits/string3.h:53:71: runtime error: null pointer passed as argument 2, which is declared to never be null Information Dispersal and Secret Sharing...
This commit is contained in:
parent
092b3cb467
commit
6f36c7deae
@ -65,9 +65,14 @@ static void Mash(const byte *in, size_t inLen, byte *out, size_t outLen, int ite
|
||||
template <class BC, class H, class Info>
|
||||
static void GenerateKeyIV(const byte *passphrase, size_t passphraseLength, const byte *salt, size_t saltLength, unsigned int iterations, byte *key, byte *IV)
|
||||
{
|
||||
// UBsan. User supplied params, may be NULL
|
||||
SecByteBlock temp(passphraseLength+saltLength);
|
||||
memcpy(temp, passphrase, passphraseLength);
|
||||
memcpy(temp+passphraseLength, salt, saltLength);
|
||||
if (passphrase != NULLPTR)
|
||||
memcpy(temp, passphrase, passphraseLength);
|
||||
if (salt != NULLPTR)
|
||||
memcpy(temp+passphraseLength, salt, saltLength);
|
||||
|
||||
// OK. Derived params, cannot be NULL
|
||||
SecByteBlock keyIV(Info::KEYLENGTH+Info::BLOCKSIZE);
|
||||
Mash<H>(temp, passphraseLength + saltLength, keyIV, Info::KEYLENGTH+Info::BLOCKSIZE, iterations);
|
||||
memcpy(key, keyIV, Info::KEYLENGTH);
|
||||
|
Loading…
Reference in New Issue
Block a user