@@ -3974,11 +3974,7 @@ bool DiffieHellman::Init(int primeLength, int g) {
3974
3974
dh_.reset (DH_new ());
3975
3975
if (!DH_generate_parameters_ex (dh_.get (), primeLength, g, 0 ))
3976
3976
return false ;
3977
- bool result = VerifyContext ();
3978
- if (!result)
3979
- return false ;
3980
- initialised_ = true ;
3981
- return true ;
3977
+ return VerifyContext ();
3982
3978
}
3983
3979
3984
3980
@@ -3993,11 +3989,7 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) {
3993
3989
BN_free (bn_g);
3994
3990
return false ;
3995
3991
}
3996
- bool result = VerifyContext ();
3997
- if (!result)
3998
- return false ;
3999
- initialised_ = true ;
4000
- return true ;
3992
+ return VerifyContext ();
4001
3993
}
4002
3994
4003
3995
@@ -4010,11 +4002,7 @@ bool DiffieHellman::Init(const char* p, int p_len, const char* g, int g_len) {
4010
4002
BN_free (bn_g);
4011
4003
return false ;
4012
4004
}
4013
- bool result = VerifyContext ();
4014
- if (!result)
4015
- return false ;
4016
- initialised_ = true ;
4017
- return true ;
4005
+ return VerifyContext ();
4018
4006
}
4019
4007
4020
4008
@@ -4088,7 +4076,6 @@ void DiffieHellman::GenerateKeys(const FunctionCallbackInfo<Value>& args) {
4088
4076
4089
4077
DiffieHellman* diffieHellman;
4090
4078
ASSIGN_OR_RETURN_UNWRAP (&diffieHellman, args.Holder ());
4091
- CHECK (diffieHellman->initialised_ );
4092
4079
4093
4080
if (!DH_generate_key (diffieHellman->dh_ .get ())) {
4094
4081
return ThrowCryptoError (env, ERR_get_error (), " Key generation failed" );
@@ -4110,7 +4097,6 @@ void DiffieHellman::GetField(const FunctionCallbackInfo<Value>& args,
4110
4097
4111
4098
DiffieHellman* dh;
4112
4099
ASSIGN_OR_RETURN_UNWRAP (&dh, args.Holder ());
4113
- CHECK (dh->initialised_ );
4114
4100
4115
4101
const BIGNUM* num = get_field (dh->dh_ .get ());
4116
4102
if (num == nullptr ) return env->ThrowError (err_if_null);
@@ -4162,7 +4148,6 @@ void DiffieHellman::ComputeSecret(const FunctionCallbackInfo<Value>& args) {
4162
4148
4163
4149
DiffieHellman* diffieHellman;
4164
4150
ASSIGN_OR_RETURN_UNWRAP (&diffieHellman, args.Holder ());
4165
- CHECK (diffieHellman->initialised_ );
4166
4151
4167
4152
ClearErrorOnReturn clear_error_on_return;
4168
4153
@@ -4230,7 +4215,6 @@ void DiffieHellman::SetKey(const v8::FunctionCallbackInfo<Value>& args,
4230
4215
4231
4216
DiffieHellman* dh;
4232
4217
ASSIGN_OR_RETURN_UNWRAP (&dh, args.Holder ());
4233
- CHECK (dh->initialised_ );
4234
4218
4235
4219
char errmsg[64 ];
4236
4220
@@ -4276,7 +4260,6 @@ void DiffieHellman::VerifyErrorGetter(const FunctionCallbackInfo<Value>& args) {
4276
4260
4277
4261
DiffieHellman* diffieHellman;
4278
4262
ASSIGN_OR_RETURN_UNWRAP (&diffieHellman, args.Holder ());
4279
- CHECK (diffieHellman->initialised_ );
4280
4263
4281
4264
args.GetReturnValue ().Set (diffieHellman->verifyError_ );
4282
4265
}
0 commit comments