gb.openssl: Hash memory allocation

[GB.OPENSSL]
* BUG: Hash incorrectly allocated by sizeof a pointer.
This commit is contained in:
Andy 2020-05-14 07:35:28 -07:00 committed by Tobias Boege
parent 3b67580477
commit 0eb47b25bb

View file

@ -111,7 +111,7 @@ BEGIN_METHOD(OpenSSL_Pbkdf2, GB_STRING password; GB_STRING salt; GB_LONG iterati
GB.Error("Invalid Parameter: method not a supported digest");
return;
}
memset(hash, 0, sizeof(hash));
memset(hash, 0, lKey));
ret = PKCS5_PBKDF2_HMAC((const char *) STRING(password), LENGTH(password), (const unsigned char *) STRING(salt),
LENGTH(salt), (int) VARG(iterations), emethod, lKey, (unsigned char *) hash);
if (ret == 0) {
@ -175,7 +175,7 @@ BEGIN_METHOD(OpenSSL_Scrypt, GB_STRING password; GB_STRING salt; GB_LONG N; GB_L
GB.Error("Invalid Parameter: The combination of N, r, and p was rejected by OpenSSL");
return;
}
memset(hash, 0, sizeof(hash));
memset(hash, 0, lKey);
ret = EVP_PBE_scrypt((const char *) STRING(password), LENGTH(password), (const unsigned char *) STRING(salt),
LENGTH(salt), lN, lR, lP, 0, (unsigned char *) hash, lKey);
if (ret == 0) {