Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crypto: use compatible ecdh function #39054

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/crypto/crypto_ec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ void ECDH::SetPrivateKey(const FunctionCallbackInfo<Value>& args) {
return THROW_ERR_CRYPTO_OPERATION_FAILED(env,
"Failed to set generated public key");

EC_KEY_copy(ecdh->key_.get(), new_key.get());
ecdh->key_ = std::move(new_key);
ecdh->group_ = EC_KEY_get0_group(ecdh->key_.get());
}

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-crypto-ecdh-convert-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ if (getCurves().includes('secp256k1')) {
// rather than Node's generic error message.
const badKey = 'f'.repeat(128);
assert.throws(
() => ECDH.convertKey(badKey, 'secp256k1', 'hex', 'hex', 'compressed'),
() => ECDH.convertKey(badKey, 'secp521r1', 'hex', 'hex', 'compressed'),
/Failed to convert Buffer to EC_POINT/);

// Next statement should not throw an exception.
Expand Down