aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_OAEPOpenSSL.cpp
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-11-02 19:55:45 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-11-02 19:55:45 -0700
commitf829bd719067611ae0e39a6ea3703a9587fb6f6b (patch)
tree4fdd57f3b7a1145192df435c7fa0bdb6085238a5 /src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_OAEPOpenSSL.cpp
parentab4e6624842fe4fb18a1514ef45acd7d26f31d07 (diff)
downloadbun-f829bd719067611ae0e39a6ea3703a9587fb6f6b.tar.gz
bun-f829bd719067611ae0e39a6ea3703a9587fb6f6b.tar.zst
bun-f829bd719067611ae0e39a6ea3703a9587fb6f6b.zip
Fix 5/9 failing tests
Diffstat (limited to 'src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_OAEPOpenSSL.cpp')
-rw-r--r--src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_OAEPOpenSSL.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_OAEPOpenSSL.cpp b/src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_OAEPOpenSSL.cpp
index 4a3dbb6b7..3095000a6 100644
--- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_OAEPOpenSSL.cpp
+++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_OAEPOpenSSL.cpp
@@ -32,11 +32,13 @@
#include "CryptoKeyRSA.h"
#include "OpenSSLUtilities.h"
+#include <openssl/mem.h>
+
namespace WebCore {
ExceptionOr<Vector<uint8_t>> CryptoAlgorithmRSA_OAEP::platformEncrypt(const CryptoAlgorithmRsaOaepParams& parameters, const CryptoKeyRSA& key, const Vector<uint8_t>& plainText)
{
-#if defined(EVP_PKEY_CTX_set_rsa_oaep_md) && defined(EVP_PKEY_CTX_set_rsa_mgf1_md) && defined(EVP_PKEY_CTX_set0_rsa_oaep_label)
+#if 1 // defined(EVP_PKEY_CTX_set_rsa_oaep_md) && defined(EVP_PKEY_CTX_set_rsa_mgf1_md) && defined(EVP_PKEY_CTX_set0_rsa_oaep_label)
const EVP_MD* md = digestAlgorithm(key.hashAlgorithmIdentifier());
if (!md)
return Exception { NotSupportedError };
@@ -62,7 +64,7 @@ ExceptionOr<Vector<uint8_t>> CryptoAlgorithmRSA_OAEP::platformEncrypt(const Cryp
// The library takes ownership of the label so the caller should not free the original memory pointed to by label.
auto label = OPENSSL_malloc(labelSize);
memcpy(label, parameters.labelVector().data(), labelSize);
- if (EVP_PKEY_CTX_set0_rsa_oaep_label(ctx.get(), label, labelSize) <= 0) {
+ if (EVP_PKEY_CTX_set0_rsa_oaep_label(ctx.get(), reinterpret_cast<uint8_t*>(label), labelSize) <= 0) {
OPENSSL_free(label);
return Exception { OperationError };
}
@@ -85,7 +87,7 @@ ExceptionOr<Vector<uint8_t>> CryptoAlgorithmRSA_OAEP::platformEncrypt(const Cryp
ExceptionOr<Vector<uint8_t>> CryptoAlgorithmRSA_OAEP::platformDecrypt(const CryptoAlgorithmRsaOaepParams& parameters, const CryptoKeyRSA& key, const Vector<uint8_t>& cipherText)
{
-#if defined(EVP_PKEY_CTX_set_rsa_oaep_md) && defined(EVP_PKEY_CTX_set_rsa_mgf1_md) && defined(EVP_PKEY_CTX_set0_rsa_oaep_label)
+#if 1 // defined(EVP_PKEY_CTX_set_rsa_oaep_md) && defined(EVP_PKEY_CTX_set_rsa_mgf1_md) && defined(EVP_PKEY_CTX_set0_rsa_oaep_label)
const EVP_MD* md = digestAlgorithm(key.hashAlgorithmIdentifier());
if (!md)
return Exception { NotSupportedError };
@@ -111,7 +113,7 @@ ExceptionOr<Vector<uint8_t>> CryptoAlgorithmRSA_OAEP::platformDecrypt(const Cryp
// The library takes ownership of the label so the caller should not free the original memory pointed to by label.
auto label = OPENSSL_malloc(labelSize);
memcpy(label, parameters.labelVector().data(), labelSize);
- if (EVP_PKEY_CTX_set0_rsa_oaep_label(ctx.get(), label, labelSize) <= 0) {
+ if (EVP_PKEY_CTX_set0_rsa_oaep_label(ctx.get(), reinterpret_cast<uint8_t*>(label), labelSize) <= 0) {
OPENSSL_free(label);
return Exception { OperationError };
}