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 <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
codebytere authored and targos committed Jan 14, 2020
1 parent 6f61407 commit e4b3181
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 @@ -5509,8 +5509,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 e4b3181

Please sign in to comment.