aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTobias Nießen <tniessen@tnie.de>2018-02-07 16:20:21 +0100
committerRuben Bridgewater <ruben@bridgewater.de>2018-02-10 15:58:46 +0100
commit38bac4266a4f7adcfdd9832934aa57c564da1179 (patch)
treeaad8c985e4340fd35076669d20bc23324e2e7a16 /lib
parentcf52ab19dc9632e59b38744ebd0614b4d8ac151b (diff)
downloadandroid-node-v8-38bac4266a4f7adcfdd9832934aa57c564da1179.tar.gz
android-node-v8-38bac4266a4f7adcfdd9832934aa57c564da1179.tar.bz2
android-node-v8-38bac4266a4f7adcfdd9832934aa57c564da1179.zip
crypto: allow passing null as IV unless required
PR-URL: https://github.com/nodejs/node/pull/18644 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/internal/crypto/cipher.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/internal/crypto/cipher.js b/lib/internal/crypto/cipher.js
index cd2f3960e5..5426c7e6ed 100644
--- a/lib/internal/crypto/cipher.js
+++ b/lib/internal/crypto/cipher.js
@@ -182,7 +182,7 @@ function Cipheriv(cipher, key, iv, options) {
}
iv = toBuf(iv);
- if (!isArrayBufferView(iv)) {
+ if (iv !== null && !isArrayBufferView(iv)) {
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'iv',
['string', 'Buffer', 'TypedArray', 'DataView']);
}
@@ -253,7 +253,7 @@ function Decipheriv(cipher, key, iv, options) {
}
iv = toBuf(iv);
- if (!isArrayBufferView(iv)) {
+ if (iv !== null && !isArrayBufferView(iv)) {
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'iv',
['string', 'Buffer', 'TypedArray', 'DataView']);
}