@@ -4001,11 +4001,7 @@ bool DiffieHellman::Init(int primeLength, int g) {
40014001 dh_.reset (DH_new ());
40024002 if (!DH_generate_parameters_ex (dh_.get (), primeLength, g, 0 ))
40034003 return false ;
4004- bool result = VerifyContext ();
4005- if (!result)
4006- return false ;
4007- initialised_ = true ;
4008- return true ;
4004+ return VerifyContext ();
40094005}
40104006
40114007
@@ -4020,11 +4016,7 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) {
40204016 BN_free (bn_g);
40214017 return false ;
40224018 }
4023- bool result = VerifyContext ();
4024- if (!result)
4025- return false ;
4026- initialised_ = true ;
4027- return true ;
4019+ return VerifyContext ();
40284020}
40294021
40304022
@@ -4037,11 +4029,7 @@ bool DiffieHellman::Init(const char* p, int p_len, const char* g, int g_len) {
40374029 BN_free (bn_g);
40384030 return false ;
40394031 }
4040- bool result = VerifyContext ();
4041- if (!result)
4042- return false ;
4043- initialised_ = true ;
4044- return true ;
4032+ return VerifyContext ();
40454033}
40464034
40474035
@@ -4115,7 +4103,6 @@ void DiffieHellman::GenerateKeys(const FunctionCallbackInfo<Value>& args) {
41154103
41164104 DiffieHellman* diffieHellman;
41174105 ASSIGN_OR_RETURN_UNWRAP (&diffieHellman, args.Holder ());
4118- CHECK (diffieHellman->initialised_ );
41194106
41204107 if (!DH_generate_key (diffieHellman->dh_ .get ())) {
41214108 return ThrowCryptoError (env, ERR_get_error (), " Key generation failed" );
@@ -4137,7 +4124,6 @@ void DiffieHellman::GetField(const FunctionCallbackInfo<Value>& args,
41374124
41384125 DiffieHellman* dh;
41394126 ASSIGN_OR_RETURN_UNWRAP (&dh, args.Holder ());
4140- CHECK (dh->initialised_ );
41414127
41424128 const BIGNUM* num = get_field (dh->dh_ .get ());
41434129 if (num == nullptr ) return env->ThrowError (err_if_null);
@@ -4189,7 +4175,6 @@ void DiffieHellman::ComputeSecret(const FunctionCallbackInfo<Value>& args) {
41894175
41904176 DiffieHellman* diffieHellman;
41914177 ASSIGN_OR_RETURN_UNWRAP (&diffieHellman, args.Holder ());
4192- CHECK (diffieHellman->initialised_ );
41934178
41944179 ClearErrorOnReturn clear_error_on_return;
41954180
@@ -4257,7 +4242,6 @@ void DiffieHellman::SetKey(const v8::FunctionCallbackInfo<Value>& args,
42574242
42584243 DiffieHellman* dh;
42594244 ASSIGN_OR_RETURN_UNWRAP (&dh, args.Holder ());
4260- CHECK (dh->initialised_ );
42614245
42624246 char errmsg[64 ];
42634247
@@ -4303,7 +4287,6 @@ void DiffieHellman::VerifyErrorGetter(const FunctionCallbackInfo<Value>& args) {
43034287
43044288 DiffieHellman* diffieHellman;
43054289 ASSIGN_OR_RETURN_UNWRAP (&diffieHellman, args.Holder ());
4306- CHECK (diffieHellman->initialised_ );
43074290
43084291 args.GetReturnValue ().Set (diffieHellman->verifyError_ );
43094292}
0 commit comments