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
@@ -1,267 +0,0 @@
1
- /* Copyright (c) 2020, Google Inc.
2
- *
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.
6
- *
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. */
14
-
15
- #ifndef OPENSSL_HEADER_CRYPTO_HPKE_INTERNAL_H
16
- #define OPENSSL_HEADER_CRYPTO_HPKE_INTERNAL_H
17
-
18
- #include <openssl/aead.h>
19
- #include <openssl/base.h>
20
- #include <openssl/curve25519.h>
21
- #include <openssl/digest.h>
22
-
23
- #if defined(__cplusplus)
24
- extern "C" {
25
- #endif
26
-
27
-
28
- // Hybrid Public Key Encryption.
29
- //
30
- // Hybrid Public Key Encryption (HPKE) enables a sender to encrypt messages to a
31
- // receiver with a public key. Optionally, the sender may authenticate its
32
- // possession of a pre-shared key to the recipient.
33
- //
34
- // See https://tools.ietf.org/html/draft-irtf-cfrg-hpke-07.
35
-
36
- // EVP_HPKE_DHKEM_* are KEM identifiers.
37
- #define EVP_HPKE_DHKEM_X25519_HKDF_SHA256 0x0020
38
-
39
- // EVP_HPKE_AEAD_* are AEAD identifiers.
40
- #define EVP_HPKE_AEAD_AES_128_GCM 0x0001
41
- #define EVP_HPKE_AEAD_AES_256_GCM 0x0002
42
- #define EVP_HPKE_AEAD_CHACHA20POLY1305 0x0003
43
-
44
- // EVP_HPKE_HKDF_* are HKDF identifiers.
45
- #define EVP_HPKE_HKDF_SHA256 0x0001
46
- #define EVP_HPKE_HKDF_SHA384 0x0002
47
- #define EVP_HPKE_HKDF_SHA512 0x0003
48
-
49
- // EVP_HPKE_MAX_OVERHEAD contains the largest value that
50
- // |EVP_HPKE_CTX_max_overhead| would ever return for any context.
51
- #define EVP_HPKE_MAX_OVERHEAD EVP_AEAD_MAX_OVERHEAD
52
-
53
-
54
- // Encryption contexts.
55
-
56
- // An |EVP_HPKE_CTX| is an HPKE encryption context.
57
- typedef struct evp_hpke_ctx_st {
58
- const EVP_MD *hkdf_md;
59
- EVP_AEAD_CTX aead_ctx;
60
- uint16_t kdf_id;
61
- uint16_t aead_id;
62
- uint8_t base_nonce[EVP_AEAD_MAX_NONCE_LENGTH];
63
- uint8_t exporter_secret[EVP_MAX_MD_SIZE];
64
- uint64_t seq;
65
- int is_sender;
66
- } EVP_HPKE_CTX;
67
-
68
- // EVP_HPKE_CTX_init initializes an already-allocated |EVP_HPKE_CTX|. The caller
69
- // should then use one of the |EVP_HPKE_CTX_setup_*| functions.
70
- //
71
- // It is safe, but not necessary to call |EVP_HPKE_CTX_cleanup| in this state.
72
- OPENSSL_EXPORT void EVP_HPKE_CTX_init(EVP_HPKE_CTX *ctx);
73
-
74
- // EVP_HPKE_CTX_cleanup releases memory referenced by |ctx|. |ctx| must have
75
- // been initialized with |EVP_HPKE_CTX_init|.
76
- OPENSSL_EXPORT void EVP_HPKE_CTX_cleanup(EVP_HPKE_CTX *ctx);
77
-
78
-
79
- // Setting up HPKE contexts.
80
- //
81
- // In each of the following functions, |hpke| must have been initialized with
82
- // |EVP_HPKE_CTX_init|. |kdf_id| selects the KDF for non-KEM HPKE operations and
83
- // must be one of the |EVP_HPKE_HKDF_*| constants. |aead_id| selects the AEAD
84
- // for the "open" and "seal" operations and must be one of the |EVP_HPKE_AEAD_*|
85
- // constants.
86
-
87
- // EVP_HPKE_CTX_setup_base_s_x25519 sets up |hpke| as a sender context that can
88
- // encrypt for the private key corresponding to |peer_public_value| (the
89
- // recipient's public key). It returns one on success, and zero otherwise. Note
90
- // that this function will fail if |peer_public_value| is invalid.
91
- //
92
- // This function writes the encapsulated shared secret, a Diffie-Hellman public
93
- // key, to |out_enc|. It will fail if the buffer's size in |out_enc_len| is not
94
- // exactly |X25519_PUBLIC_VALUE_LEN|.
95
- OPENSSL_EXPORT int EVP_HPKE_CTX_setup_base_s_x25519(
96
- EVP_HPKE_CTX *hpke, uint8_t *out_enc, size_t out_enc_len, uint16_t kdf_id,
97
- uint16_t aead_id, const uint8_t *peer_public_value,
98
- size_t peer_public_value_len, const uint8_t *info, size_t info_len);
99
-
100
- // EVP_HPKE_CTX_setup_base_s_x25519_for_test behaves like
101
- // |EVP_HPKE_CTX_setup_base_s_x25519|, but takes a pre-generated ephemeral
102
- // sender key. The caller ensures that |ephemeral_public| and
103
- // |ephemeral_private| are a valid keypair.
104
- OPENSSL_EXPORT int EVP_HPKE_CTX_setup_base_s_x25519_for_test(
105
- EVP_HPKE_CTX *hpke, uint16_t kdf_id, uint16_t aead_id,
106
- const uint8_t *peer_public_value, size_t peer_public_value_len,
107
- const uint8_t *info, size_t info_len, const uint8_t *ephemeral_private,
108
- size_t ephemeral_private_len, const uint8_t *ephemeral_public,
109
- size_t ephemeral_public_len);
110
-
111
- // EVP_HPKE_CTX_setup_base_r_x25519 sets up |hpke| as a recipient context that
112
- // can decrypt messages. It returns one on success, and zero otherwise.
113
- //
114
- // The recipient's keypair is composed of |public_key| and |private_key|, and
115
- // |enc| is the encapsulated shared secret from the sender. If |enc| is invalid,
116
- // this function will fail.
117
- OPENSSL_EXPORT int EVP_HPKE_CTX_setup_base_r_x25519(
118
- EVP_HPKE_CTX *hpke, uint16_t kdf_id, uint16_t aead_id, const uint8_t *enc,
119
- size_t enc_len, const uint8_t *public_key, size_t public_key_len,
120
- const uint8_t *private_key, size_t private_key_len, const uint8_t *info,
121
- size_t info_len);
122
-
123
- // EVP_HPKE_CTX_setup_psk_s_x25519 sets up |hpke| as a sender context that can
124
- // encrypt for the private key corresponding to |peer_public_value| (the
125
- // recipient's public key) and authenticate its possession of a PSK. It returns
126
- // one on success, and zero otherwise. Note that this function will fail if
127
- // |peer_public_value| is invalid.
128
- //
129
- // The PSK and its ID must be provided in |psk| and |psk_id|, respectively. Both
130
- // must be nonempty (|psk_len| and |psk_id_len| must be non-zero), or this
131
- // function will fail.
132
- //
133
- // This function writes the encapsulated shared secret, a Diffie-Hellman public
134
- // key, to |out_enc|. It will fail if the buffer's size in |out_enc_len| is not
135
- // exactly |X25519_PUBLIC_VALUE_LEN|.
136
- OPENSSL_EXPORT int EVP_HPKE_CTX_setup_psk_s_x25519(
137
- EVP_HPKE_CTX *hpke, uint8_t *out_enc, size_t out_enc_len, uint16_t kdf_id,
138
- uint16_t aead_id, const uint8_t *peer_public_value,
139
- size_t peer_public_value_len, const uint8_t *info, size_t info_len,
140
- const uint8_t *psk, size_t psk_len, const uint8_t *psk_id,
141
- size_t psk_id_len);
142
-
143
- // EVP_HPKE_CTX_setup_psk_s_x25519_for_test behaves like
144
- // |EVP_HPKE_CTX_setup_psk_s_x25519|, but takes a pre-generated ephemeral sender
145
- // key. The caller ensures that |ephemeral_public| and |ephemeral_private| are a
146
- // valid keypair.
147
- OPENSSL_EXPORT int EVP_HPKE_CTX_setup_psk_s_x25519_for_test(
148
- EVP_HPKE_CTX *hpke, uint16_t kdf_id, uint16_t aead_id,
149
- const uint8_t *peer_public_value, size_t peer_public_value_len,
150
- const uint8_t *info, size_t info_len, const uint8_t *psk, size_t psk_len,
151
- const uint8_t *psk_id, size_t psk_id_len, const uint8_t *ephemeral_private,
152
- size_t ephemeral_private_len, const uint8_t *ephemeral_public,
153
- size_t ephemeral_public_len);
154
-
155
- // EVP_HPKE_CTX_setup_psk_r_x25519 sets up |hpke| as a recipient context that
156
- // can decrypt messages. Future open (decrypt) operations will fail if the
157
- // sender does not possess the PSK indicated by |psk| and |psk_id|. It returns
158
- // one on success, and zero otherwise.
159
- //
160
- // The recipient's keypair is composed of |public_key| and |private_key|, and
161
- // |enc| is the encapsulated shared secret from the sender. If |enc| is invalid,
162
- // this function will fail.
163
- //
164
- // The PSK and its ID must be provided in |psk| and |psk_id|, respectively. Both
165
- // must be nonempty (|psk_len| and |psk_id_len| must be non-zero), or this
166
- // function will fail.
167
- OPENSSL_EXPORT int EVP_HPKE_CTX_setup_psk_r_x25519(
168
- EVP_HPKE_CTX *hpke, uint16_t kdf_id, uint16_t aead_id, const uint8_t *enc,
169
- size_t enc_len, const uint8_t *public_key, size_t public_key_len,
170
- const uint8_t *private_key, size_t private_key_len, const uint8_t *info,
171
- size_t info_len, const uint8_t *psk, size_t psk_len, const uint8_t *psk_id,
172
- size_t psk_id_len);
173
-
174
-
175
- // Using an HPKE context.
176
-
177
- // EVP_HPKE_CTX_open uses the HPKE context |hpke| to authenticate |in_len| bytes
178
- // from |in| and |ad_len| bytes from |ad| and to decrypt at most |in_len| bytes
179
- // into |out|. It returns one on success, and zero otherwise.
180
- //
181
- // This operation will fail if the |hpke| context is not set up as a receiver.
182
- //
183
- // Note that HPKE encryption is stateful and ordered. The sender's first call to
184
- // |EVP_HPKE_CTX_seal| must correspond to the recipient's first call to
185
- // |EVP_HPKE_CTX_open|, etc.
186
- //
187
- // At most |in_len| bytes are written to |out|. In order to ensure success,
188
- // |max_out_len| should be at least |in_len|. On successful return, |*out_len|
189
- // is set to the actual number of bytes written.
190
- OPENSSL_EXPORT int EVP_HPKE_CTX_open(EVP_HPKE_CTX *hpke, uint8_t *out,
191
- size_t *out_len, size_t max_out_len,
192
- const uint8_t *in, size_t in_len,
193
- const uint8_t *ad, size_t ad_len);
194
-
195
- // EVP_HPKE_CTX_seal uses the HPKE context |hpke| to encrypt and authenticate
196
- // |in_len| bytes of ciphertext |in| and authenticate |ad_len| bytes from |ad|,
197
- // writing the result to |out|. It returns one on success and zero otherwise.
198
- //
199
- // This operation will fail if the |hpke| context is not set up as a sender.
200
- //
201
- // Note that HPKE encryption is stateful and ordered. The sender's first call to
202
- // |EVP_HPKE_CTX_seal| must correspond to the recipient's first call to
203
- // |EVP_HPKE_CTX_open|, etc.
204
- //
205
- // At most, |max_out_len| encrypted bytes are written to |out|. On successful
206
- // return, |*out_len| is set to the actual number of bytes written.
207
- //
208
- // To ensure success, |max_out_len| should be |in_len| plus the result of
209
- // |EVP_HPKE_CTX_max_overhead| or |EVP_HPKE_MAX_OVERHEAD|.
210
- OPENSSL_EXPORT int EVP_HPKE_CTX_seal(EVP_HPKE_CTX *hpke, uint8_t *out,
211
- size_t *out_len, size_t max_out_len,
212
- const uint8_t *in, size_t in_len,
213
- const uint8_t *ad, size_t ad_len);
214
-
215
- // EVP_HPKE_CTX_export uses the HPKE context |hpke| to export a secret of
216
- // |secret_len| bytes into |out|. This function uses |context_len| bytes from
217
- // |context| as a context string for the secret. This is necessary to separate
218
- // different uses of exported secrets and bind relevant caller-specific context
219
- // into the output. It returns one on success and zero otherwise.
220
- OPENSSL_EXPORT int EVP_HPKE_CTX_export(const EVP_HPKE_CTX *hpke, uint8_t *out,
221
- size_t secret_len,
222
- const uint8_t *context,
223
- size_t context_len);
224
-
225
- // EVP_HPKE_CTX_max_overhead returns the maximum number of additional bytes
226
- // added by sealing data with |EVP_HPKE_CTX_seal|. The |hpke| context must be
227
- // set up as a sender.
228
- OPENSSL_EXPORT size_t EVP_HPKE_CTX_max_overhead(const EVP_HPKE_CTX *hpke);
229
-
230
- // EVP_HPKE_CTX_get_aead_id returns |hpke|'s configured AEAD. The returned value
231
- // is one of the |EVP_HPKE_AEAD_*| constants, or zero if the context has not
232
- // been set up.
233
- OPENSSL_EXPORT uint16_t EVP_HPKE_CTX_get_aead_id(const EVP_HPKE_CTX *hpke);
234
-
235
- // EVP_HPKE_CTX_get_aead_id returns |hpke|'s configured KDF. The returned value
236
- // is one of the |EVP_HPKE_HKDF_*| constants, or zero if the context has not
237
- // been set up.
238
- OPENSSL_EXPORT uint16_t EVP_HPKE_CTX_get_kdf_id(const EVP_HPKE_CTX *hpke);
239
-
240
- // EVP_HPKE_get_aead returns the AEAD corresponding to |aead_id|, or NULL if
241
- // |aead_id| is not a known AEAD identifier.
242
- OPENSSL_EXPORT const EVP_AEAD *EVP_HPKE_get_aead(uint16_t aead_id);
243
-
244
- // EVP_HPKE_get_hkdf_md returns the hash function associated with |kdf_id|, or
245
- // NULL if |kdf_id| is not a known KDF identifier that uses HKDF.
246
- OPENSSL_EXPORT const EVP_MD *EVP_HPKE_get_hkdf_md(uint16_t kdf_id);
247
-
248
-
249
- #if defined(__cplusplus)
250
- } // extern C
251
- #endif
252
-
253
- #if !defined(BORINGSSL_NO_CXX)
254
- extern "C++" {
255
-
256
- BSSL_NAMESPACE_BEGIN
257
-
258
- using ScopedEVP_HPKE_CTX =
259
- internal::StackAllocated<EVP_HPKE_CTX, void, EVP_HPKE_CTX_init,
260
- EVP_HPKE_CTX_cleanup>;
261
-
262
- BSSL_NAMESPACE_END
263
-
264
- } // extern C++
265
- #endif
266
-
267
- #endif // OPENSSL_HEADER_CRYPTO_HPKE_INTERNAL_H
@@ -1,71 +0,0 @@
1
- /* vpm_int.h */
2
- /*
3
- * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
4
- * 2013.
5
- */
6
- /* ====================================================================
7
- * Copyright (c) 2013 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
- /* internal only structure to hold additional X509_VERIFY_PARAM data */
61
-
62
- struct X509_VERIFY_PARAM_ID_st {
63
- STACK_OF(OPENSSL_STRING) *hosts; /* Set of acceptable names */
64
- unsigned int hostflags; /* Flags to control matching features */
65
- char *peername; /* Matching hostname in peer certificate */
66
- char *email; /* If not NULL email address to match */
67
- size_t emaillen;
68
- unsigned char *ip; /* If not NULL IP address to match */
69
- size_t iplen; /* Length of IP address */
70
- unsigned char poison; /* Fail all verifications */
71
- };