summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2018-05-30 16:01:00 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2018-06-13 15:59:06 +0200
commitd669251f67b0d6e70853b18f7d9358fc98cb5ceb (patch)
treec2c57a8d82b483aebf953c0ccfe8959ccba16070 /test
parent5691bdfbb77f6f1acf0b0aefb5299867f1d39fb1 (diff)
downloadandroid-node-v8-d669251f67b0d6e70853b18f7d9358fc98cb5ceb.tar.gz
android-node-v8-d669251f67b0d6e70853b18f7d9358fc98cb5ceb.tar.bz2
android-node-v8-d669251f67b0d6e70853b18f7d9358fc98cb5ceb.zip
lib: replace checkUint() with validateInt32()
PR-URL: https://github.com/nodejs/node/pull/20816 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-crypto-pbkdf2.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/test/parallel/test-crypto-pbkdf2.js b/test/parallel/test-crypto-pbkdf2.js
index f65176132a..e1fa1e3d86 100644
--- a/test/parallel/test-crypto-pbkdf2.js
+++ b/test/parallel/test-crypto-pbkdf2.js
@@ -71,7 +71,7 @@ assert.throws(
code: 'ERR_OUT_OF_RANGE',
name: 'RangeError [ERR_OUT_OF_RANGE]',
message: 'The value of "iterations" is out of range. ' +
- 'It must be a non-negative number. Received -1'
+ 'It must be >= 0 && <= 2147483647. Received -1'
}
);
@@ -87,7 +87,20 @@ assert.throws(
});
});
-[Infinity, -Infinity, NaN, -1, 4073741824, INT_MAX + 1].forEach((input) => {
+[Infinity, -Infinity, NaN].forEach((input) => {
+ assert.throws(
+ () => {
+ crypto.pbkdf2('password', 'salt', 1, input, 'sha256',
+ common.mustNotCall());
+ }, {
+ code: 'ERR_OUT_OF_RANGE',
+ name: 'RangeError [ERR_OUT_OF_RANGE]',
+ message: 'The value of "keylen" is out of range. It ' +
+ `must be an integer. Received ${input}`
+ });
+});
+
+[-1, 4073741824, INT_MAX + 1].forEach((input) => {
assert.throws(
() => {
crypto.pbkdf2('password', 'salt', 1, input, 'sha256',