0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00

crypto: fix OpenSSL return code handling

PR-URL: https://github.com/nodejs/node/pull/29489
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Tobias Nießen 2019-09-08 19:19:35 +02:00
parent b64446648b
commit 3675f402ab
No known key found for this signature in database
GPG Key ID: 718207F8FD156B70

View File

@ -5218,7 +5218,7 @@ bool PublicKeyCipher::Cipher(Environment* env,
return false;
if (digest != nullptr) {
if (!EVP_PKEY_CTX_set_rsa_oaep_md(ctx.get(), digest))
if (EVP_PKEY_CTX_set_rsa_oaep_md(ctx.get(), digest) <= 0)
return false;
}
@ -5226,7 +5226,8 @@ bool PublicKeyCipher::Cipher(Environment* env,
// OpenSSL takes ownership of the label, so we need to create a copy.
void* label = OPENSSL_memdup(oaep_label, oaep_label_len);
CHECK_NOT_NULL(label);
if (!EVP_PKEY_CTX_set0_rsa_oaep_label(ctx.get(), label, oaep_label_len)) {
if (0 >= EVP_PKEY_CTX_set0_rsa_oaep_label(ctx.get(), label,
oaep_label_len)) {
OPENSSL_free(label);
return false;
}