diff --git a/ecdh.cc b/ecdh.cc index 5d1f6e6..e8f0890 100644 --- a/ecdh.cc +++ b/ecdh.cc @@ -86,7 +86,8 @@ NAN_METHOD(Derive) { } uint8_t* shared = (uint8_t *)malloc(PRIVKEY_SIZE); - if (derive((uint8_t *)privkey_a, (uint8_t *)pubkey_b, shared)) { + if (shared == NULL || + derive((uint8_t *)privkey_a, (uint8_t *)pubkey_b, shared)) { free(shared); return NanThrowError("Internal error"); } diff --git a/package.json b/package.json index 23cc395..3988349 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "crypto", "cryptography", "secp256k1", + "K-256", "elliptic", "curve" ],