diff options
author | Jan Varho <jan@varho.org> | 2014-04-29 13:33:06 +0300 |
---|---|---|
committer | Jan Varho <jan@varho.org> | 2014-04-29 13:33:06 +0300 |
commit | b7ab038150c16605cab826a68a279b0dcf6bb46d (patch) | |
tree | c3a65869177ed8f96d6233e19f8aac0c4aef900c /crypto_scrypt-nosse.c | |
parent | c6b516efbfde7fd30d14cdfe5ea6c267f413bcad (diff) |
Check that r and p are not zero before dividing by them
These parameters are required to be positive by scrypt.pdf and upstream
checks them before handing them to the scrypt function.
Diffstat (limited to 'crypto_scrypt-nosse.c')
-rw-r--r-- | crypto_scrypt-nosse.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/crypto_scrypt-nosse.c b/crypto_scrypt-nosse.c index 0502302..31e695d 100644 --- a/crypto_scrypt-nosse.c +++ b/crypto_scrypt-nosse.c @@ -251,6 +251,10 @@ libscrypt_scrypt(const uint8_t * passwd, size_t passwdlen, errno = EFBIG; goto err0; } + if (r == 0 || p == 0) { + errno = EINVAL; + goto err0; + } if (((N & (N - 1)) != 0) || (N < 2)) { errno = EINVAL; goto err0; |