|
@@ -6,10 +6,10 @@ Subject: fix: key gen APIs are not available in BoringSSL
|
|
|
This will make Node's key pair generation APIs fail.
|
|
|
|
|
|
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
|
|
|
-index e0684d9b410c2423d805dd076330b79d22356f35..e33a5d11ddbf900b26c1baa62f65bae49cdbaa24 100644
|
|
|
+index 4e1a4d8bc80fe3619826b2c865fd0503ffc66c5c..41eb04caffd4c1faaecd0f8a2cbe93016475bfe1 100644
|
|
|
--- a/src/node_crypto.cc
|
|
|
+++ b/src/node_crypto.cc
|
|
|
-@@ -290,24 +290,14 @@ Maybe<bool> Decorate(Environment* env, Local<Object> obj,
|
|
|
+@@ -267,24 +267,14 @@ Maybe<bool> Decorate(Environment* env, Local<Object> obj,
|
|
|
V(BIO) \
|
|
|
V(PKCS7) \
|
|
|
V(X509V3) \
|
|
@@ -34,21 +34,93 @@ index e0684d9b410c2423d805dd076330b79d22356f35..e33a5d11ddbf900b26c1baa62f65bae4
|
|
|
V(USER) \
|
|
|
|
|
|
#define V(name) case ERR_LIB_##name: lib = #name "_"; break;
|
|
|
-@@ -6552,6 +6542,8 @@ class DSAKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
|
|
+@@ -6017,6 +6007,7 @@ class DSAKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
|
|
if (EVP_PKEY_paramgen_init(param_ctx.get()) <= 0)
|
|
|
return nullptr;
|
|
|
|
|
|
-+ // FIXME(zcbenz): This is not available in BoringSSL.
|
|
|
+#ifndef OPENSSL_IS_BORINGSSL
|
|
|
if (EVP_PKEY_CTX_set_dsa_paramgen_bits(param_ctx.get(), modulus_bits_) <= 0)
|
|
|
return nullptr;
|
|
|
|
|
|
-@@ -6571,6 +6563,8 @@ class DSAKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
|
|
-
|
|
|
- EVPKeyCtxPointer key_ctx(EVP_PKEY_CTX_new(params.get(), nullptr));
|
|
|
- return key_ctx;
|
|
|
+@@ -6027,6 +6018,7 @@ class DSAKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
|
|
+ return nullptr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+#endif
|
|
|
-+ return nullptr;
|
|
|
+
|
|
|
+ EVP_PKEY* raw_params = nullptr;
|
|
|
+ if (EVP_PKEY_paramgen(param_ctx.get(), &raw_params) <= 0)
|
|
|
+diff --git a/src/node_crypto_common.cc b/src/node_crypto_common.cc
|
|
|
+index 197bc5cd5913a40269d5704f0f9d5aa1383c2f17..d0c1dc5387120c107696175e3515e81053fbeb21 100644
|
|
|
+--- a/src/node_crypto_common.cc
|
|
|
++++ b/src/node_crypto_common.cc
|
|
|
+@@ -237,10 +237,10 @@ int UseSNIContext(const SSLPointer& ssl, SecureContext* context) {
|
|
|
+ }
|
|
|
+
|
|
|
+ const char* GetClientHelloALPN(const SSLPointer& ssl) {
|
|
|
++#ifndef OPENSSL_IS_BORINGSSL
|
|
|
+ const unsigned char* buf;
|
|
|
+ size_t len;
|
|
|
+ size_t rem;
|
|
|
+-
|
|
|
+ if (!SSL_client_hello_get0_ext(
|
|
|
+ ssl.get(),
|
|
|
+ TLSEXT_TYPE_application_layer_protocol_negotiation,
|
|
|
+@@ -249,17 +249,18 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) {
|
|
|
+ rem < 2) {
|
|
|
+ return nullptr;
|
|
|
}
|
|
|
+-
|
|
|
+ len = (buf[0] << 8) | buf[1];
|
|
|
+ if (len + 2 != rem) return nullptr;
|
|
|
+ return reinterpret_cast<const char*>(buf + 3);
|
|
|
++#endif
|
|
|
++ return nullptr;
|
|
|
+ }
|
|
|
+
|
|
|
+ const char* GetClientHelloServerName(const SSLPointer& ssl) {
|
|
|
++#ifndef OPENSSL_IS_BORINGSSL
|
|
|
+ const unsigned char* buf;
|
|
|
+ size_t len;
|
|
|
+ size_t rem;
|
|
|
+-
|
|
|
+ if (!SSL_client_hello_get0_ext(
|
|
|
+ ssl.get(),
|
|
|
+ TLSEXT_TYPE_server_name,
|
|
|
+@@ -281,6 +282,8 @@ const char* GetClientHelloServerName(const SSLPointer& ssl) {
|
|
|
+ if (len + 2 > rem)
|
|
|
+ return nullptr;
|
|
|
+ return reinterpret_cast<const char*>(buf + 5);
|
|
|
++#endif
|
|
|
++ return nullptr;
|
|
|
+ }
|
|
|
+
|
|
|
+ const char* GetServerName(SSL* ssl) {
|
|
|
+@@ -288,7 +291,10 @@ const char* GetServerName(SSL* ssl) {
|
|
|
+ }
|
|
|
+
|
|
|
+ bool SetGroups(SecureContext* sc, const char* groups) {
|
|
|
++#ifndef OPENSSL_IS_BORINGSSL
|
|
|
+ return SSL_CTX_set1_groups_list(**sc, groups) == 1;
|
|
|
++#endif
|
|
|
++ return false;
|
|
|
+ }
|
|
|
|
|
|
- private:
|
|
|
+ const char* X509ErrorCode(long err) { // NOLINT(runtime/int)
|
|
|
+@@ -766,13 +772,13 @@ MaybeLocal<Array> GetClientHelloCiphers(
|
|
|
+ Environment* env,
|
|
|
+ const SSLPointer& ssl) {
|
|
|
+ EscapableHandleScope scope(env->isolate());
|
|
|
+- const unsigned char* buf;
|
|
|
+- size_t len = SSL_client_hello_get0_ciphers(ssl.get(), &buf);
|
|
|
++ const unsigned char* buf = nullptr;
|
|
|
++ size_t len = 0; // SSL_client_hello_get0_ciphers(ssl.get(), &buf);
|
|
|
+ size_t count = len / 2;
|
|
|
+ MaybeStackBuffer<Local<Value>, 16> ciphers(count);
|
|
|
+ int j = 0;
|
|
|
+ for (size_t n = 0; n < len; n += 2) {
|
|
|
+- const SSL_CIPHER* cipher = SSL_CIPHER_find(ssl.get(), buf);
|
|
|
++ const SSL_CIPHER* cipher = nullptr; // SSL_CIPHER_find(ssl.get(), buf);
|
|
|
+ buf += 2;
|
|
|
+ Local<Object> obj = Object::New(env->isolate());
|
|
|
+ if (!Set(env->context(),
|