mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
crypto: use compatible ecdh function
PR-URL: https://github.com/nodejs/node/pull/39054 Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user