Skip to content

Commit

Permalink
src: check EC_POINT_get_affine_coordinates result
Browse files Browse the repository at this point in the history
PR-URL: nodejs#42304
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
  • Loading branch information
tniessen authored and danielleadams committed Apr 21, 2022
1 parent 116e696 commit 683363a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/crypto/crypto_ec.cc
Expand Up @@ -733,7 +733,11 @@ Maybe<void> ExportJWKEcKey(
BignumPointer x(BN_new());
BignumPointer y(BN_new());

EC_POINT_get_affine_coordinates(group, pub, x.get(), y.get(), nullptr);
if (!EC_POINT_get_affine_coordinates(group, pub, x.get(), y.get(), nullptr)) {
ThrowCryptoError(env, ERR_get_error(),
"Failed to get elliptic-curve point coordinates");
return Nothing<void>();
}

if (target->Set(
env->context(),
Expand Down

0 comments on commit 683363a

Please sign in to comment.