diff options
-rw-r--r-- | BUILD | 3 | ||||
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | binding.gyp | 1 | ||||
-rw-r--r-- | build.yaml | 4 | ||||
-rw-r--r-- | config.m4 | 1 | ||||
-rw-r--r-- | config.w32 | 1 | ||||
-rw-r--r-- | gRPC-Core.podspec | 3 | ||||
-rwxr-xr-x | grpc.gemspec | 2 | ||||
-rw-r--r-- | package.xml | 2 | ||||
-rw-r--r-- | src/core/plugin_registry/grpc_cronet_plugin_registry.c | 4 | ||||
-rw-r--r-- | src/core/plugin_registry/grpc_plugin_registry.c | 4 | ||||
-rw-r--r-- | src/core/tsi/gts_transport_security.c | 40 | ||||
-rw-r--r-- | src/core/tsi/gts_transport_security.h | 37 | ||||
-rw-r--r-- | src/python/grpcio/grpc_core_dependencies.py | 1 | ||||
-rw-r--r-- | tools/doxygen/Doxyfile.core.internal | 2 | ||||
-rw-r--r-- | tools/run_tests/generated/sources_and_headers.json | 4 | ||||
-rw-r--r-- | vsprojects/vcxproj/grpc/grpc.vcxproj | 3 | ||||
-rw-r--r-- | vsprojects/vcxproj/grpc/grpc.vcxproj.filters | 6 |
19 files changed, 123 insertions, 0 deletions
@@ -1402,12 +1402,14 @@ grpc_cc_library( name = "tsi", srcs = [ "src/core/tsi/fake_transport_security.c", + "src/core/tsi/gts_transport_security.c", "src/core/tsi/ssl_transport_security.c", "src/core/tsi/transport_security.c", "src/core/tsi/transport_security_adapter.c", ], hdrs = [ "src/core/tsi/fake_transport_security.h", + "src/core/tsi/gts_transport_security.h", "src/core/tsi/ssl_transport_security.h", "src/core/tsi/ssl_types.h", "src/core/tsi/transport_security.h", @@ -1420,6 +1422,7 @@ grpc_cc_library( language = "c", deps = [ "gpr", + "grpc_base", "grpc_trace", ], ) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ee9490c25..e4243766bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1122,6 +1122,7 @@ add_library(grpc src/core/lib/security/util/json_util.c src/core/lib/surface/init_secure.c src/core/tsi/fake_transport_security.c + src/core/tsi/gts_transport_security.c src/core/tsi/ssl_transport_security.c src/core/tsi/transport_security.c src/core/tsi/transport_security_adapter.c @@ -1487,6 +1488,7 @@ add_library(grpc_cronet src/core/lib/security/util/json_util.c src/core/lib/surface/init_secure.c src/core/tsi/fake_transport_security.c + src/core/tsi/gts_transport_security.c src/core/tsi/ssl_transport_security.c src/core/tsi/transport_security.c src/core/tsi/transport_security_adapter.c @@ -3059,6 +3059,7 @@ LIBGRPC_SRC = \ src/core/lib/security/util/json_util.c \ src/core/lib/surface/init_secure.c \ src/core/tsi/fake_transport_security.c \ + src/core/tsi/gts_transport_security.c \ src/core/tsi/ssl_transport_security.c \ src/core/tsi/transport_security.c \ src/core/tsi/transport_security_adapter.c \ @@ -3422,6 +3423,7 @@ LIBGRPC_CRONET_SRC = \ src/core/lib/security/util/json_util.c \ src/core/lib/surface/init_secure.c \ src/core/tsi/fake_transport_security.c \ + src/core/tsi/gts_transport_security.c \ src/core/tsi/ssl_transport_security.c \ src/core/tsi/transport_security.c \ src/core/tsi/transport_security_adapter.c \ @@ -19133,6 +19135,7 @@ src/core/lib/surface/init_secure.c: $(OPENSSL_DEP) src/core/plugin_registry/grpc_cronet_plugin_registry.c: $(OPENSSL_DEP) src/core/plugin_registry/grpc_plugin_registry.c: $(OPENSSL_DEP) src/core/tsi/fake_transport_security.c: $(OPENSSL_DEP) +src/core/tsi/gts_transport_security.c: $(OPENSSL_DEP) src/core/tsi/ssl_transport_security.c: $(OPENSSL_DEP) src/core/tsi/transport_security.c: $(OPENSSL_DEP) src/core/tsi/transport_security_adapter.c: $(OPENSSL_DEP) diff --git a/binding.gyp b/binding.gyp index 00fbe70fee..6bc6450bbd 100644 --- a/binding.gyp +++ b/binding.gyp @@ -813,6 +813,7 @@ 'src/core/lib/security/util/json_util.c', 'src/core/lib/surface/init_secure.c', 'src/core/tsi/fake_transport_security.c', + 'src/core/tsi/gts_transport_security.c', 'src/core/tsi/ssl_transport_security.c', 'src/core/tsi/transport_security.c', 'src/core/tsi/transport_security_adapter.c', diff --git a/build.yaml b/build.yaml index 1b9eb63bcd..adb1e7b947 100644 --- a/build.yaml +++ b/build.yaml @@ -874,6 +874,7 @@ filegroups: - name: tsi headers: - src/core/tsi/fake_transport_security.h + - src/core/tsi/gts_transport_security.h - src/core/tsi/ssl_transport_security.h - src/core/tsi/ssl_types.h - src/core/tsi/transport_security.h @@ -881,14 +882,17 @@ filegroups: - src/core/tsi/transport_security_interface.h src: - src/core/tsi/fake_transport_security.c + - src/core/tsi/gts_transport_security.c - src/core/tsi/ssl_transport_security.c - src/core/tsi/transport_security.c - src/core/tsi/transport_security_adapter.c deps: - gpr + plugin: grpc_tsi_gts secure: true uses: - grpc_trace + - grpc_base - name: grpc++_base language: c++ public_headers: @@ -263,6 +263,7 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/security/util/json_util.c \ src/core/lib/surface/init_secure.c \ src/core/tsi/fake_transport_security.c \ + src/core/tsi/gts_transport_security.c \ src/core/tsi/ssl_transport_security.c \ src/core/tsi/transport_security.c \ src/core/tsi/transport_security_adapter.c \ diff --git a/config.w32 b/config.w32 index cd374bae65..e8ce70f158 100644 --- a/config.w32 +++ b/config.w32 @@ -240,6 +240,7 @@ if (PHP_GRPC != "no") { "src\\core\\lib\\security\\util\\json_util.c " + "src\\core\\lib\\surface\\init_secure.c " + "src\\core\\tsi\\fake_transport_security.c " + + "src\\core\\tsi\\gts_transport_security.c " + "src\\core\\tsi\\ssl_transport_security.c " + "src\\core\\tsi\\transport_security.c " + "src\\core\\tsi\\transport_security_adapter.c " + diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index fc51a92daf..1d9eca36dc 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -397,6 +397,7 @@ Pod::Spec.new do |s| 'src/core/lib/security/transport/tsi_error.h', 'src/core/lib/security/util/json_util.h', 'src/core/tsi/fake_transport_security.h', + 'src/core/tsi/gts_transport_security.h', 'src/core/tsi/ssl_transport_security.h', 'src/core/tsi/ssl_types.h', 'src/core/tsi/transport_security.h', @@ -635,6 +636,7 @@ Pod::Spec.new do |s| 'src/core/lib/security/util/json_util.c', 'src/core/lib/surface/init_secure.c', 'src/core/tsi/fake_transport_security.c', + 'src/core/tsi/gts_transport_security.c', 'src/core/tsi/ssl_transport_security.c', 'src/core/tsi/transport_security.c', 'src/core/tsi/transport_security_adapter.c', @@ -877,6 +879,7 @@ Pod::Spec.new do |s| 'src/core/lib/security/transport/tsi_error.h', 'src/core/lib/security/util/json_util.h', 'src/core/tsi/fake_transport_security.h', + 'src/core/tsi/gts_transport_security.h', 'src/core/tsi/ssl_transport_security.h', 'src/core/tsi/ssl_types.h', 'src/core/tsi/transport_security.h', diff --git a/grpc.gemspec b/grpc.gemspec index ab4a634c9b..dad1b31ec9 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -329,6 +329,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/security/transport/tsi_error.h ) s.files += %w( src/core/lib/security/util/json_util.h ) s.files += %w( src/core/tsi/fake_transport_security.h ) + s.files += %w( src/core/tsi/gts_transport_security.h ) s.files += %w( src/core/tsi/ssl_transport_security.h ) s.files += %w( src/core/tsi/ssl_types.h ) s.files += %w( src/core/tsi/transport_security.h ) @@ -571,6 +572,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/security/util/json_util.c ) s.files += %w( src/core/lib/surface/init_secure.c ) s.files += %w( src/core/tsi/fake_transport_security.c ) + s.files += %w( src/core/tsi/gts_transport_security.c ) s.files += %w( src/core/tsi/ssl_transport_security.c ) s.files += %w( src/core/tsi/transport_security.c ) s.files += %w( src/core/tsi/transport_security_adapter.c ) diff --git a/package.xml b/package.xml index 602800b1b5..c79b38f686 100644 --- a/package.xml +++ b/package.xml @@ -343,6 +343,7 @@ <file baseinstalldir="/" name="src/core/lib/security/transport/tsi_error.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/security/util/json_util.h" role="src" /> <file baseinstalldir="/" name="src/core/tsi/fake_transport_security.h" role="src" /> + <file baseinstalldir="/" name="src/core/tsi/gts_transport_security.h" role="src" /> <file baseinstalldir="/" name="src/core/tsi/ssl_transport_security.h" role="src" /> <file baseinstalldir="/" name="src/core/tsi/ssl_types.h" role="src" /> <file baseinstalldir="/" name="src/core/tsi/transport_security.h" role="src" /> @@ -585,6 +586,7 @@ <file baseinstalldir="/" name="src/core/lib/security/util/json_util.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/surface/init_secure.c" role="src" /> <file baseinstalldir="/" name="src/core/tsi/fake_transport_security.c" role="src" /> + <file baseinstalldir="/" name="src/core/tsi/gts_transport_security.c" role="src" /> <file baseinstalldir="/" name="src/core/tsi/ssl_transport_security.c" role="src" /> <file baseinstalldir="/" name="src/core/tsi/transport_security.c" role="src" /> <file baseinstalldir="/" name="src/core/tsi/transport_security_adapter.c" role="src" /> diff --git a/src/core/plugin_registry/grpc_cronet_plugin_registry.c b/src/core/plugin_registry/grpc_cronet_plugin_registry.c index b468c03aa3..322ebea111 100644 --- a/src/core/plugin_registry/grpc_cronet_plugin_registry.c +++ b/src/core/plugin_registry/grpc_cronet_plugin_registry.c @@ -26,6 +26,8 @@ extern void grpc_deadline_filter_init(void); extern void grpc_deadline_filter_shutdown(void); extern void grpc_client_channel_init(void); extern void grpc_client_channel_shutdown(void); +extern void grpc_tsi_gts_init(void); +extern void grpc_tsi_gts_shutdown(void); extern void grpc_load_reporting_plugin_init(void); extern void grpc_load_reporting_plugin_shutdown(void); @@ -38,6 +40,8 @@ void grpc_register_built_in_plugins(void) { grpc_deadline_filter_shutdown); grpc_register_plugin(grpc_client_channel_init, grpc_client_channel_shutdown); + grpc_register_plugin(grpc_tsi_gts_init, + grpc_tsi_gts_shutdown); grpc_register_plugin(grpc_load_reporting_plugin_init, grpc_load_reporting_plugin_shutdown); } diff --git a/src/core/plugin_registry/grpc_plugin_registry.c b/src/core/plugin_registry/grpc_plugin_registry.c index b0d06a3f43..fa9974952c 100644 --- a/src/core/plugin_registry/grpc_plugin_registry.c +++ b/src/core/plugin_registry/grpc_plugin_registry.c @@ -22,6 +22,8 @@ extern void grpc_http_filters_init(void); extern void grpc_http_filters_shutdown(void); extern void grpc_chttp2_plugin_init(void); extern void grpc_chttp2_plugin_shutdown(void); +extern void grpc_tsi_gts_init(void); +extern void grpc_tsi_gts_shutdown(void); extern void grpc_deadline_filter_init(void); extern void grpc_deadline_filter_shutdown(void); extern void grpc_client_channel_init(void); @@ -58,6 +60,8 @@ void grpc_register_built_in_plugins(void) { grpc_http_filters_shutdown); grpc_register_plugin(grpc_chttp2_plugin_init, grpc_chttp2_plugin_shutdown); + grpc_register_plugin(grpc_tsi_gts_init, + grpc_tsi_gts_shutdown); grpc_register_plugin(grpc_deadline_filter_init, grpc_deadline_filter_shutdown); grpc_register_plugin(grpc_client_channel_init, diff --git a/src/core/tsi/gts_transport_security.c b/src/core/tsi/gts_transport_security.c new file mode 100644 index 0000000000..e2ac685e44 --- /dev/null +++ b/src/core/tsi/gts_transport_security.c @@ -0,0 +1,40 @@ +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "src/core/tsi/gts_transport_security.h" + +#include <string.h> + +static gts_shared_resource g_gts_resource; + +gts_shared_resource *gts_get_shared_resource(void) { return &g_gts_resource; } + +void grpc_tsi_gts_init() { + memset(&g_gts_resource, 0, sizeof(gts_shared_resource)); + gpr_mu_init(&g_gts_resource.mu); +} + +void grpc_tsi_gts_shutdown() { + gpr_mu_destroy(&g_gts_resource.mu); + if (g_gts_resource.cq == NULL) { + return; + } + grpc_completion_queue_destroy(g_gts_resource.cq); + grpc_channel_destroy(g_gts_resource.channel); + gpr_thd_join(g_gts_resource.thread_id); +} diff --git a/src/core/tsi/gts_transport_security.h b/src/core/tsi/gts_transport_security.h new file mode 100644 index 0000000000..538e1030bc --- /dev/null +++ b/src/core/tsi/gts_transport_security.h @@ -0,0 +1,37 @@ +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPC_CORE_TSI_GTS_TRANSPORT_SECURITY_H +#define GRPC_CORE_TSI_GTS_TRANSPORT_SECURITY_H + +#include <grpc/grpc.h> +#include <grpc/support/sync.h> +#include <grpc/support/thd.h> + +typedef struct gts_shared_resource { + gpr_thd_id thread_id; + grpc_channel *channel; + grpc_completion_queue *cq; + gpr_mu mu; +} gts_shared_resource; + +/* This method returns the address of gts_shared_resource object shared by all + * TSI handshakes. */ +gts_shared_resource *gts_get_shared_resource(void); + +#endif /* GRPC_CORE_TSI_GTS_TRANSPORT_SECURITY_H */ diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index b30d340ce5..17cde1ac8f 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -239,6 +239,7 @@ CORE_SOURCE_FILES = [ 'src/core/lib/security/util/json_util.c', 'src/core/lib/surface/init_secure.c', 'src/core/tsi/fake_transport_security.c', + 'src/core/tsi/gts_transport_security.c', 'src/core/tsi/ssl_transport_security.c', 'src/core/tsi/transport_security.c', 'src/core/tsi/transport_security_adapter.c', diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 4c6c656b1b..bcdcab6c9a 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1402,6 +1402,8 @@ src/core/plugin_registry/grpc_plugin_registry.c \ src/core/tsi/README.md \ src/core/tsi/fake_transport_security.c \ src/core/tsi/fake_transport_security.h \ +src/core/tsi/gts_transport_security.c \ +src/core/tsi/gts_transport_security.h \ src/core/tsi/ssl_transport_security.c \ src/core/tsi/ssl_transport_security.h \ src/core/tsi/ssl_types.h \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 0a91a0cec4..c9ecfe9f39 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -8872,10 +8872,12 @@ { "deps": [ "gpr", + "grpc_base", "grpc_trace" ], "headers": [ "src/core/tsi/fake_transport_security.h", + "src/core/tsi/gts_transport_security.h", "src/core/tsi/ssl_transport_security.h", "src/core/tsi/ssl_types.h", "src/core/tsi/transport_security.h", @@ -8888,6 +8890,8 @@ "src": [ "src/core/tsi/fake_transport_security.c", "src/core/tsi/fake_transport_security.h", + "src/core/tsi/gts_transport_security.c", + "src/core/tsi/gts_transport_security.h", "src/core/tsi/ssl_transport_security.c", "src/core/tsi/ssl_transport_security.h", "src/core/tsi/ssl_types.h", diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj index 112f3ec30a..a7940833fb 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -454,6 +454,7 @@ <ClInclude Include="$(SolutionDir)\..\src\core\lib\security\transport\tsi_error.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\security\util\json_util.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\tsi\fake_transport_security.h" /> + <ClInclude Include="$(SolutionDir)\..\src\core\tsi\gts_transport_security.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\tsi\ssl_transport_security.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\tsi\ssl_types.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\tsi\transport_security.h" /> @@ -876,6 +877,8 @@ </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\core\tsi\fake_transport_security.c"> </ClCompile> + <ClCompile Include="$(SolutionDir)\..\src\core\tsi\gts_transport_security.c"> + </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\core\tsi\ssl_transport_security.c"> </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\core\tsi\transport_security.c"> diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index 5c29e58bad..6857c3d8a1 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -535,6 +535,9 @@ <ClCompile Include="$(SolutionDir)\..\src\core\tsi\fake_transport_security.c"> <Filter>src\core\tsi</Filter> </ClCompile> + <ClCompile Include="$(SolutionDir)\..\src\core\tsi\gts_transport_security.c"> + <Filter>src\core\tsi</Filter> + </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\core\tsi\ssl_transport_security.c"> <Filter>src\core\tsi</Filter> </ClCompile> @@ -1313,6 +1316,9 @@ <ClInclude Include="$(SolutionDir)\..\src\core\tsi\fake_transport_security.h"> <Filter>src\core\tsi</Filter> </ClInclude> + <ClInclude Include="$(SolutionDir)\..\src\core\tsi\gts_transport_security.h"> + <Filter>src\core\tsi</Filter> + </ClInclude> <ClInclude Include="$(SolutionDir)\..\src\core\tsi\ssl_transport_security.h"> <Filter>src\core\tsi</Filter> </ClInclude> |