grpc 1.32.0 → 1.33.0.pre1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grpc might be problematic. Click here for more details.

Files changed (214) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +175 -376
  3. data/include/grpc/grpc.h +0 -5
  4. data/include/grpc/grpc_security.h +16 -0
  5. data/include/grpc/impl/codegen/grpc_types.h +0 -5
  6. data/src/core/ext/filters/client_channel/client_channel.cc +204 -170
  7. data/src/core/ext/filters/client_channel/config_selector.cc +0 -4
  8. data/src/core/ext/filters/client_channel/config_selector.h +34 -5
  9. data/src/core/ext/filters/client_channel/lb_policy.h +1 -1
  10. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +48 -35
  11. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +7 -5
  12. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +3 -2
  13. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +106 -106
  14. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +2 -2
  15. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +3 -3
  16. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +3 -3
  17. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +9 -32
  18. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +3 -3
  19. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +198 -126
  20. data/src/core/ext/filters/client_channel/lb_policy/xds/eds.cc +439 -249
  21. data/src/core/ext/filters/client_channel/lb_policy/xds/eds_drop.cc +571 -0
  22. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +727 -0
  23. data/src/core/ext/filters/client_channel/lb_policy_registry.cc +8 -1
  24. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +1 -1
  25. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +553 -358
  26. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.h +28 -0
  27. data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +8 -39
  28. data/src/core/ext/filters/client_channel/resolver_result_parsing.h +4 -2
  29. data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +44 -43
  30. data/src/core/ext/filters/client_channel/resolving_lb_policy.h +5 -9
  31. data/src/core/ext/filters/client_channel/server_address.cc +80 -0
  32. data/src/core/ext/filters/client_channel/server_address.h +25 -36
  33. data/src/core/ext/filters/client_channel/service_config.cc +16 -13
  34. data/src/core/ext/filters/client_channel/service_config.h +7 -4
  35. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +2 -2
  36. data/src/core/ext/filters/client_channel/service_config_parser.cc +8 -6
  37. data/src/core/ext/filters/client_channel/service_config_parser.h +8 -5
  38. data/src/core/ext/filters/client_channel/subchannel_interface.h +44 -0
  39. data/src/core/ext/filters/message_size/message_size_filter.cc +2 -1
  40. data/src/core/ext/filters/message_size/message_size_filter.h +2 -1
  41. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +17 -10
  42. data/src/core/ext/transport/chttp2/transport/flow_control.cc +10 -2
  43. data/src/core/ext/transport/chttp2/transport/flow_control.h +10 -0
  44. data/src/core/ext/transport/chttp2/transport/internal.h +5 -0
  45. data/src/core/ext/transport/chttp2/transport/parsing.cc +16 -2
  46. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +29 -9
  47. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +66 -0
  48. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +123 -45
  49. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +310 -53
  50. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +17 -5
  51. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +45 -0
  52. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +1 -0
  53. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +16 -9
  54. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +38 -15
  55. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.c +53 -0
  56. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.h +133 -0
  57. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +54 -8
  58. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +123 -5
  59. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +40 -16
  60. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +114 -5
  61. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.c +36 -0
  62. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.h +85 -0
  63. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +36 -16
  64. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +86 -20
  65. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +23 -6
  66. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +54 -5
  67. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +10 -6
  68. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +28 -11
  69. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +184 -57
  70. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +504 -69
  71. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.c +6 -5
  72. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.h +11 -7
  73. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +78 -26
  74. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +236 -25
  75. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +8 -9
  76. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +19 -33
  77. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.c +7 -3
  78. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +16 -0
  79. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +65 -23
  80. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +229 -47
  81. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +20 -10
  82. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +67 -4
  83. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.c +3 -2
  84. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.h +6 -0
  85. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.c +242 -0
  86. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.h +753 -0
  87. data/src/core/ext/upb-generated/udpa/annotations/security.upb.c +31 -0
  88. data/src/core/ext/upb-generated/udpa/annotations/security.upb.h +57 -0
  89. data/src/core/ext/upb-generated/udpa/core/v1/authority.upb.c +28 -0
  90. data/src/core/ext/upb-generated/udpa/core/v1/authority.upb.h +53 -0
  91. data/src/core/ext/upb-generated/udpa/core/v1/collection_entry.upb.c +52 -0
  92. data/src/core/ext/upb-generated/udpa/core/v1/collection_entry.upb.h +129 -0
  93. data/src/core/ext/upb-generated/udpa/core/v1/context_params.upb.c +42 -0
  94. data/src/core/ext/upb-generated/udpa/core/v1/context_params.upb.h +77 -0
  95. data/src/core/ext/upb-generated/udpa/core/v1/resource.upb.c +36 -0
  96. data/src/core/ext/upb-generated/udpa/core/v1/resource.upb.h +85 -0
  97. data/src/core/ext/upb-generated/udpa/core/v1/resource_locator.upb.c +54 -0
  98. data/src/core/ext/upb-generated/udpa/core/v1/resource_locator.upb.h +160 -0
  99. data/src/core/ext/upb-generated/udpa/core/v1/resource_name.upb.c +36 -0
  100. data/src/core/ext/upb-generated/udpa/core/v1/resource_name.upb.h +84 -0
  101. data/src/core/ext/xds/certificate_provider_factory.h +59 -0
  102. data/src/core/ext/xds/certificate_provider_registry.cc +103 -0
  103. data/src/core/ext/xds/certificate_provider_registry.h +57 -0
  104. data/src/core/ext/xds/certificate_provider_store.h +50 -0
  105. data/src/core/ext/xds/google_mesh_ca_certificate_provider_factory.cc +377 -0
  106. data/src/core/ext/xds/google_mesh_ca_certificate_provider_factory.h +102 -0
  107. data/src/core/ext/xds/xds_api.cc +301 -93
  108. data/src/core/ext/xds/xds_api.h +129 -92
  109. data/src/core/ext/xds/xds_channel_args.h +6 -3
  110. data/src/core/ext/xds/xds_client.cc +498 -410
  111. data/src/core/ext/xds/xds_client.h +105 -51
  112. data/src/core/ext/xds/xds_client_stats.cc +18 -12
  113. data/src/core/ext/xds/xds_client_stats.h +33 -5
  114. data/src/core/lib/channel/channel_args.h +0 -1
  115. data/src/core/lib/channel/channelz.cc +10 -45
  116. data/src/core/lib/channel/channelz.h +11 -19
  117. data/src/core/lib/channel/channelz_registry.cc +12 -11
  118. data/src/core/lib/channel/channelz_registry.h +3 -0
  119. data/src/core/lib/gpr/time_precise.cc +2 -0
  120. data/src/core/lib/gpr/time_precise.h +6 -2
  121. data/src/core/lib/gprpp/dual_ref_counted.h +336 -0
  122. data/src/core/lib/gprpp/ref_counted.h +51 -22
  123. data/src/core/lib/gprpp/ref_counted_ptr.h +153 -0
  124. data/src/core/lib/iomgr/endpoint_cfstream.cc +9 -5
  125. data/src/core/lib/iomgr/exec_ctx.h +10 -8
  126. data/src/core/lib/json/json_util.cc +58 -0
  127. data/src/core/lib/json/json_util.h +37 -0
  128. data/src/core/lib/security/certificate_provider.h +60 -0
  129. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc +321 -0
  130. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h +214 -0
  131. data/src/core/lib/security/credentials/xds/xds_credentials.cc +45 -0
  132. data/src/core/lib/security/credentials/xds/xds_credentials.h +51 -0
  133. data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +6 -10
  134. data/src/core/lib/security/security_connector/ssl_utils.h +5 -0
  135. data/src/core/lib/surface/channel.cc +9 -31
  136. data/src/core/lib/surface/channel.h +6 -1
  137. data/src/core/lib/surface/init.cc +26 -9
  138. data/src/core/lib/surface/version.cc +2 -2
  139. data/src/core/lib/transport/bdp_estimator.h +2 -1
  140. data/src/core/lib/transport/connectivity_state.h +2 -2
  141. data/src/core/lib/transport/metadata.cc +11 -1
  142. data/src/core/plugin_registry/grpc_plugin_registry.cc +35 -20
  143. data/src/core/tsi/ssl_transport_security.cc +2 -2
  144. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -2
  145. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +3 -3
  146. data/src/ruby/lib/grpc/version.rb +1 -1
  147. data/third_party/boringssl-with-bazel/err_data.c +465 -463
  148. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_lib.c +0 -6
  149. data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +9 -43
  150. data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa_asn1.c +55 -4
  151. data/third_party/boringssl-with-bazel/src/crypto/dsa/internal.h +34 -0
  152. data/third_party/boringssl-with-bazel/src/crypto/evp/evp.c +4 -0
  153. data/third_party/boringssl-with-bazel/src/crypto/evp/p_dsa_asn1.c +6 -2
  154. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digest.c +2 -0
  155. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +4 -0
  156. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +30 -10
  157. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +10 -15
  158. data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +98 -11
  159. data/third_party/boringssl-with-bazel/src/crypto/hpke/internal.h +51 -6
  160. data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +44 -2
  161. data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +221 -49
  162. data/third_party/boringssl-with-bazel/src/crypto/trust_token/trust_token.c +64 -20
  163. data/third_party/boringssl-with-bazel/src/crypto/x509/a_strex.c +3 -3
  164. data/third_party/boringssl-with-bazel/src/crypto/x509/algorithm.c +0 -8
  165. data/third_party/boringssl-with-bazel/src/crypto/x509/t_crl.c +3 -3
  166. data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509.c +1 -1
  167. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_cmp.c +7 -2
  168. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_ext.c +21 -18
  169. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_obj.c +1 -1
  170. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +24 -3
  171. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +3 -3
  172. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_txt.c +67 -67
  173. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_v3.c +3 -3
  174. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +29 -35
  175. data/third_party/boringssl-with-bazel/src/crypto/x509/x509cset.c +13 -2
  176. data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +9 -8
  177. data/third_party/boringssl-with-bazel/src/crypto/x509/x_all.c +10 -10
  178. data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +2 -2
  179. data/third_party/boringssl-with-bazel/src/crypto/x509/x_name.c +28 -40
  180. data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +3 -1
  181. data/third_party/boringssl-with-bazel/src/crypto/x509v3/ext_dat.h +1 -4
  182. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_conf.c +7 -3
  183. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_genn.c +2 -2
  184. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_info.c +1 -1
  185. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +55 -8
  186. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_skey.c +1 -1
  187. data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +0 -1
  188. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +1 -1
  189. data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +6 -0
  190. data/third_party/boringssl-with-bazel/src/include/openssl/crypto.h +1 -1
  191. data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +12 -0
  192. data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +9 -0
  193. data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +4 -1
  194. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +9 -2
  195. data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +26 -6
  196. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +188 -78
  197. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +52 -43
  198. data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +18 -18
  199. data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +2 -3
  200. data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +1 -1
  201. data/third_party/boringssl-with-bazel/src/ssl/internal.h +9 -9
  202. data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +8 -9
  203. data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +1 -2
  204. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +4 -8
  205. data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +2 -2
  206. metadata +72 -42
  207. data/src/core/ext/filters/client_channel/lb_policy/xds/lrs.cc +0 -537
  208. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc +0 -1141
  209. data/src/core/ext/upb-generated/gogoproto/gogo.upb.c +0 -17
  210. data/src/core/ext/upb-generated/gogoproto/gogo.upb.h +0 -29
  211. data/src/core/ext/xds/xds_channel.h +0 -46
  212. data/src/core/ext/xds/xds_channel_secure.cc +0 -103
  213. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_pku.c +0 -110
  214. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_sxnet.c +0 -274
