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 0fc45f8

Browse filesBrowse files
tniessenMylesBorins
authored andcommitted
crypto: simplify exportKeyingMaterial
PR-URL: #31922 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com>
1 parent ba3f7ff commit 0fc45f8
Copy full SHA for 0fc45f8

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

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

‎src/node_crypto.cc‎

Copy file name to clipboardExpand all lines: src/node_crypto.cc
+7-11Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2807,24 +2807,20 @@ void SSLWrap<Base>::ExportKeyingMaterial(
28072807

28082808
AllocatedBuffer out = env->AllocateManaged(olen);
28092809

2810-
ByteSource key;
2811-
2812-
int useContext = 0;
2813-
if (!args[2]->IsNull() && Buffer::HasInstance(args[2])) {
2814-
key = ByteSource::FromBuffer(args[2]);
2815-
2816-
useContext = 1;
2817-
}
2810+
ByteSource context;
2811+
bool use_context = !args[2]->IsUndefined();
2812+
if (use_context)
2813+
context = ByteSource::FromBuffer(args[2]);
28182814

28192815
if (SSL_export_keying_material(w->ssl_.get(),
28202816
reinterpret_cast<unsigned char*>(out.data()),
28212817
olen,
28222818
*label,
28232819
label.length(),
28242820
reinterpret_cast<const unsigned char*>(
2825-
key.get()),
2826-
key.size(),
2827-
useContext) != 1) {
2821+
context.get()),
2822+
context.size(),
2823+
use_context) != 1) {
28282824
return ThrowCryptoError(env, ERR_get_error(), "SSL_export_keying_material");
28292825
}
28302826

0 commit comments

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