Skip to content

Commit

Permalink
node new store add partial chain flag
Browse files Browse the repository at this point in the history
* Update .patches

Co-authored-by: Lin Cheng <[email protected]>
  • Loading branch information
lcheng668 committed Feb 16, 2023
1 parent 22a4440 commit 4d607b3
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions patches/node/.patches
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ fix-creates-a-new-without-fill-buffer-issues.patch
support-SSL-select-client-cert-callback-on-tls-s.patch
src-add-crypto-wrapper-for-node-openssl.patch
src_remove_execsync_return_stderr_write_to_process.patch
src_new_store_add_partial_chain_flag.patch
42 changes: 42 additions & 0 deletions patches/node/src_new_store_add_partial_chain_flag.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
From 0e3028ba5bef23d01be6ecdc368cfadb83b08022 Mon Sep 17 00:00:00 2001
From: Lin Cheng <[email protected]>
Date: Wed, 15 Feb 2023 12:03:46 +0000
Subject: [PATCH] src: new store add X509_V_FLAG_PARTIAL_CHAIN flag

---
src/crypto/crypto_context.cc | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc
index 1e1057ccbb..bd12fd76c6 100644
--- a/src/crypto/crypto_context.cc
+++ b/src/crypto/crypto_context.cc
@@ -227,7 +227,6 @@ X509_STORE* NewRootCertStore() {
Thin_X509_STORE_add_cert(store, cert);
}
}
- Thin_X509_STORE_set_flags(store, X509_V_FLAG_PARTIAL_CHAIN);

return store;
}
@@ -714,6 +713,9 @@ void SecureContext::AddCACert(const FunctionCallbackInfo<Value>& args) {
Thin_SSL_CTX_add_client_CA(sc->ctx_.get(), x509);
Thin_X509_free(x509);
}
+ if (cert_store) {
+ Thin_X509_STORE_set_flags(cert_store, X509_V_FLAG_PARTIAL_CHAIN);
+ }
}

void SecureContext::AddCRL(const FunctionCallbackInfo<Value>& args) {
@@ -758,6 +760,7 @@ void SecureContext::AddRootCerts(const FunctionCallbackInfo<Value>& args) {

// Increment reference count so global store is not deleted along with CTX.
Thin_X509_STORE_up_ref(root_cert_store);
+ Thin_X509_STORE_set_flags(root_cert_store, X509_V_FLAG_PARTIAL_CHAIN);
Thin_SSL_CTX_set_cert_store(sc->ctx_.get(), root_cert_store);
}

--
2.25.1

0 comments on commit 4d607b3

Please sign in to comment.