grpc 1.38.0 → 1.39.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 (199) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +50 -19
  3. data/include/grpc/event_engine/endpoint_config.h +48 -0
  4. data/include/grpc/event_engine/event_engine.h +13 -15
  5. data/include/grpc/event_engine/port.h +2 -0
  6. data/include/grpc/event_engine/slice_allocator.h +17 -7
  7. data/include/grpc/grpc.h +9 -2
  8. data/include/grpc/grpc_security.h +32 -0
  9. data/include/grpc/grpc_security_constants.h +1 -0
  10. data/include/grpc/impl/codegen/grpc_types.h +17 -13
  11. data/include/grpc/impl/codegen/port_platform.h +17 -0
  12. data/src/core/ext/filters/client_channel/client_channel.cc +2 -2
  13. data/src/core/ext/filters/client_channel/health/health_check_client.cc +2 -0
  14. data/src/core/ext/filters/client_channel/health/health_check_client.h +3 -3
  15. data/src/core/ext/filters/client_channel/http_proxy.cc +16 -1
  16. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +755 -0
  17. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +10 -0
  18. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +10 -24
  19. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +63 -95
  20. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +1 -3
  21. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_event_engine.cc +31 -0
  22. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_event_engine.cc +28 -0
  23. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +1 -3
  24. data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +7 -2
  25. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +15 -3
  26. data/src/core/ext/filters/client_channel/retry_filter.cc +665 -404
  27. data/src/core/ext/filters/client_channel/retry_service_config.cc +43 -24
  28. data/src/core/ext/filters/client_channel/retry_service_config.h +8 -2
  29. data/src/core/ext/filters/client_idle/client_idle_filter.cc +1 -1
  30. data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +6 -0
  31. data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +2 -1
  32. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +3 -2
  33. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +10 -4
  34. data/src/core/ext/transport/chttp2/transport/internal.h +1 -0
  35. data/src/core/ext/transport/chttp2/transport/parsing.cc +2 -2
  36. data/src/core/ext/transport/inproc/inproc_transport.cc +42 -31
  37. data/src/core/ext/xds/xds_api.cc +247 -106
  38. data/src/core/ext/xds/xds_api.h +15 -6
  39. data/src/core/lib/address_utils/sockaddr_utils.cc +13 -0
  40. data/src/core/lib/address_utils/sockaddr_utils.h +10 -0
  41. data/src/core/lib/channel/channelz.h +3 -0
  42. data/src/core/lib/event_engine/endpoint_config.cc +46 -0
  43. data/src/core/lib/event_engine/endpoint_config_internal.h +42 -0
  44. data/src/core/lib/event_engine/event_engine.cc +50 -0
  45. data/src/core/lib/event_engine/slice_allocator.cc +33 -3
  46. data/src/core/lib/event_engine/sockaddr.cc +14 -12
  47. data/src/core/lib/event_engine/sockaddr.h +44 -0
  48. data/src/core/lib/gpr/wrap_memcpy.cc +2 -1
  49. data/src/core/lib/gprpp/status_helper.h +3 -0
  50. data/src/core/lib/iomgr/endpoint_pair_event_engine.cc +33 -0
  51. data/src/core/lib/iomgr/error.cc +5 -4
  52. data/src/core/lib/iomgr/error.h +1 -1
  53. data/src/core/lib/iomgr/event_engine/closure.cc +54 -0
  54. data/src/core/lib/iomgr/event_engine/closure.h +33 -0
  55. data/src/core/lib/iomgr/event_engine/endpoint.cc +194 -0
  56. data/src/core/lib/iomgr/event_engine/endpoint.h +53 -0
  57. data/src/core/lib/iomgr/event_engine/iomgr.cc +105 -0
  58. data/src/core/lib/iomgr/event_engine/iomgr.h +24 -0
  59. data/src/core/lib/iomgr/event_engine/pollset.cc +87 -0
  60. data/{include/grpc/event_engine/channel_args.h → src/core/lib/iomgr/event_engine/pollset.h} +7 -10
  61. data/src/core/lib/iomgr/event_engine/promise.h +51 -0
  62. data/src/core/lib/iomgr/event_engine/resolved_address_internal.cc +41 -0
  63. data/src/core/lib/iomgr/event_engine/resolved_address_internal.h +35 -0
  64. data/src/core/lib/iomgr/event_engine/resolver.cc +110 -0
  65. data/src/core/lib/iomgr/event_engine/tcp.cc +243 -0
  66. data/src/core/lib/iomgr/event_engine/timer.cc +57 -0
  67. data/src/core/lib/iomgr/exec_ctx.cc +8 -0
  68. data/src/core/lib/iomgr/exec_ctx.h +3 -4
  69. data/src/core/lib/iomgr/executor/threadpool.cc +2 -3
  70. data/src/core/lib/iomgr/executor/threadpool.h +2 -2
  71. data/src/core/lib/iomgr/iomgr.cc +1 -1
  72. data/src/core/lib/iomgr/iomgr_posix.cc +2 -0
  73. data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +40 -10
  74. data/src/core/lib/iomgr/pollset_custom.cc +2 -2
  75. data/src/core/lib/iomgr/pollset_custom.h +3 -1
  76. data/src/core/lib/iomgr/pollset_uv.cc +3 -1
  77. data/src/core/lib/iomgr/pollset_uv.h +5 -1
  78. data/src/core/lib/iomgr/port.h +7 -5
  79. data/src/core/lib/iomgr/resolve_address.cc +5 -1
  80. data/src/core/lib/iomgr/resolve_address.h +6 -0
  81. data/src/core/lib/iomgr/sockaddr.h +1 -0
  82. data/src/core/lib/iomgr/socket_mutator.cc +15 -2
  83. data/src/core/lib/iomgr/socket_mutator.h +26 -2
  84. data/src/core/lib/iomgr/socket_utils_common_posix.cc +4 -4
  85. data/src/core/lib/iomgr/socket_utils_posix.h +2 -2
  86. data/src/core/lib/iomgr/tcp_client_posix.cc +7 -2
  87. data/src/core/lib/iomgr/tcp_posix.cc +42 -39
  88. data/src/core/lib/iomgr/tcp_posix.h +8 -0
  89. data/src/core/lib/iomgr/tcp_server_custom.cc +3 -4
  90. data/src/core/lib/iomgr/tcp_server_posix.cc +6 -0
  91. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +2 -1
  92. data/src/core/lib/iomgr/timer.h +6 -1
  93. data/src/core/lib/security/authorization/authorization_engine.h +44 -0
  94. data/src/core/lib/security/authorization/authorization_policy_provider.h +32 -0
  95. data/src/core/lib/security/authorization/authorization_policy_provider_vtable.cc +46 -0
  96. data/src/core/lib/security/authorization/evaluate_args.cc +209 -0
  97. data/src/core/lib/security/authorization/evaluate_args.h +91 -0
  98. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +3 -1
  99. data/src/core/lib/security/credentials/tls/tls_utils.cc +32 -0
  100. data/src/core/lib/security/credentials/tls/tls_utils.h +13 -0
  101. data/src/core/lib/security/security_connector/local/local_security_connector.cc +9 -6
  102. data/src/core/lib/security/security_connector/ssl_utils.cc +5 -0
  103. data/src/core/lib/surface/call.cc +21 -1
  104. data/src/core/lib/surface/call.h +11 -0
  105. data/src/core/lib/surface/completion_queue.cc +22 -22
  106. data/src/core/lib/surface/completion_queue.h +1 -1
  107. data/src/core/lib/surface/completion_queue_factory.cc +1 -2
  108. data/src/core/lib/surface/init.cc +1 -3
  109. data/src/core/lib/surface/init.h +10 -1
  110. data/src/core/lib/surface/version.cc +1 -1
  111. data/src/core/lib/transport/error_utils.cc +2 -2
  112. data/src/core/lib/transport/transport.h +2 -0
  113. data/src/core/lib/transport/transport_op_string.cc +1 -1
  114. data/src/core/plugin_registry/grpc_plugin_registry.cc +4 -0
  115. data/src/core/tsi/alts/crypt/gsec.h +2 -0
  116. data/src/ruby/ext/grpc/extconf.rb +2 -0
  117. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +6 -0
  118. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +10 -1
  119. data/src/ruby/lib/grpc/version.rb +1 -1
  120. data/third_party/boringssl-with-bazel/err_data.c +269 -263
  121. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_object.c +8 -6
  122. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/cipher_extra.c +4 -0
  123. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519.c +1 -1
  124. data/third_party/boringssl-with-bazel/src/crypto/curve25519/internal.h +1 -1
  125. data/third_party/boringssl-with-bazel/src/crypto/evp/evp.c +9 -0
  126. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/prime.c +0 -4
  127. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digest.c +7 -0
  128. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/md32_common.h +87 -121
  129. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md4/md4.c +20 -30
  130. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md5/md5.c +19 -30
  131. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +1 -4
  132. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +0 -13
  133. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +26 -24
  134. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +10 -7
  135. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha1.c +28 -39
  136. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha256.c +48 -66
  137. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha512.c +4 -5
  138. data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +362 -371
  139. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7_x509.c +4 -2
  140. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/passive.c +2 -2
  141. data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/rsa_asn1.c +1 -2
  142. data/third_party/boringssl-with-bazel/src/crypto/x509/internal.h +101 -11
  143. data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509a.c +3 -0
  144. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_cmp.c +2 -2
  145. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_req.c +3 -0
  146. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +1 -1
  147. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +2 -0
  148. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +14 -15
  149. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vpm.c +53 -73
  150. data/third_party/boringssl-with-bazel/src/crypto/x509/x509cset.c +31 -0
  151. data/third_party/boringssl-with-bazel/src/crypto/x509/x509rset.c +3 -0
  152. data/third_party/boringssl-with-bazel/src/crypto/x509/x_all.c +3 -0
  153. data/third_party/boringssl-with-bazel/src/crypto/x509/x_req.c +5 -8
  154. data/third_party/boringssl-with-bazel/src/crypto/x509/x_sig.c +5 -0
  155. data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509a.c +3 -0
  156. data/third_party/boringssl-with-bazel/src/crypto/x509v3/internal.h +7 -0
  157. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +1 -1
  158. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_utl.c +5 -8
  159. data/third_party/boringssl-with-bazel/src/include/openssl/aead.h +1 -1
  160. data/third_party/boringssl-with-bazel/src/include/openssl/arm_arch.h +66 -1
  161. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +40 -9
  162. data/third_party/boringssl-with-bazel/src/include/openssl/bytestring.h +1 -0
  163. data/third_party/boringssl-with-bazel/src/include/openssl/chacha.h +1 -1
  164. data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +6 -2
  165. data/third_party/boringssl-with-bazel/src/include/openssl/ecdsa.h +14 -0
  166. data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +19 -11
  167. data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +325 -0
  168. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs7.h +23 -7
  169. data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +99 -63
  170. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +139 -109
  171. data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +12 -19
  172. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +48 -50
  173. data/third_party/boringssl-with-bazel/src/include/openssl/x509_vfy.h +451 -435
  174. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +0 -1
  175. data/third_party/boringssl-with-bazel/src/ssl/d1_both.cc +2 -2
  176. data/third_party/boringssl-with-bazel/src/ssl/d1_srtp.cc +1 -1
  177. data/third_party/boringssl-with-bazel/src/ssl/encrypted_client_hello.cc +773 -84
  178. data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +80 -47
  179. data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +24 -19
  180. data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +189 -86
  181. data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +45 -56
  182. data/third_party/boringssl-with-bazel/src/ssl/internal.h +272 -167
  183. data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +2 -2
  184. data/third_party/boringssl-with-bazel/src/ssl/s3_lib.cc +2 -2
  185. data/third_party/boringssl-with-bazel/src/ssl/s3_pkt.cc +14 -19
  186. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +34 -102
  187. data/third_party/boringssl-with-bazel/src/ssl/ssl_privkey.cc +2 -0
  188. data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +8 -31
  189. data/third_party/boringssl-with-bazel/src/ssl/ssl_stat.cc +3 -0
  190. data/third_party/boringssl-with-bazel/src/ssl/ssl_transcript.cc +4 -3
  191. data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +7 -3
  192. data/third_party/boringssl-with-bazel/src/ssl/t1_lib.cc +576 -648
  193. data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +31 -3
  194. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +98 -39
  195. data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +141 -94
  196. data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +58 -68
  197. metadata +65 -40
  198. data/third_party/boringssl-with-bazel/src/crypto/hpke/internal.h +0 -267
  199. data/third_party/boringssl-with-bazel/src/crypto/x509/vpm_int.h +0 -71
