summaryrefslogtreecommitdiff
path: root/lib/internal/crypto
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2019-03-18 02:29:39 +0100
committerRuben Bridgewater <ruben@bridgewater.de>2019-03-23 02:55:54 +0100
commitbfbce289c33b12aafb82bd5b45bcb4412850b28f (patch)
treefa9c21007fbe096b11e5a10d80de4b0af91137e4 /lib/internal/crypto
parent1ed3c54ecbd72a33693e5954f86bcc9fd9b1cc09 (diff)
downloadandroid-node-v8-bfbce289c33b12aafb82bd5b45bcb4412850b28f.tar.gz
android-node-v8-bfbce289c33b12aafb82bd5b45bcb4412850b28f.tar.bz2
android-node-v8-bfbce289c33b12aafb82bd5b45bcb4412850b28f.zip
lib: refactor Error.captureStackTrace() usage
When using `Errors.captureStackFrames` the error's stack property is set again. This adds a helper function that wraps this functionality in a simple API that does not only set the stack including the `code` property but it also improves the performance to create the error. The helper works for thrown errors and errors returned from wrapped functions in case they are Node.js core errors. PR-URL: https://github.com/nodejs/node/pull/26738 Fixes: https://github.com/nodejs/node/issues/26669 Fixes: https://github.com/nodejs/node/issues/20253 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'lib/internal/crypto')
-rw-r--r--lib/internal/crypto/pbkdf2.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/internal/crypto/pbkdf2.js b/lib/internal/crypto/pbkdf2.js
index e1a7a4811a..4694c6ce9a 100644
--- a/lib/internal/crypto/pbkdf2.js
+++ b/lib/internal/crypto/pbkdf2.js
@@ -65,8 +65,8 @@ function check(password, salt, iterations, keylen, digest) {
password = validateArrayBufferView(password, 'password');
salt = validateArrayBufferView(salt, 'salt');
- iterations = validateUint32(iterations, 'iterations', 0);
- keylen = validateUint32(keylen, 'keylen', 0);
+ validateUint32(iterations, 'iterations', 0);
+ validateUint32(keylen, 'keylen', 0);
return { password, salt, iterations, keylen, digest };
}