Skip to content

Commit 89f5a73

Browse files
codebyteretargos
authored andcommitted
crypto: use compatible ecdh function
PR-URL: #39054 Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
1 parent 683c995 commit 89f5a73

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Diff for: src/crypto/crypto_ec.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ void ECDH::SetPrivateKey(const FunctionCallbackInfo<Value>& args) {
314314
return THROW_ERR_CRYPTO_OPERATION_FAILED(env,
315315
"Failed to set generated public key");
316316

317-
EC_KEY_copy(ecdh->key_.get(), new_key.get());
317+
ecdh->key_ = std::move(new_key);
318318
ecdh->group_ = EC_KEY_get0_group(ecdh->key_.get());
319319
}
320320

Diff for: test/parallel/test-crypto-ecdh-convert-key.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ if (getCurves().includes('secp256k1')) {
117117
// rather than Node's generic error message.
118118
const badKey = 'f'.repeat(128);
119119
assert.throws(
120-
() => ECDH.convertKey(badKey, 'secp256k1', 'hex', 'hex', 'compressed'),
120+
() => ECDH.convertKey(badKey, 'secp521r1', 'hex', 'hex', 'compressed'),
121121
/Failed to convert Buffer to EC_POINT/);
122122

123123
// Next statement should not throw an exception.

0 commit comments

Comments
 (0)