diff --git a/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/nosse/pwhash_scryptxsalsa208sha256.c b/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/nosse/pwhash_scryptxsalsa208sha256.c index a79f9a78..a9ab966e 100644 --- a/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/nosse/pwhash_scryptxsalsa208sha256.c +++ b/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/nosse/pwhash_scryptxsalsa208sha256.c @@ -248,6 +248,10 @@ escrypt_kdf_nosse(escrypt_local_t * local, errno = EINVAL; return -1; } + if (r == 0 || p == 0) { + errno = EINVAL; + return -1; + } if ((r > SIZE_MAX / 128 / p) || #if SIZE_MAX / 256 <= UINT32_MAX (r > SIZE_MAX / 256) || diff --git a/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256.c b/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256.c index 3b9d9462..b734acf1 100644 --- a/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256.c +++ b/src/libsodium/crypto_pwhash/scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256.c @@ -334,6 +334,10 @@ escrypt_kdf_sse(escrypt_local_t * local, errno = EINVAL; return -1; } + if (r == 0 || p == 0) { + errno = EINVAL; + return -1; + } if ((r > SIZE_MAX / 128 / p) || #if SIZE_MAX / 256 <= UINT32_MAX (r > SIZE_MAX / 256) ||