| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2c0b249 commit 4d05508
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5938,11 +5938,7 @@ void DiffieHellman::ComputeSecret(const FunctionCallbackInfo<Value>& args) { | |||
| 5938 | 5938 | ||
| 5939 | 5939 | ClearErrorOnReturn clear_error_on_return; | |
| 5940 | 5940 | ||
| 5941 | - if (args.Length() == 0) { | ||
| 5942 | - return THROW_ERR_MISSING_ARGS( | ||
| 5943 | - env, "Other party's public key argument is mandatory"); | ||
| 5944 | - } | ||
| 5945 | - | ||
| 5941 | + CHECK_EQ(args.Length(), 1); | ||
| 5946 | 5942 | THROW_AND_RETURN_IF_NOT_BUFFER(env, args[0], "Other party's public key"); | |
| 5947 | 5943 | ArrayBufferViewContents<unsigned char> key_buf(args[0].As<ArrayBufferView>()); | |
| 5948 | 5944 | BignumPointer key(BN_bin2bn(key_buf.data(), key_buf.length(), nullptr)); | |
@@ -5993,11 +5989,7 @@ void DiffieHellman::SetKey(const FunctionCallbackInfo<Value>& args, | |||
| 5993 | 5989 | ||
| 5994 | 5990 | char errmsg[64]; | |
| 5995 | 5991 | ||
| 5996 | - if (args.Length() == 0) { | ||
| 5997 | - snprintf(errmsg, sizeof(errmsg), "%s argument is mandatory", what); | ||
| 5998 | - return THROW_ERR_MISSING_ARGS(env, errmsg); | ||
| 5999 | - } | ||
| 6000 | - | ||
| 5992 | + CHECK_EQ(args.Length(), 1); | ||
| 6001 | 5993 | if (!Buffer::HasInstance(args[0])) { | |
| 6002 | 5994 | snprintf(errmsg, sizeof(errmsg), "%s must be a buffer", what); | |
| 6003 | 5995 | return THROW_ERR_INVALID_ARG_TYPE(env, errmsg); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments