mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
crypto: simplify exportKeyingMaterial
PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
1 parent
ba3f7ff94d
commit
0fc45f80b5
1 file changed
+7
-11
+7
-11
@@ -2807,14 +2807,10 @@ void SSLWrap<Base>::ExportKeyingMaterial(
|
||||
|
||||
AllocatedBuffer out = env->AllocateManaged(olen);
|
||||
|
||||
ByteSource key;
|
||||
|
||||
int useContext = 0;
|
||||
if (!args[2]->IsNull() && Buffer::HasInstance(args[2])) {
|
||||
key = ByteSource::FromBuffer(args[2]);
|
||||
|
||||
useContext = 1;
|
||||
}
|
||||
ByteSource context;
|
||||
bool use_context = !args[2]->IsUndefined();
|
||||
if (use_context)
|
||||
context = ByteSource::FromBuffer(args[2]);
|
||||
|
||||
if (SSL_export_keying_material(w->ssl_.get(),
|
||||
reinterpret_cast<unsigned char*>(out.data()),
|
||||
@@ -2822,9 +2818,9 @@ void SSLWrap<Base>::ExportKeyingMaterial(
|
||||
*label,
|
||||
label.length(),
|
||||
reinterpret_cast<const unsigned char*>(
|
||||
key.get()),
|
||||
key.size(),
|
||||
useContext) != 1) {
|
||||
context.get()),
|
||||
context.size(),
|
||||
use_context) != 1) {
|
||||
return ThrowCryptoError(env, ERR_get_error(), "SSL_export_keying_material");
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user