Skip to content

Commit

Permalink
crypto: cast oaepLabel to unsigned char*
Browse files Browse the repository at this point in the history
OpenSSL uses a macro without typechecking; since C++ does not
implicitly cast void* this is needed to conform Node.js to the
OpenSSL documentation.

PR-URL: #30917
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
codebytere authored and MylesBorins committed Dec 17, 2019
1 parent 663a6b4 commit a221017
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5510,8 +5510,9 @@ 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 (0 >= EVP_PKEY_CTX_set0_rsa_oaep_label(ctx.get(), label,
oaep_label_len)) {
if (0 >= EVP_PKEY_CTX_set0_rsa_oaep_label(ctx.get(),
reinterpret_cast<unsigned char*>(label),
oaep_label_len)) {
OPENSSL_free(label);
return false;
}
Expand Down

0 comments on commit a221017

Please sign in to comment.