diff --git a/src/crypto/crypto_dh.cc b/src/crypto/crypto_dh.cc index 72f6a114ddfbc2..8a2c559d783eda 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& args) { ManagedEVPPKey our_key = our_key_object->Data()->GetAsymmetricKey(); ManagedEVPPKey their_key = their_key_object->Data()->GetAsymmetricKey(); - Local out; - { - Local ab = StatelessDiffieHellmanThreadsafe(our_key, their_key) - .ToArrayBuffer(env); - out = Buffer::New(env, ab, 0, ab->ByteLength()) - .FromMaybe(Local()); - } + Local out = StatelessDiffieHellmanThreadsafe(our_key, their_key) + .ToBuffer(env).FromMaybe(Local()); if (Buffer::Length(out) == 0) return ThrowCryptoError(env, ERR_get_error(), "diffieHellman failed");