Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ebd9add

Browse filesBrowse files
indutnyShigeki Ohtsu
authored andcommitted
crypto: clear error stack in ECDH::Initialize
Clean up OpenSSL error stack in `ECDH::Initialize`, some curves have faulty implementations that are leaving dangling errors after initializing the curve. Fix: #4686 PR-URL: #4689 Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
1 parent 310530b commit ebd9add
Copy full SHA for ebd9add

File tree

Expand file treeCollapse file tree

2 files changed

+7
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+7
-0
lines changed
Open diff view settings
Collapse file

‎src/node_crypto.cc‎

Copy file name to clipboardExpand all lines: src/node_crypto.cc
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4678,6 +4678,8 @@ void ECDH::Initialize(Environment* env, Local<Object> target) {
46784678
void ECDH::New(const FunctionCallbackInfo<Value>& args) {
46794679
Environment* env = Environment::GetCurrent(args);
46804680

4681+
MarkPopErrorOnReturn mark_pop_error_on_return;
4682+
46814683
// TODO(indutny): Support raw curves?
46824684
CHECK(args[0]->IsString());
46834685
node::Utf8Value curve(env->isolate(), args[0]);
Collapse file

‎test/parallel/test-crypto-dh.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-crypto-dh.js
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ secret2 = ecdh2.computeSecret(key1, 'binary', 'buffer');
159159

160160
assert.equal(secret1, secret2.toString('base64'));
161161

162+
// Oakley curves do not clean up ERR stack, it was causing unexpected failure
163+
// when accessing other OpenSSL APIs afterwards.
164+
crypto.createECDH('Oakley-EC2N-3');
165+
crypto.createHash('sha256');
166+
162167
// Point formats
163168
assert.equal(ecdh1.getPublicKey('buffer', 'uncompressed')[0], 4);
164169
let firstByte = ecdh1.getPublicKey('buffer', 'compressed')[0];

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.