ssl_security_connector.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2018 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
20 
22 
23 #include <stdint.h>
24 #include <string.h>
25 
26 #include <string>
27 #include <utility>
28 
29 #include "absl/status/status.h"
30 #include "absl/strings/str_cat.h"
31 #include "absl/strings/str_format.h"
32 #include "absl/strings/string_view.h"
33 
35 #include <grpc/support/alloc.h>
36 #include <grpc/support/log.h>
37 
59 
60 namespace {
61 grpc_error_handle ssl_check_peer(
62  const char* peer_name, const tsi_peer* peer,
65  if (!GRPC_ERROR_IS_NONE(error)) {
66  return error;
67  }
68  /* Check the peer name if specified. */
69  if (peer_name != nullptr && !grpc_ssl_host_matches_name(peer, peer_name)) {
71  absl::StrCat("Peer name ", peer_name, " is not in peer certificate"));
72  }
73  *auth_context =
75  return GRPC_ERROR_NONE;
76 }
77 
78 class grpc_ssl_channel_security_connector final
80  public:
81  grpc_ssl_channel_security_connector(
84  const grpc_ssl_config* config, const char* target_name,
85  const char* overridden_target_name)
87  std::move(channel_creds),
88  std::move(request_metadata_creds)),
89  overridden_target_name_(
90  overridden_target_name == nullptr ? "" : overridden_target_name),
91  verify_options_(&config->verify_options) {
92  absl::string_view host;
94  grpc_core::SplitHostPort(target_name, &host, &port);
95  target_name_ = std::string(host);
96  }
97 
98  ~grpc_ssl_channel_security_connector() override {
99  tsi_ssl_client_handshaker_factory_unref(client_handshaker_factory_);
100  }
101 
102  grpc_security_status InitializeHandshakerFactory(
103  const grpc_ssl_config* config, const char* pem_root_certs,
104  const tsi_ssl_root_certs_store* root_store,
105  tsi_ssl_session_cache* ssl_session_cache) {
106  bool has_key_cert_pair =
107  config->pem_key_cert_pair != nullptr &&
108  config->pem_key_cert_pair->private_key != nullptr &&
109  config->pem_key_cert_pair->cert_chain != nullptr;
111  GPR_DEBUG_ASSERT(pem_root_certs != nullptr);
112  options.pem_root_certs = pem_root_certs;
113  options.root_store = root_store;
114  options.alpn_protocols =
115  grpc_fill_alpn_protocol_strings(&options.num_alpn_protocols);
116  if (has_key_cert_pair) {
117  options.pem_key_cert_pair = config->pem_key_cert_pair;
118  }
119  options.cipher_suites = grpc_get_ssl_cipher_suites();
120  options.session_cache = ssl_session_cache;
121  options.min_tls_version = grpc_get_tsi_tls_version(config->min_tls_version);
122  options.max_tls_version = grpc_get_tsi_tls_version(config->max_tls_version);
123  const tsi_result result =
125  &options, &client_handshaker_factory_);
126  gpr_free(options.alpn_protocols);
127  if (result != TSI_OK) {
128  gpr_log(GPR_ERROR, "Handshaker factory creation failed with %s.",
130  return GRPC_SECURITY_ERROR;
131  }
132  return GRPC_SECURITY_OK;
133  }
134 
136  grpc_pollset_set* /*interested_parties*/,
137  grpc_core::HandshakeManager* handshake_mgr) override {
138  // Instantiate TSI handshaker.
139  tsi_handshaker* tsi_hs = nullptr;
141  client_handshaker_factory_,
142  overridden_target_name_.empty() ? target_name_.c_str()
143  : overridden_target_name_.c_str(),
144  /*network_bio_buf_size=*/0,
145  /*ssl_bio_buf_size=*/0, &tsi_hs);
146  if (result != TSI_OK) {
147  gpr_log(GPR_ERROR, "Handshaker creation failed with error %s.",
149  return;
150  }
151  // Create handshakers.
152  handshake_mgr->Add(grpc_core::SecurityHandshakerCreate(tsi_hs, this, args));
153  }
154 
155  void check_peer(tsi_peer peer, grpc_endpoint* /*ep*/,
157  grpc_closure* on_peer_checked) override {
158  const char* target_name = overridden_target_name_.empty()
159  ? target_name_.c_str()
160  : overridden_target_name_.c_str();
161  grpc_error_handle error = ssl_check_peer(target_name, &peer, auth_context);
162  if (GRPC_ERROR_IS_NONE(error) &&
163  verify_options_->verify_peer_callback != nullptr) {
164  const tsi_peer_property* p =
166  if (p == nullptr) {
168  "Cannot check peer: missing pem cert property.");
169  } else {
170  char* peer_pem = static_cast<char*>(gpr_malloc(p->value.length + 1));
171  memcpy(peer_pem, p->value.data, p->value.length);
172  peer_pem[p->value.length] = '\0';
173  int callback_status = verify_options_->verify_peer_callback(
174  target_name, peer_pem,
175  verify_options_->verify_peer_callback_userdata);
176  gpr_free(peer_pem);
177  if (callback_status) {
179  "Verify peer callback returned a failure (%d)", callback_status));
180  }
181  }
182  }
183  grpc_core::ExecCtx::Run(DEBUG_LOCATION, on_peer_checked, error);
184  tsi_peer_destruct(&peer);
185  }
186 
187  void cancel_check_peer(grpc_closure* /*on_peer_checked*/,
188  grpc_error_handle error) override {
190  }
191 
192  int cmp(const grpc_security_connector* other_sc) const override {
193  auto* other =
194  reinterpret_cast<const grpc_ssl_channel_security_connector*>(other_sc);
195  int c = channel_security_connector_cmp(other);
196  if (c != 0) return c;
197  c = target_name_.compare(other->target_name_);
198  if (c != 0) return c;
199  return overridden_target_name_.compare(other->overridden_target_name_);
200  }
201 
203  absl::string_view host, grpc_auth_context* auth_context) override {
204  return grpc_core::Immediate(
205  SslCheckCallHost(host, target_name_.c_str(),
206  overridden_target_name_.c_str(), auth_context));
207  }
208 
209  private:
210  tsi_ssl_client_handshaker_factory* client_handshaker_factory_;
211  std::string target_name_;
212  std::string overridden_target_name_;
213  const verify_peer_options* verify_options_;
214 };
215 
216 class grpc_ssl_server_security_connector
218  public:
219  explicit grpc_ssl_server_security_connector(
222  std::move(server_creds)) {}
223 
224  ~grpc_ssl_server_security_connector() override {
225  tsi_ssl_server_handshaker_factory_unref(server_handshaker_factory_);
226  }
227 
228  bool has_cert_config_fetcher() const {
229  return static_cast<const grpc_ssl_server_credentials*>(server_creds())
230  ->has_cert_config_fetcher();
231  }
232 
233  const tsi_ssl_server_handshaker_factory* server_handshaker_factory() const {
234  return server_handshaker_factory_;
235  }
236 
237  grpc_security_status InitializeHandshakerFactory() {
238  if (has_cert_config_fetcher()) {
239  // Load initial credentials from certificate_config_fetcher:
240  if (!try_fetch_ssl_server_credentials()) {
242  "Failed loading SSL server credentials from fetcher.");
243  return GRPC_SECURITY_ERROR;
244  }
245  } else {
246  auto* server_credentials =
247  static_cast<const grpc_ssl_server_credentials*>(server_creds());
248  size_t num_alpn_protocols = 0;
249  const char** alpn_protocol_strings =
250  grpc_fill_alpn_protocol_strings(&num_alpn_protocols);
252  options.pem_key_cert_pairs =
253  server_credentials->config().pem_key_cert_pairs;
254  options.num_key_cert_pairs =
255  server_credentials->config().num_key_cert_pairs;
256  options.pem_client_root_certs =
257  server_credentials->config().pem_root_certs;
258  options.client_certificate_request =
260  server_credentials->config().client_certificate_request);
261  options.cipher_suites = grpc_get_ssl_cipher_suites();
262  options.alpn_protocols = alpn_protocol_strings;
263  options.num_alpn_protocols = static_cast<uint16_t>(num_alpn_protocols);
264  options.min_tls_version = grpc_get_tsi_tls_version(
265  server_credentials->config().min_tls_version);
266  options.max_tls_version = grpc_get_tsi_tls_version(
267  server_credentials->config().max_tls_version);
268  const tsi_result result =
270  &options, &server_handshaker_factory_);
271  gpr_free(alpn_protocol_strings);
272  if (result != TSI_OK) {
273  gpr_log(GPR_ERROR, "Handshaker factory creation failed with %s.",
275  return GRPC_SECURITY_ERROR;
276  }
277  }
278  return GRPC_SECURITY_OK;
279  }
280 
282  grpc_pollset_set* /*interested_parties*/,
283  grpc_core::HandshakeManager* handshake_mgr) override {
284  // Instantiate TSI handshaker.
285  try_fetch_ssl_server_credentials();
286  tsi_handshaker* tsi_hs = nullptr;
288  server_handshaker_factory_, /*network_bio_buf_size=*/0,
289  /*ssl_bio_buf_size=*/0, &tsi_hs);
290  if (result != TSI_OK) {
291  gpr_log(GPR_ERROR, "Handshaker creation failed with error %s.",
293  return;
294  }
295  // Create handshakers.
296  handshake_mgr->Add(grpc_core::SecurityHandshakerCreate(tsi_hs, this, args));
297  }
298 
299  void check_peer(tsi_peer peer, grpc_endpoint* /*ep*/,
301  grpc_closure* on_peer_checked) override {
302  grpc_error_handle error = ssl_check_peer(nullptr, &peer, auth_context);
303  tsi_peer_destruct(&peer);
304  grpc_core::ExecCtx::Run(DEBUG_LOCATION, on_peer_checked, error);
305  }
306 
307  void cancel_check_peer(grpc_closure* /*on_peer_checked*/,
308  grpc_error_handle error) override {
310  }
311 
312  int cmp(const grpc_security_connector* other) const override {
314  static_cast<const grpc_server_security_connector*>(other));
315  }
316 
317  private:
318  /* Attempts to fetch the server certificate config if a callback is available.
319  * Current certificate config will continue to be used if the callback returns
320  * an error. Returns true if new credentials were successfully loaded. */
321  bool try_fetch_ssl_server_credentials() {
322  grpc_ssl_server_certificate_config* certificate_config = nullptr;
323  bool status;
324  if (!has_cert_config_fetcher()) return false;
325 
326  grpc_core::MutexLock lock(&mu_);
327  grpc_ssl_server_credentials* server_creds =
328  static_cast<grpc_ssl_server_credentials*>(this->mutable_server_creds());
330  server_creds->FetchCertConfig(&certificate_config);
332  gpr_log(GPR_DEBUG, "No change in SSL server credentials.");
333  status = false;
334  } else if (cb_result == GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_NEW) {
335  status = try_replace_server_handshaker_factory(certificate_config);
336  } else {
337  // Log error, continue using previously-loaded credentials.
339  "Failed fetching new server credentials, continuing to "
340  "use previously-loaded credentials.");
341  status = false;
342  }
343 
344  if (certificate_config != nullptr) {
345  grpc_ssl_server_certificate_config_destroy(certificate_config);
346  }
347  return status;
348  }
349 
350  /* Attempts to replace the server_handshaker_factory with a new factory using
351  * the provided grpc_ssl_server_certificate_config. Should new factory
352  * creation fail, the existing factory will not be replaced. Returns true on
353  * success (new factory created). */
354  bool try_replace_server_handshaker_factory(
356  if (config == nullptr) {
358  "Server certificate config callback returned invalid (NULL) "
359  "config.");
360  return false;
361  }
362  gpr_log(GPR_DEBUG, "Using new server certificate config (%p).", config);
363 
364  size_t num_alpn_protocols = 0;
365  const char** alpn_protocol_strings =
366  grpc_fill_alpn_protocol_strings(&num_alpn_protocols);
367  tsi_ssl_server_handshaker_factory* new_handshaker_factory = nullptr;
368  const grpc_ssl_server_credentials* server_creds =
369  static_cast<const grpc_ssl_server_credentials*>(this->server_creds());
370  GPR_DEBUG_ASSERT(config->pem_root_certs != nullptr);
372  options.pem_key_cert_pairs = grpc_convert_grpc_to_tsi_cert_pairs(
373  config->pem_key_cert_pairs, config->num_key_cert_pairs);
374  options.num_key_cert_pairs = config->num_key_cert_pairs;
375  options.pem_client_root_certs = config->pem_root_certs;
376  options.client_certificate_request =
378  server_creds->config().client_certificate_request);
379  options.cipher_suites = grpc_get_ssl_cipher_suites();
380  options.alpn_protocols = alpn_protocol_strings;
381  options.num_alpn_protocols = static_cast<uint16_t>(num_alpn_protocols);
383  &options, &new_handshaker_factory);
385  const_cast<tsi_ssl_pem_key_cert_pair*>(options.pem_key_cert_pairs),
386  options.num_key_cert_pairs);
387  gpr_free(alpn_protocol_strings);
388 
389  if (result != TSI_OK) {
390  gpr_log(GPR_ERROR, "Handshaker factory creation failed with %s.",
392  return false;
393  }
394  set_server_handshaker_factory(new_handshaker_factory);
395  return true;
396  }
397 
398  void set_server_handshaker_factory(
399  tsi_ssl_server_handshaker_factory* new_factory) {
400  if (server_handshaker_factory_) {
401  tsi_ssl_server_handshaker_factory_unref(server_handshaker_factory_);
402  }
403  server_handshaker_factory_ = new_factory;
404  }
405 
407  tsi_ssl_server_handshaker_factory* server_handshaker_factory_ = nullptr;
408 };
409 } // namespace
410 
415  const grpc_ssl_config* config, const char* target_name,
416  const char* overridden_target_name,
417  tsi_ssl_session_cache* ssl_session_cache) {
418  if (config == nullptr || target_name == nullptr) {
419  gpr_log(GPR_ERROR, "An ssl channel needs a config and a target name.");
420  return nullptr;
421  }
422 
423  const char* pem_root_certs;
424  const tsi_ssl_root_certs_store* root_store;
425  if (config->pem_root_certs == nullptr) {
426  // Use default root certificates.
428  if (pem_root_certs == nullptr) {
429  gpr_log(GPR_ERROR, "Could not get default pem root certs.");
430  return nullptr;
431  }
433  } else {
434  pem_root_certs = config->pem_root_certs;
435  root_store = nullptr;
436  }
437 
439  grpc_core::MakeRefCounted<grpc_ssl_channel_security_connector>(
440  std::move(channel_creds), std::move(request_metadata_creds), config,
441  target_name, overridden_target_name);
442  const grpc_security_status result = c->InitializeHandshakerFactory(
443  config, pem_root_certs, root_store, ssl_session_cache);
444  if (result != GRPC_SECURITY_OK) {
445  return nullptr;
446  }
447  return c;
448 }
449 
453  GPR_ASSERT(server_credentials != nullptr);
455  grpc_core::MakeRefCounted<grpc_ssl_server_security_connector>(
456  std::move(server_credentials));
457  const grpc_security_status retval = c->InitializeHandshakerFactory();
458  if (retval != GRPC_SECURITY_OK) {
459  return nullptr;
460  }
461  return c;
462 }
grpc_ssl_server_certificate_config::pem_root_certs
char * pem_root_certs
Definition: ssl_credentials.h:79
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
grpc_auth_context
Definition: security_context.h:63
tsi_create_ssl_server_handshaker_factory_with_options
tsi_result tsi_create_ssl_server_handshaker_factory_with_options(const tsi_ssl_server_handshaker_options *options, tsi_ssl_server_handshaker_factory **factory)
Definition: ssl_transport_security.cc:2179
grpc_fill_alpn_protocol_strings
const char ** grpc_fill_alpn_protocol_strings(size_t *num_alpn_protocols)
Definition: ssl_utils.cc:205
GRPC_ERROR_NONE
#define GRPC_ERROR_NONE
Definition: error.h:234
log.h
grpc_security_connector::check_peer
virtual void check_peer(tsi_peer peer, grpc_endpoint *ep, grpc_core::RefCountedPtr< grpc_auth_context > *auth_context, grpc_closure *on_peer_checked)=0
absl::StrCat
std::string StrCat(const AlphaNum &a, const AlphaNum &b)
Definition: abseil-cpp/absl/strings/str_cat.cc:98
tsi_create_ssl_client_handshaker_factory_with_options
tsi_result tsi_create_ssl_client_handshaker_factory_with_options(const tsi_ssl_client_handshaker_options *options, tsi_ssl_client_handshaker_factory **factory)
Definition: ssl_transport_security.cc:2007
absl::StrFormat
ABSL_MUST_USE_RESULT std::string StrFormat(const FormatSpec< Args... > &format, const Args &... args)
Definition: abseil-cpp/absl/strings/str_format.h:338
GPR_DEBUG_ASSERT
#define GPR_DEBUG_ASSERT(x)
Definition: include/grpc/impl/codegen/log.h:103
grpc_server_security_connector::add_handshakers
virtual void add_handshakers(const grpc_channel_args *args, grpc_pollset_set *interested_parties, grpc_core::HandshakeManager *handshake_mgr)=0
grpc_server_security_connector
Definition: security_connector.h:171
pem_root_certs
static char * pem_root_certs
Definition: rb_channel_credentials.c:38
tsi_handshaker
Definition: transport_security.h:84
GRPC_SECURITY_ERROR
@ GRPC_SECURITY_ERROR
Definition: security_connector.h:52
grpc_core::SecurityHandshakerCreate
RefCountedPtr< Handshaker > SecurityHandshakerCreate(tsi_handshaker *handshaker, grpc_security_connector *connector, const grpc_channel_args *args)
Creates a security handshaker using handshaker.
Definition: security_handshaker.cc:658
uint16_t
unsigned short uint16_t
Definition: stdint-msvc2008.h:79
tsi_ssl_pem_key_cert_pair
Definition: ssl_transport_security.h:101
grpc_ssl_peer_to_auth_context
grpc_core::RefCountedPtr< grpc_auth_context > grpc_ssl_peer_to_auth_context(const tsi_peer *peer, const char *transport_security_type)
Definition: ssl_utils.cc:261
grpc_ssl_server_credentials::config
const grpc_ssl_server_config & config() const
Definition: ssl_credentials.h:116
grpc_core::MutexLock
Definition: src/core/lib/gprpp/sync.h:88
grpc_pollset_set
struct grpc_pollset_set grpc_pollset_set
Definition: iomgr_fwd.h:23
grpc_ssl_certificate_config_reload_status
grpc_ssl_certificate_config_reload_status
Definition: grpc_security_constants.h:73
tsi_ssl_client_handshaker_factory_unref
void tsi_ssl_client_handshaker_factory_unref(tsi_ssl_client_handshaker_factory *factory)
Definition: ssl_transport_security.cc:1783
string.h
options
double_dict options[]
Definition: capstone_test.c:55
absl::string_view
Definition: abseil-cpp/absl/strings/string_view.h:167
tsi_ssl_client_handshaker_factory
Definition: ssl_transport_security.cc:93
gpr_free
GPRAPI void gpr_free(void *ptr)
Definition: alloc.cc:51
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
error
grpc_error_handle error
Definition: retry_filter.cc:499
GRPC_SSL_TRANSPORT_SECURITY_TYPE
#define GRPC_SSL_TRANSPORT_SECURITY_TYPE
Definition: grpc_security_constants.h:27
gpr_malloc
GPRAPI void * gpr_malloc(size_t size)
Definition: alloc.cc:29
closure.h
grpc_core::SplitHostPort
bool SplitHostPort(absl::string_view name, absl::string_view *host, absl::string_view *port)
Definition: host_port.cc:88
status
absl::Status status
Definition: rls.cc:251
grpc_core::DefaultSslRootStore::GetPemRootCerts
static const char * GetPemRootCerts()
Definition: ssl_utils.cc:568
xds_manager.p
p
Definition: xds_manager.py:60
ssl_transport_security.h
credentials.h
grpc_channel_args
Definition: grpc_types.h:132
mu_
Mutex mu_
Definition: oob_backend_metric.cc:115
ssl_security_connector.h
tsi_ssl_server_handshaker_options
Definition: ssl_transport_security.h:279
grpc_types.h
grpc_core::DefaultSslRootStore::GetRootStore
static const tsi_ssl_root_certs_store * GetRootStore()
Definition: ssl_utils.cc:563
grpc_security_connector
Definition: security_connector.h:61
TSI_OK
@ TSI_OK
Definition: transport_security_interface.h:32
DEBUG_LOCATION
#define DEBUG_LOCATION
Definition: debug_location.h:41
grpc_security_connector::cancel_check_peer
virtual void cancel_check_peer(grpc_closure *on_peer_checked, grpc_error_handle error)=0
memcpy
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
c
void c(T a)
Definition: miscompile_with_no_unique_address_test.cc:40
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
grpc_core::RefCountedPtr< grpc_auth_context >
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
GPR_ASSERT
#define GPR_ASSERT(x)
Definition: include/grpc/impl/codegen/log.h:94
grpc_ssl_server_security_connector_create
grpc_core::RefCountedPtr< grpc_server_security_connector > grpc_ssl_server_security_connector_create(grpc_core::RefCountedPtr< grpc_server_credentials > server_credentials)
Definition: ssl_security_connector.cc:451
grpc_channel_security_connector::CheckCallHost
virtual grpc_core::ArenaPromise< absl::Status > CheckCallHost(absl::string_view host, grpc_auth_context *auth_context)=0
grpc_tsi_ssl_pem_key_cert_pairs_destroy
void grpc_tsi_ssl_pem_key_cert_pairs_destroy(tsi_ssl_pem_key_cert_pair *kp, size_t num_key_cert_pairs)
Definition: ssl_utils.cc:168
GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED
@ GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED
Definition: grpc_security_constants.h:74
TSI_X509_PEM_CERT_PROPERTY
#define TSI_X509_PEM_CERT_PROPERTY
Definition: ssl_transport_security.h:42
gpr_log
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_NEW
@ GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_NEW
Definition: grpc_security_constants.h:75
grpc_ssl_check_alpn
grpc_error_handle grpc_ssl_check_alpn(const tsi_peer *peer)
Definition: ssl_utils.cc:141
grpc_core::SslCheckCallHost
absl::Status SslCheckCallHost(absl::string_view host, absl::string_view target_name, absl::string_view overridden_target_name, grpc_auth_context *auth_context)
Definition: ssl_utils.cc:180
tsi_result
tsi_result
Definition: transport_security_interface.h:31
grpc_core::HandshakeManager::Add
void Add(RefCountedPtr< Handshaker > handshaker)
Definition: src/core/lib/transport/handshaker.cc:63
grpc_get_ssl_cipher_suites
const char * grpc_get_ssl_cipher_suites(void)
Definition: ssl_utils.cc:100
arena_promise.h
tsi_ssl_server_handshaker_factory_create_handshaker
tsi_result tsi_ssl_server_handshaker_factory_create_handshaker(tsi_ssl_server_handshaker_factory *factory, size_t network_bio_buf_size, size_t ssl_bio_buf_size, tsi_handshaker **handshaker)
Definition: ssl_transport_security.cc:1813
tsi_peer_get_property_by_name
const tsi_peer_property * tsi_peer_get_property_by_name(const tsi_peer *peer, const char *name)
Definition: transport_security.cc:369
error.h
host_port.h
grpc_channel_security_connector::add_handshakers
virtual void add_handshakers(const grpc_channel_args *args, grpc_pollset_set *interested_parties, grpc_core::HandshakeManager *handshake_mgr)=0
Registers handshakers with handshake_mgr.
GPR_ERROR
#define GPR_ERROR
Definition: include/grpc/impl/codegen/log.h:57
grpc_ssl_server_config::client_certificate_request
grpc_ssl_client_certificate_request_type client_certificate_request
Definition: ssl_security_connector.h:67
grpc_ssl_server_certificate_config
Definition: ssl_credentials.h:76
transport_security_interface.h
promise.h
grpc_ssl_server_credentials
Definition: ssl_credentials.h:87
grpc_convert_grpc_to_tsi_cert_pairs
tsi_ssl_pem_key_cert_pair * grpc_convert_grpc_to_tsi_cert_pairs(const grpc_ssl_pem_key_cert_pair *pem_key_cert_pairs, size_t num_key_cert_pairs)
Definition: ssl_credentials.cc:202
stdint.h
GRPC_ERROR_CREATE_FROM_STATIC_STRING
#define GRPC_ERROR_CREATE_FROM_STATIC_STRING(desc)
Definition: error.h:291
verify_peer_options
Definition: grpc_security.h:187
tests.unit._exit_scenarios.port
port
Definition: _exit_scenarios.py:179
tsi_peer_property
Definition: transport_security_interface.h:230
grpc_channel_security_connector::channel_security_connector_cmp
int channel_security_connector_cmp(const grpc_channel_security_connector *other) const
Definition: security_connector.cc:45
tsi_ssl_server_handshaker_factory
Definition: ssl_transport_security.cc:102
GRPC_SECURITY_OK
@ GRPC_SECURITY_OK
Definition: security_connector.h:52
security_handshaker.h
tsi_peer
Definition: transport_security_interface.h:238
security_context.h
grpc_core::Mutex
Definition: src/core/lib/gprpp/sync.h:61
transport_security.h
grpc_ssl_server_credentials::FetchCertConfig
grpc_ssl_certificate_config_reload_status FetchCertConfig(grpc_ssl_server_certificate_config **config)
Definition: ssl_credentials.h:104
debug_location.h
tsi_ssl_server_handshaker_factory_unref
void tsi_ssl_server_handshaker_factory_unref(tsi_ssl_server_handshaker_factory *factory)
Definition: ssl_transport_security.cc:1824
grpc_ssl_channel_security_connector_create
grpc_core::RefCountedPtr< grpc_channel_security_connector > grpc_ssl_channel_security_connector_create(grpc_core::RefCountedPtr< grpc_channel_credentials > channel_creds, grpc_core::RefCountedPtr< grpc_call_credentials > request_metadata_creds, const grpc_ssl_config *config, const char *target_name, const char *overridden_target_name, tsi_ssl_session_cache *ssl_session_cache)
Definition: ssl_security_connector.cc:412
grpc_core::ArenaPromise
Definition: arena_promise.h:152
tsi_ssl_session_cache
struct tsi_ssl_session_cache tsi_ssl_session_cache
Definition: ssl_transport_security.h:68
tsi_ssl_root_certs_store
Definition: ssl_transport_security.cc:84
tsi_result_to_string
const char * tsi_result_to_string(tsi_result result)
Definition: transport_security.cc:35
poll.h
grpc_ssl_host_matches_name
int grpc_ssl_host_matches_name(const tsi_peer *peer, absl::string_view peer_name)
Definition: ssl_utils.cc:216
GRPC_ERROR_CREATE_FROM_CPP_STRING
#define GRPC_ERROR_CREATE_FROM_CPP_STRING(desc)
Definition: error.h:297
alloc.h
std
Definition: grpcpp/impl/codegen/async_unary_call.h:407
exec_ctx.h
handshaker.h
GRPC_ERROR_UNREF
#define GRPC_ERROR_UNREF(err)
Definition: error.h:262
grpc_core::ExecCtx::Run
static void Run(const DebugLocation &location, grpc_closure *closure, grpc_error_handle error)
Definition: exec_ctx.cc:98
grpc_ssl_config
Definition: ssl_security_connector.h:33
ref_counted_ptr.h
config_s
Definition: bloaty/third_party/zlib/deflate.c:120
grpc_get_tsi_tls_version
tsi_tls_version grpc_get_tsi_tls_version(grpc_tls_version tls_version)
Definition: ssl_utils.cc:129
grpc_get_tsi_client_certificate_request_type
tsi_client_certificate_request_type grpc_get_tsi_client_certificate_request_type(grpc_ssl_client_certificate_request_type grpc_request_type)
Definition: ssl_utils.cc:106
grpc_channel_security_connector
Definition: security_connector.h:118
grpc_core::Immediate
promise_detail::Immediate< T > Immediate(T value)
Definition: promise/promise.h:73
GPR_DEBUG
#define GPR_DEBUG
Definition: include/grpc/impl/codegen/log.h:55
grpc_server_security_connector::mutable_server_creds
grpc_server_credentials * mutable_server_creds()
Definition: security_connector.h:184
tsi_ssl_client_handshaker_options
Definition: ssl_transport_security.h:137
grpc_core::HandshakeManager
Definition: handshaker.h:98
iomgr_fwd.h
endpoint.h
grpc_server_security_connector::server_creds
const grpc_server_credentials * server_creds() const
Definition: security_connector.h:181
GRPC_SSL_URL_SCHEME
#define GRPC_SSL_URL_SCHEME
Definition: security_connector.h:49
grpc_error
Definition: error_internal.h:42
ssl_credentials.h
grpc_security_connector::cmp
virtual int cmp(const grpc_security_connector *other) const =0
grpc_closure
Definition: closure.h:56
tsi_peer_destruct
void tsi_peer_destruct(tsi_peer *self)
Definition: transport_security.cc:320
grpc_endpoint
Definition: endpoint.h:105
grpc_security_status
grpc_security_status
Definition: security_connector.h:52
grpc_ssl_server_certificate_config_destroy
GRPCAPI void grpc_ssl_server_certificate_config_destroy(grpc_ssl_server_certificate_config *config)
Definition: ssl_credentials.cc:266
tsi_ssl_client_handshaker_factory_create_handshaker
tsi_result tsi_ssl_client_handshaker_factory_create_handshaker(tsi_ssl_client_handshaker_factory *factory, const char *server_name_indication, size_t network_bio_buf_size, size_t ssl_bio_buf_size, tsi_handshaker **handshaker)
Definition: ssl_transport_security.cc:1774
sync.h
ssl_utils.h
grpc_server_security_connector::server_security_connector_cmp
int server_security_connector_cmp(const grpc_server_security_connector *other) const
Definition: security_connector.cc:67
GRPC_ERROR_IS_NONE
#define GRPC_ERROR_IS_NONE(err)
Definition: error.h:241
port_platform.h


grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:16