diff --git a/lib/internal/crypto/scrypt.js b/lib/internal/crypto/scrypt.js index 0ed4140c9c5df5..50a2bbc1536026 100644 --- a/lib/internal/crypto/scrypt.js +++ b/lib/internal/crypto/scrypt.js @@ -44,7 +44,7 @@ function scrypt(password, salt, keylen, options, callback = defaults) { callback.call(wrap, null, keybuf.toString(encoding)); }; - handleError(keybuf, password, salt, N, r, p, maxmem, wrap); + handleError(_scrypt(keybuf, password, salt, N, r, p, maxmem, wrap)); } function scryptSync(password, salt, keylen, options = defaults) { @@ -52,15 +52,13 @@ function scryptSync(password, salt, keylen, options = defaults) { const { N, r, p, maxmem } = options; ({ password, salt, keylen } = options); const keybuf = Buffer.alloc(keylen); - handleError(keybuf, password, salt, N, r, p, maxmem); + handleError(_scrypt(keybuf, password, salt, N, r, p, maxmem)); const encoding = getDefaultEncoding(); if (encoding === 'buffer') return keybuf; return keybuf.toString(encoding); } -function handleError(keybuf, password, salt, N, r, p, maxmem, wrap) { - const ex = _scrypt(keybuf, password, salt, N, r, p, maxmem, wrap); - +function handleError(ex) { if (ex === undefined) return;