@@ -4001,11 +4001,7 @@ bool DiffieHellman::Init(int primeLength, int g) {
4001
4001
dh_.reset (DH_new ());
4002
4002
if (!DH_generate_parameters_ex (dh_.get (), primeLength, g, 0 ))
4003
4003
return false ;
4004
- bool result = VerifyContext ();
4005
- if (!result)
4006
- return false ;
4007
- initialised_ = true ;
4008
- return true ;
4004
+ return VerifyContext ();
4009
4005
}
4010
4006
4011
4007
@@ -4020,11 +4016,7 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) {
4020
4016
BN_free (bn_g);
4021
4017
return false ;
4022
4018
}
4023
- bool result = VerifyContext ();
4024
- if (!result)
4025
- return false ;
4026
- initialised_ = true ;
4027
- return true ;
4019
+ return VerifyContext ();
4028
4020
}
4029
4021
4030
4022
@@ -4037,11 +4029,7 @@ bool DiffieHellman::Init(const char* p, int p_len, const char* g, int g_len) {
4037
4029
BN_free (bn_g);
4038
4030
return false ;
4039
4031
}
4040
- bool result = VerifyContext ();
4041
- if (!result)
4042
- return false ;
4043
- initialised_ = true ;
4044
- return true ;
4032
+ return VerifyContext ();
4045
4033
}
4046
4034
4047
4035
@@ -4115,7 +4103,6 @@ void DiffieHellman::GenerateKeys(const FunctionCallbackInfo<Value>& args) {
4115
4103
4116
4104
DiffieHellman* diffieHellman;
4117
4105
ASSIGN_OR_RETURN_UNWRAP (&diffieHellman, args.Holder ());
4118
- CHECK (diffieHellman->initialised_ );
4119
4106
4120
4107
if (!DH_generate_key (diffieHellman->dh_ .get ())) {
4121
4108
return ThrowCryptoError (env, ERR_get_error (), " Key generation failed" );
@@ -4137,7 +4124,6 @@ void DiffieHellman::GetField(const FunctionCallbackInfo<Value>& args,
4137
4124
4138
4125
DiffieHellman* dh;
4139
4126
ASSIGN_OR_RETURN_UNWRAP (&dh, args.Holder ());
4140
- CHECK (dh->initialised_ );
4141
4127
4142
4128
const BIGNUM* num = get_field (dh->dh_ .get ());
4143
4129
if (num == nullptr ) return env->ThrowError (err_if_null);
@@ -4189,7 +4175,6 @@ void DiffieHellman::ComputeSecret(const FunctionCallbackInfo<Value>& args) {
4189
4175
4190
4176
DiffieHellman* diffieHellman;
4191
4177
ASSIGN_OR_RETURN_UNWRAP (&diffieHellman, args.Holder ());
4192
- CHECK (diffieHellman->initialised_ );
4193
4178
4194
4179
ClearErrorOnReturn clear_error_on_return;
4195
4180
@@ -4257,7 +4242,6 @@ void DiffieHellman::SetKey(const v8::FunctionCallbackInfo<Value>& args,
4257
4242
4258
4243
DiffieHellman* dh;
4259
4244
ASSIGN_OR_RETURN_UNWRAP (&dh, args.Holder ());
4260
- CHECK (dh->initialised_ );
4261
4245
4262
4246
char errmsg[64 ];
4263
4247
@@ -4303,7 +4287,6 @@ void DiffieHellman::VerifyErrorGetter(const FunctionCallbackInfo<Value>& args) {
4303
4287
4304
4288
DiffieHellman* diffieHellman;
4305
4289
ASSIGN_OR_RETURN_UNWRAP (&diffieHellman, args.Holder ());
4306
- CHECK (diffieHellman->initialised_ );
4307
4290
4308
4291
args.GetReturnValue ().Set (diffieHellman->verifyError_ );
4309
4292
}
0 commit comments