summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-10-01 13:59:25 +0200
committerRich Trott <rtrott@gmail.com>2019-10-03 13:54:36 -0700
commit389969ea9247a7bb12d5e595879a7f0f05357dc5 (patch)
treedc3499231f8072aa289c6af3d34e5cc6f6593164 /lib
parent500720f5781b96147422614b82c1f85e22d6a6e8 (diff)
downloadandroid-node-v8-389969ea9247a7bb12d5e595879a7f0f05357dc5.tar.gz
android-node-v8-389969ea9247a7bb12d5e595879a7f0f05357dc5.tar.bz2
android-node-v8-389969ea9247a7bb12d5e595879a7f0f05357dc5.zip
crypto: remove arbitrary UTF16 restriction
Since 71f633a32f1f5617, this is no longer necessary. Refs: https://github.com/nodejs/node/pull/22622 Fixes: https://github.com/nodejs/node/issues/29793 PR-URL: https://github.com/nodejs/node/pull/29795 Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/internal/crypto/hash.js6
-rw-r--r--lib/internal/errors.js2
2 files changed, 0 insertions, 8 deletions
diff --git a/lib/internal/crypto/hash.js b/lib/internal/crypto/hash.js
index 7e4a83ca93..eccfb44569 100644
--- a/lib/internal/crypto/hash.js
+++ b/lib/internal/crypto/hash.js
@@ -20,14 +20,12 @@ const {
const { Buffer } = require('buffer');
const {
- ERR_CRYPTO_HASH_DIGEST_NO_UTF16,
ERR_CRYPTO_HASH_FINALIZED,
ERR_CRYPTO_HASH_UPDATE_FAILED,
ERR_INVALID_ARG_TYPE
} = require('internal/errors').codes;
const { validateEncoding, validateString, validateUint32 } =
require('internal/validators');
-const { normalizeEncoding } = require('internal/util');
const { isArrayBufferView } = require('internal/util/types');
const LazyTransform = require('internal/streams/lazy_transform');
const kState = Symbol('kState');
@@ -90,8 +88,6 @@ Hash.prototype.digest = function digest(outputEncoding) {
if (state[kFinalized])
throw new ERR_CRYPTO_HASH_FINALIZED();
outputEncoding = outputEncoding || getDefaultEncoding();
- if (normalizeEncoding(outputEncoding) === 'utf16le')
- throw new ERR_CRYPTO_HASH_DIGEST_NO_UTF16();
// Explicit conversion for backward compatibility.
const ret = this[kHandle].digest(`${outputEncoding}`);
@@ -121,8 +117,6 @@ Hmac.prototype.update = Hash.prototype.update;
Hmac.prototype.digest = function digest(outputEncoding) {
const state = this[kState];
outputEncoding = outputEncoding || getDefaultEncoding();
- if (normalizeEncoding(outputEncoding) === 'utf16le')
- throw new ERR_CRYPTO_HASH_DIGEST_NO_UTF16();
if (state[kFinalized]) {
const buf = Buffer.from('');
diff --git a/lib/internal/errors.js b/lib/internal/errors.js
index eb3c435b20..3382d137f7 100644
--- a/lib/internal/errors.js
+++ b/lib/internal/errors.js
@@ -749,8 +749,6 @@ E('ERR_CRYPTO_FIPS_FORCED',
'Cannot set FIPS mode, it was forced with --force-fips at startup.', Error);
E('ERR_CRYPTO_FIPS_UNAVAILABLE', 'Cannot set FIPS mode in a non-FIPS build.',
Error);
-E('ERR_CRYPTO_HASH_DIGEST_NO_UTF16', 'hash.digest() does not support UTF-16',
- Error);
E('ERR_CRYPTO_HASH_FINALIZED', 'Digest already called', Error);
E('ERR_CRYPTO_HASH_UPDATE_FAILED', 'Hash update failed', Error);
E('ERR_CRYPTO_INCOMPATIBLE_KEY_OPTIONS', 'The selected key encoding %s %s.',