diff options
author | Tobias Nießen <tniessen@tnie.de> | 2018-02-07 16:20:21 +0100 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-02-10 15:58:46 +0100 |
commit | 38bac4266a4f7adcfdd9832934aa57c564da1179 (patch) | |
tree | aad8c985e4340fd35076669d20bc23324e2e7a16 /lib | |
parent | cf52ab19dc9632e59b38744ebd0614b4d8ac151b (diff) | |
download | android-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.js | 4 |
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']); } |