grpc 1.69.0 → 1.70.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Makefile +251 -249
- data/include/grpc/support/atm.h +0 -13
- data/src/core/call/request_buffer.cc +224 -0
- data/src/core/call/request_buffer.h +192 -0
- data/src/core/client_channel/client_channel.cc +2 -3
- data/src/core/client_channel/client_channel_args.h +21 -0
- data/src/core/client_channel/client_channel_filter.h +1 -3
- data/src/core/client_channel/retry_interceptor.cc +406 -0
- data/src/core/client_channel/retry_interceptor.h +157 -0
- data/src/core/client_channel/retry_service_config.h +13 -0
- data/src/core/client_channel/retry_throttle.cc +33 -18
- data/src/core/client_channel/retry_throttle.h +3 -3
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +596 -94
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +189 -13
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +1 -0
- data/src/core/ext/transport/chttp2/transport/frame_security.cc +1 -3
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +40 -1
- data/src/core/ext/upb-gen/envoy/admin/v3/config_dump_shared.upb.h +3 -1
- data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb.h +66 -36
- data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb_minitable.c +19 -17
- data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb.h +116 -0
- data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb_minitable.c +31 -5
- data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb.h +67 -6
- data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb_minitable.c +12 -8
- data/src/core/ext/upb-gen/envoy/config/core/v3/socket_cmsg_headers.upb.h +151 -0
- data/src/core/ext/upb-gen/envoy/config/core/v3/socket_cmsg_headers.upb_minitable.c +60 -0
- data/src/core/ext/upb-gen/envoy/config/core/v3/socket_cmsg_headers.upb_minitable.h +32 -0
- data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb.h +228 -21
- data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb_minitable.c +65 -17
- data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb_minitable.h +6 -0
- data/src/core/ext/upb-gen/envoy/config/listener/v3/listener_components.upb.h +7 -106
- data/src/core/ext/upb-gen/envoy/config/listener/v3/listener_components.upb_minitable.c +7 -28
- data/src/core/ext/upb-gen/envoy/config/listener/v3/listener_components.upb_minitable.h +0 -2
- data/src/core/ext/upb-gen/envoy/config/listener/v3/quic_config.upb.h +85 -0
- data/src/core/ext/upb-gen/envoy/config/listener/v3/quic_config.upb_minitable.c +25 -3
- data/src/core/ext/upb-gen/envoy/config/overload/v3/overload.upb.h +2 -1
- data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb.h +152 -0
- data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb_minitable.c +40 -10
- data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb.h +135 -4
- data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb_minitable.c +41 -9
- data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/config/trace/v3/trace.upb.h +0 -2
- data/src/core/ext/upb-gen/envoy/config/trace/v3/trace.upb_minitable.c +0 -1
- data/src/core/ext/upb-gen/envoy/config/trace/v3/trace.upb_minitable.h +0 -1
- data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +16 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.c +3 -2
- data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.h +60 -0
- data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb_minitable.c +13 -2
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb.h +0 -1
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb_minitable.c +0 -1
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +102 -24
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls.upb_minitable.c +28 -19
- data/src/core/ext/upb-gen/envoy/service/discovery/v3/discovery.upb.h +251 -18
- data/src/core/ext/upb-gen/envoy/service/discovery/v3/discovery.upb_minitable.c +41 -16
- data/src/core/ext/upb-gen/envoy/service/discovery/v3/discovery.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/service/status/v3/csds.upb.h +2 -1
- data/src/core/ext/upbdefs-gen/envoy/admin/v3/config_dump_shared.upbdefs.c +11 -10
- data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/cluster.upbdefs.c +418 -413
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/base.upbdefs.c +161 -153
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/base.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/protocol.upbdefs.c +267 -261
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_cmsg_headers.upbdefs.c +46 -0
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_cmsg_headers.upbdefs.h +33 -0
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_option.upbdefs.c +29 -19
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_option.upbdefs.h +15 -0
- data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener_components.upbdefs.c +58 -65
- data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener_components.upbdefs.h +0 -5
- data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/quic_config.upbdefs.c +73 -63
- data/src/core/ext/upbdefs-gen/envoy/config/overload/v3/overload.upbdefs.c +49 -48
- data/src/core/ext/upbdefs-gen/envoy/config/rbac/v3/rbac.upbdefs.c +117 -100
- data/src/core/ext/upbdefs-gen/envoy/config/rbac/v3/rbac.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route_components.upbdefs.c +905 -897
- data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route_components.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/trace.upbdefs.c +15 -18
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +460 -457
- data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upbdefs.c +16 -19
- data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +95 -95
- data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +202 -191
- data/src/core/ext/upbdefs-gen/envoy/service/discovery/v3/discovery.upbdefs.c +148 -135
- data/src/core/ext/upbdefs-gen/envoy/service/discovery/v3/discovery.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/service/status/v3/csds.upbdefs.c +23 -22
- data/src/core/filter/filter_args.h +112 -0
- data/src/core/handshaker/http_connect/http_connect_handshaker.cc +1 -1
- data/src/core/lib/channel/promise_based_filter.h +5 -79
- data/src/core/lib/debug/trace_flags.cc +2 -0
- data/src/core/lib/debug/trace_flags.h +1 -0
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +14 -0
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +7 -2
- data/src/core/lib/event_engine/posix_engine/posix_engine.h +0 -2
- data/src/core/lib/event_engine/windows/windows_engine.cc +1 -0
- data/src/core/lib/experiments/experiments.cc +90 -39
- data/src/core/lib/experiments/experiments.h +43 -24
- data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +1 -1
- data/src/core/lib/promise/activity.cc +2 -0
- data/src/core/lib/promise/activity.h +29 -8
- data/src/core/lib/promise/map.h +42 -0
- data/src/core/lib/promise/party.cc +36 -1
- data/src/core/lib/promise/party.h +13 -5
- data/src/core/lib/promise/sleep.h +1 -0
- data/src/core/lib/promise/status_flag.h +10 -0
- data/src/core/lib/resource_quota/arena.h +8 -0
- data/src/core/lib/resource_quota/connection_quota.h +4 -0
- data/src/core/lib/surface/call_utils.h +2 -0
- data/src/core/lib/surface/client_call.cc +43 -35
- data/src/core/lib/surface/client_call.h +5 -0
- data/src/core/lib/surface/event_string.cc +7 -1
- data/src/core/lib/surface/init_internally.h +13 -2
- data/src/core/lib/surface/server_call.cc +100 -85
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/call_filters.cc +10 -4
- data/src/core/lib/transport/call_filters.h +8 -0
- data/src/core/lib/transport/call_spine.cc +36 -71
- data/src/core/lib/transport/call_spine.h +131 -7
- data/src/core/lib/transport/call_state.h +132 -39
- data/src/core/lib/transport/interception_chain.cc +8 -0
- data/src/core/lib/transport/interception_chain.h +9 -0
- data/src/core/load_balancing/endpoint_list.cc +10 -0
- data/src/core/load_balancing/endpoint_list.h +13 -6
- data/src/core/load_balancing/lb_policy.h +0 -8
- data/src/core/load_balancing/pick_first/pick_first.cc +89 -56
- data/src/core/load_balancing/ring_hash/ring_hash.cc +158 -70
- data/src/core/load_balancing/ring_hash/ring_hash.h +4 -11
- data/src/core/load_balancing/round_robin/round_robin.cc +9 -14
- data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +12 -15
- data/src/core/resolver/dns/c_ares/dns_resolver_ares.cc +4 -4
- data/src/core/resolver/xds/xds_dependency_manager.cc +139 -135
- data/src/core/resolver/xds/xds_dependency_manager.h +24 -18
- data/src/core/resolver/xds/xds_resolver.cc +28 -47
- data/src/core/server/server.cc +290 -24
- data/src/core/server/server.h +199 -61
- data/src/core/server/xds_server_config_fetcher.cc +78 -142
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +1 -1
- data/src/core/util/backoff.cc +15 -4
- data/src/core/util/http_client/httpcli.cc +66 -18
- data/src/core/util/http_client/httpcli.h +14 -4
- data/src/core/util/matchers.h +5 -10
- data/src/core/util/ref_counted.h +1 -0
- data/src/core/util/ref_counted_ptr.h +1 -1
- data/src/core/util/useful.h +9 -11
- data/src/core/xds/grpc/xds_endpoint_parser.cc +54 -23
- data/src/core/xds/grpc/xds_metadata.h +8 -0
- data/src/core/xds/xds_client/xds_api.cc +0 -223
- data/src/core/xds/xds_client/xds_api.h +1 -133
- data/src/core/xds/xds_client/xds_client.cc +599 -466
- data/src/core/xds/xds_client/xds_client.h +107 -26
- data/src/core/xds/xds_client/xds_resource_type_impl.h +10 -5
- data/src/ruby/ext/grpc/extconf.rb +1 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_bitstr.c → a_bitstr.cc} +3 -2
- data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_d2i_fp.c → a_d2i_fp.cc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_dup.c → a_dup.cc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_i2d_fp.c → a_i2d_fp.cc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_int.c → a_int.cc} +2 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_mbstr.c → a_mbstr.cc} +9 -7
- data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_object.c → a_object.cc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_strnid.c → a_strnid.cc} +7 -4
- data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_type.c → a_type.cc} +4 -4
- data/third_party/boringssl-with-bazel/src/crypto/asn1/{asn1_lib.c → asn1_lib.cc} +4 -4
- data/third_party/boringssl-with-bazel/src/crypto/asn1/{asn_pack.c → asn_pack.cc} +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/asn1/{posix_time.c → posix_time.cc} +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/asn1/{tasn_dec.c → tasn_dec.cc} +4 -3
- data/third_party/boringssl-with-bazel/src/crypto/asn1/{tasn_enc.c → tasn_enc.cc} +9 -6
- data/third_party/boringssl-with-bazel/src/crypto/asn1/{tasn_fre.c → tasn_fre.cc} +14 -20
- data/third_party/boringssl-with-bazel/src/crypto/asn1/{tasn_new.c → tasn_new.cc} +7 -6
- data/third_party/boringssl-with-bazel/src/crypto/asn1/{tasn_utl.c → tasn_utl.cc} +13 -10
- data/third_party/boringssl-with-bazel/src/crypto/base64/{base64.c → base64.cc} +9 -12
- data/third_party/boringssl-with-bazel/src/crypto/bcm_support.h +7 -1
- data/third_party/boringssl-with-bazel/src/crypto/bio/{bio.c → bio.cc} +32 -58
- data/third_party/boringssl-with-bazel/src/crypto/bio/{bio_mem.c → bio_mem.cc} +8 -7
- data/third_party/boringssl-with-bazel/src/crypto/bio/{connect.c → connect.cc} +24 -16
- data/third_party/boringssl-with-bazel/src/crypto/bio/{file.c → file.cc} +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/bio/{pair.c → pair.cc} +22 -20
- data/third_party/boringssl-with-bazel/src/crypto/bio/{printf.c → printf.cc} +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/bio/{socket_helper.c → socket_helper.cc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/blake2/{blake2.c → blake2.cc} +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/bn_extra/{bn_asn1.c → bn_asn1.cc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/bn_extra/{convert.c → convert.cc} +21 -21
- data/third_party/boringssl-with-bazel/src/crypto/buf/{buf.c → buf.cc} +6 -3
- data/third_party/boringssl-with-bazel/src/crypto/bytestring/{asn1_compat.c → asn1_compat.cc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/bytestring/{ber.c → ber.cc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/bytestring/{cbb.c → cbb.cc} +33 -49
- data/third_party/boringssl-with-bazel/src/crypto/bytestring/{cbs.c → cbs.cc} +20 -27
- data/third_party/boringssl-with-bazel/src/crypto/bytestring/internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/bytestring/{unicode.c → unicode.cc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/chacha/{chacha.c → chacha.cc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/chacha/internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{e_aesctrhmac.c → e_aesctrhmac.cc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{e_aesgcmsiv.c → e_aesgcmsiv.cc} +23 -26
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{e_chacha20poly1305.c → e_chacha20poly1305.cc} +1 -8
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{e_des.c → e_des.cc} +61 -49
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{e_null.c → e_null.cc} +12 -9
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{e_rc2.c → e_rc2.cc} +23 -19
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{e_rc4.c → e_rc4.cc} +10 -8
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{e_tls.c → e_tls.cc} +2 -1
- data/third_party/boringssl-with-bazel/src/crypto/conf/{conf.c → conf.cc} +17 -14
- data/third_party/boringssl-with-bazel/src/crypto/conf/internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_apple.c → cpu_aarch64_apple.cc} +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_fuchsia.c → cpu_aarch64_fuchsia.cc} +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_linux.c → cpu_aarch64_linux.cc} +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_openbsd.c → cpu_aarch64_openbsd.cc} +4 -4
- data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_sysreg.c → cpu_aarch64_sysreg.cc} +3 -2
- data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_win.c → cpu_aarch64_win.cc} +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/{cpu_arm_freebsd.c → cpu_arm_freebsd.cc} +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/{cpu_arm_linux.c → cpu_arm_linux.cc} +5 -5
- data/third_party/boringssl-with-bazel/src/crypto/cpu_arm_linux.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/{cpu_intel.c → cpu_intel.cc} +47 -32
- data/third_party/boringssl-with-bazel/src/crypto/{crypto.c → crypto.cc} +6 -11
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/{curve25519.c → curve25519.cc} +28 -31
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/{curve25519_64_adx.c → curve25519_64_adx.cc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_tables.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/{spake25519.c → spake25519.cc} +20 -16
- data/third_party/boringssl-with-bazel/src/crypto/dh_extra/{dh_asn1.c → dh_asn1.cc} +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/digest_extra/{digest_extra.c → digest_extra.cc} +113 -31
- data/third_party/boringssl-with-bazel/src/crypto/dsa/{dsa.c → dsa.cc} +153 -154
- data/third_party/boringssl-with-bazel/src/crypto/dsa/{dsa_asn1.c → dsa_asn1.cc} +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/dsa/internal.h +1 -3
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/{ec_asn1.c → ec_asn1.cc} +35 -0
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/{ec_derive.c → ec_derive.cc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/{hash_to_curve.c → hash_to_curve.cc} +66 -64
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/ecdsa_extra/{ecdsa_asn1.c → ecdsa_asn1.cc} +15 -25
- data/third_party/boringssl-with-bazel/src/crypto/engine/{engine.c → engine.cc} +12 -8
- data/third_party/boringssl-with-bazel/src/crypto/err/{err.c → err.cc} +24 -27
- data/third_party/boringssl-with-bazel/src/crypto/err/internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/evp/{evp.c → evp.cc} +8 -9
- data/third_party/boringssl-with-bazel/src/crypto/evp/{evp_ctx.c → evp_ctx.cc} +7 -8
- data/third_party/boringssl-with-bazel/src/crypto/evp/{p_dh.c → p_dh.cc} +23 -14
- data/third_party/boringssl-with-bazel/src/crypto/evp/{p_dh_asn1.c → p_dh_asn1.cc} +38 -21
- data/third_party/boringssl-with-bazel/src/crypto/evp/{p_dsa_asn1.c → p_dsa_asn1.cc} +19 -24
- data/third_party/boringssl-with-bazel/src/crypto/evp/{p_ec.c → p_ec.cc} +20 -23
- data/third_party/boringssl-with-bazel/src/crypto/evp/{p_ec_asn1.c → p_ec_asn1.cc} +20 -20
- data/third_party/boringssl-with-bazel/src/crypto/evp/{p_ed25519.c → p_ed25519.cc} +22 -19
- data/third_party/boringssl-with-bazel/src/crypto/evp/{p_ed25519_asn1.c → p_ed25519_asn1.cc} +14 -13
- data/third_party/boringssl-with-bazel/src/crypto/evp/{p_hkdf.c → p_hkdf.cc} +18 -14
- data/third_party/boringssl-with-bazel/src/crypto/evp/{p_rsa.c → p_rsa.cc} +38 -37
- data/third_party/boringssl-with-bazel/src/crypto/evp/{p_rsa_asn1.c → p_rsa_asn1.cc} +16 -18
- data/third_party/boringssl-with-bazel/src/crypto/evp/{p_x25519.c → p_x25519.cc} +22 -19
- data/third_party/boringssl-with-bazel/src/crypto/evp/{p_x25519_asn1.c → p_x25519_asn1.cc} +18 -17
- data/third_party/boringssl-with-bazel/src/crypto/evp/{pbkdf.c → pbkdf.cc} +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/evp/{print.c → print.cc} +4 -5
- data/third_party/boringssl-with-bazel/src/crypto/evp/{scrypt.c → scrypt.cc} +7 -5
- data/third_party/boringssl-with-bazel/src/crypto/{ex_data.c → ex_data.cc} +3 -4
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/{aes_nohw.c.inc → aes_nohw.cc.inc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/internal.h +1 -5
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/{key_wrap.c.inc → key_wrap.cc.inc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/{bcm.c → bcm.cc} +96 -101
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm_interface.h +165 -12
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{add.c.inc → add.cc.inc} +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/asm/{x86_64-gcc.c.inc → x86_64-gcc.cc.inc} +4 -4
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{bn.c.inc → bn.cc.inc} +12 -24
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{ctx.c.inc → ctx.cc.inc} +5 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{div.c.inc → div.cc.inc} +29 -38
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{div_extra.c.inc → div_extra.cc.inc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{exponentiation.c.inc → exponentiation.cc.inc} +22 -22
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{gcd.c.inc → gcd.cc.inc} +3 -6
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{gcd_extra.c.inc → gcd_extra.cc.inc} +33 -25
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{montgomery.c.inc → montgomery.cc.inc} +10 -17
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{mul.c.inc → mul.cc.inc} +11 -15
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{prime.c.inc → prime.cc.inc} +31 -34
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{shift.c.inc → shift.cc.inc} +3 -4
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{aead.c.inc → aead.cc.inc} +18 -10
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{cipher.c.inc → cipher.cc.inc} +6 -9
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{e_aes.c.inc → e_aes.cc.inc} +46 -54
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cmac/{cmac.c.inc → cmac.cc.inc} +6 -6
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/delocate.h +14 -10
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/{dh.c.inc → dh.cc.inc} +15 -19
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/internal.h +1 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/{digest.c.inc → digest.cc.inc} +17 -13
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/{digests.c.inc → digests.cc.inc} +29 -113
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digestsign/{digestsign.c.inc → digestsign.cc.inc} +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/builtin_curves.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{ec.c.inc → ec.cc.inc} +10 -15
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{ec_key.c.inc → ec_key.cc.inc} +12 -14
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{felem.c.inc → felem.cc.inc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{oct.c.inc → oct.cc.inc} +5 -6
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{p224-64.c.inc → p224-64.cc.inc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-nistz-table.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{p256-nistz.c.inc → p256-nistz.cc.inc} +15 -13
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{p256.c.inc → p256.cc.inc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256_table.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{scalar.c.inc → scalar.cc.inc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{simple_mul.c.inc → simple_mul.cc.inc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{util.c.inc → util.cc.inc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{wnaf.c.inc → wnaf.cc.inc} +24 -15
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdh/{ecdh.c.inc → ecdh.cc.inc} +14 -5
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/{ecdsa.c.inc → ecdsa.cc.inc} +6 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/{fips_shared_support.c → fips_shared_support.cc} +2 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/hkdf/{hkdf.c.inc → hkdf.cc.inc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/hmac/{hmac.c.inc → hmac.cc.inc} +3 -2
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{gcm.c.inc → gcm.cc.inc} +69 -21
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{gcm_nohw.c.inc → gcm_nohw.cc.inc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/internal.h +53 -33
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{polyval.c.inc → polyval.cc.inc} +2 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/{ctrdrbg.c.inc → ctrdrbg.cc.inc} +5 -4
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/{rand.c.inc → rand.cc.inc} +20 -18
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/{blinding.c.inc → blinding.cc.inc} +5 -4
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/{padding.c.inc → padding.cc.inc} +21 -21
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/{rsa.c.inc → rsa.cc.inc} +77 -73
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/{rsa_impl.c.inc → rsa_impl.cc.inc} +50 -53
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/{fips.c.inc → fips.cc.inc} +14 -6
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/{self_check.c.inc → self_check.cc.inc} +56 -52
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/service_indicator/{service_indicator.c.inc → service_indicator.cc.inc} +10 -11
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/internal.h +2 -4
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/{sha1.c.inc → sha1.cc.inc} +26 -33
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/{sha256.c.inc → sha256.cc.inc} +37 -55
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/{sha512.c.inc → sha512.cc.inc} +48 -76
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/tls/internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/hpke/{hpke.c → hpke.cc} +7 -4
- data/third_party/boringssl-with-bazel/src/crypto/hrss/{hrss.c → hrss.cc} +53 -110
- data/third_party/boringssl-with-bazel/src/crypto/hrss/internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/internal.h +191 -248
- data/third_party/boringssl-with-bazel/src/crypto/keccak/internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/keccak/{keccak.c → keccak.cc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/kyber/internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/kyber/{kyber.c → kyber.cc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/lhash/{lhash.c → lhash.cc} +8 -7
- data/third_party/boringssl-with-bazel/src/crypto/{fipsmodule/md4/md4.c.inc → md4/md4.cc} +8 -12
- data/third_party/boringssl-with-bazel/src/crypto/{fipsmodule/md5 → md5}/internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/{fipsmodule/md5/md5.c.inc → md5/md5.cc} +4 -3
- data/third_party/boringssl-with-bazel/src/crypto/{mem.c → mem.cc} +34 -22
- data/third_party/boringssl-with-bazel/src/crypto/mldsa/internal.h +4 -1
- data/third_party/boringssl-with-bazel/src/crypto/mldsa/{mldsa.c → mldsa.cc} +646 -543
- data/third_party/boringssl-with-bazel/src/crypto/mlkem/internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/mlkem/mlkem.cc +8 -8
- data/third_party/boringssl-with-bazel/src/crypto/obj/{obj.c → obj.cc} +27 -30
- data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_info.c → pem_info.cc} +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_lib.c → pem_lib.cc} +3 -4
- data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_oth.c → pem_oth.cc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/pkcs7/internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/pkcs7/{pkcs7.c → pkcs7.cc} +5 -5
- data/third_party/boringssl-with-bazel/src/crypto/pkcs7/{pkcs7_x509.c → pkcs7_x509.cc} +26 -25
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/{p5_pbev2.c → p5_pbev2.cc} +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/{pkcs8.c → pkcs8.cc} +159 -158
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/{pkcs8_x509.c → pkcs8_x509.cc} +90 -97
- data/third_party/boringssl-with-bazel/src/crypto/poly1305/internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/poly1305/{poly1305.c → poly1305.cc} +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/poly1305/{poly1305_arm.c → poly1305_arm.cc} +4 -2
- data/third_party/boringssl-with-bazel/src/crypto/poly1305/{poly1305_vec.c → poly1305_vec.cc} +14 -11
- data/third_party/boringssl-with-bazel/src/crypto/pool/internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/pool/{pool.c → pool.cc} +12 -11
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{deterministic.c → deterministic.cc} +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{fork_detect.c → fork_detect.cc} +11 -12
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{forkunsafe.c → forkunsafe.cc} +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{getentropy.c → getentropy.cc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/getrandom_fillin.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{ios.c → ios.cc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{passive.c → passive.cc} +22 -18
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{rand_extra.c → rand_extra.cc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/sysrand_internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{trusty.c → trusty.cc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{urandom.c → urandom.cc} +7 -7
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{windows.c → windows.cc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/{refcount.c → refcount.cc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/{rsa_asn1.c → rsa_asn1.cc} +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/{rsa_crypt.c → rsa_crypt.cc} +81 -78
- data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/rsa_extra.cc +17 -0
- data/third_party/boringssl-with-bazel/src/crypto/sha/sha1.cc +52 -0
- data/third_party/boringssl-with-bazel/src/crypto/sha/sha256.cc +87 -0
- data/third_party/boringssl-with-bazel/src/crypto/sha/sha512.cc +104 -0
- data/third_party/boringssl-with-bazel/src/crypto/siphash/{siphash.c → siphash.cc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/slhdsa/address.h +123 -0
- data/third_party/boringssl-with-bazel/src/crypto/slhdsa/fors.cc +169 -0
- data/third_party/boringssl-with-bazel/src/crypto/slhdsa/fors.h +58 -0
- data/third_party/boringssl-with-bazel/src/crypto/slhdsa/internal.h +63 -0
- data/third_party/boringssl-with-bazel/src/crypto/slhdsa/merkle.cc +161 -0
- data/third_party/boringssl-with-bazel/src/crypto/slhdsa/merkle.h +70 -0
- data/third_party/boringssl-with-bazel/src/crypto/slhdsa/params.h +83 -0
- data/third_party/boringssl-with-bazel/src/crypto/slhdsa/slhdsa.cc +307 -0
- data/third_party/boringssl-with-bazel/src/crypto/slhdsa/thash.cc +173 -0
- data/third_party/boringssl-with-bazel/src/crypto/slhdsa/thash.h +85 -0
- data/third_party/boringssl-with-bazel/src/crypto/slhdsa/wots.cc +171 -0
- data/third_party/boringssl-with-bazel/src/crypto/slhdsa/wots.h +50 -0
- data/third_party/boringssl-with-bazel/src/crypto/stack/{stack.c → stack.cc} +10 -6
- data/third_party/boringssl-with-bazel/src/crypto/{thread_none.c → thread_none.cc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/{thread_pthread.c → thread_pthread.cc} +9 -8
- data/third_party/boringssl-with-bazel/src/crypto/{thread_win.c → thread_win.cc} +21 -17
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/{pmbtoken.c → pmbtoken.cc} +146 -158
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/{trust_token.c → trust_token.cc} +19 -21
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/{voprf.c → voprf.cc} +165 -169
- data/third_party/boringssl-with-bazel/src/crypto/x509/{a_digest.c → a_digest.cc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/{a_sign.c → a_sign.cc} +37 -34
- data/third_party/boringssl-with-bazel/src/crypto/x509/{a_verify.c → a_verify.cc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/{algorithm.c → algorithm.cc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/{asn1_gen.c → asn1_gen.cc} +5 -6
- data/third_party/boringssl-with-bazel/src/crypto/x509/{by_dir.c → by_dir.cc} +7 -6
- data/third_party/boringssl-with-bazel/src/crypto/x509/{policy.c → policy.cc} +188 -178
- data/third_party/boringssl-with-bazel/src/crypto/x509/{rsa_pss.c → rsa_pss.cc} +48 -44
- data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_akey.c → v3_akey.cc} +4 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_alt.c → v3_alt.cc} +5 -5
- data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_bcons.c → v3_bcons.cc} +3 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_bitst.c → v3_bitst.cc} +6 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_conf.c → v3_conf.cc} +5 -5
- data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_cpols.c → v3_cpols.cc} +47 -41
- data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_crld.c → v3_crld.cc} +3 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_enum.c → v3_enum.cc} +5 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_extku.c → v3_extku.cc} +3 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_genn.c → v3_genn.cc} +7 -7
- data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_ia5.c → v3_ia5.cc} +3 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_info.c → v3_info.cc} +4 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_int.c → v3_int.cc} +3 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_lib.c → v3_lib.cc} +9 -6
- data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_ncons.c → v3_ncons.cc} +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_ocsp.c → v3_ocsp.cc} +4 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_pcons.c → v3_pcons.cc} +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_pmaps.c → v3_pmaps.cc} +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_prn.c → v3_prn.cc} +2 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_purp.c → v3_purp.cc} +16 -8
- data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_skey.c → v3_skey.cc} +6 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_utl.c → v3_utl.cc} +15 -10
- data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_att.c → x509_att.cc} +3 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_lu.c → x509_lu.cc} +6 -5
- data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_v3.c → x509_v3.cc} +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_vfy.c → x509_vfy.cc} +216 -212
- data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_vpm.c → x509_vpm.cc} +55 -13
- data/third_party/boringssl-with-bazel/src/crypto/x509/{x509spki.c → x509spki.cc} +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509/{x_all.c → x_all.cc} +10 -6
- data/third_party/boringssl-with-bazel/src/crypto/x509/{x_crl.c → x_crl.cc} +6 -6
- data/third_party/boringssl-with-bazel/src/crypto/x509/{x_name.c → x_name.cc} +39 -32
- data/third_party/boringssl-with-bazel/src/crypto/x509/{x_pubkey.c → x_pubkey.cc} +4 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/{x_x509.c → x_x509.cc} +48 -44
- data/third_party/boringssl-with-bazel/src/crypto/x509/{x_x509a.c → x_x509a.cc} +4 -2
- data/third_party/boringssl-with-bazel/src/gen/crypto/{err_data.c → err_data.cc} +359 -358
- data/third_party/boringssl-with-bazel/src/include/openssl/aead.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/asm_base.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/asn1_mac.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/asn1t.h +237 -275
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +12 -5
- data/third_party/boringssl-with-bazel/src/include/openssl/bcm_public.h +82 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/blake2.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/buffer.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/bytestring.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/chacha.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/cmac.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/cpu.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/crypto.h +13 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/ctrdrbg.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/curve25519.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +4 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +6 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +4 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/dtls1.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/e_os2.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/ec_key.h +17 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/engine.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/experimental/kyber.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/hkdf.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/hrss.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/is_boringssl.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/kdf.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/mldsa.h +8 -8
- data/third_party/boringssl-with-bazel/src/include/openssl/mlkem.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/obj_mac.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/objects.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/opensslconf.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/opensslv.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/ossl_typ.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/pkcs12.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/pkcs7.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/pkcs8.h +2 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/poly1305.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/pool.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/posix_time.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +10 -5
- data/third_party/boringssl-with-bazel/src/include/openssl/safestack.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/sha.h +2 -40
- data/third_party/boringssl-with-bazel/src/include/openssl/siphash.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/slhdsa.h +133 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/span.h +6 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/srtp.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +160 -116
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl3.h +1 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/target.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/thread.h +2 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/time.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/x509_vfy.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/x509v3_errors.h +2 -2
- data/third_party/boringssl-with-bazel/src/ssl/bio_ssl.cc +2 -6
- data/third_party/boringssl-with-bazel/src/ssl/d1_both.cc +667 -322
- data/third_party/boringssl-with-bazel/src/ssl/d1_lib.cc +116 -119
- data/third_party/boringssl-with-bazel/src/ssl/d1_pkt.cc +163 -21
- data/third_party/boringssl-with-bazel/src/ssl/d1_srtp.cc +4 -12
- data/third_party/boringssl-with-bazel/src/ssl/dtls_method.cc +94 -49
- data/third_party/boringssl-with-bazel/src/ssl/dtls_record.cc +296 -198
- data/third_party/boringssl-with-bazel/src/ssl/encrypted_client_hello.cc +23 -14
- data/third_party/boringssl-with-bazel/src/ssl/extensions.cc +363 -343
- data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +48 -58
- data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +44 -36
- data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +145 -159
- data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +65 -58
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +910 -356
- data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +29 -41
- data/third_party/boringssl-with-bazel/src/ssl/s3_lib.cc +13 -11
- data/third_party/boringssl-with-bazel/src/ssl/s3_pkt.cc +2 -2
- data/third_party/boringssl-with-bazel/src/ssl/ssl_aead_ctx.cc +90 -183
- data/third_party/boringssl-with-bazel/src/ssl/ssl_asn1.cc +38 -64
- data/third_party/boringssl-with-bazel/src/ssl/ssl_buffer.cc +1 -1
- data/third_party/boringssl-with-bazel/src/ssl/ssl_cert.cc +103 -44
- data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +210 -220
- data/third_party/boringssl-with-bazel/src/ssl/ssl_credential.cc +70 -12
- data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +20 -17
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +146 -169
- data/third_party/boringssl-with-bazel/src/ssl/ssl_privkey.cc +15 -16
- data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +79 -95
- data/third_party/boringssl-with-bazel/src/ssl/ssl_stat.cc +3 -9
- data/third_party/boringssl-with-bazel/src/ssl/ssl_transcript.cc +91 -16
- data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +30 -16
- data/third_party/boringssl-with-bazel/src/ssl/ssl_x509.cc +51 -56
- data/third_party/boringssl-with-bazel/src/ssl/t1_enc.cc +22 -25
- data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +43 -27
- data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +63 -59
- data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +204 -121
- data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +86 -59
- data/third_party/boringssl-with-bazel/src/ssl/tls_method.cc +51 -62
- data/third_party/boringssl-with-bazel/src/ssl/tls_record.cc +37 -25
- data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_32.h +6 -0
- data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64.h +6 -0
- data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64_adx.h +4 -1
- data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_32.h +1 -1
- data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_64.h +3 -0
- metadata +339 -339
- data/src/core/ext/upb-gen/envoy/config/trace/v3/opencensus.upb.h +0 -426
- data/src/core/ext/upb-gen/envoy/config/trace/v3/opencensus.upb_minitable.c +0 -87
- data/src/core/ext/upb-gen/envoy/config/trace/v3/opencensus.upb_minitable.h +0 -32
- data/src/core/ext/upb-gen/opencensus/proto/trace/v1/trace_config.upb.h +0 -408
- data/src/core/ext/upb-gen/opencensus/proto/trace/v1/trace_config.upb_minitable.c +0 -124
- data/src/core/ext/upb-gen/opencensus/proto/trace/v1/trace_config.upb_minitable.h +0 -38
- data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/opencensus.upbdefs.c +0 -108
- data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/opencensus.upbdefs.h +0 -33
- data/src/core/ext/upbdefs-gen/opencensus/proto/trace/v1/trace_config.upbdefs.c +0 -67
- data/src/core/ext/upbdefs-gen/opencensus/proto/trace/v1/trace_config.upbdefs.h +0 -48
- data/src/core/util/atm.cc +0 -34
- data/third_party/boringssl-with-bazel/src/crypto/dilithium/dilithium.c +0 -1539
- data/third_party/boringssl-with-bazel/src/crypto/dilithium/internal.h +0 -58
- data/third_party/boringssl-with-bazel/src/crypto/spx/address.c +0 -101
- data/third_party/boringssl-with-bazel/src/crypto/spx/address.h +0 -50
- data/third_party/boringssl-with-bazel/src/crypto/spx/fors.c +0 -133
- data/third_party/boringssl-with-bazel/src/crypto/spx/fors.h +0 -54
- data/third_party/boringssl-with-bazel/src/crypto/spx/merkle.c +0 -150
- data/third_party/boringssl-with-bazel/src/crypto/spx/merkle.h +0 -61
- data/third_party/boringssl-with-bazel/src/crypto/spx/params.h +0 -71
- data/third_party/boringssl-with-bazel/src/crypto/spx/spx.c +0 -140
- data/third_party/boringssl-with-bazel/src/crypto/spx/spx_util.c +0 -53
- data/third_party/boringssl-with-bazel/src/crypto/spx/spx_util.h +0 -44
- data/third_party/boringssl-with-bazel/src/crypto/spx/thash.c +0 -136
- data/third_party/boringssl-with-bazel/src/crypto/spx/thash.h +0 -70
- data/third_party/boringssl-with-bazel/src/crypto/spx/wots.c +0 -135
- data/third_party/boringssl-with-bazel/src/crypto/spx/wots.h +0 -45
- data/third_party/boringssl-with-bazel/src/include/openssl/experimental/dilithium.h +0 -129
- data/third_party/boringssl-with-bazel/src/include/openssl/experimental/spx.h +0 -90
- /data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_bool.c → a_bool.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_gentm.c → a_gentm.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_octet.c → a_octet.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_strex.c → a_strex.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_time.c → a_time.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_utctm.c → a_utctm.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/asn1/{asn1_par.c → asn1_par.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/asn1/{f_int.c → f_int.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/asn1/{f_string.c → f_string.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/asn1/{tasn_typ.c → tasn_typ.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/bio/{errno.c → errno.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/bio/{fd.c → fd.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/bio/{hexdump.c → hexdump.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/bio/{socket.c → socket.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{cipher_extra.c → cipher_extra.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{derive_key.c → derive_key.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{tls_cbc.c → tls_cbc.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/des/{des.c → des.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/dh_extra/{params.c → params.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/ecdh_extra/{ecdh_extra.c → ecdh_extra.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/evp/{evp_asn1.c → evp_asn1.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/evp/{sign.c → sign.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/{aes.c.inc → aes.cc.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/{mode_wrappers.c.inc → mode_wrappers.cc.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{bytes.c.inc → bytes.cc.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{cmp.c.inc → cmp.cc.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{generic.c.inc → generic.cc.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{jacobi.c.inc → jacobi.cc.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{montgomery_inv.c.inc → montgomery_inv.cc.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{random.c.inc → random.cc.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{rsaz_exp.c.inc → rsaz_exp.cc.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{sqrt.c.inc → sqrt.cc.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{e_aesccm.c.inc → e_aesccm.cc.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/{check.c.inc → check.cc.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{ec_montgomery.c.inc → ec_montgomery.cc.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{simple.c.inc → simple.cc.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{cbc.c.inc → cbc.cc.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{cfb.c.inc → cfb.cc.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{ctr.c.inc → ctr.cc.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{ofb.c.inc → ofb.cc.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/tls/{kdf.c.inc → kdf.cc.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/obj/{obj_xref.c → obj_xref.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_all.c → pem_all.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_pk8.c → pem_pk8.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_pkey.c → pem_pkey.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_x509.c → pem_x509.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_xaux.c → pem_xaux.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/rc4/{rc4.c → rc4.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/{rsa_print.c → rsa_print.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/{thread.c → thread.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{by_file.c → by_file.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{i2d_pr.c → i2d_pr.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{name_print.c → name_print.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{t_crl.c → t_crl.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{t_req.c → t_req.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{t_x509.c → t_x509.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{t_x509a.c → t_x509a.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_akeya.c → v3_akeya.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509.c → x509.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_cmp.c → x509_cmp.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_d2.c → x509_d2.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_def.c → x509_def.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_ext.c → x509_ext.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_obj.c → x509_obj.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_req.c → x509_req.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_set.c → x509_set.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_trs.c → x509_trs.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_txt.c → x509_txt.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509cset.c → x509cset.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509name.c → x509name.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509rset.c → x509rset.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{x_algor.c → x_algor.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{x_attrib.c → x_attrib.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{x_exten.c → x_exten.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{x_req.c → x_req.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{x_sig.c → x_sig.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{x_spki.c → x_spki.cc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/x509/{x_val.c → x_val.cc} +0 -0
@@ -155,7 +155,6 @@
|
|
155
155
|
#include <utility>
|
156
156
|
|
157
157
|
#include <openssl/aead.h>
|
158
|
-
#include <openssl/aes.h>
|
159
158
|
#include <openssl/curve25519.h>
|
160
159
|
#include <openssl/err.h>
|
161
160
|
#include <openssl/hpke.h>
|
@@ -189,13 +188,60 @@ struct SSL_X509_METHOD;
|
|
189
188
|
|
190
189
|
// C++ utilities.
|
191
190
|
|
191
|
+
// Fill-ins for various functions in C++17.
|
192
|
+
// TODO(crbug.com/42290600): Replace these with the standard ones when we
|
193
|
+
// require C++17.
|
194
|
+
|
195
|
+
template <typename ForwardIt>
|
196
|
+
ForwardIt cxx17_uninitialized_default_construct_n(ForwardIt first, size_t n) {
|
197
|
+
using T = typename std::iterator_traits<ForwardIt>::value_type;
|
198
|
+
while (n > 0) {
|
199
|
+
new (std::addressof(*first)) T;
|
200
|
+
first++;
|
201
|
+
n--;
|
202
|
+
}
|
203
|
+
return first;
|
204
|
+
}
|
205
|
+
|
206
|
+
template <typename ForwardIt>
|
207
|
+
ForwardIt cxx17_uninitialized_value_construct_n(ForwardIt first, size_t n) {
|
208
|
+
using T = typename std::iterator_traits<ForwardIt>::value_type;
|
209
|
+
while (n > 0) {
|
210
|
+
new (std::addressof(*first)) T();
|
211
|
+
first++;
|
212
|
+
n--;
|
213
|
+
}
|
214
|
+
return first;
|
215
|
+
}
|
216
|
+
|
217
|
+
template <typename InputIt, typename OutputIt>
|
218
|
+
InputIt cxx17_uninitialized_move(InputIt first, InputIt last, OutputIt out) {
|
219
|
+
using OutputT = typename std::iterator_traits<OutputIt>::value_type;
|
220
|
+
for (; first != last; ++first) {
|
221
|
+
new (std::addressof(*out)) OutputT(std::move(*first));
|
222
|
+
++out;
|
223
|
+
}
|
224
|
+
return out;
|
225
|
+
}
|
226
|
+
|
227
|
+
template <typename ForwardIt>
|
228
|
+
ForwardIt cxx17_destroy_n(ForwardIt first, size_t n) {
|
229
|
+
using T = typename std::iterator_traits<ForwardIt>::value_type;
|
230
|
+
while (n > 0) {
|
231
|
+
first->~T();
|
232
|
+
first++;
|
233
|
+
n--;
|
234
|
+
}
|
235
|
+
return first;
|
236
|
+
}
|
237
|
+
|
192
238
|
// New behaves like |new| but uses |OPENSSL_malloc| for memory allocation. It
|
193
239
|
// returns nullptr on allocation error. It only implements single-object
|
194
240
|
// allocation and not new T[n].
|
195
241
|
//
|
196
242
|
// Note: unlike |new|, this does not support non-public constructors.
|
197
243
|
template <typename T, typename... Args>
|
198
|
-
T *New(Args &&...
|
244
|
+
T *New(Args &&...args) {
|
199
245
|
void *t = OPENSSL_malloc(sizeof(T));
|
200
246
|
if (t == nullptr) {
|
201
247
|
return nullptr;
|
@@ -226,7 +272,7 @@ struct DeleterImpl<T, std::enable_if_t<T::kAllowUniquePtr>> {
|
|
226
272
|
// MakeUnique behaves like |std::make_unique| but returns nullptr on allocation
|
227
273
|
// error.
|
228
274
|
template <typename T, typename... Args>
|
229
|
-
UniquePtr<T> MakeUnique(Args &&...
|
275
|
+
UniquePtr<T> MakeUnique(Args &&...args) {
|
230
276
|
return UniquePtr<T>(New<T>(std::forward<Args>(args)...));
|
231
277
|
}
|
232
278
|
|
@@ -253,8 +299,14 @@ class Array {
|
|
253
299
|
size_t size() const { return size_; }
|
254
300
|
bool empty() const { return size_ == 0; }
|
255
301
|
|
256
|
-
const T &operator[](size_t i) const {
|
257
|
-
|
302
|
+
const T &operator[](size_t i) const {
|
303
|
+
BSSL_CHECK(i < size_);
|
304
|
+
return data_[i];
|
305
|
+
}
|
306
|
+
T &operator[](size_t i) {
|
307
|
+
BSSL_CHECK(i < size_);
|
308
|
+
return data_[i];
|
309
|
+
}
|
258
310
|
|
259
311
|
T *begin() { return data_; }
|
260
312
|
const T *begin() const { return data_; }
|
@@ -266,9 +318,7 @@ class Array {
|
|
266
318
|
// Reset releases the current contents of the array and takes ownership of the
|
267
319
|
// raw pointer supplied by the caller.
|
268
320
|
void Reset(T *new_data, size_t new_size) {
|
269
|
-
|
270
|
-
data_[i].~T();
|
271
|
-
}
|
321
|
+
cxx17_destroy_n(data_, size_);
|
272
322
|
OPENSSL_free(data_);
|
273
323
|
data_ = new_data;
|
274
324
|
size_ = new_size;
|
@@ -284,38 +334,35 @@ class Array {
|
|
284
334
|
}
|
285
335
|
|
286
336
|
// Init replaces the array with a newly-allocated array of |new_size|
|
287
|
-
//
|
288
|
-
// error.
|
289
|
-
//
|
290
|
-
// Note that if |T| is a primitive type like |uint8_t|, it is uninitialized.
|
337
|
+
// value-constructed copies of |T|. It returns true on success and false on
|
338
|
+
// error. If |T| is a primitive type like |uint8_t|, value-construction means
|
339
|
+
// it will be zero-initialized.
|
291
340
|
bool Init(size_t new_size) {
|
292
|
-
|
293
|
-
if (new_size == 0) {
|
294
|
-
return true;
|
295
|
-
}
|
296
|
-
|
297
|
-
if (new_size > std::numeric_limits<size_t>::max() / sizeof(T)) {
|
298
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_OVERFLOW);
|
341
|
+
if (!InitUninitialized(new_size)) {
|
299
342
|
return false;
|
300
343
|
}
|
301
|
-
data_
|
302
|
-
|
344
|
+
cxx17_uninitialized_value_construct_n(data_, size_);
|
345
|
+
return true;
|
346
|
+
}
|
347
|
+
|
348
|
+
// InitForOverwrite behaves like |Init| but it default-constructs each element
|
349
|
+
// instead. This means that, if |T| is a primitive type, the array will be
|
350
|
+
// uninitialized and thus must be filled in by the caller.
|
351
|
+
bool InitForOverwrite(size_t new_size) {
|
352
|
+
if (!InitUninitialized(new_size)) {
|
303
353
|
return false;
|
304
354
|
}
|
305
|
-
size_
|
306
|
-
for (size_t i = 0; i < size_; i++) {
|
307
|
-
new (&data_[i]) T;
|
308
|
-
}
|
355
|
+
cxx17_uninitialized_default_construct_n(data_, size_);
|
309
356
|
return true;
|
310
357
|
}
|
311
358
|
|
312
359
|
// CopyFrom replaces the array with a newly-allocated copy of |in|. It returns
|
313
360
|
// true on success and false on error.
|
314
361
|
bool CopyFrom(Span<const T> in) {
|
315
|
-
if (!
|
362
|
+
if (!InitUninitialized(in.size())) {
|
316
363
|
return false;
|
317
364
|
}
|
318
|
-
std::
|
365
|
+
std::uninitialized_copy(in.begin(), in.end(), data_);
|
319
366
|
return true;
|
320
367
|
}
|
321
368
|
|
@@ -325,55 +372,79 @@ class Array {
|
|
325
372
|
if (new_size > size_) {
|
326
373
|
abort();
|
327
374
|
}
|
328
|
-
|
329
|
-
data_[i].~T();
|
330
|
-
}
|
375
|
+
cxx17_destroy_n(data_ + new_size, size_ - new_size);
|
331
376
|
size_ = new_size;
|
332
377
|
}
|
333
378
|
|
334
379
|
private:
|
380
|
+
// InitUninitialized replaces the array with a newly-allocated array of
|
381
|
+
// |new_size| elements, but whose constructor has not yet run. On success, the
|
382
|
+
// elements must be constructed before returning control to the caller.
|
383
|
+
bool InitUninitialized(size_t new_size) {
|
384
|
+
Reset();
|
385
|
+
if (new_size == 0) {
|
386
|
+
return true;
|
387
|
+
}
|
388
|
+
|
389
|
+
if (new_size > std::numeric_limits<size_t>::max() / sizeof(T)) {
|
390
|
+
OPENSSL_PUT_ERROR(SSL, ERR_R_OVERFLOW);
|
391
|
+
return false;
|
392
|
+
}
|
393
|
+
data_ = reinterpret_cast<T *>(OPENSSL_malloc(new_size * sizeof(T)));
|
394
|
+
if (data_ == nullptr) {
|
395
|
+
return false;
|
396
|
+
}
|
397
|
+
size_ = new_size;
|
398
|
+
return true;
|
399
|
+
}
|
400
|
+
|
335
401
|
T *data_ = nullptr;
|
336
402
|
size_t size_ = 0;
|
337
403
|
};
|
338
404
|
|
339
|
-
//
|
340
|
-
// Array<T>. When necessary, pushing will automatically trigger a resize.
|
341
|
-
//
|
342
|
-
// Note, for simplicity, this class currently differs from |std::vector| in that
|
343
|
-
// |T| must be efficiently default-constructible. Allocated elements beyond the
|
344
|
-
// end of the array are constructed and destructed.
|
405
|
+
// Vector<T> is a resizable array of elements of |T|.
|
345
406
|
template <typename T>
|
346
|
-
class
|
407
|
+
class Vector {
|
347
408
|
public:
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
~
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
other.
|
357
|
-
|
409
|
+
Vector() = default;
|
410
|
+
Vector(const Vector &) = delete;
|
411
|
+
Vector(Vector &&other) { *this = std::move(other); }
|
412
|
+
~Vector() { clear(); }
|
413
|
+
|
414
|
+
Vector &operator=(const Vector &) = delete;
|
415
|
+
Vector &operator=(Vector &&other) {
|
416
|
+
clear();
|
417
|
+
std::swap(data_, other.data_);
|
418
|
+
std::swap(size_, other.size_);
|
419
|
+
std::swap(capacity_, other.capacity_);
|
358
420
|
return *this;
|
359
421
|
}
|
360
422
|
|
361
|
-
const T *data() const { return
|
362
|
-
T *data() { return
|
423
|
+
const T *data() const { return data_; }
|
424
|
+
T *data() { return data_; }
|
363
425
|
size_t size() const { return size_; }
|
364
426
|
bool empty() const { return size_ == 0; }
|
365
427
|
|
366
|
-
const T &operator[](size_t i) const {
|
367
|
-
|
428
|
+
const T &operator[](size_t i) const {
|
429
|
+
BSSL_CHECK(i < size_);
|
430
|
+
return data_[i];
|
431
|
+
}
|
432
|
+
T &operator[](size_t i) {
|
433
|
+
BSSL_CHECK(i < size_);
|
434
|
+
return data_[i];
|
435
|
+
}
|
368
436
|
|
369
|
-
T *begin() { return
|
370
|
-
const T *begin() const { return
|
371
|
-
T *end() { return
|
372
|
-
const T *end() const { return
|
437
|
+
T *begin() { return data_; }
|
438
|
+
const T *begin() const { return data_; }
|
439
|
+
T *end() { return data_ + size_; }
|
440
|
+
const T *end() const { return data_ + size_; }
|
373
441
|
|
374
442
|
void clear() {
|
443
|
+
cxx17_destroy_n(data_, size_);
|
444
|
+
OPENSSL_free(data_);
|
445
|
+
data_ = nullptr;
|
375
446
|
size_ = 0;
|
376
|
-
|
447
|
+
capacity_ = 0;
|
377
448
|
}
|
378
449
|
|
379
450
|
// Push adds |elem| at the end of the internal array, growing if necessary. It
|
@@ -382,7 +453,7 @@ class GrowableArray {
|
|
382
453
|
if (!MaybeGrow()) {
|
383
454
|
return false;
|
384
455
|
}
|
385
|
-
|
456
|
+
new (&data_[size_]) T(std::move(elem));
|
386
457
|
size_++;
|
387
458
|
return true;
|
388
459
|
}
|
@@ -390,10 +461,14 @@ class GrowableArray {
|
|
390
461
|
// CopyFrom replaces the contents of the array with a copy of |in|. It returns
|
391
462
|
// true on success and false on allocation error.
|
392
463
|
bool CopyFrom(Span<const T> in) {
|
393
|
-
|
464
|
+
Array<T> copy;
|
465
|
+
if (!copy.CopyFrom(in)) {
|
394
466
|
return false;
|
395
467
|
}
|
396
|
-
|
468
|
+
|
469
|
+
clear();
|
470
|
+
copy.Release(&data_, &size_);
|
471
|
+
capacity_ = size_;
|
397
472
|
return true;
|
398
473
|
}
|
399
474
|
|
@@ -401,39 +476,249 @@ class GrowableArray {
|
|
401
476
|
// If there is no room for one more element, creates a new backing array with
|
402
477
|
// double the size of the old one and copies elements over.
|
403
478
|
bool MaybeGrow() {
|
404
|
-
if (array_.size() == 0) {
|
405
|
-
return array_.Init(kDefaultSize);
|
406
|
-
}
|
407
479
|
// No need to grow if we have room for one more T.
|
408
|
-
if (size_ <
|
480
|
+
if (size_ < capacity_) {
|
409
481
|
return true;
|
410
482
|
}
|
411
|
-
|
412
|
-
if (
|
483
|
+
size_t new_capacity = kDefaultSize;
|
484
|
+
if (capacity_ > 0) {
|
485
|
+
// Double the array's size if it's safe to do so.
|
486
|
+
if (capacity_ > std::numeric_limits<size_t>::max() / 2) {
|
487
|
+
OPENSSL_PUT_ERROR(SSL, ERR_R_OVERFLOW);
|
488
|
+
return false;
|
489
|
+
}
|
490
|
+
new_capacity = capacity_ * 2;
|
491
|
+
}
|
492
|
+
if (new_capacity > std::numeric_limits<size_t>::max() / sizeof(T)) {
|
413
493
|
OPENSSL_PUT_ERROR(SSL, ERR_R_OVERFLOW);
|
414
494
|
return false;
|
415
495
|
}
|
416
|
-
|
417
|
-
|
496
|
+
T *new_data =
|
497
|
+
reinterpret_cast<T *>(OPENSSL_malloc(new_capacity * sizeof(T)));
|
498
|
+
if (new_data == nullptr) {
|
418
499
|
return false;
|
419
500
|
}
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
501
|
+
size_t new_size = size_;
|
502
|
+
cxx17_uninitialized_move(begin(), end(), new_data);
|
503
|
+
clear();
|
504
|
+
data_ = new_data;
|
505
|
+
size_ = new_size;
|
506
|
+
capacity_ = new_capacity;
|
425
507
|
return true;
|
426
508
|
}
|
427
509
|
|
428
|
-
//
|
510
|
+
// data_ is a pointer to |capacity_| objects of size |T|, the first |size_| of
|
511
|
+
// which are constructed.
|
512
|
+
T *data_ = nullptr;
|
513
|
+
// |size_| is the number of elements stored in this Vector.
|
429
514
|
size_t size_ = 0;
|
430
|
-
// |
|
431
|
-
|
432
|
-
Array<T> array_;
|
515
|
+
// |capacity_| is the number of elements allocated in this Vector.
|
516
|
+
size_t capacity_ = 0;
|
433
517
|
// |kDefaultSize| is the default initial size of the backing array.
|
434
518
|
static constexpr size_t kDefaultSize = 16;
|
435
519
|
};
|
436
520
|
|
521
|
+
// A PackedSize is an integer that can store values from 0 to N, represented as
|
522
|
+
// a minimal-width integer.
|
523
|
+
template <size_t N>
|
524
|
+
using PackedSize = std::conditional_t<
|
525
|
+
N <= 0xff, uint8_t,
|
526
|
+
std::conditional_t<N <= 0xffff, uint16_t,
|
527
|
+
std::conditional_t<N <= 0xffffffff, uint32_t, size_t>>>;
|
528
|
+
|
529
|
+
// An InplaceVector is like a Vector, but stores up to N elements inline in the
|
530
|
+
// object. It is inspired by std::inplace_vector in C++26.
|
531
|
+
template <typename T, size_t N>
|
532
|
+
class InplaceVector {
|
533
|
+
public:
|
534
|
+
InplaceVector() = default;
|
535
|
+
InplaceVector(const InplaceVector &other) { *this = other; }
|
536
|
+
InplaceVector(InplaceVector &&other) { *this = std::move(other); }
|
537
|
+
~InplaceVector() { clear(); }
|
538
|
+
InplaceVector &operator=(const InplaceVector &other) {
|
539
|
+
if (this != &other) {
|
540
|
+
CopyFrom(other);
|
541
|
+
}
|
542
|
+
return *this;
|
543
|
+
}
|
544
|
+
InplaceVector &operator=(InplaceVector &&other) {
|
545
|
+
clear();
|
546
|
+
cxx17_uninitialized_move(other.begin(), other.end(), data());
|
547
|
+
size_ = other.size();
|
548
|
+
return *this;
|
549
|
+
}
|
550
|
+
|
551
|
+
const T *data() const { return reinterpret_cast<const T *>(storage_); }
|
552
|
+
T *data() { return reinterpret_cast<T *>(storage_); }
|
553
|
+
size_t size() const { return size_; }
|
554
|
+
static constexpr size_t capacity() { return N; }
|
555
|
+
bool empty() const { return size_ == 0; }
|
556
|
+
|
557
|
+
const T &operator[](size_t i) const {
|
558
|
+
BSSL_CHECK(i < size_);
|
559
|
+
return data()[i];
|
560
|
+
}
|
561
|
+
T &operator[](size_t i) {
|
562
|
+
BSSL_CHECK(i < size_);
|
563
|
+
return data()[i];
|
564
|
+
}
|
565
|
+
|
566
|
+
T *begin() { return data(); }
|
567
|
+
const T *begin() const { return data(); }
|
568
|
+
T *end() { return data() + size_; }
|
569
|
+
const T *end() const { return data() + size_; }
|
570
|
+
|
571
|
+
void clear() { Shrink(0); }
|
572
|
+
|
573
|
+
// Shrink resizes the vector to |new_size|, which must not be larger than the
|
574
|
+
// current size. Unlike |Resize|, this can be called when |T| is not
|
575
|
+
// default-constructible.
|
576
|
+
void Shrink(size_t new_size) {
|
577
|
+
BSSL_CHECK(new_size <= size_);
|
578
|
+
cxx17_destroy_n(data() + new_size, size_ - new_size);
|
579
|
+
size_ = static_cast<PackedSize<N>>(new_size);
|
580
|
+
}
|
581
|
+
|
582
|
+
// TryResize resizes the vector to |new_size| and returns true, or returns
|
583
|
+
// false if |new_size| is too large. Any newly-added elements are
|
584
|
+
// value-initialized.
|
585
|
+
bool TryResize(size_t new_size) {
|
586
|
+
if (new_size <= size_) {
|
587
|
+
Shrink(new_size);
|
588
|
+
return true;
|
589
|
+
}
|
590
|
+
if (new_size > capacity()) {
|
591
|
+
return false;
|
592
|
+
}
|
593
|
+
cxx17_uninitialized_value_construct_n(data() + size_, new_size - size_);
|
594
|
+
size_ = static_cast<PackedSize<N>>(new_size);
|
595
|
+
return true;
|
596
|
+
}
|
597
|
+
|
598
|
+
// TryResizeForOverwrite behaves like |TryResize|, but newly-added elements
|
599
|
+
// are default-initialized, so POD types may contain uninitialized values that
|
600
|
+
// the caller is responsible for filling in.
|
601
|
+
bool TryResizeForOverwrite(size_t new_size) {
|
602
|
+
if (new_size <= size_) {
|
603
|
+
Shrink(new_size);
|
604
|
+
return true;
|
605
|
+
}
|
606
|
+
if (new_size > capacity()) {
|
607
|
+
return false;
|
608
|
+
}
|
609
|
+
cxx17_uninitialized_default_construct_n(data() + size_, new_size - size_);
|
610
|
+
size_ = static_cast<PackedSize<N>>(new_size);
|
611
|
+
return true;
|
612
|
+
}
|
613
|
+
|
614
|
+
// TryCopyFrom sets the vector to a copy of |in| and returns true, or returns
|
615
|
+
// false if |in| is too large.
|
616
|
+
bool TryCopyFrom(Span<const T> in) {
|
617
|
+
if (in.size() > capacity()) {
|
618
|
+
return false;
|
619
|
+
}
|
620
|
+
clear();
|
621
|
+
std::uninitialized_copy(in.begin(), in.end(), data());
|
622
|
+
size_ = in.size();
|
623
|
+
return true;
|
624
|
+
}
|
625
|
+
|
626
|
+
// TryPushBack appends |val| to the vector and returns a pointer to the
|
627
|
+
// newly-inserted value, or nullptr if the vector is at capacity.
|
628
|
+
T *TryPushBack(T val) {
|
629
|
+
if (size() >= capacity()) {
|
630
|
+
return nullptr;
|
631
|
+
}
|
632
|
+
T *ret = &data()[size_];
|
633
|
+
new (ret) T(std::move(val));
|
634
|
+
size_++;
|
635
|
+
return ret;
|
636
|
+
}
|
637
|
+
|
638
|
+
// The following methods behave like their |Try*| counterparts, but abort the
|
639
|
+
// program on failure.
|
640
|
+
void Resize(size_t size) { BSSL_CHECK(TryResize(size)); }
|
641
|
+
void ResizeForOverwrite(size_t size) {
|
642
|
+
BSSL_CHECK(TryResizeForOverwrite(size));
|
643
|
+
}
|
644
|
+
void CopyFrom(Span<const T> in) { BSSL_CHECK(TryCopyFrom(in)); }
|
645
|
+
T &PushBack(T val) {
|
646
|
+
T *ret = TryPushBack(std::move(val));
|
647
|
+
BSSL_CHECK(ret != nullptr);
|
648
|
+
return *ret;
|
649
|
+
}
|
650
|
+
|
651
|
+
template <typename Pred>
|
652
|
+
void EraseIf(Pred pred) {
|
653
|
+
// See if anything needs to be erased at all. This avoids a self-move.
|
654
|
+
auto iter = std::find_if(begin(), end(), pred);
|
655
|
+
if (iter == end()) {
|
656
|
+
return;
|
657
|
+
}
|
658
|
+
|
659
|
+
// Elements before the first to be erased may be left as-is.
|
660
|
+
size_t new_size = iter - begin();
|
661
|
+
// Swap all subsequent elements in if they are to be kept.
|
662
|
+
for (size_t i = new_size + 1; i < size(); i++) {
|
663
|
+
if (!pred((*this)[i])) {
|
664
|
+
(*this)[new_size] = std::move((*this)[i]);
|
665
|
+
new_size++;
|
666
|
+
}
|
667
|
+
}
|
668
|
+
|
669
|
+
Shrink(new_size);
|
670
|
+
}
|
671
|
+
|
672
|
+
private:
|
673
|
+
alignas(T) char storage_[sizeof(T[N])];
|
674
|
+
PackedSize<N> size_ = 0;
|
675
|
+
};
|
676
|
+
|
677
|
+
// An MRUQueue maintains a queue of up to |N| objects of type |T|. If the queue
|
678
|
+
// is at capacity, adding to the queue pops the least recently added element.
|
679
|
+
template <typename T, size_t N>
|
680
|
+
class MRUQueue {
|
681
|
+
public:
|
682
|
+
static constexpr bool kAllowUniquePtr = true;
|
683
|
+
|
684
|
+
MRUQueue() = default;
|
685
|
+
|
686
|
+
// If we ever need to make this type movable, we could. (The defaults almost
|
687
|
+
// work except we need |start_| to be reset when moved-from.)
|
688
|
+
MRUQueue(const MRUQueue &other) = delete;
|
689
|
+
MRUQueue &operator=(const MRUQueue &other) = delete;
|
690
|
+
|
691
|
+
bool empty() const { return size() == 0; }
|
692
|
+
size_t size() const { return storage_.size(); }
|
693
|
+
|
694
|
+
T &operator[](size_t i) {
|
695
|
+
BSSL_CHECK(i < size());
|
696
|
+
return storage_[(start_ + i) % N];
|
697
|
+
}
|
698
|
+
const T &operator[](size_t i) const {
|
699
|
+
return (*const_cast<MRUQueue *>(this))[i];
|
700
|
+
}
|
701
|
+
|
702
|
+
void Clear() {
|
703
|
+
storage_.clear();
|
704
|
+
start_ = 0;
|
705
|
+
}
|
706
|
+
|
707
|
+
void PushBack(T t) {
|
708
|
+
if (storage_.size() < N) {
|
709
|
+
assert(start_ == 0);
|
710
|
+
storage_.PushBack(std::move(t));
|
711
|
+
} else {
|
712
|
+
(*this)[0] = std::move(t);
|
713
|
+
start_ = (start_ + 1) % N;
|
714
|
+
}
|
715
|
+
}
|
716
|
+
|
717
|
+
private:
|
718
|
+
InplaceVector<T, N> storage_;
|
719
|
+
PackedSize<N> start_ = 0;
|
720
|
+
};
|
721
|
+
|
437
722
|
// CBBFinishArray behaves like |CBB_finish| but stores the result in an Array.
|
438
723
|
OPENSSL_EXPORT bool CBBFinishArray(CBB *cbb, Array<uint8_t> *out);
|
439
724
|
|
@@ -548,6 +833,11 @@ bool ssl_add_supported_versions(const SSL_HANDSHAKE *hs, CBB *cbb,
|
|
548
833
|
bool ssl_negotiate_version(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
549
834
|
uint16_t *out_version, const CBS *peer_versions);
|
550
835
|
|
836
|
+
// ssl_has_final_version returns whether |ssl| has determined the final version.
|
837
|
+
// This may be used to distinguish the predictive 0-RTT version from the final
|
838
|
+
// one.
|
839
|
+
bool ssl_has_final_version(const SSL *ssl);
|
840
|
+
|
551
841
|
// ssl_protocol_version returns |ssl|'s protocol version. It is an error to
|
552
842
|
// call this function before the version is determined.
|
553
843
|
uint16_t ssl_protocol_version(const SSL *ssl);
|
@@ -672,7 +962,7 @@ Span<const SSL_CIPHER> AllCiphers();
|
|
672
962
|
bool ssl_cipher_get_evp_aead(const EVP_AEAD **out_aead,
|
673
963
|
size_t *out_mac_secret_len,
|
674
964
|
size_t *out_fixed_iv_len, const SSL_CIPHER *cipher,
|
675
|
-
uint16_t version
|
965
|
+
uint16_t version);
|
676
966
|
|
677
967
|
// ssl_get_handshake_digest returns the |EVP_MD| corresponding to |version| and
|
678
968
|
// |cipher|.
|
@@ -733,7 +1023,7 @@ OPENSSL_EXPORT bool ssl_cipher_is_deprecated(const SSL_CIPHER *cipher);
|
|
733
1023
|
// buffer and running hash.
|
734
1024
|
class SSLTranscript {
|
735
1025
|
public:
|
736
|
-
SSLTranscript();
|
1026
|
+
explicit SSLTranscript(bool is_dtls);
|
737
1027
|
~SSLTranscript();
|
738
1028
|
|
739
1029
|
SSLTranscript(SSLTranscript &&other) = default;
|
@@ -796,10 +1086,23 @@ class SSLTranscript {
|
|
796
1086
|
bool from_server) const;
|
797
1087
|
|
798
1088
|
private:
|
1089
|
+
// HashBuffer initializes |ctx| to use |digest| and writes the contents of
|
1090
|
+
// |buffer_| to |ctx|. If this SSLTranscript is for DTLS 1.3, the appropriate
|
1091
|
+
// bytes in |buffer_| will be skipped when hashing the buffer.
|
1092
|
+
bool HashBuffer(EVP_MD_CTX *ctx, const EVP_MD *digest) const;
|
1093
|
+
|
1094
|
+
// AddToBufferOrHash directly adds the contents of |in| to |buffer_| and/or
|
1095
|
+
// |hash_|.
|
1096
|
+
bool AddToBufferOrHash(Span<const uint8_t> in);
|
1097
|
+
|
799
1098
|
// buffer_, if non-null, contains the handshake transcript.
|
800
1099
|
UniquePtr<BUF_MEM> buffer_;
|
801
1100
|
// hash, if initialized with an |EVP_MD|, maintains the handshake hash.
|
802
1101
|
ScopedEVP_MD_CTX hash_;
|
1102
|
+
// is_dtls_ indicates whether this is a transcript for a DTLS connection.
|
1103
|
+
bool is_dtls_ : 1;
|
1104
|
+
// version_ contains the version for the connection (if known).
|
1105
|
+
uint16_t version_ = 0;
|
803
1106
|
};
|
804
1107
|
|
805
1108
|
// tls1_prf computes the PRF function for |ssl|. It fills |out|, using |secret|
|
@@ -812,21 +1115,11 @@ bool tls1_prf(const EVP_MD *digest, Span<uint8_t> out,
|
|
812
1115
|
|
813
1116
|
// Encryption layer.
|
814
1117
|
|
815
|
-
class RecordNumberEncrypter {
|
816
|
-
public:
|
817
|
-
virtual ~RecordNumberEncrypter() = default;
|
818
|
-
static constexpr bool kAllowUniquePtr = true;
|
819
|
-
|
820
|
-
virtual size_t KeySize() = 0;
|
821
|
-
virtual bool SetKey(Span<const uint8_t> key) = 0;
|
822
|
-
virtual bool GenerateMask(Span<uint8_t> out, Span<const uint8_t> sample) = 0;
|
823
|
-
};
|
824
|
-
|
825
1118
|
// SSLAEADContext contains information about an AEAD that is being used to
|
826
1119
|
// encrypt an SSL connection.
|
827
1120
|
class SSLAEADContext {
|
828
1121
|
public:
|
829
|
-
SSLAEADContext(
|
1122
|
+
explicit SSLAEADContext(const SSL_CIPHER *cipher);
|
830
1123
|
~SSLAEADContext();
|
831
1124
|
static constexpr bool kAllowUniquePtr = true;
|
832
1125
|
|
@@ -834,38 +1127,23 @@ class SSLAEADContext {
|
|
834
1127
|
SSLAEADContext &operator=(const SSLAEADContext &&) = delete;
|
835
1128
|
|
836
1129
|
// CreateNullCipher creates an |SSLAEADContext| for the null cipher.
|
837
|
-
static UniquePtr<SSLAEADContext> CreateNullCipher(
|
1130
|
+
static UniquePtr<SSLAEADContext> CreateNullCipher();
|
838
1131
|
|
839
1132
|
// Create creates an |SSLAEADContext| using the supplied key material. It
|
840
1133
|
// returns nullptr on error. Only one of |Open| or |Seal| may be used with the
|
841
|
-
// resulting object, depending on |direction|. |version| is the
|
842
|
-
// protocol version, so DTLS 1.0 is represented as 0x0301, not 0xffef.
|
1134
|
+
// resulting object, depending on |direction|. |version| is the wire version.
|
843
1135
|
static UniquePtr<SSLAEADContext> Create(enum evp_aead_direction_t direction,
|
844
|
-
uint16_t version,
|
1136
|
+
uint16_t version,
|
845
1137
|
const SSL_CIPHER *cipher,
|
846
1138
|
Span<const uint8_t> enc_key,
|
847
1139
|
Span<const uint8_t> mac_key,
|
848
1140
|
Span<const uint8_t> fixed_iv);
|
849
1141
|
|
850
1142
|
// CreatePlaceholderForQUIC creates a placeholder |SSLAEADContext| for the
|
851
|
-
// given cipher
|
852
|
-
//
|
1143
|
+
// given cipher. The resulting object can be queried for various properties
|
1144
|
+
// but cannot encrypt or decrypt data.
|
853
1145
|
static UniquePtr<SSLAEADContext> CreatePlaceholderForQUIC(
|
854
|
-
|
855
|
-
|
856
|
-
// SetVersionIfNullCipher sets the version the SSLAEADContext for the null
|
857
|
-
// cipher, to make version-specific determinations in the record layer prior
|
858
|
-
// to a cipher being selected.
|
859
|
-
void SetVersionIfNullCipher(uint16_t version);
|
860
|
-
|
861
|
-
// ProtocolVersion returns the protocol version associated with this
|
862
|
-
// SSLAEADContext. It can only be called once |version_| has been set to a
|
863
|
-
// valid value.
|
864
|
-
uint16_t ProtocolVersion() const;
|
865
|
-
|
866
|
-
// RecordVersion returns the record version that should be used with this
|
867
|
-
// SSLAEADContext for record construction and crypto.
|
868
|
-
uint16_t RecordVersion() const;
|
1146
|
+
const SSL_CIPHER *cipher);
|
869
1147
|
|
870
1148
|
const SSL_CIPHER *cipher() const { return cipher_; }
|
871
1149
|
|
@@ -878,6 +1156,10 @@ class SSLAEADContext {
|
|
878
1156
|
// MaxOverhead returns the maximum overhead of calling |Seal|.
|
879
1157
|
size_t MaxOverhead() const;
|
880
1158
|
|
1159
|
+
// MaxSealInputLen returns the maximum length for |Seal| that can fit in
|
1160
|
+
// |max_out| output bytes, or zero if no input may fit.
|
1161
|
+
size_t MaxSealInputLen(size_t max_out) const;
|
1162
|
+
|
881
1163
|
// SuffixLen calculates the suffix length written by |SealScatter| and writes
|
882
1164
|
// it to |*out_suffix_len|. It returns true on success and false on error.
|
883
1165
|
// |in_len| and |extra_in_len| should equal the argument of the same names
|
@@ -927,17 +1209,6 @@ class SSLAEADContext {
|
|
927
1209
|
|
928
1210
|
bool GetIV(const uint8_t **out_iv, size_t *out_iv_len) const;
|
929
1211
|
|
930
|
-
RecordNumberEncrypter *GetRecordNumberEncrypter() {
|
931
|
-
return rn_encrypter_.get();
|
932
|
-
}
|
933
|
-
|
934
|
-
// GenerateRecordNumberMask computes the mask used for DTLS 1.3 record number
|
935
|
-
// encryption (RFC 9147 section 4.2.3), writing it to |out|. The |out| buffer
|
936
|
-
// must be sized to AES_BLOCK_SIZE. The |sample| buffer must be at least 16
|
937
|
-
// bytes, as required by the AES and ChaCha20 cipher suites in RFC 9147. Extra
|
938
|
-
// bytes in |sample| will be ignored.
|
939
|
-
bool GenerateRecordNumberMask(Span<uint8_t> out, Span<const uint8_t> sample);
|
940
|
-
|
941
1212
|
private:
|
942
1213
|
// GetAdditionalData returns the additional data, writing into |storage| if
|
943
1214
|
// necessary.
|
@@ -946,19 +1217,12 @@ class SSLAEADContext {
|
|
946
1217
|
uint64_t seqnum, size_t plaintext_len,
|
947
1218
|
Span<const uint8_t> header);
|
948
1219
|
|
949
|
-
void CreateRecordNumberEncrypter();
|
950
|
-
|
951
1220
|
const SSL_CIPHER *cipher_;
|
952
1221
|
ScopedEVP_AEAD_CTX ctx_;
|
953
1222
|
// fixed_nonce_ contains any bytes of the nonce that are fixed for all
|
954
1223
|
// records.
|
955
|
-
uint8_t fixed_nonce_
|
956
|
-
uint8_t
|
957
|
-
// version_ is the wire version that should be used with this AEAD.
|
958
|
-
uint16_t version_;
|
959
|
-
UniquePtr<RecordNumberEncrypter> rn_encrypter_;
|
960
|
-
// is_dtls_ is whether DTLS is being used with this AEAD.
|
961
|
-
bool is_dtls_;
|
1224
|
+
InplaceVector<uint8_t, 12> fixed_nonce_;
|
1225
|
+
uint8_t variable_nonce_len_ = 0;
|
962
1226
|
// variable_nonce_included_in_record_ is true if the variable nonce
|
963
1227
|
// for a record is included as a prefix before the ciphertext.
|
964
1228
|
bool variable_nonce_included_in_record_ : 1;
|
@@ -976,57 +1240,31 @@ class SSLAEADContext {
|
|
976
1240
|
bool ad_is_header_ : 1;
|
977
1241
|
};
|
978
1242
|
|
979
|
-
class AESRecordNumberEncrypter : public RecordNumberEncrypter {
|
980
|
-
public:
|
981
|
-
bool SetKey(Span<const uint8_t> key) override;
|
982
|
-
bool GenerateMask(Span<uint8_t> out, Span<const uint8_t> sample) override;
|
983
1243
|
|
984
|
-
|
985
|
-
AES_KEY key_;
|
986
|
-
};
|
1244
|
+
// DTLS replay bitmap.
|
987
1245
|
|
988
|
-
|
1246
|
+
// DTLSReplayBitmap maintains a sliding window of sequence numbers to detect
|
1247
|
+
// replayed packets.
|
1248
|
+
class DTLSReplayBitmap {
|
989
1249
|
public:
|
990
|
-
|
991
|
-
|
1250
|
+
// ShouldDiscard returns true if |seq_num| has been seen in
|
1251
|
+
// |bitmap| or is stale. Otherwise it returns false.
|
1252
|
+
bool ShouldDiscard(uint64_t seqnum) const;
|
992
1253
|
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
1254
|
+
// Record updates the bitmap to record receipt of sequence number
|
1255
|
+
// |seq_num|. It slides the window forward if needed. It is an error to call
|
1256
|
+
// this function on a stale sequence number.
|
1257
|
+
void Record(uint64_t seqnum);
|
997
1258
|
|
998
|
-
|
999
|
-
public:
|
1000
|
-
size_t KeySize() override;
|
1001
|
-
bool SetKey(Span<const uint8_t> key) override;
|
1002
|
-
bool GenerateMask(Span<uint8_t> out, Span<const uint8_t> sample) override;
|
1259
|
+
uint64_t max_seq_num() const { return max_seq_num_; }
|
1003
1260
|
|
1004
1261
|
private:
|
1005
|
-
static const size_t kKeySize = 32;
|
1006
|
-
uint8_t key_[kKeySize];
|
1007
|
-
};
|
1008
|
-
|
1009
|
-
#if defined(BORINGSSL_UNSAFE_FUZZER_MODE)
|
1010
|
-
class NullRecordNumberEncrypter : public RecordNumberEncrypter {
|
1011
|
-
public:
|
1012
|
-
size_t KeySize() override;
|
1013
|
-
bool SetKey(Span<const uint8_t> key) override;
|
1014
|
-
bool GenerateMask(Span<uint8_t> out, Span<const uint8_t> sample) override;
|
1015
|
-
};
|
1016
|
-
#endif // BORINGSSL_UNSAFE_FUZZER_MODE
|
1017
|
-
|
1018
|
-
|
1019
|
-
// DTLS replay bitmap.
|
1020
|
-
|
1021
|
-
// DTLS1_BITMAP maintains a sliding window of 64 sequence numbers to detect
|
1022
|
-
// replayed packets. It should be initialized by zeroing every field.
|
1023
|
-
struct DTLS1_BITMAP {
|
1024
1262
|
// map is a bitset of sequence numbers that have been seen. Bit i corresponds
|
1025
|
-
// to |
|
1026
|
-
std::bitset<256>
|
1027
|
-
//
|
1263
|
+
// to |max_seq_num_ - i|.
|
1264
|
+
std::bitset<256> map_;
|
1265
|
+
// max_seq_num_ is the largest sequence number seen so far as a 64-bit
|
1028
1266
|
// integer.
|
1029
|
-
uint64_t
|
1267
|
+
uint64_t max_seq_num_ = 0;
|
1030
1268
|
};
|
1031
1269
|
|
1032
1270
|
// reconstruct_seqnum takes the low order bits of a record sequence number from
|
@@ -1038,11 +1276,89 @@ struct DTLS1_BITMAP {
|
|
1038
1276
|
// successfully deprotected in this epoch. This function returns the sequence
|
1039
1277
|
// number that is numerically closest to one plus |max_valid_seqnum| that when
|
1040
1278
|
// bitwise and-ed with |seq_mask| equals |wire_seq|.
|
1279
|
+
//
|
1280
|
+
// |max_valid_seqnum| must be most 2^48-1, in which case the output will also be
|
1281
|
+
// at most 2^48-1.
|
1041
1282
|
OPENSSL_EXPORT uint64_t reconstruct_seqnum(uint16_t wire_seq, uint64_t seq_mask,
|
1042
1283
|
uint64_t max_valid_seqnum);
|
1043
1284
|
|
1285
|
+
|
1044
1286
|
// Record layer.
|
1045
1287
|
|
1288
|
+
class DTLSRecordNumber {
|
1289
|
+
public:
|
1290
|
+
static constexpr uint64_t kMaxSequence = (uint64_t{1} << 48) - 1;
|
1291
|
+
|
1292
|
+
DTLSRecordNumber() = default;
|
1293
|
+
DTLSRecordNumber(uint16_t epoch, uint64_t sequence) {
|
1294
|
+
BSSL_CHECK(sequence <= kMaxSequence);
|
1295
|
+
combined_ = (uint64_t{epoch} << 48) | sequence;
|
1296
|
+
}
|
1297
|
+
|
1298
|
+
static DTLSRecordNumber FromCombined(uint64_t combined) {
|
1299
|
+
return DTLSRecordNumber(combined);
|
1300
|
+
}
|
1301
|
+
|
1302
|
+
bool operator==(DTLSRecordNumber r) const {
|
1303
|
+
return combined() == r.combined();
|
1304
|
+
}
|
1305
|
+
bool operator!=(DTLSRecordNumber r) const { return !((*this) == r); }
|
1306
|
+
bool operator<(DTLSRecordNumber r) const { return combined() < r.combined(); }
|
1307
|
+
|
1308
|
+
uint64_t combined() const { return combined_; }
|
1309
|
+
uint16_t epoch() const { return combined_ >> 48; }
|
1310
|
+
uint64_t sequence() const { return combined_ & kMaxSequence; }
|
1311
|
+
|
1312
|
+
bool HasNext() const { return sequence() < kMaxSequence; }
|
1313
|
+
DTLSRecordNumber Next() const {
|
1314
|
+
BSSL_CHECK(HasNext());
|
1315
|
+
// This will not overflow into the epoch.
|
1316
|
+
return DTLSRecordNumber::FromCombined(combined_ + 1);
|
1317
|
+
}
|
1318
|
+
|
1319
|
+
private:
|
1320
|
+
explicit DTLSRecordNumber(uint64_t combined) : combined_(combined) {}
|
1321
|
+
|
1322
|
+
uint64_t combined_ = 0;
|
1323
|
+
};
|
1324
|
+
|
1325
|
+
class RecordNumberEncrypter {
|
1326
|
+
public:
|
1327
|
+
static constexpr bool kAllowUniquePtr = true;
|
1328
|
+
static constexpr size_t kMaxKeySize = 32;
|
1329
|
+
|
1330
|
+
// Create returns a DTLS 1.3 record number encrypter for |traffic_secret|, or
|
1331
|
+
// nullptr on error.
|
1332
|
+
static UniquePtr<RecordNumberEncrypter> Create(
|
1333
|
+
const SSL_CIPHER *cipher, Span<const uint8_t> traffic_secret);
|
1334
|
+
|
1335
|
+
virtual ~RecordNumberEncrypter() = default;
|
1336
|
+
virtual size_t KeySize() = 0;
|
1337
|
+
virtual bool SetKey(Span<const uint8_t> key) = 0;
|
1338
|
+
virtual bool GenerateMask(Span<uint8_t> out, Span<const uint8_t> sample) = 0;
|
1339
|
+
};
|
1340
|
+
|
1341
|
+
struct DTLSReadEpoch {
|
1342
|
+
static constexpr bool kAllowUniquePtr = true;
|
1343
|
+
|
1344
|
+
// TODO(davidben): This could be made slightly more compact if |bitmap| stored
|
1345
|
+
// a DTLSRecordNumber.
|
1346
|
+
uint16_t epoch = 0;
|
1347
|
+
UniquePtr<SSLAEADContext> aead;
|
1348
|
+
UniquePtr<RecordNumberEncrypter> rn_encrypter;
|
1349
|
+
DTLSReplayBitmap bitmap;
|
1350
|
+
};
|
1351
|
+
|
1352
|
+
struct DTLSWriteEpoch {
|
1353
|
+
static constexpr bool kAllowUniquePtr = true;
|
1354
|
+
|
1355
|
+
uint16_t epoch() const { return next_record.epoch(); }
|
1356
|
+
|
1357
|
+
DTLSRecordNumber next_record;
|
1358
|
+
UniquePtr<SSLAEADContext> aead;
|
1359
|
+
UniquePtr<RecordNumberEncrypter> rn_encrypter;
|
1360
|
+
};
|
1361
|
+
|
1046
1362
|
// ssl_record_prefix_len returns the length of the prefix before the ciphertext
|
1047
1363
|
// of a record for |ssl|.
|
1048
1364
|
//
|
@@ -1087,8 +1403,10 @@ enum ssl_open_record_t tls_open_record(SSL *ssl, uint8_t *out_type,
|
|
1087
1403
|
|
1088
1404
|
// dtls_open_record implements |tls_open_record| for DTLS. It only returns
|
1089
1405
|
// |ssl_open_record_partial| if |in| was empty and sets |*out_consumed| to
|
1090
|
-
// zero. The caller should read one packet and try again.
|
1406
|
+
// zero. The caller should read one packet and try again. On success,
|
1407
|
+
// |*out_number| is set to the record number of the record.
|
1091
1408
|
enum ssl_open_record_t dtls_open_record(SSL *ssl, uint8_t *out_type,
|
1409
|
+
DTLSRecordNumber *out_number,
|
1092
1410
|
Span<uint8_t> *out,
|
1093
1411
|
size_t *out_consumed,
|
1094
1412
|
uint8_t *out_alert, Span<uint8_t> in);
|
@@ -1123,13 +1441,18 @@ size_t dtls_max_seal_overhead(const SSL *ssl, uint16_t epoch);
|
|
1123
1441
|
// front of the plaintext when sealing a record in-place.
|
1124
1442
|
size_t dtls_seal_prefix_len(const SSL *ssl, uint16_t epoch);
|
1125
1443
|
|
1444
|
+
// dtls_seal_max_input_len returns the maximum number of input bytes that can
|
1445
|
+
// fit in a record of up to |max_out| bytes, or zero if none may fit.
|
1446
|
+
size_t dtls_seal_max_input_len(const SSL *ssl, uint16_t epoch, size_t max_out);
|
1447
|
+
|
1126
1448
|
// dtls_seal_record implements |tls_seal_record| for DTLS. |epoch| selects which
|
1127
1449
|
// epoch's cipher state to use. Unlike |tls_seal_record|, |in| and |out| may
|
1128
1450
|
// alias but, if they do, |in| must be exactly |dtls_seal_prefix_len| bytes
|
1129
|
-
// ahead of |out|.
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1451
|
+
// ahead of |out|. On success, |*out_number| is set to the record number of the
|
1452
|
+
// record.
|
1453
|
+
bool dtls_seal_record(SSL *ssl, DTLSRecordNumber *out_number, uint8_t *out,
|
1454
|
+
size_t *out_len, size_t max_out, uint8_t type,
|
1455
|
+
const uint8_t *in, size_t in_len, uint16_t epoch);
|
1133
1456
|
|
1134
1457
|
// ssl_process_alert processes |in| as an alert and updates |ssl|'s shutdown
|
1135
1458
|
// state. It returns one of |ssl_open_record_discard|, |ssl_open_record_error|,
|
@@ -1201,8 +1524,7 @@ class SSLKeyShare {
|
|
1201
1524
|
// |out_ciphertext|, and sets |*out_secret| to the shared secret. On failure,
|
1202
1525
|
// it returns false and sets |*out_alert| to an alert to send to the peer.
|
1203
1526
|
virtual bool Encap(CBB *out_ciphertext, Array<uint8_t> *out_secret,
|
1204
|
-
uint8_t *out_alert,
|
1205
|
-
Span<const uint8_t> peer_key) = 0;
|
1527
|
+
uint8_t *out_alert, Span<const uint8_t> peer_key) = 0;
|
1206
1528
|
|
1207
1529
|
// Decap decapsulates the symmetric secret in |ciphertext|. On success, it
|
1208
1530
|
// returns true and sets |*out_secret| to the shared secret. On failure, it
|
@@ -1288,21 +1610,13 @@ bool dtls_has_unprocessed_handshake_data(const SSL *ssl);
|
|
1288
1610
|
// tls_flush_pending_hs_data flushes any handshake plaintext data.
|
1289
1611
|
bool tls_flush_pending_hs_data(SSL *ssl);
|
1290
1612
|
|
1291
|
-
struct DTLS_OUTGOING_MESSAGE {
|
1292
|
-
DTLS_OUTGOING_MESSAGE() {}
|
1293
|
-
DTLS_OUTGOING_MESSAGE(const DTLS_OUTGOING_MESSAGE &) = delete;
|
1294
|
-
DTLS_OUTGOING_MESSAGE &operator=(const DTLS_OUTGOING_MESSAGE &) = delete;
|
1295
|
-
|
1296
|
-
void Clear();
|
1297
|
-
|
1298
|
-
Array<uint8_t> data;
|
1299
|
-
uint16_t epoch = 0;
|
1300
|
-
bool is_ccs = false;
|
1301
|
-
};
|
1302
|
-
|
1303
1613
|
// dtls_clear_outgoing_messages releases all buffered outgoing messages.
|
1304
1614
|
void dtls_clear_outgoing_messages(SSL *ssl);
|
1305
1615
|
|
1616
|
+
// dtls_clear_unused_write_epochs releases any write epochs that are no longer
|
1617
|
+
// needed.
|
1618
|
+
void dtls_clear_unused_write_epochs(SSL *ssl);
|
1619
|
+
|
1306
1620
|
|
1307
1621
|
// Callbacks.
|
1308
1622
|
|
@@ -1425,32 +1739,51 @@ enum ssl_key_usage_t {
|
|
1425
1739
|
OPENSSL_EXPORT bool ssl_cert_check_key_usage(const CBS *in,
|
1426
1740
|
enum ssl_key_usage_t bit);
|
1427
1741
|
|
1742
|
+
// ssl_cert_extract_issuer parses the DER-encoded, X.509 certificate in |in|
|
1743
|
+
// and extracts the issuer. On success it returns true and the DER encoded
|
1744
|
+
// issuer is in |out_dn|, otherwise it returns false.
|
1745
|
+
OPENSSL_EXPORT bool ssl_cert_extract_issuer(const CBS *in, CBS *out_dn);
|
1746
|
+
|
1747
|
+
// ssl_cert_matches_issuer parses the DER-encoded, X.509 certificate in |in|
|
1748
|
+
// and returns true if its issuer is an exact match for the DER encoded
|
1749
|
+
// distinguished name in |dn|
|
1750
|
+
bool ssl_cert_matches_issuer(const CBS *in, const CBS *dn);
|
1751
|
+
|
1428
1752
|
// ssl_cert_parse_pubkey extracts the public key from the DER-encoded, X.509
|
1429
1753
|
// certificate in |in|. It returns an allocated |EVP_PKEY| or else returns
|
1430
1754
|
// nullptr and pushes to the error queue.
|
1431
1755
|
UniquePtr<EVP_PKEY> ssl_cert_parse_pubkey(const CBS *in);
|
1432
1756
|
|
1433
|
-
//
|
1434
|
-
//
|
1435
|
-
// |CRYPTO_BUFFER| list and advances
|
1436
|
-
// sets |*out_alert| to an alert to
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1757
|
+
// SSL_parse_CA_list parses a CA list from |cbs| in the format used by a TLS
|
1758
|
+
// CertificateRequest message and Certificate Authorities extension. On success,
|
1759
|
+
// it returns a newly-allocated |CRYPTO_BUFFER| list and advances
|
1760
|
+
// |cbs|. Otherwise, it returns nullptr and sets |*out_alert| to an alert to
|
1761
|
+
// send to the peer.
|
1762
|
+
UniquePtr<STACK_OF(CRYPTO_BUFFER)> SSL_parse_CA_list(SSL *ssl,
|
1763
|
+
uint8_t *out_alert,
|
1764
|
+
CBS *cbs);
|
1440
1765
|
|
1441
|
-
// ssl_has_client_CAs returns there are configured CAs.
|
1766
|
+
// ssl_has_client_CAs returns whether there are configured CAs.
|
1442
1767
|
bool ssl_has_client_CAs(const SSL_CONFIG *cfg);
|
1443
1768
|
|
1444
1769
|
// ssl_add_client_CA_list adds the configured CA list to |cbb| in the format
|
1445
1770
|
// used by a TLS CertificateRequest message. It returns true on success and
|
1446
1771
|
// false on error.
|
1447
|
-
bool ssl_add_client_CA_list(SSL_HANDSHAKE *hs, CBB *cbb);
|
1772
|
+
bool ssl_add_client_CA_list(const SSL_HANDSHAKE *hs, CBB *cbb);
|
1773
|
+
|
1774
|
+
// ssl_has_CA_names returns whether there are configured CA names.
|
1775
|
+
bool ssl_has_CA_names(const SSL_CONFIG *cfg);
|
1776
|
+
|
1777
|
+
// ssl_add_CA_names adds the configured CA_names list to |cbb| in the format
|
1778
|
+
// used by a TLS Certificate Authorities extension. It returns true on success
|
1779
|
+
// and false on error.
|
1780
|
+
bool ssl_add_CA_names(const SSL_HANDSHAKE *hs, CBB *cbb);
|
1448
1781
|
|
1449
1782
|
// ssl_check_leaf_certificate returns one if |pkey| and |leaf| are suitable as
|
1450
1783
|
// a server's leaf certificate for |hs|. Otherwise, it returns zero and pushes
|
1451
1784
|
// an error on the error queue.
|
1452
1785
|
bool ssl_check_leaf_certificate(SSL_HANDSHAKE *hs, EVP_PKEY *pkey,
|
1453
|
-
|
1786
|
+
const CRYPTO_BUFFER *leaf);
|
1454
1787
|
|
1455
1788
|
|
1456
1789
|
// TLS 1.3 key derivation.
|
@@ -1677,7 +2010,7 @@ struct ssl_credential_st : public bssl::RefCounted<ssl_credential_st> {
|
|
1677
2010
|
ssl_credential_st &operator=(const ssl_credential_st &) = delete;
|
1678
2011
|
|
1679
2012
|
// Dup returns a copy of the credential, or nullptr on error. The |ex_data|
|
1680
|
-
// values are not copied. This is only used on the
|
2013
|
+
// values are not copied. This is only used on the legacy credential, whose
|
1681
2014
|
// |ex_data| is inaccessible.
|
1682
2015
|
bssl::UniquePtr<SSL_CREDENTIAL> Dup() const;
|
1683
2016
|
|
@@ -1711,6 +2044,10 @@ struct ssl_credential_st : public bssl::RefCounted<ssl_credential_st> {
|
|
1711
2044
|
// returns one on success and zero on error.
|
1712
2045
|
bool AppendIntermediateCert(bssl::UniquePtr<CRYPTO_BUFFER> cert);
|
1713
2046
|
|
2047
|
+
// ChainContainsIssuer returns true if |dn| is a byte for byte match with the
|
2048
|
+
// issuer of any certificate in |chain|, false otherwise.
|
2049
|
+
bool ChainContainsIssuer(bssl::Span<const uint8_t> dn) const;
|
2050
|
+
|
1714
2051
|
// type is the credential type and determines which other fields apply.
|
1715
2052
|
bssl::SSLCredentialType type;
|
1716
2053
|
|
@@ -1758,6 +2095,11 @@ struct ssl_credential_st : public bssl::RefCounted<ssl_credential_st> {
|
|
1758
2095
|
|
1759
2096
|
CRYPTO_EX_DATA ex_data;
|
1760
2097
|
|
2098
|
+
// must_match_issuer is a flag indicating that this credential should be
|
2099
|
+
// considered only when it matches a peer request for a particular issuer via
|
2100
|
+
// a negotiation mechanism (such as the certificate_authorities extension).
|
2101
|
+
bool must_match_issuer = false;
|
2102
|
+
|
1761
2103
|
private:
|
1762
2104
|
friend RefCounted;
|
1763
2105
|
~ssl_credential_st();
|
@@ -1773,6 +2115,10 @@ BSSL_NAMESPACE_BEGIN
|
|
1773
2115
|
// The pointers in the result are only valid until |hs| is next mutated.
|
1774
2116
|
bool ssl_get_credential_list(SSL_HANDSHAKE *hs, Array<SSL_CREDENTIAL *> *out);
|
1775
2117
|
|
2118
|
+
// ssl_credential_matches_requested_issuers returns true if |cred| is a
|
2119
|
+
// usable match for any requested issuers in |hs|.
|
2120
|
+
bool ssl_credential_matches_requested_issuers(SSL_HANDSHAKE *hs,
|
2121
|
+
const SSL_CREDENTIAL *cred);
|
1776
2122
|
|
1777
2123
|
// Handshake functions.
|
1778
2124
|
|
@@ -1927,18 +2273,13 @@ struct SSL_HANDSHAKE {
|
|
1927
2273
|
// |SSL_OP_NO_*| and |SSL_CTX_set_max_proto_version| APIs.
|
1928
2274
|
uint16_t max_version = 0;
|
1929
2275
|
|
1930
|
-
|
1931
|
-
|
1932
|
-
uint8_t
|
1933
|
-
uint8_t
|
1934
|
-
uint8_t
|
1935
|
-
uint8_t
|
1936
|
-
uint8_t
|
1937
|
-
uint8_t server_traffic_secret_0_[SSL_MAX_MD_SIZE] = {0};
|
1938
|
-
uint8_t expected_client_finished_[SSL_MAX_MD_SIZE] = {0};
|
1939
|
-
|
1940
|
-
public:
|
1941
|
-
void ResizeSecrets(size_t hash_len);
|
2276
|
+
InplaceVector<uint8_t, SSL_MAX_MD_SIZE> secret;
|
2277
|
+
InplaceVector<uint8_t, SSL_MAX_MD_SIZE> early_traffic_secret;
|
2278
|
+
InplaceVector<uint8_t, SSL_MAX_MD_SIZE> client_handshake_secret;
|
2279
|
+
InplaceVector<uint8_t, SSL_MAX_MD_SIZE> server_handshake_secret;
|
2280
|
+
InplaceVector<uint8_t, SSL_MAX_MD_SIZE> client_traffic_secret_0;
|
2281
|
+
InplaceVector<uint8_t, SSL_MAX_MD_SIZE> server_traffic_secret_0;
|
2282
|
+
InplaceVector<uint8_t, SSL_MAX_MD_SIZE> expected_client_finished;
|
1942
2283
|
|
1943
2284
|
// GetClientHello, on the server, returns either the normal ClientHello
|
1944
2285
|
// message or the ClientHelloInner if it has been serialized to
|
@@ -1951,29 +2292,6 @@ struct SSL_HANDSHAKE {
|
|
1951
2292
|
// SSL_HANDSHAKE.
|
1952
2293
|
bool GetClientHello(SSLMessage *out_msg, SSL_CLIENT_HELLO *out_client_hello);
|
1953
2294
|
|
1954
|
-
Span<uint8_t> secret() { return MakeSpan(secret_, hash_len_); }
|
1955
|
-
Span<const uint8_t> secret() const {
|
1956
|
-
return MakeConstSpan(secret_, hash_len_);
|
1957
|
-
}
|
1958
|
-
Span<uint8_t> early_traffic_secret() {
|
1959
|
-
return MakeSpan(early_traffic_secret_, hash_len_);
|
1960
|
-
}
|
1961
|
-
Span<uint8_t> client_handshake_secret() {
|
1962
|
-
return MakeSpan(client_handshake_secret_, hash_len_);
|
1963
|
-
}
|
1964
|
-
Span<uint8_t> server_handshake_secret() {
|
1965
|
-
return MakeSpan(server_handshake_secret_, hash_len_);
|
1966
|
-
}
|
1967
|
-
Span<uint8_t> client_traffic_secret_0() {
|
1968
|
-
return MakeSpan(client_traffic_secret_0_, hash_len_);
|
1969
|
-
}
|
1970
|
-
Span<uint8_t> server_traffic_secret_0() {
|
1971
|
-
return MakeSpan(server_traffic_secret_0_, hash_len_);
|
1972
|
-
}
|
1973
|
-
Span<uint8_t> expected_client_finished() {
|
1974
|
-
return MakeSpan(expected_client_finished_, hash_len_);
|
1975
|
-
}
|
1976
|
-
|
1977
2295
|
union {
|
1978
2296
|
// sent is a bitset where the bits correspond to elements of kExtensions
|
1979
2297
|
// in extensions.cc. Each bit is set if that extension was sent in a
|
@@ -2014,7 +2332,8 @@ struct SSL_HANDSHAKE {
|
|
2014
2332
|
|
2015
2333
|
// dtls_cookie is the value of the cookie in DTLS HelloVerifyRequest. If
|
2016
2334
|
// empty, either none was received or HelloVerifyRequest contained an empty
|
2017
|
-
// cookie.
|
2335
|
+
// cookie. Check the received_hello_verify_request field to distinguish an
|
2336
|
+
// empty cookie from no HelloVerifyRequest message being received.
|
2018
2337
|
Array<uint8_t> dtls_cookie;
|
2019
2338
|
|
2020
2339
|
// ech_client_outer contains the outer ECH extension to send in the
|
@@ -2078,8 +2397,8 @@ struct SSL_HANDSHAKE {
|
|
2078
2397
|
// server when using a TLS 1.2 PSK key exchange.
|
2079
2398
|
UniquePtr<char> peer_psk_identity_hint;
|
2080
2399
|
|
2081
|
-
// ca_names
|
2082
|
-
// CertificateRequest message
|
2400
|
+
// ca_names contains the list of CAs received via the Certificate Authorities
|
2401
|
+
// extension in our peer's CertificateRequest or ClientHello message
|
2083
2402
|
UniquePtr<STACK_OF(CRYPTO_BUFFER)> ca_names;
|
2084
2403
|
|
2085
2404
|
// cached_x509_ca_names contains a cache of parsed versions of the elements of
|
@@ -2181,6 +2500,10 @@ struct SSL_HANDSHAKE {
|
|
2181
2500
|
// the handshake.
|
2182
2501
|
bool can_early_write : 1;
|
2183
2502
|
|
2503
|
+
// is_early_version is true if the protocol version configured is not
|
2504
|
+
// necessarily the final version and is just the predicted 0-RTT version.
|
2505
|
+
bool is_early_version : 1;
|
2506
|
+
|
2184
2507
|
// next_proto_neg_seen is one of NPN was negotiated.
|
2185
2508
|
bool next_proto_neg_seen : 1;
|
2186
2509
|
|
@@ -2222,6 +2545,10 @@ struct SSL_HANDSHAKE {
|
|
2222
2545
|
// handshake.
|
2223
2546
|
bool channel_id_negotiated : 1;
|
2224
2547
|
|
2548
|
+
// received_hello_verify_request is true if we received a HelloVerifyRequest
|
2549
|
+
// message from the server.
|
2550
|
+
bool received_hello_verify_request : 1;
|
2551
|
+
|
2225
2552
|
// client_version is the value sent or received in the ClientHello version.
|
2226
2553
|
uint16_t client_version = 0;
|
2227
2554
|
|
@@ -2241,8 +2568,7 @@ struct SSL_HANDSHAKE {
|
|
2241
2568
|
uint8_t ech_config_id = 0;
|
2242
2569
|
|
2243
2570
|
// session_id is the session ID in the ClientHello.
|
2244
|
-
uint8_t
|
2245
|
-
uint8_t session_id_len = 0;
|
2571
|
+
InplaceVector<uint8_t, SSL_MAX_SSL_SESSION_ID_LENGTH> session_id;
|
2246
2572
|
|
2247
2573
|
// grease_seed is the entropy for GREASE values.
|
2248
2574
|
uint8_t grease_seed[ssl_grease_last_index + 1] = {0};
|
@@ -2278,10 +2604,9 @@ const char *ssl_server_handshake_state(SSL_HANDSHAKE *hs);
|
|
2278
2604
|
const char *tls13_client_handshake_state(SSL_HANDSHAKE *hs);
|
2279
2605
|
const char *tls13_server_handshake_state(SSL_HANDSHAKE *hs);
|
2280
2606
|
|
2281
|
-
// tls13_add_key_update queues a KeyUpdate message on |ssl|.
|
2282
|
-
//
|
2283
|
-
|
2284
|
-
bool tls13_add_key_update(SSL *ssl, int update_requested);
|
2607
|
+
// tls13_add_key_update queues a KeyUpdate message on |ssl|. |request_type| must
|
2608
|
+
// be one of |SSL_KEY_UPDATE_REQUESTED| or |SSL_KEY_UPDATE_NOT_REQUESTED|.
|
2609
|
+
bool tls13_add_key_update(SSL *ssl, int request_type);
|
2285
2610
|
|
2286
2611
|
// tls13_post_handshake processes a post-handshake message. It returns true on
|
2287
2612
|
// success and false on failure.
|
@@ -2542,32 +2867,32 @@ struct CERT {
|
|
2542
2867
|
explicit CERT(const SSL_X509_METHOD *x509_method);
|
2543
2868
|
~CERT();
|
2544
2869
|
|
2545
|
-
bool is_valid() const { return
|
2870
|
+
bool is_valid() const { return legacy_credential != nullptr; }
|
2546
2871
|
|
2547
2872
|
// credentials is the list of credentials to select between. Elements of this
|
2548
2873
|
// array immutable.
|
2549
|
-
|
2874
|
+
Vector<UniquePtr<SSL_CREDENTIAL>> credentials;
|
2550
2875
|
|
2551
|
-
//
|
2876
|
+
// legacy_credential is the credential configured by the legacy
|
2552
2877
|
// non-credential-based APIs. If IsComplete() returns true, it is appended to
|
2553
2878
|
// the list of credentials.
|
2554
|
-
UniquePtr<SSL_CREDENTIAL>
|
2879
|
+
UniquePtr<SSL_CREDENTIAL> legacy_credential;
|
2555
2880
|
|
2556
2881
|
// x509_method contains pointers to functions that might deal with |X509|
|
2557
2882
|
// compatibility, or might be a no-op, depending on the application.
|
2558
2883
|
const SSL_X509_METHOD *x509_method = nullptr;
|
2559
2884
|
|
2560
|
-
// x509_chain may contain a parsed copy of |chain[1..]| from the
|
2885
|
+
// x509_chain may contain a parsed copy of |chain[1..]| from the legacy
|
2561
2886
|
// credential. This is only used as a cache in order to implement “get0”
|
2562
2887
|
// functions that return a non-owning pointer to the certificate chain.
|
2563
2888
|
STACK_OF(X509) *x509_chain = nullptr;
|
2564
2889
|
|
2565
2890
|
// x509_leaf may contain a parsed copy of the first element of |chain| from
|
2566
|
-
// the
|
2891
|
+
// the legacy credential. This is only used as a cache in order to implement
|
2567
2892
|
// “get0” functions that return a non-owning pointer to the certificate chain.
|
2568
2893
|
X509 *x509_leaf = nullptr;
|
2569
2894
|
|
2570
|
-
// x509_stash contains the last |X509| object append to the
|
2895
|
+
// x509_stash contains the last |X509| object append to the legacy
|
2571
2896
|
// credential's chain. This is a workaround for some third-party code that
|
2572
2897
|
// continue to use an |X509| object even after passing ownership with an
|
2573
2898
|
// “add0” function.
|
@@ -2588,8 +2913,7 @@ struct CERT {
|
|
2588
2913
|
|
2589
2914
|
// sid_ctx partitions the session space within a shared session cache or
|
2590
2915
|
// ticket key. Only sessions with a matching value will be accepted.
|
2591
|
-
uint8_t
|
2592
|
-
uint8_t sid_ctx[SSL_MAX_SID_CTX_LENGTH] = {0};
|
2916
|
+
InplaceVector<uint8_t, SSL_MAX_SID_CTX_LENGTH> sid_ctx;
|
2593
2917
|
};
|
2594
2918
|
|
2595
2919
|
// |SSL_PROTOCOL_METHOD| abstracts between TLS and DTLS.
|
@@ -2638,25 +2962,37 @@ struct SSL_PROTOCOL_METHOD {
|
|
2638
2962
|
// add_change_cipher_spec adds a ChangeCipherSpec record to the pending
|
2639
2963
|
// flight. It returns true on success and false on error.
|
2640
2964
|
bool (*add_change_cipher_spec)(SSL *ssl);
|
2641
|
-
//
|
2642
|
-
//
|
2643
|
-
|
2965
|
+
// finish_flight marks the pending flight as finished and ready to send.
|
2966
|
+
// |flush| must be called to write it.
|
2967
|
+
void (*finish_flight)(SSL *ssl);
|
2968
|
+
// schedule_ack schedules a DTLS 1.3 ACK to be sent, without an ACK delay.
|
2969
|
+
// |flush| must be called to write it.
|
2970
|
+
void (*schedule_ack)(SSL *ssl);
|
2971
|
+
// flush writes any scheduled data to the transport. It returns one on success
|
2972
|
+
// and <= 0 on error.
|
2973
|
+
int (*flush)(SSL *ssl);
|
2644
2974
|
// on_handshake_complete is called when the handshake is complete.
|
2645
2975
|
void (*on_handshake_complete)(SSL *ssl);
|
2646
2976
|
// set_read_state sets |ssl|'s read cipher state and level to |aead_ctx| and
|
2647
|
-
// |level|. In QUIC, |aead_ctx| is a placeholder object
|
2648
|
-
// is the original secret. This function returns true
|
2649
|
-
// error.
|
2977
|
+
// |level|. In QUIC, |aead_ctx| is a placeholder object. In TLS 1.3,
|
2978
|
+
// |traffic_secret| is the original traffic secret. This function returns true
|
2979
|
+
// on success and false on error.
|
2980
|
+
//
|
2981
|
+
// TODO(crbug.com/371998381): Take the traffic secrets as input and let the
|
2982
|
+
// function create the SSLAEADContext.
|
2650
2983
|
bool (*set_read_state)(SSL *ssl, ssl_encryption_level_t level,
|
2651
2984
|
UniquePtr<SSLAEADContext> aead_ctx,
|
2652
|
-
Span<const uint8_t>
|
2985
|
+
Span<const uint8_t> traffic_secret);
|
2653
2986
|
// set_write_state sets |ssl|'s write cipher state and level to |aead_ctx| and
|
2654
|
-
// |level|. In QUIC, |aead_ctx| is a placeholder object
|
2655
|
-
// is the original secret. This function returns true
|
2656
|
-
// error.
|
2987
|
+
// |level|. In QUIC, |aead_ctx| is a placeholder object In TLS 1.3,
|
2988
|
+
// |traffic_secret| is the original traffic secret. This function returns true
|
2989
|
+
// on success and false on error.
|
2990
|
+
//
|
2991
|
+
// TODO(crbug.com/371998381): Take the traffic secrets as input and let the
|
2992
|
+
// function create the SSLAEADContext.
|
2657
2993
|
bool (*set_write_state)(SSL *ssl, ssl_encryption_level_t level,
|
2658
2994
|
UniquePtr<SSLAEADContext> aead_ctx,
|
2659
|
-
Span<const uint8_t>
|
2995
|
+
Span<const uint8_t> traffic_secret);
|
2660
2996
|
};
|
2661
2997
|
|
2662
2998
|
// The following wrappers call |open_*| but handle |read_shutdown| correctly.
|
@@ -2682,10 +3018,10 @@ ssl_open_record_t ssl_open_app_data(SSL *ssl, Span<uint8_t> *out,
|
|
2682
3018
|
Span<uint8_t> in);
|
2683
3019
|
|
2684
3020
|
struct SSL_X509_METHOD {
|
2685
|
-
//
|
2686
|
-
//
|
2687
|
-
//
|
2688
|
-
bool (*
|
3021
|
+
// check_CA_list returns one if |names| is a good list of X.509 distinguished
|
3022
|
+
// names and zero otherwise. This is used to ensure that we can reject
|
3023
|
+
// unparsable values at handshake time when using crypto/x509.
|
3024
|
+
bool (*check_CA_list)(STACK_OF(CRYPTO_BUFFER) *names);
|
2689
3025
|
|
2690
3026
|
// cert_clear frees and NULLs all X509 certificate-related state.
|
2691
3027
|
void (*cert_clear)(CERT *cert);
|
@@ -2846,8 +3182,14 @@ struct SSL3_STATE {
|
|
2846
3182
|
// needs re-doing when in SSL_accept or SSL_connect
|
2847
3183
|
int rwstate = SSL_ERROR_NONE;
|
2848
3184
|
|
2849
|
-
enum ssl_encryption_level_t
|
2850
|
-
enum ssl_encryption_level_t
|
3185
|
+
enum ssl_encryption_level_t quic_read_level = ssl_encryption_initial;
|
3186
|
+
enum ssl_encryption_level_t quic_write_level = ssl_encryption_initial;
|
3187
|
+
|
3188
|
+
// version is the protocol version, or zero if the version has not yet been
|
3189
|
+
// set. In clients offering 0-RTT, this version will initially be set to the
|
3190
|
+
// early version, then switched to the final version. To distinguish these
|
3191
|
+
// cases, use |ssl_has_final_version|.
|
3192
|
+
uint16_t version = 0;
|
2851
3193
|
|
2852
3194
|
// early_data_skipped is the amount of early data that has been skipped by the
|
2853
3195
|
// record layer.
|
@@ -2870,10 +3212,6 @@ struct SSL3_STATE {
|
|
2870
3212
|
// messages when 0RTT is rejected.
|
2871
3213
|
bool skip_early_data : 1;
|
2872
3214
|
|
2873
|
-
// have_version is true if the connection's final version is known. Otherwise
|
2874
|
-
// the version has not been negotiated yet.
|
2875
|
-
bool have_version : 1;
|
2876
|
-
|
2877
3215
|
// v2_hello_done is true if the peer's V2ClientHello, if any, has been handled
|
2878
3216
|
// and future messages should use the record layer.
|
2879
3217
|
bool v2_hello_done : 1;
|
@@ -2899,8 +3237,10 @@ struct SSL3_STATE {
|
|
2899
3237
|
// Channel ID and the |channel_id| field is filled in.
|
2900
3238
|
bool channel_id_valid : 1;
|
2901
3239
|
|
2902
|
-
// key_update_pending is true if we
|
2903
|
-
//
|
3240
|
+
// key_update_pending is true if we are in the process of sending a KeyUpdate
|
3241
|
+
// message. As a DoS mitigation (and a requirement in DTLS), we never send
|
3242
|
+
// more than one KeyUpdate at once. In DTLS, this tracks whether there is an
|
3243
|
+
// unACKed KeyUpdate.
|
2904
3244
|
bool key_update_pending : 1;
|
2905
3245
|
|
2906
3246
|
// early_data_accepted is true if early data was accepted by the server.
|
@@ -2957,18 +3297,13 @@ struct SSL3_STATE {
|
|
2957
3297
|
// one.
|
2958
3298
|
UniquePtr<SSL_HANDSHAKE> hs;
|
2959
3299
|
|
2960
|
-
uint8_t
|
2961
|
-
uint8_t
|
2962
|
-
uint8_t
|
2963
|
-
uint8_t write_traffic_secret_len = 0;
|
2964
|
-
uint8_t read_traffic_secret_len = 0;
|
2965
|
-
uint8_t exporter_secret_len = 0;
|
3300
|
+
InplaceVector<uint8_t, SSL_MAX_MD_SIZE> write_traffic_secret;
|
3301
|
+
InplaceVector<uint8_t, SSL_MAX_MD_SIZE> read_traffic_secret;
|
3302
|
+
InplaceVector<uint8_t, SSL_MAX_MD_SIZE> exporter_secret;
|
2966
3303
|
|
2967
3304
|
// Connection binding to prevent renegotiation attacks
|
2968
|
-
uint8_t
|
2969
|
-
uint8_t
|
2970
|
-
uint8_t previous_server_finished_len = 0;
|
2971
|
-
uint8_t previous_server_finished[12] = {0};
|
3305
|
+
InplaceVector<uint8_t, 12> previous_client_finished;
|
3306
|
+
InplaceVector<uint8_t, 12> previous_server_finished;
|
2972
3307
|
|
2973
3308
|
uint8_t send_alert[2] = {0};
|
2974
3309
|
|
@@ -3031,9 +3366,47 @@ static_assert(DTLS1_RT_MAX_HEADER_LENGTH >= DTLS1_3_RECORD_HEADER_WRITE_LENGTH,
|
|
3031
3366
|
|
3032
3367
|
#define DTLS1_HM_HEADER_LENGTH 12
|
3033
3368
|
|
3034
|
-
|
3369
|
+
// A DTLSMessageBitmap maintains a list of bits which may be marked to indicate
|
3370
|
+
// a portion of a message was received or ACKed.
|
3371
|
+
class DTLSMessageBitmap {
|
3372
|
+
public:
|
3373
|
+
// A Range represents a range of bits from |start|, inclusive, to |end|,
|
3374
|
+
// exclusive.
|
3375
|
+
struct Range {
|
3376
|
+
size_t start = 0;
|
3377
|
+
size_t end = 0;
|
3378
|
+
|
3379
|
+
bool empty() const { return start == end; }
|
3380
|
+
size_t size() const { return end - start; }
|
3381
|
+
bool operator==(const Range &r) const {
|
3382
|
+
return start == r.start && end == r.end;
|
3383
|
+
}
|
3384
|
+
bool operator!=(const Range &r) const { return !(*this == r); }
|
3385
|
+
};
|
3386
|
+
|
3387
|
+
// Init initializes the structure with |num_bits| unmarked bits, from zero
|
3388
|
+
// to |num_bits - 1|.
|
3389
|
+
bool Init(size_t num_bits);
|
3390
|
+
|
3391
|
+
// MarkRange marks the bits from |start|, inclusive, to |end|, exclusive.
|
3392
|
+
void MarkRange(size_t start, size_t end);
|
3393
|
+
|
3394
|
+
// NextUnmarkedRange returns the next range of unmarked bits, starting from
|
3395
|
+
// |start|, inclusive. If all bits after |start| are marked, it returns an
|
3396
|
+
// empty range.
|
3397
|
+
Range NextUnmarkedRange(size_t start) const;
|
3035
3398
|
|
3036
|
-
|
3399
|
+
// IsComplete returns whether every bit in the bitmask has been marked.
|
3400
|
+
bool IsComplete() const { return bytes_.empty(); }
|
3401
|
+
|
3402
|
+
private:
|
3403
|
+
// bytes_ contains the unmarked bits. We maintain an invariant: if |bytes_| is
|
3404
|
+
// not empty, some bit is unset.
|
3405
|
+
Array<uint8_t> bytes_;
|
3406
|
+
// first_unmarked_byte_ is the index of first byte in |bytes_| that is not
|
3407
|
+
// 0xff. This is maintained to amortize checking if the message is complete.
|
3408
|
+
size_t first_unmarked_byte_ = 0;
|
3409
|
+
};
|
3037
3410
|
|
3038
3411
|
struct hm_header_st {
|
3039
3412
|
uint8_t type;
|
@@ -3043,28 +3416,47 @@ struct hm_header_st {
|
|
3043
3416
|
uint32_t frag_len;
|
3044
3417
|
};
|
3045
3418
|
|
3046
|
-
// An
|
3047
|
-
|
3419
|
+
// An DTLSIncomingMessage is an incoming DTLS message, possibly not yet
|
3420
|
+
// assembled.
|
3421
|
+
struct DTLSIncomingMessage {
|
3048
3422
|
static constexpr bool kAllowUniquePtr = true;
|
3049
3423
|
|
3050
|
-
|
3051
|
-
|
3052
|
-
|
3053
|
-
|
3054
|
-
|
3424
|
+
Span<uint8_t> msg() { return MakeSpan(data).subspan(DTLS1_HM_HEADER_LENGTH); }
|
3425
|
+
Span<const uint8_t> msg() const {
|
3426
|
+
return MakeSpan(data).subspan(DTLS1_HM_HEADER_LENGTH);
|
3427
|
+
}
|
3428
|
+
size_t msg_len() const { return msg().size(); }
|
3055
3429
|
|
3056
3430
|
// type is the type of the message.
|
3057
3431
|
uint8_t type = 0;
|
3058
3432
|
// seq is the sequence number of this message.
|
3059
3433
|
uint16_t seq = 0;
|
3060
|
-
//
|
3061
|
-
|
3062
|
-
|
3063
|
-
//
|
3064
|
-
|
3065
|
-
|
3066
|
-
|
3067
|
-
|
3434
|
+
// data contains the message, including the message header of length
|
3435
|
+
// |DTLS1_HM_HEADER_LENGTH|.
|
3436
|
+
Array<uint8_t> data;
|
3437
|
+
// reassembly tracks which parts of the message have been received.
|
3438
|
+
DTLSMessageBitmap reassembly;
|
3439
|
+
};
|
3440
|
+
|
3441
|
+
struct DTLSOutgoingMessage {
|
3442
|
+
size_t msg_len() const {
|
3443
|
+
assert(!is_ccs);
|
3444
|
+
assert(data.size() >= DTLS1_HM_HEADER_LENGTH);
|
3445
|
+
return data.size() - DTLS1_HM_HEADER_LENGTH;
|
3446
|
+
}
|
3447
|
+
|
3448
|
+
bool IsFullyAcked() const {
|
3449
|
+
// ACKs only exist in DTLS 1.3, which does not send ChangeCipherSpec.
|
3450
|
+
return !is_ccs && acked.IsComplete();
|
3451
|
+
}
|
3452
|
+
|
3453
|
+
Array<uint8_t> data;
|
3454
|
+
uint16_t epoch = 0;
|
3455
|
+
bool is_ccs = false;
|
3456
|
+
// acked tracks which bits of the message have been ACKed by the peer. If
|
3457
|
+
// |msg_len| is zero, it tracks one bit for whether the header has been
|
3458
|
+
// received.
|
3459
|
+
DTLSMessageBitmap acked;
|
3068
3460
|
};
|
3069
3461
|
|
3070
3462
|
struct OPENSSL_timeval {
|
@@ -3072,12 +3464,111 @@ struct OPENSSL_timeval {
|
|
3072
3464
|
uint32_t tv_usec;
|
3073
3465
|
};
|
3074
3466
|
|
3467
|
+
struct DTLSTimer {
|
3468
|
+
public:
|
3469
|
+
static constexpr uint64_t kNever = UINT64_MAX;
|
3470
|
+
|
3471
|
+
// StartMicroseconds schedules the timer to expire the specified number of
|
3472
|
+
// microseconds from |now|.
|
3473
|
+
void StartMicroseconds(OPENSSL_timeval now, uint64_t microseconds);
|
3474
|
+
|
3475
|
+
// Stop disables the timer.
|
3476
|
+
void Stop();
|
3477
|
+
|
3478
|
+
// IsExpired returns true if the timer was set and is expired at time |now|.
|
3479
|
+
bool IsExpired(OPENSSL_timeval now) const;
|
3480
|
+
|
3481
|
+
// IsSet returns true if the timer is scheduled or expired, and false if it is
|
3482
|
+
// stopped.
|
3483
|
+
bool IsSet() const;
|
3484
|
+
|
3485
|
+
// MicrosecondsRemaining returns the time remaining, in microseconds, at
|
3486
|
+
// |now|, or |kNever| if the timer is unset.
|
3487
|
+
uint64_t MicrosecondsRemaining(OPENSSL_timeval now) const;
|
3488
|
+
|
3489
|
+
private:
|
3490
|
+
// expire_time_ is the time when the timer expires, or zero if the timer is
|
3491
|
+
// unset.
|
3492
|
+
//
|
3493
|
+
// TODO(crbug.com/366284846): This is an extremely inconvenient time
|
3494
|
+
// representation. Switch libssl to something like a 64-bit count of
|
3495
|
+
// microseconds. While it's decidedly past 1970 now, zero is a less obviously
|
3496
|
+
// sound distinguished value for the monotonic clock, so maybe we should use a
|
3497
|
+
// different distinguished time, like |INT64_MAX| in the microseconds
|
3498
|
+
// representation.
|
3499
|
+
OPENSSL_timeval expire_time_ = {0, 0};
|
3500
|
+
};
|
3501
|
+
|
3502
|
+
// DTLS_MAX_EXTRA_WRITE_EPOCHS is the maximum number of additional write epochs
|
3503
|
+
// that DTLS may need to retain.
|
3504
|
+
//
|
3505
|
+
// The maximum is, as a DTLS 1.3 server, immediately after sending Finished. At
|
3506
|
+
// this point, the current epoch is the application write keys (epoch 3), but we
|
3507
|
+
// may have ServerHello (epoch 0) and EncryptedExtensions (epoch 1) to
|
3508
|
+
// retransmit. KeyUpdate does not increase this count. If the server were to
|
3509
|
+
// initiate KeyUpdate from this state, it would not apply the new epoch until
|
3510
|
+
// the client's ACKs have caught up. At that point, epochs 0 and 1 can be
|
3511
|
+
// discarded.
|
3512
|
+
#define DTLS_MAX_EXTRA_WRITE_EPOCHS 2
|
3513
|
+
|
3514
|
+
// DTLS_MAX_ACK_BUFFER is the maximum number of records worth of data we'll keep
|
3515
|
+
// track of with DTLS 1.3 ACKs. When we exceed this value, information about
|
3516
|
+
// stale records will be dropped. This will not break the connection but may
|
3517
|
+
// cause ACKs to perform worse and retransmit unnecessary information.
|
3518
|
+
#define DTLS_MAX_ACK_BUFFER 32
|
3519
|
+
|
3520
|
+
// A DTLSSentRecord records information about a record we sent. Each record
|
3521
|
+
// covers all bytes from |first_msg_start| (inclusive) of |first_msg| to
|
3522
|
+
// |last_msg_end| (exclusive) of |last_msg|. Messages are referenced by index
|
3523
|
+
// into |outgoing_messages|. |last_msg_end| may be |outgoing_messages.size()| if
|
3524
|
+
// |last_msg_end| is zero.
|
3525
|
+
//
|
3526
|
+
// When the message is empty, |first_msg_start| and |last_msg_end| are
|
3527
|
+
// maintained as if there is a single bit in the message representing the
|
3528
|
+
// header. See |acked| in DTLSOutgoingMessage.
|
3529
|
+
struct DTLSSentRecord {
|
3530
|
+
DTLSRecordNumber number;
|
3531
|
+
PackedSize<SSL_MAX_HANDSHAKE_FLIGHT> first_msg = 0;
|
3532
|
+
PackedSize<SSL_MAX_HANDSHAKE_FLIGHT> last_msg = 0;
|
3533
|
+
uint32_t first_msg_start = 0;
|
3534
|
+
uint32_t last_msg_end = 0;
|
3535
|
+
};
|
3536
|
+
|
3537
|
+
enum class QueuedKeyUpdate {
|
3538
|
+
kNone,
|
3539
|
+
kUpdateNotRequested,
|
3540
|
+
kUpdateRequested,
|
3541
|
+
};
|
3542
|
+
|
3543
|
+
// DTLS_PREV_READ_EPOCH_EXPIRE_SECONDS is how long to retain the previous read
|
3544
|
+
// epoch in DTLS 1.3. This value is set based on the following:
|
3545
|
+
//
|
3546
|
+
// - Section 4.2.1 of RFC 9147 recommends retaining past read epochs for the
|
3547
|
+
// default TCP MSL. This accommodates packet reordering with KeyUpdate.
|
3548
|
+
//
|
3549
|
+
// - Section 5.8.1 of RFC 9147 requires being capable of ACKing the client's
|
3550
|
+
// final flight for at least twice the default MSL. That requires retaining
|
3551
|
+
// epoch 2 after the handshake.
|
3552
|
+
//
|
3553
|
+
// - Section 4 of RFC 9293 defines the MSL to be two minutes.
|
3554
|
+
#define DTLS_PREV_READ_EPOCH_EXPIRE_SECONDS (4 * 60)
|
3555
|
+
|
3556
|
+
struct DTLSPrevReadEpoch {
|
3557
|
+
static constexpr bool kAllowUniquePtr = true;
|
3558
|
+
DTLSReadEpoch epoch;
|
3559
|
+
// expire is the expiration time of the read epoch, expressed as a POSIX
|
3560
|
+
// timestamp in seconds.
|
3561
|
+
uint64_t expire;
|
3562
|
+
};
|
3563
|
+
|
3075
3564
|
struct DTLS1_STATE {
|
3076
3565
|
static constexpr bool kAllowUniquePtr = true;
|
3077
3566
|
|
3078
3567
|
DTLS1_STATE();
|
3079
3568
|
~DTLS1_STATE();
|
3080
3569
|
|
3570
|
+
bool Init();
|
3571
|
+
|
3081
3572
|
// has_change_cipher_spec is true if we have received a ChangeCipherSpec from
|
3082
3573
|
// the peer in this epoch.
|
3083
3574
|
bool has_change_cipher_spec : 1;
|
@@ -3092,36 +3583,63 @@ struct DTLS1_STATE {
|
|
3092
3583
|
// peer sent the final flight.
|
3093
3584
|
bool flight_has_reply : 1;
|
3094
3585
|
|
3095
|
-
//
|
3096
|
-
//
|
3097
|
-
|
3098
|
-
|
3586
|
+
// handshake_write_overflow and handshake_read_overflow are true if
|
3587
|
+
// handshake_write_seq and handshake_read_seq, respectively have overflowed.
|
3588
|
+
bool handshake_write_overflow : 1;
|
3589
|
+
bool handshake_read_overflow : 1;
|
3099
3590
|
|
3100
|
-
//
|
3101
|
-
|
3591
|
+
// sending_flight and sending_ack are true if we are in the process of sending
|
3592
|
+
// a handshake flight and ACK, respectively.
|
3593
|
+
bool sending_flight : 1;
|
3594
|
+
bool sending_ack : 1;
|
3595
|
+
|
3596
|
+
// queued_key_update, if not kNone, indicates we've queued a KeyUpdate message
|
3597
|
+
// to send after the current flight is ACKed.
|
3598
|
+
QueuedKeyUpdate queued_key_update : 2;
|
3102
3599
|
|
3103
3600
|
uint16_t handshake_write_seq = 0;
|
3104
3601
|
uint16_t handshake_read_seq = 0;
|
3105
3602
|
|
3106
|
-
//
|
3107
|
-
|
3108
|
-
|
3603
|
+
// read_epoch is the current read epoch.
|
3604
|
+
DTLSReadEpoch read_epoch;
|
3605
|
+
|
3606
|
+
// next_read_epoch is the next read epoch in DTLS 1.3. It will become
|
3607
|
+
// current once a record is received from it.
|
3608
|
+
UniquePtr<DTLSReadEpoch> next_read_epoch;
|
3609
|
+
|
3610
|
+
// prev_read_epoch is the previous read epoch in DTLS 1.3.
|
3611
|
+
UniquePtr<DTLSPrevReadEpoch> prev_read_epoch;
|
3109
3612
|
|
3613
|
+
// write_epoch is the current DTLS write epoch. Non-retransmit records will
|
3614
|
+
// generally use this epoch.
|
3615
|
+
// TODO(crbug.com/381113363): 0-RTT will be the exception, when implemented.
|
3616
|
+
DTLSWriteEpoch write_epoch;
|
3110
3617
|
|
3111
|
-
//
|
3112
|
-
|
3113
|
-
|
3618
|
+
// extra_write_epochs is the collection available write epochs.
|
3619
|
+
InplaceVector<UniquePtr<DTLSWriteEpoch>, DTLS_MAX_EXTRA_WRITE_EPOCHS>
|
3620
|
+
extra_write_epochs;
|
3114
3621
|
|
3115
3622
|
// incoming_messages is a ring buffer of incoming handshake messages that have
|
3116
3623
|
// yet to be processed. The front of the ring buffer is message number
|
3117
3624
|
// |handshake_read_seq|, at position |handshake_read_seq| %
|
3118
3625
|
// |SSL_MAX_HANDSHAKE_FLIGHT|.
|
3119
|
-
UniquePtr<
|
3626
|
+
UniquePtr<DTLSIncomingMessage> incoming_messages[SSL_MAX_HANDSHAKE_FLIGHT];
|
3120
3627
|
|
3121
3628
|
// outgoing_messages is the queue of outgoing messages from the last handshake
|
3122
3629
|
// flight.
|
3123
|
-
|
3124
|
-
|
3630
|
+
InplaceVector<DTLSOutgoingMessage, SSL_MAX_HANDSHAKE_FLIGHT>
|
3631
|
+
outgoing_messages;
|
3632
|
+
|
3633
|
+
// sent_records is a queue of records we sent, for processing ACKs. To save
|
3634
|
+
// memory in the steady state, the structure is stored on the heap and dropped
|
3635
|
+
// when empty.
|
3636
|
+
UniquePtr<MRUQueue<DTLSSentRecord, DTLS_MAX_ACK_BUFFER>> sent_records;
|
3637
|
+
|
3638
|
+
// records_to_ack is a queue of received records that we should ACK. This is
|
3639
|
+
// not stored on the heap because, in the steady state, DTLS 1.3 does not
|
3640
|
+
// necessarily empty this list. (We probably could drop records from here once
|
3641
|
+
// they are sufficiently old.)
|
3642
|
+
MRUQueue<DTLSRecordNumber, DTLS_MAX_ACK_BUFFER> records_to_ack;
|
3125
3643
|
|
3126
3644
|
// outgoing_written is the number of outgoing messages that have been
|
3127
3645
|
// written.
|
@@ -3136,12 +3654,15 @@ struct DTLS1_STATE {
|
|
3136
3654
|
// the last time it was reset.
|
3137
3655
|
unsigned num_timeouts = 0;
|
3138
3656
|
|
3139
|
-
//
|
3140
|
-
//
|
3141
|
-
|
3657
|
+
// retransmit_timer tracks when to schedule the next DTLS retransmit if we do
|
3658
|
+
// not hear from the peer.
|
3659
|
+
DTLSTimer retransmit_timer;
|
3660
|
+
|
3661
|
+
// ack_timer tracks when to send an ACK.
|
3662
|
+
DTLSTimer ack_timer;
|
3142
3663
|
|
3143
3664
|
// timeout_duration_ms is the timeout duration in milliseconds.
|
3144
|
-
|
3665
|
+
uint32_t timeout_duration_ms = 0;
|
3145
3666
|
};
|
3146
3667
|
|
3147
3668
|
// An ALPSConfig is a pair of ALPN protocol and settings value to use with ALPS.
|
@@ -3207,6 +3728,13 @@ struct SSL_CONFIG {
|
|
3207
3728
|
// |client_CA|.
|
3208
3729
|
STACK_OF(X509_NAME) *cached_x509_client_CA = nullptr;
|
3209
3730
|
|
3731
|
+
// For client side, keep the list of CA distinguished names we can use
|
3732
|
+
// for the Certificate Authorities extension.
|
3733
|
+
// TODO(bbe) having this separate from the client side (above) is mildly
|
3734
|
+
// silly, but OpenSSL has *_client_CA API's for this exposed, and for the
|
3735
|
+
// moment we are not crossing those streams.
|
3736
|
+
UniquePtr<STACK_OF(CRYPTO_BUFFER)> CA_names;
|
3737
|
+
|
3210
3738
|
Array<uint16_t> supported_group_list; // our list
|
3211
3739
|
|
3212
3740
|
// channel_id_private is the client's Channel ID private key, or null if
|
@@ -3219,7 +3747,7 @@ struct SSL_CONFIG {
|
|
3219
3747
|
|
3220
3748
|
// alps_configs contains the list of supported protocols to use with ALPS,
|
3221
3749
|
// along with their corresponding ALPS values.
|
3222
|
-
|
3750
|
+
Vector<ALPSConfig> alps_configs;
|
3223
3751
|
|
3224
3752
|
// Contains the QUIC transport params that this endpoint will send.
|
3225
3753
|
Array<uint8_t> quic_transport_params;
|
@@ -3330,10 +3858,15 @@ bool ssl_is_key_type_supported(int key_type);
|
|
3330
3858
|
// counterpart to |privkey|. Otherwise it returns false and pushes a helpful
|
3331
3859
|
// message on the error queue.
|
3332
3860
|
bool ssl_compare_public_and_private_key(const EVP_PKEY *pubkey,
|
3333
|
-
|
3861
|
+
const EVP_PKEY *privkey);
|
3334
3862
|
bool ssl_get_new_session(SSL_HANDSHAKE *hs);
|
3863
|
+
|
3864
|
+
// ssl_encrypt_ticket encrypt a ticket for |session| and writes the result to
|
3865
|
+
// |out|. It returns true on success and false on error. If, on success, nothing
|
3866
|
+
// was written to |out|, the caller should skip sending a ticket.
|
3335
3867
|
bool ssl_encrypt_ticket(SSL_HANDSHAKE *hs, CBB *out,
|
3336
3868
|
const SSL_SESSION *session);
|
3869
|
+
|
3337
3870
|
bool ssl_ctx_rotate_ticket_encryption_key(SSL_CTX *ctx);
|
3338
3871
|
|
3339
3872
|
// ssl_session_new returns a newly-allocated blank |SSL_SESSION| or nullptr on
|
@@ -3354,6 +3887,20 @@ OPENSSL_EXPORT UniquePtr<SSL_SESSION> SSL_SESSION_parse(
|
|
3354
3887
|
// error.
|
3355
3888
|
OPENSSL_EXPORT bool ssl_session_serialize(const SSL_SESSION *in, CBB *cbb);
|
3356
3889
|
|
3890
|
+
enum class SSLSessionType {
|
3891
|
+
// The session is not resumable.
|
3892
|
+
kNotResumable,
|
3893
|
+
// The session uses a TLS 1.2 session ID.
|
3894
|
+
kID,
|
3895
|
+
// The session uses a TLS 1.2 ticket.
|
3896
|
+
kTicket,
|
3897
|
+
// The session uses a TLS 1.3 pre-shared key.
|
3898
|
+
kPreSharedKey,
|
3899
|
+
};
|
3900
|
+
|
3901
|
+
// ssl_session_get_type returns the type of |session|.
|
3902
|
+
SSLSessionType ssl_session_get_type(const SSL_SESSION *session);
|
3903
|
+
|
3357
3904
|
// ssl_session_is_context_valid returns whether |session|'s session ID context
|
3358
3905
|
// matches the one set on |hs|.
|
3359
3906
|
bool ssl_session_is_context_valid(const SSL_HANDSHAKE *hs,
|
@@ -3438,13 +3985,15 @@ bool tls_init_message(const SSL *ssl, CBB *cbb, CBB *body, uint8_t type);
|
|
3438
3985
|
bool tls_finish_message(const SSL *ssl, CBB *cbb, Array<uint8_t> *out_msg);
|
3439
3986
|
bool tls_add_message(SSL *ssl, Array<uint8_t> msg);
|
3440
3987
|
bool tls_add_change_cipher_spec(SSL *ssl);
|
3441
|
-
int
|
3988
|
+
int tls_flush(SSL *ssl);
|
3442
3989
|
|
3443
3990
|
bool dtls1_init_message(const SSL *ssl, CBB *cbb, CBB *body, uint8_t type);
|
3444
3991
|
bool dtls1_finish_message(const SSL *ssl, CBB *cbb, Array<uint8_t> *out_msg);
|
3445
3992
|
bool dtls1_add_message(SSL *ssl, Array<uint8_t> msg);
|
3446
3993
|
bool dtls1_add_change_cipher_spec(SSL *ssl);
|
3447
|
-
|
3994
|
+
void dtls1_finish_flight(SSL *ssl);
|
3995
|
+
void dtls1_schedule_ack(SSL *ssl);
|
3996
|
+
int dtls1_flush(SSL *ssl);
|
3448
3997
|
|
3449
3998
|
// ssl_add_message_cbb finishes the handshake message in |cbb| and adds it to
|
3450
3999
|
// the pending flight. It returns true on success and false on error.
|
@@ -3454,6 +4003,9 @@ bool ssl_add_message_cbb(SSL *ssl, CBB *cbb);
|
|
3454
4003
|
// on success and false on allocation failure.
|
3455
4004
|
bool ssl_hash_message(SSL_HANDSHAKE *hs, const SSLMessage &msg);
|
3456
4005
|
|
4006
|
+
ssl_open_record_t dtls1_process_ack(SSL *ssl, uint8_t *out_alert,
|
4007
|
+
DTLSRecordNumber ack_record_number,
|
4008
|
+
Span<const uint8_t> data);
|
3457
4009
|
ssl_open_record_t dtls1_open_app_data(SSL *ssl, Span<uint8_t> *out,
|
3458
4010
|
size_t *out_consumed, uint8_t *out_alert,
|
3459
4011
|
Span<uint8_t> in);
|
@@ -3469,19 +4021,27 @@ int dtls1_write_app_data(SSL *ssl, bool *out_needs_handshake,
|
|
3469
4021
|
int dtls1_write_record(SSL *ssl, int type, Span<const uint8_t> in,
|
3470
4022
|
uint16_t epoch);
|
3471
4023
|
|
3472
|
-
int dtls1_retransmit_outgoing_messages(SSL *ssl);
|
3473
4024
|
bool dtls1_parse_fragment(CBS *cbs, struct hm_header_st *out_hdr,
|
3474
4025
|
CBS *out_body);
|
3475
|
-
bool dtls1_check_timeout_num(SSL *ssl);
|
3476
4026
|
|
3477
|
-
|
4027
|
+
// DTLS1_MTU_TIMEOUTS is the maximum number of retransmit timeouts to expire
|
4028
|
+
// before starting to decrease the MTU.
|
4029
|
+
#define DTLS1_MTU_TIMEOUTS 2
|
4030
|
+
|
4031
|
+
// DTLS1_MAX_TIMEOUTS is the maximum number of retransmit timeouts to expire
|
4032
|
+
// before failing the DTLS handshake.
|
4033
|
+
#define DTLS1_MAX_TIMEOUTS 12
|
4034
|
+
|
3478
4035
|
void dtls1_stop_timer(SSL *ssl);
|
3479
|
-
|
4036
|
+
|
3480
4037
|
unsigned int dtls1_min_mtu(void);
|
3481
4038
|
|
3482
4039
|
bool dtls1_new(SSL *ssl);
|
3483
4040
|
void dtls1_free(SSL *ssl);
|
3484
4041
|
|
4042
|
+
bool dtls1_process_handshake_fragments(SSL *ssl, uint8_t *out_alert,
|
4043
|
+
DTLSRecordNumber record_number,
|
4044
|
+
Span<const uint8_t> record);
|
3485
4045
|
bool dtls1_get_message(const SSL *ssl, SSLMessage *out);
|
3486
4046
|
ssl_open_record_t dtls1_open_handshake(SSL *ssl, size_t *out_consumed,
|
3487
4047
|
uint8_t *out_alert, Span<uint8_t> in);
|
@@ -3500,8 +4060,11 @@ bool tls1_configure_aead(SSL *ssl, evp_aead_direction_t direction,
|
|
3500
4060
|
|
3501
4061
|
bool tls1_change_cipher_state(SSL_HANDSHAKE *hs,
|
3502
4062
|
evp_aead_direction_t direction);
|
3503
|
-
|
3504
|
-
|
4063
|
+
|
4064
|
+
// tls1_generate_master_secret computes the master secret from |premaster| and
|
4065
|
+
// writes it to |out|. |out| must have size |SSL3_MASTER_SECRET_SIZE|.
|
4066
|
+
bool tls1_generate_master_secret(SSL_HANDSHAKE *hs, Span<uint8_t> out,
|
4067
|
+
Span<const uint8_t> premaster);
|
3505
4068
|
|
3506
4069
|
// tls1_get_grouplist returns the locally-configured group preference list.
|
3507
4070
|
Span<const uint16_t> tls1_get_grouplist(const SSL_HANDSHAKE *ssl);
|
@@ -3580,9 +4143,7 @@ bool ssl_can_write(const SSL *ssl);
|
|
3580
4143
|
// ssl_can_read returns wheter |ssl| is allowed to read.
|
3581
4144
|
bool ssl_can_read(const SSL *ssl);
|
3582
4145
|
|
3583
|
-
|
3584
|
-
void ssl_ctx_get_current_time(const SSL_CTX *ctx,
|
3585
|
-
struct OPENSSL_timeval *out_clock);
|
4146
|
+
OPENSSL_timeval ssl_ctx_get_current_time(const SSL_CTX *ctx);
|
3586
4147
|
|
3587
4148
|
// ssl_reset_error_state resets state for |SSL_get_error|.
|
3588
4149
|
void ssl_reset_error_state(SSL *ssl);
|
@@ -3713,6 +4274,8 @@ struct ssl_ctx_st : public bssl::RefCounted<ssl_ctx_st> {
|
|
3713
4274
|
// |client_CA|.
|
3714
4275
|
STACK_OF(X509_NAME) *cached_x509_client_CA = nullptr;
|
3715
4276
|
|
4277
|
+
// What we put in client hello in the CA extension.
|
4278
|
+
bssl::UniquePtr<STACK_OF(CRYPTO_BUFFER)> CA_names;
|
3716
4279
|
|
3717
4280
|
// Default values to use in SSL structures follow (these are copied by
|
3718
4281
|
// SSL_new)
|
@@ -3822,7 +4385,7 @@ struct ssl_ctx_st : public bssl::RefCounted<ssl_ctx_st> {
|
|
3822
4385
|
bssl::UniquePtr<STACK_OF(SRTP_PROTECTION_PROFILE)> srtp_profiles;
|
3823
4386
|
|
3824
4387
|
// Defined compression algorithms for certificates.
|
3825
|
-
bssl::
|
4388
|
+
bssl::Vector<bssl::CertCompressionAlg> cert_compression_algs;
|
3826
4389
|
|
3827
4390
|
// Supported group values inherited by SSL structure
|
3828
4391
|
bssl::Array<uint16_t> supported_group_list;
|
@@ -3939,9 +4502,6 @@ struct ssl_st {
|
|
3939
4502
|
// that instead, and skip the null check.)
|
3940
4503
|
bssl::UniquePtr<bssl::SSL_CONFIG> config;
|
3941
4504
|
|
3942
|
-
// version is the protocol version.
|
3943
|
-
uint16_t version = 0;
|
3944
|
-
|
3945
4505
|
uint16_t max_send_fragment = 0;
|
3946
4506
|
|
3947
4507
|
// There are 2 BIO's even though they are normally both the same. This is so
|
@@ -3967,11 +4527,9 @@ struct ssl_st {
|
|
3967
4527
|
// session info
|
3968
4528
|
|
3969
4529
|
// initial_timeout_duration_ms is the default DTLS timeout duration in
|
3970
|
-
// milliseconds. It's used to initialize the timer any time it's restarted.
|
3971
|
-
//
|
3972
|
-
|
3973
|
-
// second.
|
3974
|
-
unsigned initial_timeout_duration_ms = 1000;
|
4530
|
+
// milliseconds. It's used to initialize the timer any time it's restarted. We
|
4531
|
+
// default to RFC 9147's recommendation for real-time applications, 400ms.
|
4532
|
+
uint32_t initial_timeout_duration_ms = 400;
|
3975
4533
|
|
3976
4534
|
// session is the configured session to be offered by the client. This session
|
3977
4535
|
// is immutable.
|
@@ -4032,17 +4590,14 @@ struct ssl_session_st : public bssl::RefCounted<ssl_session_st> {
|
|
4032
4590
|
// session. In TLS 1.3 and up, it is the resumption PSK for sessions handed to
|
4033
4591
|
// the caller, but it stores the resumption secret when stored on |SSL|
|
4034
4592
|
// objects.
|
4035
|
-
uint8_t
|
4036
|
-
|
4593
|
+
bssl::InplaceVector<uint8_t, SSL_MAX_MASTER_KEY_LENGTH> secret;
|
4594
|
+
|
4595
|
+
bssl::InplaceVector<uint8_t, SSL_MAX_SSL_SESSION_ID_LENGTH> session_id;
|
4037
4596
|
|
4038
|
-
// session_id - valid?
|
4039
|
-
uint8_t session_id_length = 0;
|
4040
|
-
uint8_t session_id[SSL_MAX_SSL_SESSION_ID_LENGTH] = {0};
|
4041
4597
|
// this is used to determine whether the session is being reused in
|
4042
4598
|
// the appropriate context. It is up to the application to set this,
|
4043
4599
|
// via SSL_new
|
4044
|
-
uint8_t
|
4045
|
-
uint8_t sid_ctx[SSL_MAX_SID_CTX_LENGTH] = {0};
|
4600
|
+
bssl::InplaceVector<uint8_t, SSL_MAX_SID_CTX_LENGTH> sid_ctx;
|
4046
4601
|
|
4047
4602
|
bssl::UniquePtr<char> psk_identity;
|
4048
4603
|
|
@@ -4105,8 +4660,7 @@ struct ssl_session_st : public bssl::RefCounted<ssl_session_st> {
|
|
4105
4660
|
// original_handshake_hash contains the handshake hash (either SHA-1+MD5 or
|
4106
4661
|
// SHA-2, depending on TLS version) for the original, full handshake that
|
4107
4662
|
// created a session. This is used by Channel IDs during resumption.
|
4108
|
-
uint8_t
|
4109
|
-
uint8_t original_handshake_hash_len = 0;
|
4663
|
+
bssl::InplaceVector<uint8_t, EVP_MAX_MD_SIZE> original_handshake_hash;
|
4110
4664
|
|
4111
4665
|
uint32_t ticket_lifetime_hint = 0; // Session lifetime hint in seconds
|
4112
4666
|
|
@@ -4166,7 +4720,7 @@ struct ssl_session_st : public bssl::RefCounted<ssl_session_st> {
|
|
4166
4720
|
struct ssl_ech_keys_st : public bssl::RefCounted<ssl_ech_keys_st> {
|
4167
4721
|
ssl_ech_keys_st() : RefCounted(CheckSubClass()) {}
|
4168
4722
|
|
4169
|
-
bssl::
|
4723
|
+
bssl::Vector<bssl::UniquePtr<bssl::ECHServerConfig>> configs;
|
4170
4724
|
|
4171
4725
|
private:
|
4172
4726
|
friend RefCounted;
|