Merge pull request #300 from kareem-wolfssl/aesSaltFix

Ensure salt[0] is 0 only if pad is 0.
pull/298/head^2
David Garske 2022-03-01 14:03:12 -08:00 committed by GitHub
commit c85c7a1152
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -44,6 +44,9 @@ int GenerateKey(WC_RNG* rng, byte* key, int size, byte* salt, int pad)
if (pad == 0)
salt[0] = 0;
/* salt[0] == 0 should only be used if pad == 0 */
else if (salt[0] == 0)
salt[0] = 1;
/* stretches key */
ret = wc_PBKDF2(key, key, strlen((const char*)key), salt, SALT_SIZE, 4096,