crypto: fix public key encryption internals

Coincidentally, the old version works as well since the padding
parameter is never null, but it is semantically incorrect.

PR-URL: https://github.com/nodejs/node/pull/22780
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
Tobias Nießen 2018-09-09 21:54:55 +02:00 committed by Tobias Nießen
parent 0ade10df79
commit 711445b419
No known key found for this signature in database
GPG Key ID: 718207F8FD156B70

View File

@ -3887,7 +3887,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) {
bool r = Cipher<operation, EVP_PKEY_cipher_init, EVP_PKEY_cipher>(
kbuf,
klen,
args.Length() >= 3 && !args[2]->IsNull() ? *passphrase : nullptr,
args.Length() >= 4 && !args[3]->IsNull() ? *passphrase : nullptr,
padding,
reinterpret_cast<const unsigned char*>(buf),
len,