Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions src/node_crypto.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -4102,10 +4102,7 @@ void DiffieHellman::GenerateKeys(const FunctionCallbackInfo<Value>& args) {

DiffieHellman* diffieHellman;
ASSIGN_OR_RETURN_UNWRAP(&diffieHellman, args.Holder());

if (!diffieHellman->initialised_) {
return ThrowCryptoError(env, ERR_get_error(), "Not initialized");
}
CHECK(diffieHellman->initialised_);

if (!DH_generate_key(diffieHellman->dh_.get())) {
return ThrowCryptoError(env, ERR_get_error(), "Key generation failed");
Expand All@@ -4127,7 +4124,7 @@ void DiffieHellman::GetField(const FunctionCallbackInfo<Value>& args,

DiffieHellman* dh;
ASSIGN_OR_RETURN_UNWRAP(&dh, args.Holder());
if (!dh->initialised_) return env->ThrowError("Not initialized");
CHECK(dh->initialised_);

const BIGNUM* num = get_field(dh->dh_.get());
if (num == nullptr) return env->ThrowError(err_if_null);
Expand DownExpand Up@@ -4179,10 +4176,7 @@ void DiffieHellman::ComputeSecret(const FunctionCallbackInfo<Value>& args) {

DiffieHellman* diffieHellman;
ASSIGN_OR_RETURN_UNWRAP(&diffieHellman, args.Holder());

if (!diffieHellman->initialised_) {
return ThrowCryptoError(env, ERR_get_error(), "Not initialized");
}
CHECK(diffieHellman->initialised_);

ClearErrorOnReturn clear_error_on_return;

Expand DownExpand Up@@ -4250,7 +4244,7 @@ void DiffieHellman::SetKey(const v8::FunctionCallbackInfo<Value>& args,

DiffieHellman* dh;
ASSIGN_OR_RETURN_UNWRAP(&dh, args.Holder());
if (!dh->initialised_) return env->ThrowError("Not initialized");
CHECK(dh->initialised_);

char errmsg[64];

Expand DownExpand Up@@ -4296,10 +4290,7 @@ void DiffieHellman::VerifyErrorGetter(const FunctionCallbackInfo<Value>& args) {

DiffieHellman* diffieHellman;
ASSIGN_OR_RETURN_UNWRAP(&diffieHellman, args.Holder());

if (!diffieHellman->initialised_)
return ThrowCryptoError(diffieHellman->env(), ERR_get_error(),
"Not initialized");
CHECK(diffieHellman->initialised_);

args.GetReturnValue().Set(diffieHellman->verifyError_);
}
Expand Down