@@ -192,7 +192,8 @@ static int pkcs7_bundle_certificates_cb(CBB *out, const void *arg) {
192
192
  }
193
193
  }
194
194
 
195
- return CBB_flush(out);
195
+ // |certificates| is a implicitly-tagged SET OF.
196
+ return CBB_flush_asn1_set_of(&certificates) && CBB_flush(out);
196
197
  }
197
198
 
198
199
  int PKCS7_bundle_certificates(CBB *out, const STACK_OF(X509) *certs) {
@@ -222,7 +223,8 @@ static int pkcs7_bundle_crls_cb(CBB *out, const void *arg) {
222
223
  }
223
224
  }
224
225
 
225
- return CBB_flush(out);
226
+ // |crl_data| is a implicitly-tagged SET OF.
227
+ return CBB_flush_asn1_set_of(&crl_data) && CBB_flush(out);
226
228
  }
227
229
 
228
230
  int PKCS7_bundle_CRLs(CBB *out, const STACK_OF(X509_CRL) *crls) {
@@ -15,7 +15,7 @@
15
15
  #include <openssl/base.h>
16
16
  #include "../fipsmodule/rand/internal.h"
17
17
 
18
- #if defined(BORINGSSL_FIPS_PASSIVE_ENTROPY)
18
+ #if defined(BORINGSSL_FIPS)
19
19
 
20
20
  // RAND_need_entropy is called by the FIPS module when it has blocked because of
21
21
  // a lack of entropy. This signal is used as an indication to feed it more.
@@ -31,4 +31,4 @@ void RAND_need_entropy(size_t bytes_needed) {
31
31
  RAND_load_entropy(buf, todo, used_cpu);
32
32
  }
33
33
 
34
- #endif // BORINGSSL_FIPS_PASSIVE_ENTROPY
34
+ #endif // FIPS
@@ -102,8 +102,7 @@ RSA *RSA_parse_public_key(CBS *cbs) {
102
102
  return NULL;
103
103
  }
104
104
 
105
- if (!BN_is_odd(ret->e) ||
106
- BN_num_bits(ret->e) < 2) {
105
+ if (!RSA_check_key(ret)) {
107
106
  OPENSSL_PUT_ERROR(RSA, RSA_R_BAD_RSA_PARAMETERS);
108
107
  RSA_free(ret);
109
108
  return NULL;
@@ -1,16 +1,60 @@
1
- /* Copyright (c) 2016, Google Inc.
1
+ /*
2
+ * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
3
+ * 2013.
4
+ */
5
+ /* ====================================================================
6
+ * Copyright (c) 2013 The OpenSSL Project. All rights reserved.
2
7
  *
3
- * Permission to use, copy, modify, and/or distribute this software for any
4
- * purpose with or without fee is hereby granted, provided that the above
5
- * copyright notice and this permission notice appear in all copies.
8
+ * Redistribution and use in source and binary forms, with or without
9
+ * modification, are permitted provided that the following conditions
10
+ * are met:
6
11
  *
7
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10
- * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
12
+ * 1. Redistributions of source code must retain the above copyright
13
+ * notice, this list of conditions and the following disclaimer.
14
+ *
15
+ * 2. Redistributions in binary form must reproduce the above copyright
16
+ * notice, this list of conditions and the following disclaimer in
17
+ * the documentation and/or other materials provided with the
18
+ * distribution.
19
+ *
20
+ * 3. All advertising materials mentioning features or use of this
21
+ * software must display the following acknowledgment:
22
+ * "This product includes software developed by the OpenSSL Project
23
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24
+ *
25
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26
+ * endorse or promote products derived from this software without
27
+ * prior written permission. For written permission, please contact
28
+ * licensing@OpenSSL.org.
29
+ *
30
+ * 5. Products derived from this software may not be called "OpenSSL"
31
+ * nor may "OpenSSL" appear in their names without prior written
32
+ * permission of the OpenSSL Project.
33
+ *
34
+ * 6. Redistributions of any form whatsoever must retain the following
35
+ * acknowledgment:
36
+ * "This product includes software developed by the OpenSSL Project
37
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38
+ *
39
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
51
+ * ====================================================================
52
+ *
53
+ * This product includes cryptographic software written by Eric Young
54
+ * (eay@cryptsoft.com). This product includes software written by Tim
55
+ * Hudson (tjh@cryptsoft.com).
56
+ *
57
+ */
14
58
 
15
59
  #ifndef OPENSSL_HEADER_X509_INTERNAL_H
16
60
  #define OPENSSL_HEADER_X509_INTERNAL_H
@@ -42,6 +86,52 @@ struct x509_attributes_st {
42
86
  STACK_OF(ASN1_TYPE) *set;
43
87
  } /* X509_ATTRIBUTE */;
44
88
 
89
+ struct x509_cert_aux_st {
90
+ STACK_OF(ASN1_OBJECT) *trust; // trusted uses
91
+ STACK_OF(ASN1_OBJECT) *reject; // rejected uses
92
+ ASN1_UTF8STRING *alias; // "friendly name"
93
+ ASN1_OCTET_STRING *keyid; // key id of private key
94
+ STACK_OF(X509_ALGOR) *other; // other unspecified info
95
+ } /* X509_CERT_AUX */;
96
+
97
+ typedef struct {
98
+ ASN1_ENCODING enc;
99
+ ASN1_INTEGER *version;
100
+ X509_NAME *subject;
101
+ X509_PUBKEY *pubkey;
102
+ // d=2 hl=2 l= 0 cons: cont: 00
103
+ STACK_OF(X509_ATTRIBUTE) *attributes; // [ 0 ]
104
+ } X509_REQ_INFO;
105
+
106
+ DECLARE_ASN1_FUNCTIONS(X509_REQ_INFO)
107
+
108
+ struct X509_req_st {
109
+ X509_REQ_INFO *req_info;
110
+ X509_ALGOR *sig_alg;
111
+ ASN1_BIT_STRING *signature;
112
+ CRYPTO_refcount_t references;
113
+ } /* X509_REQ */;
114
+
115
+ struct X509_VERIFY_PARAM_st {
116
+ char *name;
117
+ time_t check_time; // Time to use
118
+ unsigned long inh_flags; // Inheritance flags
119
+ unsigned long flags; // Various verify flags
120
+ int purpose; // purpose to check untrusted certificates
121
+ int trust; // trust setting to check
122
+ int depth; // Verify depth
123
+ STACK_OF(ASN1_OBJECT) *policies; // Permissible policies
124
+ // The following fields specify acceptable peer identities.
125
+ STACK_OF(OPENSSL_STRING) *hosts; // Set of acceptable names
126
+ unsigned int hostflags; // Flags to control matching features
127
+ char *peername; // Matching hostname in peer certificate
128
+ char *email; // If not NULL email address to match
129
+ size_t emaillen;
130
+ unsigned char *ip; // If not NULL IP address to match
131
+ size_t iplen; // Length of IP address
132
+ unsigned char poison; // Fail all verifications at name checking
133
+ } /* X509_VERIFY_PARAM */;
134
+
45
135
 
46
136
  /* RSA-PSS functions. */
47
137
 
@@ -60,6 +60,9 @@
60
60
  #include <openssl/obj.h>
61
61
  #include <openssl/x509.h>
62
62
 
63
+ #include "internal.h"
64
+
65
+
63
66
  /* X509_CERT_AUX and string set routines */
64
67
 
65
68
  int X509_CERT_AUX_print(BIO *out, X509_CERT_AUX *aux, int indent)
@@ -384,7 +384,7 @@ int X509_chain_check_suiteb(int *perror_depth, X509 *x, STACK_OF(X509) *chain,
384
384
  } else
385
385
  i = 0;
386
386
 
387
- if (X509_get_version(x) != X509V3_VERSION) {
387
+ if (X509_get_version(x) != X509_VERSION_3) {
388
388
  rv = X509_V_ERR_SUITE_B_INVALID_VERSION;
389
389
  /* Correct error depth */
390
390
  i = 0;
@@ -402,7 +402,7 @@ int X509_chain_check_suiteb(int *perror_depth, X509 *x, STACK_OF(X509) *chain,
402
402
  for (; i < sk_X509_num(chain); i++) {
403
403
  sign_nid = X509_get_signature_nid(x);
404
404
  x = sk_X509_value(chain, i);
405
- if (X509_get_version(x) != X509V3_VERSION) {
405
+ if (X509_get_version(x) != X509_VERSION_3) {
406
406
  rv = X509_V_ERR_SUITE_B_INVALID_VERSION;
407
407
  goto end;
408
408
  }
@@ -65,6 +65,9 @@
65
65
  #include <openssl/pem.h>
66
66
  #include <openssl/x509.h>
67
67
 
68
+ #include "internal.h"
69
+
70
+
68
71
  X509_REQ *X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md)
69
72
  {
70
73
  X509_REQ *ret;
@@ -67,7 +67,7 @@ long X509_get_version(const X509 *x509)
67
67
  {
68
68
  // The default version is v1(0).
69
69
  if (x509->cert_info->version == NULL) {
70
- return X509V1_VERSION;
70
+ return X509_VERSION_1;
71
71
  }
72
72
  return ASN1_INTEGER_get(x509->cert_info->version);
73
73
  }
@@ -60,6 +60,8 @@
60
60
  #include <openssl/x509v3.h>
61
61
 
62
62
  #include "../x509v3/internal.h"
63
+ #include "internal.h"
64
+
63
65
 
64
66
  static int tr_cmp(const X509_TRUST **a, const X509_TRUST **b);
65
67
  static void trtable_free(X509_TRUST *p);
@@ -67,7 +67,7 @@
67
67
  #include <openssl/x509.h>
68
68
  #include <openssl/x509v3.h>
69
69
 
70
- #include "vpm_int.h"
70
+ #include "internal.h"
71
71
  #include "../internal.h"
72
72
  #include "../x509v3/internal.h"
73
73
 
@@ -835,20 +835,20 @@ static int check_id_error(X509_STORE_CTX *ctx, int errcode)
835
835
  return ctx->verify_cb(0, ctx);
836
836
  }
837
837
 
838
- static int check_hosts(X509 *x, X509_VERIFY_PARAM_ID *id)
838
+ static int check_hosts(X509 *x, X509_VERIFY_PARAM *param)
839
839
  {
840
840
  size_t i;
841
- size_t n = sk_OPENSSL_STRING_num(id->hosts);
841
+ size_t n = sk_OPENSSL_STRING_num(param->hosts);
842
842
  char *name;
843
843
 
844
- if (id->peername != NULL) {
845
- OPENSSL_free(id->peername);
846
- id->peername = NULL;
844
+ if (param->peername != NULL) {
845
+ OPENSSL_free(param->peername);
846
+ param->peername = NULL;
847
847
  }
848
848
  for (i = 0; i < n; ++i) {
849
- name = sk_OPENSSL_STRING_value(id->hosts, i);
850
- if (X509_check_host(x, name, strlen(name), id->hostflags,
851
- &id->peername) > 0)
849
+ name = sk_OPENSSL_STRING_value(param->hosts, i);
850
+ if (X509_check_host(x, name, strlen(name), param->hostflags,
851
+ &param->peername) > 0)
852
852
  return 1;
853
853
  }
854
854
  return n == 0;
@@ -857,21 +857,20 @@ static int check_hosts(X509 *x, X509_VERIFY_PARAM_ID *id)
857
857
  static int check_id(X509_STORE_CTX *ctx)
858
858
  {
859
859
  X509_VERIFY_PARAM *vpm = ctx->param;
860
- X509_VERIFY_PARAM_ID *id = vpm->id;
861
860
  X509 *x = ctx->cert;
862
- if (id->poison) {
861
+ if (vpm->poison) {
863
862
  if (!check_id_error(ctx, X509_V_ERR_INVALID_CALL))
864
863
  return 0;
865
864
  }
866
- if (id->hosts && check_hosts(x, id) <= 0) {
865
+ if (vpm->hosts && check_hosts(x, vpm) <= 0) {
867
866
  if (!check_id_error(ctx, X509_V_ERR_HOSTNAME_MISMATCH))
868
867
  return 0;
869
868
  }
870
- if (id->email && X509_check_email(x, id->email, id->emaillen, 0) <= 0) {
869
+ if (vpm->email && X509_check_email(x, vpm->email, vpm->emaillen, 0) <= 0) {
871
870
  if (!check_id_error(ctx, X509_V_ERR_EMAIL_MISMATCH))
872
871
  return 0;
873
872
  }
874
- if (id->ip && X509_check_ip(x, id->ip, id->iplen, 0) <= 0) {
873
+ if (vpm->ip && X509_check_ip(x, vpm->ip, vpm->iplen, 0) <= 0) {
875
874
  if (!check_id_error(ctx, X509_V_ERR_IP_ADDRESS_MISMATCH))
876
875
  return 0;
877
876
  }
@@ -2052,7 +2051,7 @@ X509_CRL *X509_CRL_diff(X509_CRL *base, X509_CRL *newer,
2052
2051
  }
2053
2052
  /* Create new CRL */
2054
2053
  crl = X509_CRL_new();
2055
- if (!crl || !X509_CRL_set_version(crl, X509V2_VERSION))
2054
+ if (!crl || !X509_CRL_set_version(crl, X509_CRL_VERSION_2))
2056
2055
  goto memerr;
2057
2056
  /* Set issuer name */
2058
2057
  if (!X509_CRL_set_issuer_name(crl, X509_CRL_get_issuer(newer)))
@@ -62,8 +62,9 @@
62
62
  #include <openssl/x509.h>
63
63
  #include <openssl/x509v3.h>
64
64
 
65
- #include "vpm_int.h"
65
+ #include "internal.h"
66
66
  #include "../internal.h"
67
+ #include "../x509v3/internal.h"
67
68
 
68
69
 
69
70
  /* X509_VERIFY_PARAM functions */
@@ -83,7 +84,7 @@ static void str_free(char *s)
83
84
 
84
85
  #define string_stack_free(sk) sk_OPENSSL_STRING_pop_free(sk, str_free)
85
86
 
86
- static int int_x509_param_set_hosts(X509_VERIFY_PARAM_ID *id, int mode,
87
+ static int int_x509_param_set_hosts(X509_VERIFY_PARAM *param, int mode,
87
88
  const char *name, size_t namelen)
88
89
  {
89
90
  char *copy;
@@ -100,26 +101,26 @@ static int int_x509_param_set_hosts(X509_VERIFY_PARAM_ID *id, int mode,
100
101
  if (name && OPENSSL_memchr(name, '\0', namelen))
101
102
  return 0;
102
103
 
103
- if (mode == SET_HOST && id->hosts) {
104
- string_stack_free(id->hosts);
105
- id->hosts = NULL;
104
+ if (mode == SET_HOST && param->hosts) {
105
+ string_stack_free(param->hosts);
106
+ param->hosts = NULL;
106
107
  }
107
108
 
108
109
  copy = OPENSSL_strndup(name, namelen);
109
110
  if (copy == NULL)
110
111
  return 0;
111
112
 
112
- if (id->hosts == NULL &&
113
- (id->hosts = sk_OPENSSL_STRING_new_null()) == NULL) {
113
+ if (param->hosts == NULL &&
114
+ (param->hosts = sk_OPENSSL_STRING_new_null()) == NULL) {
114
115
  OPENSSL_free(copy);
115
116
  return 0;
116
117
  }
117
118
 
118
- if (!sk_OPENSSL_STRING_push(id->hosts, copy)) {
119
+ if (!sk_OPENSSL_STRING_push(param->hosts, copy)) {
119
120
  OPENSSL_free(copy);
120
- if (sk_OPENSSL_STRING_num(id->hosts) == 0) {
121
- sk_OPENSSL_STRING_free(id->hosts);
122
- id->hosts = NULL;
121
+ if (sk_OPENSSL_STRING_num(param->hosts) == 0) {
122
+ sk_OPENSSL_STRING_free(param->hosts);
123
+ param->hosts = NULL;
123
124
  }
124
125
  return 0;
125
126
  }
@@ -129,7 +130,6 @@ static int int_x509_param_set_hosts(X509_VERIFY_PARAM_ID *id, int mode,
129
130
 
130
131
  static void x509_verify_param_zero(X509_VERIFY_PARAM *param)
131
132
  {
132
- X509_VERIFY_PARAM_ID *paramid;
133
133
  if (!param)
134
134
  return;
135
135
  param->name = NULL;
@@ -145,43 +145,34 @@ static void x509_verify_param_zero(X509_VERIFY_PARAM *param)
145
145
  sk_ASN1_OBJECT_pop_free(param->policies, ASN1_OBJECT_free);
146
146
  param->policies = NULL;
147
147
  }
148
- paramid = param->id;
149
- if (paramid->hosts) {
150
- string_stack_free(paramid->hosts);
151
- paramid->hosts = NULL;
148
+ if (param->hosts) {
149
+ string_stack_free(param->hosts);
150
+ param->hosts = NULL;
152
151
  }
153
- if (paramid->peername) {
154
- OPENSSL_free(paramid->peername);
155
- paramid->peername = NULL;
152
+ if (param->peername) {
153
+ OPENSSL_free(param->peername);
154
+ param->peername = NULL;
156
155
  }
157
- if (paramid->email) {
158
- OPENSSL_free(paramid->email);
159
- paramid->email = NULL;
160
- paramid->emaillen = 0;
156
+ if (param->email) {
157
+ OPENSSL_free(param->email);
158
+ param->email = NULL;
159
+ param->emaillen = 0;
161
160
  }
162
- if (paramid->ip) {
163
- OPENSSL_free(paramid->ip);
164
- paramid->ip = NULL;
165
- paramid->iplen = 0;
161
+ if (param->ip) {
162
+ OPENSSL_free(param->ip);
163
+ param->ip = NULL;
164
+ param->iplen = 0;
166
165
  }
167
- paramid->poison = 0;
166
+ param->poison = 0;
168
167
  }
169
168
 
170
169
  X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void)
171
170
  {
172
171
  X509_VERIFY_PARAM *param;
173
- X509_VERIFY_PARAM_ID *paramid;
174
172
  param = OPENSSL_malloc(sizeof(X509_VERIFY_PARAM));
175
173
  if (!param)
176
174
  return NULL;
177
- paramid = OPENSSL_malloc(sizeof(X509_VERIFY_PARAM_ID));
178
- if (!paramid) {
179
- OPENSSL_free(param);
180
- return NULL;
181
- }
182
175
  OPENSSL_memset(param, 0, sizeof(X509_VERIFY_PARAM));
183
- OPENSSL_memset(paramid, 0, sizeof(X509_VERIFY_PARAM_ID));
184
- param->id = paramid;
185
176
  x509_verify_param_zero(param);
186
177
  return param;
187
178
  }
@@ -191,7 +182,6 @@ void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param)
191
182
  if (param == NULL)
192
183
  return;
193
184
  x509_verify_param_zero(param);
194
- OPENSSL_free(param->id);
195
185
  OPENSSL_free(param);
196
186
  }
197
187
 
@@ -233,11 +223,6 @@ void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param)
233
223
  (to_overwrite || \
234
224
  ((src->field != (def)) && (to_default || (dest->field == (def)))))
235
225
 
236
- /* As above but for ID fields */
237
-
238
- #define test_x509_verify_param_copy_id(idf, def) \
239
- test_x509_verify_param_copy(id->idf, def)
240
-
241
226
  /* Macro to test and copy a field if necessary */
242
227
 
243
228
  #define x509_verify_param_copy(field, def) \
@@ -249,10 +234,8 @@ int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *dest,
249
234
  {
250
235
  unsigned long inh_flags;
251
236
  int to_default, to_overwrite;
252
- X509_VERIFY_PARAM_ID *id;
253
237
  if (!src)
254
238
  return 1;
255
- id = src->id;
256
239
  inh_flags = dest->inh_flags | src->inh_flags;
257
240
 
258
241
  if (inh_flags & X509_VP_FLAG_ONCE)
@@ -294,31 +277,31 @@ int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *dest,
294
277
  }
295
278
 
296
279
  /* Copy the host flags if and only if we're copying the host list */
297
- if (test_x509_verify_param_copy_id(hosts, NULL)) {
298
- if (dest->id->hosts) {
299
- string_stack_free(dest->id->hosts);
300
- dest->id->hosts = NULL;
280
+ if (test_x509_verify_param_copy(hosts, NULL)) {
281
+ if (dest->hosts) {
282
+ string_stack_free(dest->hosts);
283
+ dest->hosts = NULL;
301
284
  }
302
- if (id->hosts) {
303
- dest->id->hosts =
304
- sk_OPENSSL_STRING_deep_copy(id->hosts, str_copy, str_free);
305
- if (dest->id->hosts == NULL)
285
+ if (src->hosts) {
286
+ dest->hosts =
287
+ sk_OPENSSL_STRING_deep_copy(src->hosts, str_copy, str_free);
288
+ if (dest->hosts == NULL)
306
289
  return 0;
307
- dest->id->hostflags = id->hostflags;
290
+ dest->hostflags = src->hostflags;
308
291
  }
309
292
  }
310
293
 
311
- if (test_x509_verify_param_copy_id(email, NULL)) {
312
- if (!X509_VERIFY_PARAM_set1_email(dest, id->email, id->emaillen))
294
+ if (test_x509_verify_param_copy(email, NULL)) {
295
+ if (!X509_VERIFY_PARAM_set1_email(dest, src->email, src->emaillen))
313
296
  return 0;
314
297
  }
315
298
 
316
- if (test_x509_verify_param_copy_id(ip, NULL)) {
317
- if (!X509_VERIFY_PARAM_set1_ip(dest, id->ip, id->iplen))
299
+ if (test_x509_verify_param_copy(ip, NULL)) {
300
+ if (!X509_VERIFY_PARAM_set1_ip(dest, src->ip, src->iplen))
318
301
  return 0;
319
302
  }
320
303
 
321
- dest->id->poison = src->id->poison;
304
+ dest->poison = src->poison;
322
305
 
323
306
  return 1;
324
307
  }
@@ -457,8 +440,8 @@ int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param,
457
440
  int X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param,
458
441
  const char *name, size_t namelen)
459
442
  {
460
- if (!int_x509_param_set_hosts(param->id, SET_HOST, name, namelen)) {
461
- param->id->poison = 1;
443
+ if (!int_x509_param_set_hosts(param, SET_HOST, name, namelen)) {
444
+ param->poison = 1;
462
445
  return 0;
463
446
  }
464
447
  return 1;
@@ -467,8 +450,8 @@ int X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param,
467
450
  int X509_VERIFY_PARAM_add1_host(X509_VERIFY_PARAM *param,
468
451
  const char *name, size_t namelen)
469
452
  {
470
- if (!int_x509_param_set_hosts(param->id, ADD_HOST, name, namelen)) {
471
- param->id->poison = 1;
453
+ if (!int_x509_param_set_hosts(param, ADD_HOST, name, namelen)) {
454
+ param->poison = 1;
472
455
  return 0;
473
456
  }
474
457
  return 1;
@@ -477,21 +460,21 @@ int X509_VERIFY_PARAM_add1_host(X509_VERIFY_PARAM *param,
477
460
  void X509_VERIFY_PARAM_set_hostflags(X509_VERIFY_PARAM *param,
478
461
  unsigned int flags)
479
462
  {
480
- param->id->hostflags = flags;
463
+ param->hostflags = flags;
481
464
  }
482
465
 
483
466
  char *X509_VERIFY_PARAM_get0_peername(X509_VERIFY_PARAM *param)
484
467
  {
485
- return param->id->peername;
468
+ return param->peername;
486
469
  }
487
470
 
488
471
  int X509_VERIFY_PARAM_set1_email(X509_VERIFY_PARAM *param,
489
472
  const char *email, size_t emaillen)
490
473
  {
491
474
  if (OPENSSL_memchr(email, '\0', emaillen) != NULL ||
492
- !int_x509_param_set1(&param->id->email, &param->id->emaillen,
475
+ !int_x509_param_set1(&param->email, &param->emaillen,
493
476
  email, emaillen)) {
494
- param->id->poison = 1;
477
+ param->poison = 1;
495
478
  return 0;
496
479
  }
497
480
 
@@ -502,9 +485,9 @@ int X509_VERIFY_PARAM_set1_ip(X509_VERIFY_PARAM *param,
502
485
  const unsigned char *ip, size_t iplen)
503
486
  {
504
487
  if ((iplen != 4 && iplen != 16) ||
505
- !int_x509_param_set1((char **)&param->id->ip, &param->id->iplen,
488
+ !int_x509_param_set1((char **)&param->ip, &param->iplen,
506
489
  (char *)ip, iplen)) {
507
- param->id->poison = 1;
490
+ param->poison = 1;
508
491
  return 0;
509
492
  }
510
493
 
@@ -516,7 +499,7 @@ int X509_VERIFY_PARAM_set1_ip_asc(X509_VERIFY_PARAM *param, const char *ipasc)
516
499
  unsigned char ipout[16];
517
500
  size_t iplen;
518
501
 
519
- iplen = (size_t)a2i_ipadd(ipout, ipasc);
502
+ iplen = (size_t)x509v3_a2i_ipadd(ipout, ipasc);
520
503
  if (iplen == 0)
521
504
  return 0;
522
505
  return X509_VERIFY_PARAM_set1_ip(param, ipout, iplen);
@@ -532,10 +515,7 @@ const char *X509_VERIFY_PARAM_get0_name(const X509_VERIFY_PARAM *param)
532
515
  return param->name;
533
516
  }
534
517
 
535
- static const X509_VERIFY_PARAM_ID _empty_id =
536
- { NULL, 0U, NULL, NULL, 0, NULL, 0, 0 };
537
-
538
- #define vpm_empty_id ((X509_VERIFY_PARAM_ID *)&_empty_id)
518
+ #define vpm_empty_id NULL, 0U, NULL, NULL, 0, NULL, 0, 0
539
519
 
540
520
  /*
541
521
  * Default verify parameters: these are used for various applications and can