Skip to content

Commit

Permalink
Merge pull request grpc#14858 from jiangtaoli2016/root_cert_once
Browse files Browse the repository at this point in the history
Init default root certs store once
  • Loading branch information
Jiangtao Li authored Mar 29, 2018
2 parents 7f25d20 + 4fe2cd2 commit fa7cbb5
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 29 deletions.
10 changes: 0 additions & 10 deletions src/core/lib/security/security_connector/security_connector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1151,16 +1151,6 @@ const char* DefaultSslRootStore::GetPemRootCerts() {
GRPC_SLICE_START_PTR(default_pem_root_certs_);
}

void DefaultSslRootStore::Initialize() {
default_root_store_ = nullptr;
default_pem_root_certs_ = grpc_empty_slice();
}

void DefaultSslRootStore::Destroy() {
tsi_ssl_root_certs_store_destroy(default_root_store_);
grpc_slice_unref_internal(default_pem_root_certs_);
}

grpc_slice DefaultSslRootStore::ComputePemRootCerts() {
grpc_slice result = grpc_empty_slice();
// First try to load the roots from the environment.
Expand Down
9 changes: 0 additions & 9 deletions src/core/lib/security/security_connector/security_connector.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,15 +256,6 @@ class DefaultSslRootStore {
// Gets the default PEM root certificate.
static const char* GetPemRootCerts();

// Initializes the SSL root store's underlying data structure. It does not
// load default SSL root certificates. Should only be called by
// grpc_security_init().
static void Initialize();

// Destroys the default SSL root store. Should only be called by
// grpc_security_shutdown().
static void Destroy();

protected:
// Returns default PEM root certificates in nullptr terminated grpc_slice.
// This function is protected instead of private, so that it can be tested.
Expand Down
1 change: 0 additions & 1 deletion src/core/lib/surface/init.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ void grpc_shutdown(void) {
}
}
}
grpc_security_shutdown();
grpc_iomgr_shutdown();
gpr_timers_global_destroy();
grpc_tracer_shutdown();
Expand Down
1 change: 0 additions & 1 deletion src/core/lib/surface/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
void grpc_register_security_filters(void);
void grpc_security_pre_init(void);
void grpc_security_init(void);
void grpc_security_shutdown(void);
int grpc_is_initialized(void);

#endif /* GRPC_CORE_LIB_SURFACE_INIT_H */
7 changes: 1 addition & 6 deletions src/core/lib/surface/init_secure.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,4 @@ void grpc_register_security_filters(void) {
maybe_prepend_server_auth_filter, nullptr);
}

void grpc_security_init() {
grpc_security_register_handshaker_factories();
grpc_core::DefaultSslRootStore::Initialize();
}

void grpc_security_shutdown() { grpc_core::DefaultSslRootStore::Destroy(); }
void grpc_security_init() { grpc_security_register_handshaker_factories(); }
2 changes: 0 additions & 2 deletions src/core/lib/surface/init_unsecure.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,3 @@ void grpc_security_pre_init(void) {}
void grpc_register_security_filters(void) {}

void grpc_security_init(void) {}

void grpc_security_shutdown(void) {}

0 comments on commit fa7cbb5

Please sign in to comment.