@@ -3991,11 +3991,7 @@ bool DiffieHellman::Init(int primeLength, int g) {
39913991 dh_.reset (DH_new ());
39923992 if (!DH_generate_parameters_ex (dh_.get (), primeLength, g, 0 ))
39933993 return false ;
3994- bool result = VerifyContext ();
3995- if (!result)
3996- return false ;
3997- initialised_ = true ;
3998- return true ;
3994+ return VerifyContext ();
39993995}
40003996
40013997
@@ -4010,11 +4006,7 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) {
40104006 BN_free (bn_g);
40114007 return false ;
40124008 }
4013- bool result = VerifyContext ();
4014- if (!result)
4015- return false ;
4016- initialised_ = true ;
4017- return true ;
4009+ return VerifyContext ();
40184010}
40194011
40204012
@@ -4027,11 +4019,7 @@ bool DiffieHellman::Init(const char* p, int p_len, const char* g, int g_len) {
40274019 BN_free (bn_g);
40284020 return false ;
40294021 }
4030- bool result = VerifyContext ();
4031- if (!result)
4032- return false ;
4033- initialised_ = true ;
4034- return true ;
4022+ return VerifyContext ();
40354023}
40364024
40374025
@@ -4105,7 +4093,6 @@ void DiffieHellman::GenerateKeys(const FunctionCallbackInfo<Value>& args) {
41054093
41064094 DiffieHellman* diffieHellman;
41074095 ASSIGN_OR_RETURN_UNWRAP (&diffieHellman, args.Holder ());
4108- CHECK (diffieHellman->initialised_ );
41094096
41104097 if (!DH_generate_key (diffieHellman->dh_ .get ())) {
41114098 return ThrowCryptoError (env, ERR_get_error (), " Key generation failed" );
@@ -4127,7 +4114,6 @@ void DiffieHellman::GetField(const FunctionCallbackInfo<Value>& args,
41274114
41284115 DiffieHellman* dh;
41294116 ASSIGN_OR_RETURN_UNWRAP (&dh, args.Holder ());
4130- CHECK (dh->initialised_ );
41314117
41324118 const BIGNUM* num = get_field (dh->dh_ .get ());
41334119 if (num == nullptr ) return env->ThrowError (err_if_null);
@@ -4179,7 +4165,6 @@ void DiffieHellman::ComputeSecret(const FunctionCallbackInfo<Value>& args) {
41794165
41804166 DiffieHellman* diffieHellman;
41814167 ASSIGN_OR_RETURN_UNWRAP (&diffieHellman, args.Holder ());
4182- CHECK (diffieHellman->initialised_ );
41834168
41844169 ClearErrorOnReturn clear_error_on_return;
41854170
@@ -4247,7 +4232,6 @@ void DiffieHellman::SetKey(const v8::FunctionCallbackInfo<Value>& args,
42474232
42484233 DiffieHellman* dh;
42494234 ASSIGN_OR_RETURN_UNWRAP (&dh, args.Holder ());
4250- CHECK (dh->initialised_ );
42514235
42524236 char errmsg[64 ];
42534237
@@ -4293,7 +4277,6 @@ void DiffieHellman::VerifyErrorGetter(const FunctionCallbackInfo<Value>& args) {
42934277
42944278 DiffieHellman* diffieHellman;
42954279 ASSIGN_OR_RETURN_UNWRAP (&diffieHellman, args.Holder ());
4296- CHECK (diffieHellman->initialised_ );
42974280
42984281 args.GetReturnValue ().Set (diffieHellman->verifyError_ );
42994282}
0 commit comments