@@ -1,17 +0,0 @@
1
- /* This file was generated by upbc (the upb compiler) from the input
2
- * file:
3
- *
4
- * gogoproto/gogo.proto
5
- *
6
- * Do not edit -- your changes will be discarded when the file is
7
- * regenerated. */
8
-
9
- #include <stddef.h>
10
- #include "upb/msg.h"
11
- #include "gogoproto/gogo.upb.h"
12
- #include "google/protobuf/descriptor.upb.h"
13
-
14
- #include "upb/port_def.inc"
15
-
16
- #include "upb/port_undef.inc"
17
-
@@ -1,29 +0,0 @@
1
- /* This file was generated by upbc (the upb compiler) from the input
2
- * file:
3
- *
4
- * gogoproto/gogo.proto
5
- *
6
- * Do not edit -- your changes will be discarded when the file is
7
- * regenerated. */
8
-
9
- #ifndef GOGOPROTO_GOGO_PROTO_UPB_H_
10
- #define GOGOPROTO_GOGO_PROTO_UPB_H_
11
-
12
- #include "upb/msg.h"
13
- #include "upb/decode.h"
14
- #include "upb/encode.h"
15
-
16
- #include "upb/port_def.inc"
17
-
18
- #ifdef __cplusplus
19
- extern "C" {
20
- #endif
21
-
22
-
23
- #ifdef __cplusplus
24
- } /* extern "C" */
25
- #endif
26
-
27
- #include "upb/port_undef.inc"
28
-
29
- #endif /* GOGOPROTO_GOGO_PROTO_UPB_H_ */
@@ -1,46 +0,0 @@
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
-
19
- #ifndef GRPC_CORE_EXT_XDS_XDS_CHANNEL_H
20
- #define GRPC_CORE_EXT_XDS_XDS_CHANNEL_H
21
-
22
- #include <grpc/support/port_platform.h>
23
-
24
- #include <grpc/impl/codegen/grpc_types.h>
25
-
26
- #include "src/core/ext/xds/xds_bootstrap.h"
27
- #include "src/core/lib/iomgr/error.h"
28
-
29
- namespace grpc_core {
30
-
31
- /// Makes any necessary modifications to \a args for use in the xds
32
- /// balancer channel.
33
- ///
34
- /// Takes ownership of \a args.
35
- ///
36
- /// Caller takes ownership of the returned args.
37
- grpc_channel_args* ModifyXdsChannelArgs(grpc_channel_args* args);
38
-
39
- grpc_channel* CreateXdsChannel(const XdsBootstrap& bootstrap,
40
- const grpc_channel_args& args,
41
- grpc_error** error);
42
-
43
- } // namespace grpc_core
44
-
45
- #endif /* GRPC_CORE_EXT_XDS_XDS_CHANNEL_H \
46
- */
@@ -1,103 +0,0 @@
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
-
19
- #include <grpc/support/port_platform.h>
20
-
21
- #include "src/core/ext/xds/xds_channel.h"
22
-
23
- #include <string.h>
24
-
25
- #include "absl/container/inlined_vector.h"
26
-
27
- #include <grpc/grpc_security.h>
28
- #include <grpc/support/alloc.h>
29
- #include <grpc/support/string_util.h>
30
-
31
- #include "src/core/lib/channel/channel_args.h"
32
- #include "src/core/lib/gpr/string.h"
33
- #include "src/core/lib/iomgr/sockaddr_utils.h"
34
- #include "src/core/lib/security/credentials/credentials.h"
35
- #include "src/core/lib/security/credentials/fake/fake_credentials.h"
36
- #include "src/core/lib/slice/slice_internal.h"
37
-
38
- namespace grpc_core {
39
-
40
- grpc_channel_args* ModifyXdsChannelArgs(grpc_channel_args* args) {
41
- absl::InlinedVector<const char*, 1> args_to_remove;
42
- absl::InlinedVector<grpc_arg, 2> args_to_add;
43
- // Substitute the channel credentials with a version without call
44
- // credentials: the load balancer is not necessarily trusted to handle
45
- // bearer token credentials.
46
- grpc_channel_credentials* channel_credentials =
47
- grpc_channel_credentials_find_in_args(args);
48
- RefCountedPtr<grpc_channel_credentials> creds_sans_call_creds;
49
- if (channel_credentials != nullptr) {
50
- creds_sans_call_creds =
51
- channel_credentials->duplicate_without_call_credentials();
52
- GPR_ASSERT(creds_sans_call_creds != nullptr);
53
- args_to_remove.emplace_back(GRPC_ARG_CHANNEL_CREDENTIALS);
54
- args_to_add.emplace_back(
55
- grpc_channel_credentials_to_arg(creds_sans_call_creds.get()));
56
- }
57
- grpc_channel_args* result = grpc_channel_args_copy_and_add_and_remove(
58
- args, args_to_remove.data(), args_to_remove.size(), args_to_add.data(),
59
- args_to_add.size());
60
- // Clean up.
61
- grpc_channel_args_destroy(args);
62
- return result;
63
- }
64
-
65
- grpc_channel* CreateXdsChannel(const XdsBootstrap& bootstrap,
66
- const grpc_channel_args& args,
67
- grpc_error** error) {
68
- grpc_channel_credentials* creds = nullptr;
69
- RefCountedPtr<grpc_channel_credentials> creds_to_unref;
70
- if (!bootstrap.server().channel_creds.empty()) {
71
- for (size_t i = 0; i < bootstrap.server().channel_creds.size(); ++i) {
72
- if (bootstrap.server().channel_creds[i].type == "google_default") {
73
- creds = grpc_google_default_credentials_create(nullptr);
74
- break;
75
- } else if (bootstrap.server().channel_creds[i].type == "fake") {
76
- creds = grpc_fake_transport_security_credentials_create();
77
- break;
78
- }
79
- }
80
- if (creds == nullptr) {
81
- *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
82
- "no supported credential types found");
83
- return nullptr;
84
- }
85
- creds_to_unref.reset(creds);
86
- } else {
87
- creds = grpc_channel_credentials_find_in_args(&args);
88
- if (creds == nullptr) {
89
- // Built with security but parent channel is insecure.
90
- return grpc_insecure_channel_create(bootstrap.server().server_uri.c_str(),
91
- &args, nullptr);
92
- }
93
- }
94
- const char* arg_to_remove = GRPC_ARG_CHANNEL_CREDENTIALS;
95
- grpc_channel_args* new_args =
96
- grpc_channel_args_copy_and_remove(&args, &arg_to_remove, 1);
97
- grpc_channel* channel = grpc_secure_channel_create(
98
- creds, bootstrap.server().server_uri.c_str(), new_args, nullptr);
99
- grpc_channel_args_destroy(new_args);
100
- return channel;
101
- }
102
-
103
- } // namespace grpc_core
@@ -1,110 +0,0 @@
1
- /* v3_pku.c */
2
- /*
3
- * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
4
- * 1999.
5
- */
6
- /* ====================================================================
7
- * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
8
- *
9
- * Redistribution and use in source and binary forms, with or without
10
- * modification, are permitted provided that the following conditions
11
- * are met:
12
- *
13
- * 1. Redistributions of source code must retain the above copyright
14
- * notice, this list of conditions and the following disclaimer.
15
- *
16
- * 2. Redistributions in binary form must reproduce the above copyright
17
- * notice, this list of conditions and the following disclaimer in
18
- * the documentation and/or other materials provided with the
19
- * distribution.
20
- *
21
- * 3. All advertising materials mentioning features or use of this
22
- * software must display the following acknowledgment:
23
- * "This product includes software developed by the OpenSSL Project
24
- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
25
- *
26
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
27
- * endorse or promote products derived from this software without
28
- * prior written permission. For written permission, please contact
29
- * licensing@OpenSSL.org.
30
- *
31
- * 5. Products derived from this software may not be called "OpenSSL"
32
- * nor may "OpenSSL" appear in their names without prior written
33
- * permission of the OpenSSL Project.
34
- *
35
- * 6. Redistributions of any form whatsoever must retain the following
36
- * acknowledgment:
37
- * "This product includes software developed by the OpenSSL Project
38
- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
39
- *
40
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
41
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
44
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51
- * OF THE POSSIBILITY OF SUCH DAMAGE.
52
- * ====================================================================
53
- *
54
- * This product includes cryptographic software written by Eric Young
55
- * (eay@cryptsoft.com). This product includes software written by Tim
56
- * Hudson (tjh@cryptsoft.com). */
57
-
58
- #include <stdio.h>
59
-
60
- #include <openssl/asn1.h>
61
- #include <openssl/asn1t.h>
62
- #include <openssl/mem.h>
63
- #include <openssl/obj.h>
64
- #include <openssl/x509v3.h>
65
-
66
- static int i2r_PKEY_USAGE_PERIOD(X509V3_EXT_METHOD *method,
67
- PKEY_USAGE_PERIOD *usage, BIO *out,
68
- int indent);
69
- /*
70
- * static PKEY_USAGE_PERIOD *v2i_PKEY_USAGE_PERIOD(X509V3_EXT_METHOD *method,
71
- * X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *values);
72
- */
73
- const X509V3_EXT_METHOD v3_pkey_usage_period = {
74
- NID_private_key_usage_period, 0, ASN1_ITEM_ref(PKEY_USAGE_PERIOD),
75
- 0, 0, 0, 0,
76
- 0, 0, 0, 0,
77
- (X509V3_EXT_I2R)i2r_PKEY_USAGE_PERIOD, NULL,
78
- NULL
79
- };
80
-
81
- ASN1_SEQUENCE(PKEY_USAGE_PERIOD) = {
82
- ASN1_IMP_OPT(PKEY_USAGE_PERIOD, notBefore, ASN1_GENERALIZEDTIME, 0),
83
- ASN1_IMP_OPT(PKEY_USAGE_PERIOD, notAfter, ASN1_GENERALIZEDTIME, 1)
84
- } ASN1_SEQUENCE_END(PKEY_USAGE_PERIOD)
85
-
86
- IMPLEMENT_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD)
87
-
88
- static int i2r_PKEY_USAGE_PERIOD(X509V3_EXT_METHOD *method,
89
- PKEY_USAGE_PERIOD *usage, BIO *out,
90
- int indent)
91
- {
92
- BIO_printf(out, "%*s", indent, "");
93
- if (usage->notBefore) {
94
- BIO_write(out, "Not Before: ", 12);
95
- ASN1_GENERALIZEDTIME_print(out, usage->notBefore);
96
- if (usage->notAfter)
97
- BIO_write(out, ", ", 2);
98
- }
99
- if (usage->notAfter) {
100
- BIO_write(out, "Not After: ", 11);
101
- ASN1_GENERALIZEDTIME_print(out, usage->notAfter);
102
- }
103
- return 1;
104
- }
105
-
106
- /*
107
- * static PKEY_USAGE_PERIOD *v2i_PKEY_USAGE_PERIOD(method, ctx, values)
108
- * X509V3_EXT_METHOD *method; X509V3_CTX *ctx; STACK_OF(CONF_VALUE) *values;
109
- * { return NULL; }
110
- */
@@ -1,274 +0,0 @@
1
- /* v3_sxnet.c */
2
- /*
3
- * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
4
- * 1999.
5
- */
6
- /* ====================================================================
7
- * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
8
- *
9
- * Redistribution and use in source and binary forms, with or without
10
- * modification, are permitted provided that the following conditions
11
- * are met:
12
- *
13
- * 1. Redistributions of source code must retain the above copyright
14
- * notice, this list of conditions and the following disclaimer.
15
- *
16
- * 2. Redistributions in binary form must reproduce the above copyright
17
- * notice, this list of conditions and the following disclaimer in
18
- * the documentation and/or other materials provided with the
19
- * distribution.
20
- *
21
- * 3. All advertising materials mentioning features or use of this
22
- * software must display the following acknowledgment:
23
- * "This product includes software developed by the OpenSSL Project
24
- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
25
- *
26
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
27
- * endorse or promote products derived from this software without
28
- * prior written permission. For written permission, please contact
29
- * licensing@OpenSSL.org.
30
- *
31
- * 5. Products derived from this software may not be called "OpenSSL"
32
- * nor may "OpenSSL" appear in their names without prior written
33
- * permission of the OpenSSL Project.
34
- *
35
- * 6. Redistributions of any form whatsoever must retain the following
36
- * acknowledgment:
37
- * "This product includes software developed by the OpenSSL Project
38
- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
39
- *
40
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
41
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
44
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51
- * OF THE POSSIBILITY OF SUCH DAMAGE.
52
- * ====================================================================
53
- *
54
- * This product includes cryptographic software written by Eric Young
55
- * (eay@cryptsoft.com). This product includes software written by Tim
56
- * Hudson (tjh@cryptsoft.com).
57
- *
58
- */
59
-
60
- #include <stdio.h>
61
- #include <string.h>
62
-
63
- #include <openssl/asn1.h>
64
- #include <openssl/asn1t.h>
65
- #include <openssl/conf.h>
66
- #include <openssl/err.h>
67
- #include <openssl/mem.h>
68
- #include <openssl/obj.h>
69
- #include <openssl/x509v3.h>
70
-
71
- /* Support for Thawte strong extranet extension */
72
-
73
- #define SXNET_TEST
74
-
75
- static int sxnet_i2r(X509V3_EXT_METHOD *method, SXNET *sx, BIO *out,
76
- int indent);
77
- #ifdef SXNET_TEST
78
- static SXNET *sxnet_v2i(X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
79
- STACK_OF(CONF_VALUE) *nval);
80
- #endif
81
- const X509V3_EXT_METHOD v3_sxnet = {
82
- NID_sxnet, X509V3_EXT_MULTILINE, ASN1_ITEM_ref(SXNET),
83
- 0, 0, 0, 0,
84
- 0, 0,
85
- 0,
86
- #ifdef SXNET_TEST
87
- (X509V3_EXT_V2I)sxnet_v2i,
88
- #else
89
- 0,
90
- #endif
91
- (X509V3_EXT_I2R)sxnet_i2r,
92
- 0,
93
- NULL
94
- };
95
-
96
- ASN1_SEQUENCE(SXNETID) = {
97
- ASN1_SIMPLE(SXNETID, zone, ASN1_INTEGER),
98
- ASN1_SIMPLE(SXNETID, user, ASN1_OCTET_STRING)
99
- } ASN1_SEQUENCE_END(SXNETID)
100
-
101
- IMPLEMENT_ASN1_FUNCTIONS(SXNETID)
102
-
103
- ASN1_SEQUENCE(SXNET) = {
104
- ASN1_SIMPLE(SXNET, version, ASN1_INTEGER),
105
- ASN1_SEQUENCE_OF(SXNET, ids, SXNETID)
106
- } ASN1_SEQUENCE_END(SXNET)
107
-
108
- IMPLEMENT_ASN1_FUNCTIONS(SXNET)
109
-
110
- static int sxnet_i2r(X509V3_EXT_METHOD *method, SXNET *sx, BIO *out,
111
- int indent)
112
- {
113
- long v;
114
- char *tmp;
115
- SXNETID *id;
116
- size_t i;
117
- v = ASN1_INTEGER_get(sx->version);
118
- BIO_printf(out, "%*sVersion: %ld (0x%lX)", indent, "", v + 1, v);
119
- for (i = 0; i < sk_SXNETID_num(sx->ids); i++) {
120
- id = sk_SXNETID_value(sx->ids, i);
121
- tmp = i2s_ASN1_INTEGER(NULL, id->zone);
122
- BIO_printf(out, "\n%*sZone: %s, User: ", indent, "", tmp);
123
- OPENSSL_free(tmp);
124
- M_ASN1_OCTET_STRING_print(out, id->user);
125
- }
126
- return 1;
127
- }
128
-
129
- #ifdef SXNET_TEST
130
-
131
- /*
132
- * NBB: this is used for testing only. It should *not* be used for anything
133
- * else because it will just take static IDs from the configuration file and
134
- * they should really be separate values for each user.
135
- */
136
-
137
- static SXNET *sxnet_v2i(X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
138
- STACK_OF(CONF_VALUE) *nval)
139
- {
140
- CONF_VALUE *cnf;
141
- SXNET *sx = NULL;
142
- size_t i;
143
- for (i = 0; i < sk_CONF_VALUE_num(nval); i++) {
144
- cnf = sk_CONF_VALUE_value(nval, i);
145
- if (!SXNET_add_id_asc(&sx, cnf->name, cnf->value, -1))
146
- return NULL;
147
- }
148
- return sx;
149
- }
150
-
151
- #endif
152
-
153
- /* Strong Extranet utility functions */
154
-
155
- /* Add an id given the zone as an ASCII number */
156
-
157
- int SXNET_add_id_asc(SXNET **psx, char *zone, char *user, int userlen)
158
- {
159
- ASN1_INTEGER *izone = NULL;
160
- if (!(izone = s2i_ASN1_INTEGER(NULL, zone))) {
161
- OPENSSL_PUT_ERROR(X509V3, X509V3_R_ERROR_CONVERTING_ZONE);
162
- return 0;
163
- }
164
- return SXNET_add_id_INTEGER(psx, izone, user, userlen);
165
- }
166
-
167
- /* Add an id given the zone as an unsigned long */
168
-
169
- int SXNET_add_id_ulong(SXNET **psx, unsigned long lzone, char *user,
170
- int userlen)
171
- {
172
- ASN1_INTEGER *izone = NULL;
173
- if (!(izone = M_ASN1_INTEGER_new()) || !ASN1_INTEGER_set(izone, lzone)) {
174
- OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE);
175
- M_ASN1_INTEGER_free(izone);
176
- return 0;
177
- }
178
- return SXNET_add_id_INTEGER(psx, izone, user, userlen);
179
-
180
- }
181
-
182
- /*
183
- * Add an id given the zone as an ASN1_INTEGER. Note this version uses the
184
- * passed integer and doesn't make a copy so don't free it up afterwards.
185
- */
186
-
187
- int SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *zone, char *user,
188
- int userlen)
189
- {
190
- SXNET *sx = NULL;
191
- SXNETID *id = NULL;
192
- if (!psx || !zone || !user) {
193
- OPENSSL_PUT_ERROR(X509V3, X509V3_R_INVALID_NULL_ARGUMENT);
194
- return 0;
195
- }
196
- if (userlen == -1)
197
- userlen = strlen(user);
198
- if (userlen > 64) {
199
- OPENSSL_PUT_ERROR(X509V3, X509V3_R_USER_TOO_LONG);
200
- return 0;
201
- }
202
- if (!*psx) {
203
- if (!(sx = SXNET_new()))
204
- goto err;
205
- if (!ASN1_INTEGER_set(sx->version, 0))
206
- goto err;
207
- *psx = sx;
208
- } else
209
- sx = *psx;
210
- if (SXNET_get_id_INTEGER(sx, zone)) {
211
- OPENSSL_PUT_ERROR(X509V3, X509V3_R_DUPLICATE_ZONE_ID);
212
- return 0;
213
- }
214
-
215
- if (!(id = SXNETID_new()))
216
- goto err;
217
- if (userlen == -1)
218
- userlen = strlen(user);
219
-
220
- if (!M_ASN1_OCTET_STRING_set(id->user, user, userlen))
221
- goto err;
222
- if (!sk_SXNETID_push(sx->ids, id))
223
- goto err;
224
- id->zone = zone;
225
- return 1;
226
-
227
- err:
228
- OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE);
229
- SXNETID_free(id);
230
- SXNET_free(sx);
231
- *psx = NULL;
232
- return 0;
233
- }
234
-
235
- ASN1_OCTET_STRING *SXNET_get_id_asc(SXNET *sx, char *zone)
236
- {
237
- ASN1_INTEGER *izone = NULL;
238
- ASN1_OCTET_STRING *oct;
239
- if (!(izone = s2i_ASN1_INTEGER(NULL, zone))) {
240
- OPENSSL_PUT_ERROR(X509V3, X509V3_R_ERROR_CONVERTING_ZONE);
241
- return NULL;
242
- }
243
- oct = SXNET_get_id_INTEGER(sx, izone);
244
- M_ASN1_INTEGER_free(izone);
245
- return oct;
246
- }
247
-
248
- ASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone)
249
- {
250
- ASN1_INTEGER *izone = NULL;
251
- ASN1_OCTET_STRING *oct;
252
- if (!(izone = M_ASN1_INTEGER_new()) || !ASN1_INTEGER_set(izone, lzone)) {
253
- OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE);
254
- M_ASN1_INTEGER_free(izone);
255
- return NULL;
256
- }
257
- oct = SXNET_get_id_INTEGER(sx, izone);
258
- M_ASN1_INTEGER_free(izone);
259
- return oct;
260
- }
261
-
262
- ASN1_OCTET_STRING *SXNET_get_id_INTEGER(SXNET *sx, ASN1_INTEGER *zone)
263
- {
264
- SXNETID *id;
265
- size_t i;
266
- for (i = 0; i < sk_SXNETID_num(sx->ids); i++) {
267
- id = sk_SXNETID_value(sx->ids, i);
268
- if (!M_ASN1_INTEGER_cmp(id->zone, zone))
269
- return id->user;
270
- }
271
- return NULL;
272
- }
273
-
274
- IMPLEMENT_ASN1_SET_OF(SXNETID)