crypto: simplify error handling in ECDH::New

The type of the argument is being checked within JS which makes the
type checking in C++ unnecessary.

PR-URL: https://github.com/nodejs/node/pull/23647
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
Tobias Nießen 2018-10-13 19:23:07 +02:00
parent 7872d7933b
commit 4e2862ad9e
No known key found for this signature in database
GPG Key ID: 718207F8FD156B70

View File

@ -4342,7 +4342,7 @@ void ECDH::New(const FunctionCallbackInfo<Value>& args) {
MarkPopErrorOnReturn mark_pop_error_on_return;
// TODO(indutny): Support raw curves?
THROW_AND_RETURN_IF_NOT_STRING(env, args[0], "ECDH curve name");
CHECK(args[0]->IsString());
node::Utf8Value curve(env->isolate(), args[0]);
int nid = OBJ_sn2nid(*curve);