THRIFT-6073: Add optional TLCP/NTLS support to C++ TSSLSocket via Tongsuo#3606
THRIFT-6073: Add optional TLCP/NTLS support to C++ TSSLSocket via Tongsuo#3606hongzhi-gao wants to merge 1 commit into
Conversation
Enable building libthrift against Tongsuo via -DWITH_TONGSUO and expose NTLS dual-certificate APIs on TSSLSocketFactory for TLCP workloads.
Code reviewFound 2 issues:
thrift/lib/cpp/src/thrift/transport/TSSLSocket.cpp Lines 1110 to 1115 in 0d5e69a
🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
| TLSv1_0 = 3, // Supports TLSv1_0 or later. | ||
| TLSv1_1 = 4, // Supports TLSv1_1 or later. | ||
| TLSv1_2 = 5, // Supports TLSv1_2 or later. | ||
| NTLS = 6, // Tongsuo NTLS/TLCP; requires dual signing and encryption certificates. |
|
Thanks for putting this together. Could we consider narrowing the upstream change to a generic TLS-provider compatibility layer, rather than making Tongsuo/NTLS a first-class Thrift backend? The current patch adds Tongsuo-specific build plumbing, An alternative might be to expose a small backend-neutral extension point around That would still let users avoid carrying a private transport fork, but keeps the provider-specific dependency and policy choices outside the core Thrift tree. Would you be open to reshaping the patch in that direction? |
Summary
Add optional TLCP/NTLS support to the C++
TSSLSocketstack by allowing libthrift to be built against Tongsuo, an OpenSSL-compatible TLS library with NTLS/TLCP support.This enables Thrift C++ services to run over TLCP without maintaining a private fork of the transport layer.
Background
Thrift C++ already provides SSL/TLS through
TSSLSocket/TSSLSocketFactory, backed by OpenSSL. In deployments that require TLCP (Transport Layer Cryptography Protocol, commonly implemented as NTLS in Tongsuo/BabaSSL), the existing API is not sufficient:loadCertificate()/loadPrivateKey().Teams using Thrift in TLCP-regulated environments today must either patch Thrift locally or replace the transport entirely. Both options increase maintenance cost and reduce interoperability with upstream Thrift.
Tongsuo is API-compatible with OpenSSL for most Thrift SSL usage, so this can be integrated as an opt-in build path rather than a breaking change to the default OpenSSL workflow.
What changed
-DWITH_TONGSUO=ONand-DTONGSUO_ROOT_DIR=...to link against Tongsuo instead of system OpenSSL; runtime detection setsTHRIFT_HAVE_NTLSwhen NTLS is available.TSSLSocketFactory: newSSLProtocol::NTLSand dual-certificate APIs (loadSign*/loadEnc*, including buffer variants).TNTLSSocketTestwith SM2 dual-cert fixtures undertest/keys/ntls/.Existing OpenSSL builds and standard TLS behavior are unchanged when
-DWITH_TONGSUOis not enabled.Test plan
-DWITH_TONGSUO=ON -DTONGSUO_ROOT_DIR=<prefix> -DBUILD_TESTING=ON -DBUILD_COMPILER=ONctest -R TNTLSSocketTestTongsuo must be built with
./config enable-ntlsbefore running NTLS tests.