Skip to content

Commit 509156a

Browse files
committed
fixup! tls: add allowPartialTrustChain flag
1 parent 5f501b4 commit 509156a

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

src/crypto/crypto_context.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -761,15 +761,15 @@ void SecureContext::SetX509StoreFlag(unsigned long flags) {
761761
}
762762

763763
X509_STORE* SecureContext::GetCertStoreOwnedByThisSecureContext() {
764-
if (owned_cert_store_cached_ != nullptr) return owned_cert_store_cached_;
764+
if (own_cert_store_cache_ != nullptr) return own_cert_store_cache_;
765765

766766
X509_STORE* cert_store = SSL_CTX_get_cert_store(ctx_.get());
767767
if (cert_store == GetOrCreateRootCertStore()) {
768768
cert_store = NewRootCertStore();
769769
SSL_CTX_set_cert_store(ctx_.get(), cert_store);
770770
}
771771

772-
return owned_cert_store_cached_ = cert_store;
772+
return own_cert_store_cache_ = cert_store;
773773
}
774774

775775
void SecureContext::SetAllowPartialTrustChain(

src/crypto/crypto_context.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ class SecureContext final : public BaseObject {
147147
SSLCtxPointer ctx_;
148148
X509Pointer cert_;
149149
X509Pointer issuer_;
150-
X509_STORE* owned_cert_store_cached_ = nullptr;
150+
// Non-owning cache for SSL_CTX_get_cert_store(ctx_.get())
151+
X509_STORE* own_cert_store_cache_ = nullptr;
151152
#ifndef OPENSSL_NO_ENGINE
152153
bool client_cert_engine_provided_ = false;
153154
ncrypto::EnginePointer private_key_engine_;

test/parallel/test-tls-client-allow-partial-trust-chain.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
'use strict';
22
const common = require('../common');
3-
4-
if (!common.hasCrypto)
5-
common.skip('missing crypto');
3+
if (!common.hasCrypto) { common.skip('missing crypto'); };
64

75
const assert = require('assert');
86
const { once } = require('events');
9-
const tls = require('tls');
107
const fixtures = require('../common/fixtures');
118

129
// agent6-cert.pem is signed by intermediate cert of ca3.
1310
// The server has a cert chain of agent6->ca3->ca1(root).
1411

1512
const { it, beforeEach, afterEach, describe } = require('node:test');
1613

17-
describe('allowPartialTrustChain', function() {
14+
describe('allowPartialTrustChain', { skip: !common.hasCrypto }, function() {
15+
const tls = require('tls');
1816
let server;
1917
let client;
2018
let opts;

0 commit comments

Comments
 (0)