Skip to content

crypto: cast oaepLabel to unsigned char*

Rodrigo Muino Tomonari requested to merge github/fork/codebytere/cast-label into master

This PR fixes an incompatibility between BoringSSL and OpenSSL in compilation through Electron.

OpenSSL has the signature

int EVP_PKEY_CTX_set0_rsa_oaep_label(EVP_PKEY_CTX *ctx, unsigned char *label, int len);

whereas BoringSSL has:

int EVP_PKEY_CTX_set0_rsa_oaep_label(EVP_PKEY_CTX *ctx, uint8_t *label, size_t label_len);

Changing this in BoringSSL would not have the correct effect, since label (as returned by OpenSSL_memdup) is a void* & C++ doesn't cast from void* to T* without an explicit cast. OpenSSL has a lot of functions/macros that aren't typesafe which means we don't get the usual C++ type-checking and so this fails to compile without this patch.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Merge request reports

Loading