Skip to content

Commit

Permalink
crypto: fix label cast in EVP_PKEY_CTX_set0_rsa_oaep_label
Browse files Browse the repository at this point in the history
PR-URL: #38926
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
  • Loading branch information
codebytere authored and targos committed Jun 11, 2021
1 parent 6e93c17 commit 6d5dc63
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/crypto/crypto_cipher.cc
Expand Up @@ -906,7 +906,7 @@ bool PublicKeyCipher::Cipher(
void* label = OPENSSL_memdup(oaep_label.data(), oaep_label.size());
CHECK_NOT_NULL(label);
if (0 >= EVP_PKEY_CTX_set0_rsa_oaep_label(ctx.get(),
reinterpret_cast<unsigned char*>(label),
static_cast<unsigned char*>(label),
oaep_label.size())) {
OPENSSL_free(label);
return false;
Expand Down
5 changes: 4 additions & 1 deletion src/crypto/crypto_rsa.cc
Expand Up @@ -210,7 +210,10 @@ WebCryptoCipherStatus RSA_Cipher(
if (label_len > 0) {
void* label = OPENSSL_memdup(params.label.get(), label_len);
CHECK_NOT_NULL(label);
if (EVP_PKEY_CTX_set0_rsa_oaep_label(ctx.get(), label, label_len) <= 0) {
if (EVP_PKEY_CTX_set0_rsa_oaep_label(
ctx.get(),
static_cast<unsigned char*>(label),
label_len) <= 0) {
OPENSSL_free(label);
return WebCryptoCipherStatus::FAILED;
}
Expand Down

0 comments on commit 6d5dc63

Please sign in to comment.