|
28 | 28 | #include <folly/io/async/AsyncSocket.h> |
29 | 29 | #include <folly/io/async/SSLContext.h> |
30 | 30 |
|
| 31 | +#include <openssl/ssl.h> |
| 32 | + |
31 | 33 | #include <thrift/lib/cpp2/async/RocketClientChannel.h> |
32 | 34 | #include <thrift/lib/thrift/gen-cpp2/RpcMetadata_types.h> |
33 | 35 |
|
@@ -191,6 +193,17 @@ MockServicesClient::MockServicesClient( |
191 | 193 | // pinned fbthrift v2026.01.05.00). Without ALPN, the server may |
192 | 194 | // reject the connection or fall back to the header-upgrade path. |
193 | 195 | ssl_ctx->setAdvertisedNextProtocols({"rs"}); |
| 196 | + // Restrict the offered ciphers to AES-GCM so the connection negotiates |
| 197 | + // hardware AES (ARMv8 crypto extensions via libcrypto), matching prod's |
| 198 | + // cipher. Without this, OpenSSL may pick ChaCha20-Poly1305 (a NEON/integer |
| 199 | + // cipher with no AES instructions), which reads as ~0% in the crypto |
| 200 | + // instruction mix vs prod's ~0.88% and runs the AEAD un-accelerated. |
| 201 | + SSL_CTX_set_ciphersuites( |
| 202 | + ssl_ctx->getSSLCtx(), |
| 203 | + "TLS_AES_256_GCM_SHA384:TLS_AES_128_GCM_SHA256"); // TLS 1.3 |
| 204 | + ssl_ctx->setCiphersOrThrow( |
| 205 | + "ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:" |
| 206 | + "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256"); // TLS 1.2 |
194 | 207 | folly::AsyncSSLSocket::UniquePtr ssl_sock( |
195 | 208 | new folly::AsyncSSLSocket(ssl_ctx, evb_)); |
196 | 209 | // AsyncSSLSocket buffers writes until the TLS handshake completes, |
|
0 commit comments