Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarshan Sen <darshan.sen@postman.com>2021-11-25 03:14:49 +0300
committerGitHub <noreply@github.com>2021-11-25 03:14:49 +0300
commit50f3428e219b420bae310f348eb16856fb31dd76 (patch)
treec3481ca0ee36fffddecdb72efe6d4aa109d52b05 /src/crypto
parentaf283458ad0209d29fd8283b39ec311e29877e28 (diff)
src,crypto: use `ByteSource::ToBuffer()` in `crypto_dh`
Signed-off-by: Darshan Sen <darshan.sen@postman.com> PR-URL: https://github.com/nodejs/node/pull/40903 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Diffstat (limited to 'src/crypto')
-rw-r--r--src/crypto/crypto_dh.cc10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/crypto/crypto_dh.cc b/src/crypto/crypto_dh.cc
index 72f6a114ddf..8a2c559d783 100644
--- a/src/crypto/crypto_dh.cc
+++ b/src/crypto/crypto_dh.cc
@@ -13,7 +13,6 @@
namespace node {
-using v8::ArrayBuffer;
using v8::ConstructorBehavior;
using v8::DontDelete;
using v8::FunctionCallback;
@@ -610,13 +609,8 @@ void DiffieHellman::Stateless(const FunctionCallbackInfo<Value>& args) {
ManagedEVPPKey our_key = our_key_object->Data()->GetAsymmetricKey();
ManagedEVPPKey their_key = their_key_object->Data()->GetAsymmetricKey();
- Local<Value> out;
- {
- Local<ArrayBuffer> ab = StatelessDiffieHellmanThreadsafe(our_key, their_key)
- .ToArrayBuffer(env);
- out = Buffer::New(env, ab, 0, ab->ByteLength())
- .FromMaybe(Local<Uint8Array>());
- }
+ Local<Value> out = StatelessDiffieHellmanThreadsafe(our_key, their_key)
+ .ToBuffer(env).FromMaybe(Local<Uint8Array>());
if (Buffer::Length(out) == 0)
return ThrowCryptoError(env, ERR_get_error(), "diffieHellman failed");