Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup! crypto: increase maxmem range from 32 to 53 bits
  • Loading branch information
tniessen committed Jul 22, 2019
commit e9cb4ec34bc8423a718dccd44e0e292a11b21871
9 changes: 2 additions & 7 deletions lib/internal/crypto/scrypt.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { Number } = primordials;
const { AsyncWrap, Providers } = internalBinding('async_wrap');
const { Buffer } = require('buffer');
const { scrypt: _scrypt } = internalBinding('crypto');
const { validateUint32 } = require('internal/validators');
const { validateInteger, validateUint32 } = require('internal/validators');
const {
ERR_CRYPTO_SCRYPT_INVALID_PARAMETER,
ERR_CRYPTO_SCRYPT_NOT_SUPPORTED,
Expand Down Expand Up @@ -111,12 +111,7 @@ function check(password, salt, keylen, options) {
}
if (options.maxmem !== undefined) {
maxmem = options.maxmem;
if (typeof maxmem !== 'number')
throw new ERR_INVALID_ARG_TYPE('maxmem', 'number', maxmem);
if (!Number.isInteger(maxmem))
throw new ERR_OUT_OF_RANGE('maxmem', 'an integer', maxmem);
if (maxmem < 0 || maxmem > Number.MAX_SAFE_INTEGER)
throw new ERR_OUT_OF_RANGE('maxmem', `>= 0 && < ${2 ** 53}`, maxmem);
validateInteger(maxmem, 'maxmem', 0);
}
if (N === 0) N = defaults.N;
if (r === 0) r = defaults.r;
Expand Down