grpc 1.4.5 → 1.6.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +1235 -1100
- data/etc/roots.pem +0 -412
- data/include/grpc/byte_buffer.h +10 -25
- data/include/grpc/byte_buffer_reader.h +10 -25
- data/include/grpc/census.h +10 -25
- data/include/grpc/compression.h +10 -25
- data/include/grpc/grpc.h +15 -26
- data/include/grpc/grpc_cronet.h +10 -25
- data/include/grpc/grpc_posix.h +10 -25
- data/include/grpc/grpc_security.h +10 -25
- data/include/grpc/grpc_security_constants.h +10 -25
- data/include/grpc/impl/codegen/atm.h +11 -25
- data/include/grpc/impl/codegen/atm_gcc_atomic.h +10 -25
- data/include/grpc/impl/codegen/atm_gcc_sync.h +10 -25
- data/include/grpc/impl/codegen/atm_windows.h +10 -25
- data/include/grpc/impl/codegen/byte_buffer_reader.h +11 -26
- data/include/grpc/impl/codegen/compression_types.h +12 -27
- data/include/grpc/impl/codegen/connectivity_state.h +10 -25
- data/include/grpc/impl/codegen/exec_ctx_fwd.h +10 -25
- data/include/grpc/impl/codegen/gpr_slice.h +10 -25
- data/include/grpc/impl/codegen/gpr_types.h +10 -25
- data/include/grpc/impl/codegen/grpc_types.h +42 -43
- data/include/grpc/impl/codegen/port_platform.h +10 -25
- data/include/grpc/impl/codegen/propagation_bits.h +10 -25
- data/include/grpc/impl/codegen/slice.h +13 -28
- data/include/grpc/impl/codegen/status.h +10 -25
- data/include/grpc/impl/codegen/sync.h +10 -25
- data/include/grpc/impl/codegen/sync_generic.h +10 -25
- data/include/grpc/impl/codegen/sync_posix.h +10 -25
- data/include/grpc/impl/codegen/sync_windows.h +10 -25
- data/include/grpc/load_reporting.h +10 -25
- data/include/grpc/slice.h +10 -25
- data/include/grpc/slice_buffer.h +10 -25
- data/include/grpc/status.h +10 -25
- data/include/grpc/support/alloc.h +10 -25
- data/include/grpc/support/atm.h +10 -25
- data/include/grpc/support/atm_gcc_atomic.h +10 -25
- data/include/grpc/support/atm_gcc_sync.h +10 -25
- data/include/grpc/support/atm_windows.h +10 -25
- data/include/grpc/support/avl.h +46 -49
- data/include/grpc/support/cmdline.h +10 -25
- data/include/grpc/support/cpu.h +10 -25
- data/include/grpc/support/histogram.h +10 -25
- data/include/grpc/support/host_port.h +10 -25
- data/include/grpc/support/log.h +10 -25
- data/include/grpc/support/log_windows.h +10 -25
- data/include/grpc/support/port_platform.h +10 -25
- data/include/grpc/support/string_util.h +10 -25
- data/include/grpc/support/subprocess.h +10 -25
- data/include/grpc/support/sync.h +10 -25
- data/include/grpc/support/sync_generic.h +10 -25
- data/include/grpc/support/sync_posix.h +10 -25
- data/include/grpc/support/sync_windows.h +10 -25
- data/include/grpc/support/thd.h +10 -25
- data/include/grpc/support/time.h +10 -25
- data/include/grpc/support/tls.h +10 -25
- data/include/grpc/support/tls_gcc.h +10 -25
- data/include/grpc/support/tls_msvc.h +10 -25
- data/include/grpc/support/tls_pthread.h +10 -25
- data/include/grpc/support/useful.h +10 -25
- data/include/grpc/support/workaround_list.h +11 -26
- data/src/boringssl/err_data.c +277 -259
- data/src/core/ext/census/aggregation.h +10 -25
- data/src/core/ext/census/base_resources.c +10 -25
- data/src/core/ext/census/base_resources.h +10 -25
- data/src/core/ext/census/census_interface.h +10 -25
- data/src/core/ext/census/census_rpc_stats.h +10 -25
- data/src/core/ext/census/context.c +10 -25
- data/src/core/ext/census/gen/census.pb.c +10 -25
- data/src/core/ext/census/gen/census.pb.h +10 -25
- data/src/core/ext/census/gen/trace_context.pb.c +10 -25
- data/src/core/ext/census/gen/trace_context.pb.h +10 -25
- data/src/core/ext/census/grpc_context.c +10 -25
- data/src/core/ext/census/grpc_filter.c +11 -26
- data/src/core/ext/census/grpc_filter.h +10 -25
- data/src/core/ext/census/grpc_plugin.c +10 -25
- data/src/core/ext/census/initialize.c +10 -25
- data/src/core/ext/census/intrusive_hash_map.c +10 -25
- data/src/core/ext/census/intrusive_hash_map.h +10 -25
- data/src/core/ext/census/intrusive_hash_map_internal.h +10 -25
- data/src/core/ext/census/mlog.c +10 -25
- data/src/core/ext/census/mlog.h +10 -25
- data/src/core/ext/census/operation.c +10 -25
- data/src/core/ext/census/placeholders.c +10 -25
- data/src/core/ext/census/resource.c +10 -25
- data/src/core/ext/census/resource.h +10 -25
- data/src/core/ext/census/rpc_metric_id.h +10 -25
- data/src/core/ext/census/trace_context.c +10 -25
- data/src/core/ext/census/trace_context.h +10 -25
- data/src/core/ext/census/trace_label.h +10 -25
- data/src/core/ext/census/trace_propagation.h +10 -25
- data/src/core/ext/census/trace_status.h +10 -25
- data/src/core/ext/census/trace_string.h +10 -25
- data/src/core/ext/census/tracing.c +10 -26
- data/src/core/ext/census/tracing.h +10 -25
- data/src/core/ext/filters/client_channel/channel_connectivity.c +20 -33
- data/src/core/ext/filters/client_channel/client_channel.c +617 -520
- data/src/core/ext/filters/client_channel/client_channel.h +15 -28
- data/src/core/ext/filters/client_channel/client_channel_factory.c +13 -31
- data/src/core/ext/filters/client_channel/client_channel_factory.h +10 -25
- data/src/core/ext/filters/client_channel/client_channel_plugin.c +16 -29
- data/src/core/ext/filters/client_channel/connector.c +10 -25
- data/src/core/ext/filters/client_channel/connector.h +10 -25
- data/src/core/ext/filters/client_channel/http_connect_handshaker.c +15 -30
- data/src/core/ext/filters/client_channel/http_connect_handshaker.h +10 -25
- data/src/core/ext/filters/client_channel/http_proxy.c +112 -38
- data/src/core/ext/filters/client_channel/http_proxy.h +10 -25
- data/src/core/ext/filters/client_channel/lb_policy.c +32 -36
- data/src/core/ext/filters/client_channel/lb_policy.h +24 -27
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.c +14 -30
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +10 -25
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c +464 -279
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +10 -25
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +15 -28
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.c +40 -48
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.c +65 -49
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +31 -31
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.c +47 -32
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +11 -26
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +13 -9
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +27 -21
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c +373 -136
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +504 -279
- data/src/core/ext/filters/client_channel/lb_policy_factory.c +12 -31
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +12 -27
- data/src/core/ext/filters/client_channel/lb_policy_registry.c +10 -25
- data/src/core/ext/filters/client_channel/lb_policy_registry.h +10 -25
- data/src/core/ext/filters/client_channel/parse_address.c +10 -25
- data/src/core/ext/filters/client_channel/parse_address.h +10 -25
- data/src/core/ext/filters/client_channel/proxy_mapper.c +10 -25
- data/src/core/ext/filters/client_channel/proxy_mapper.h +10 -25
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.c +10 -25
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +10 -25
- data/src/core/ext/filters/client_channel/resolver.c +33 -38
- data/src/core/ext/filters/client_channel/resolver.h +19 -30
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c +153 -50
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +14 -27
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c +33 -30
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c +326 -116
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +35 -36
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.c +60 -0
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.c +19 -34
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c +254 -0
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +60 -0
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c +16 -28
- data/src/core/ext/filters/client_channel/resolver_factory.c +10 -25
- data/src/core/ext/filters/client_channel/resolver_factory.h +10 -25
- data/src/core/ext/filters/client_channel/resolver_registry.c +10 -25
- data/src/core/ext/filters/client_channel/resolver_registry.h +10 -25
- data/src/core/ext/filters/client_channel/retry_throttle.c +23 -34
- data/src/core/ext/filters/client_channel/retry_throttle.h +10 -25
- data/src/core/ext/filters/client_channel/subchannel.c +33 -55
- data/src/core/ext/filters/client_channel/subchannel.h +16 -26
- data/src/core/ext/filters/client_channel/subchannel_index.c +55 -92
- data/src/core/ext/filters/client_channel/subchannel_index.h +26 -29
- data/src/core/ext/filters/client_channel/uri_parser.c +10 -25
- data/src/core/ext/filters/client_channel/uri_parser.h +10 -25
- data/src/core/ext/filters/deadline/deadline_filter.c +30 -45
- data/src/core/ext/filters/deadline/deadline_filter.h +10 -25
- data/src/core/ext/filters/http/client/http_client_filter.c +255 -294
- data/src/core/ext/filters/http/client/http_client_filter.h +10 -25
- data/src/core/ext/filters/http/http_filters_plugin.c +11 -26
- data/src/core/ext/filters/http/message_compress/message_compress_filter.c +133 -105
- data/src/core/ext/filters/http/message_compress/message_compress_filter.h +10 -25
- data/src/core/ext/filters/http/server/http_server_filter.c +17 -32
- data/src/core/ext/filters/http/server/http_server_filter.h +10 -25
- data/src/core/ext/filters/load_reporting/load_reporting.c +11 -30
- data/src/core/ext/filters/load_reporting/load_reporting.h +10 -25
- data/src/core/ext/filters/load_reporting/load_reporting_filter.c +11 -26
- data/src/core/ext/filters/load_reporting/load_reporting_filter.h +10 -25
- data/src/core/ext/filters/max_age/max_age_filter.c +28 -43
- data/src/core/ext/filters/max_age/max_age_filter.h +10 -25
- data/src/core/ext/filters/message_size/message_size_filter.c +24 -37
- data/src/core/ext/filters/message_size/message_size_filter.h +10 -25
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c +16 -31
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h +10 -25
- data/src/core/ext/filters/workarounds/workaround_utils.c +12 -26
- data/src/core/ext/filters/workarounds/workaround_utils.h +11 -26
- data/src/core/ext/transport/chttp2/alpn/alpn.c +10 -25
- data/src/core/ext/transport/chttp2/alpn/alpn.h +10 -25
- data/src/core/ext/transport/chttp2/client/chttp2_connector.c +13 -28
- data/src/core/ext/transport/chttp2/client/chttp2_connector.h +10 -25
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +13 -30
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c +12 -29
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c +13 -30
- data/src/core/ext/transport/chttp2/server/chttp2_server.c +11 -26
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +10 -25
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.c +10 -25
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +10 -25
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c +10 -25
- data/src/core/ext/transport/chttp2/transport/bin_decoder.c +11 -25
- data/src/core/ext/transport/chttp2/transport/bin_decoder.h +10 -25
- data/src/core/ext/transport/chttp2/transport/bin_encoder.c +10 -25
- data/src/core/ext/transport/chttp2/transport/bin_encoder.h +10 -25
- data/src/core/ext/transport/chttp2/transport/chttp2_plugin.c +15 -27
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +421 -443
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +14 -25
- data/src/core/ext/transport/chttp2/transport/flow_control.c +500 -0
- data/src/core/ext/transport/chttp2/transport/frame.h +10 -25
- data/src/core/ext/transport/chttp2/transport/frame_data.c +20 -28
- data/src/core/ext/transport/chttp2/transport/frame_data.h +10 -25
- data/src/core/ext/transport/chttp2/transport/frame_goaway.c +10 -25
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +10 -25
- data/src/core/ext/transport/chttp2/transport/frame_ping.c +11 -26
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +10 -25
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +11 -26
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +10 -25
- data/src/core/ext/transport/chttp2/transport/frame_settings.c +16 -29
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +10 -25
- data/src/core/ext/transport/chttp2/transport/frame_window_update.c +17 -33
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +10 -25
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +18 -31
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +12 -25
- data/src/core/ext/transport/chttp2/transport/hpack_parser.c +15 -30
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +10 -25
- data/src/core/ext/transport/chttp2/transport/hpack_table.c +10 -25
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +10 -25
- data/src/core/ext/transport/chttp2/transport/http2_settings.c +10 -25
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +10 -25
- data/src/core/ext/transport/chttp2/transport/huffsyms.c +10 -25
- data/src/core/ext/transport/chttp2/transport/huffsyms.h +10 -25
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.c +10 -25
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +10 -25
- data/src/core/ext/transport/chttp2/transport/internal.h +191 -179
- data/src/core/ext/transport/chttp2/transport/parsing.c +33 -102
- data/src/core/ext/transport/chttp2/transport/stream_lists.c +26 -28
- data/src/core/ext/transport/chttp2/transport/stream_map.c +10 -25
- data/src/core/ext/transport/chttp2/transport/stream_map.h +10 -25
- data/src/core/ext/transport/chttp2/transport/varint.c +14 -25
- data/src/core/ext/transport/chttp2/transport/varint.h +10 -25
- data/src/core/ext/transport/chttp2/transport/writing.c +164 -106
- data/src/core/ext/transport/inproc/inproc_plugin.c +29 -0
- data/src/core/ext/transport/inproc/inproc_transport.c +1303 -0
- data/src/core/ext/transport/inproc/inproc_transport.h +41 -0
- data/src/core/lib/channel/channel_args.c +52 -27
- data/src/core/lib/channel/channel_args.h +18 -27
- data/src/core/lib/channel/channel_stack.c +11 -26
- data/src/core/lib/channel/channel_stack.h +12 -27
- data/src/core/lib/channel/channel_stack_builder.c +11 -26
- data/src/core/lib/channel/channel_stack_builder.h +10 -25
- data/src/core/lib/channel/connected_channel.c +10 -25
- data/src/core/lib/channel/connected_channel.h +10 -25
- data/src/core/lib/channel/context.h +10 -25
- data/src/core/lib/channel/handshaker.c +14 -29
- data/src/core/lib/channel/handshaker.h +10 -25
- data/src/core/lib/channel/handshaker_factory.c +10 -25
- data/src/core/lib/channel/handshaker_factory.h +10 -25
- data/src/core/lib/channel/handshaker_registry.c +10 -25
- data/src/core/lib/channel/handshaker_registry.h +10 -25
- data/src/core/lib/compression/algorithm_metadata.h +10 -25
- data/src/core/lib/compression/compression.c +10 -25
- data/src/core/lib/compression/message_compress.c +10 -25
- data/src/core/lib/compression/message_compress.h +10 -25
- data/src/core/lib/compression/stream_compression.c +191 -0
- data/src/core/lib/compression/stream_compression.h +90 -0
- data/src/core/lib/debug/trace.c +28 -29
- data/src/core/lib/debug/trace.h +16 -30
- data/src/core/lib/http/format_request.c +10 -25
- data/src/core/lib/http/format_request.h +10 -25
- data/src/core/lib/http/httpcli.c +19 -35
- data/src/core/lib/http/httpcli.h +10 -25
- data/src/core/lib/http/httpcli_security_connector.c +17 -30
- data/src/core/lib/http/parser.c +11 -26
- data/src/core/lib/http/parser.h +10 -25
- data/src/core/lib/iomgr/closure.c +62 -25
- data/src/core/lib/iomgr/closure.h +81 -26
- data/src/core/lib/iomgr/combiner.c +103 -200
- data/src/core/lib/iomgr/combiner.h +14 -32
- data/src/core/lib/iomgr/endpoint.c +10 -29
- data/src/core/lib/iomgr/endpoint.h +10 -29
- data/src/core/lib/iomgr/endpoint_pair.h +10 -25
- data/src/core/lib/iomgr/endpoint_pair_posix.c +10 -25
- data/src/core/lib/iomgr/endpoint_pair_uv.c +10 -25
- data/src/core/lib/iomgr/endpoint_pair_windows.c +10 -25
- data/src/core/lib/iomgr/error.c +45 -46
- data/src/core/lib/iomgr/error.h +21 -34
- data/src/core/lib/iomgr/error_internal.h +10 -25
- data/src/core/lib/iomgr/ev_epoll1_linux.c +279 -179
- data/src/core/lib/iomgr/ev_epoll1_linux.h +10 -25
- data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c +75 -264
- data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.h +10 -25
- data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c +44 -199
- data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.h +10 -25
- data/src/core/lib/iomgr/ev_epollex_linux.c +184 -247
- data/src/core/lib/iomgr/ev_epollex_linux.h +10 -25
- data/src/core/lib/iomgr/ev_epollsig_linux.c +116 -323
- data/src/core/lib/iomgr/ev_epollsig_linux.h +10 -25
- data/src/core/lib/iomgr/ev_poll_posix.c +328 -184
- data/src/core/lib/iomgr/ev_poll_posix.h +10 -25
- data/src/core/lib/iomgr/ev_posix.c +25 -56
- data/src/core/lib/iomgr/ev_posix.h +15 -44
- data/src/core/lib/iomgr/ev_windows.c +11 -26
- data/src/core/lib/iomgr/exec_ctx.c +36 -45
- data/src/core/lib/iomgr/exec_ctx.h +10 -25
- data/src/core/lib/iomgr/executor.c +152 -127
- data/src/core/lib/iomgr/executor.h +18 -26
- data/src/core/lib/iomgr/gethostname.h +26 -0
- data/src/core/lib/iomgr/gethostname_fallback.c +27 -0
- data/src/core/lib/iomgr/gethostname_host_name_max.c +37 -0
- data/src/core/lib/iomgr/gethostname_sysconf.c +37 -0
- data/src/core/lib/iomgr/iocp_windows.c +10 -25
- data/src/core/lib/iomgr/iocp_windows.h +10 -25
- data/src/core/lib/iomgr/iomgr.c +17 -28
- data/src/core/lib/iomgr/iomgr.h +12 -27
- data/src/core/lib/iomgr/iomgr_internal.h +10 -25
- data/src/core/lib/iomgr/iomgr_posix.c +11 -26
- data/src/core/lib/iomgr/iomgr_posix.h +10 -25
- data/src/core/lib/iomgr/iomgr_uv.c +19 -26
- data/src/core/lib/iomgr/iomgr_uv.h +37 -0
- data/src/core/lib/iomgr/iomgr_windows.c +10 -25
- data/src/core/lib/iomgr/is_epollexclusive_available.c +10 -25
- data/src/core/lib/iomgr/is_epollexclusive_available.h +10 -25
- data/src/core/lib/iomgr/load_file.c +10 -25
- data/src/core/lib/iomgr/load_file.h +10 -25
- data/src/core/lib/iomgr/lockfree_event.c +22 -35
- data/src/core/lib/iomgr/lockfree_event.h +13 -27
- data/src/core/lib/iomgr/nameser.h +104 -0
- data/src/core/lib/iomgr/network_status_tracker.c +10 -25
- data/src/core/lib/iomgr/network_status_tracker.h +10 -25
- data/src/core/lib/iomgr/polling_entity.c +10 -25
- data/src/core/lib/iomgr/polling_entity.h +14 -34
- data/src/core/lib/iomgr/pollset.h +14 -25
- data/src/core/lib/iomgr/pollset_set.h +10 -25
- data/src/core/lib/iomgr/pollset_set_uv.c +10 -25
- data/src/core/lib/iomgr/pollset_set_windows.c +10 -25
- data/src/core/lib/iomgr/pollset_set_windows.h +10 -25
- data/src/core/lib/iomgr/pollset_uv.c +25 -26
- data/src/core/lib/iomgr/pollset_uv.h +10 -25
- data/src/core/lib/iomgr/pollset_windows.c +17 -27
- data/src/core/lib/iomgr/pollset_windows.h +10 -25
- data/src/core/lib/iomgr/port.h +24 -25
- data/src/core/lib/iomgr/resolve_address.h +10 -25
- data/src/core/lib/iomgr/resolve_address_posix.c +13 -28
- data/src/core/lib/iomgr/resolve_address_uv.c +31 -35
- data/src/core/lib/iomgr/resolve_address_windows.c +13 -28
- data/src/core/lib/iomgr/resource_quota.c +52 -67
- data/src/core/lib/iomgr/resource_quota.h +10 -25
- data/src/core/lib/iomgr/sockaddr.h +10 -25
- data/src/core/lib/iomgr/sockaddr_posix.h +10 -25
- data/src/core/lib/iomgr/sockaddr_utils.c +15 -25
- data/src/core/lib/iomgr/sockaddr_utils.h +12 -25
- data/src/core/lib/iomgr/sockaddr_windows.h +10 -25
- data/src/core/lib/iomgr/socket_factory_posix.c +13 -31
- data/src/core/lib/iomgr/socket_factory_posix.h +10 -25
- data/src/core/lib/iomgr/socket_mutator.c +14 -31
- data/src/core/lib/iomgr/socket_mutator.h +10 -25
- data/src/core/lib/iomgr/socket_utils.h +10 -25
- data/src/core/lib/iomgr/socket_utils_common_posix.c +10 -25
- data/src/core/lib/iomgr/socket_utils_linux.c +10 -25
- data/src/core/lib/iomgr/socket_utils_posix.c +10 -25
- data/src/core/lib/iomgr/socket_utils_posix.h +10 -25
- data/src/core/lib/iomgr/socket_utils_uv.c +10 -25
- data/src/core/lib/iomgr/socket_utils_windows.c +10 -25
- data/src/core/lib/iomgr/socket_windows.c +12 -27
- data/src/core/lib/iomgr/socket_windows.h +10 -25
- data/src/core/lib/iomgr/sys_epoll_wrapper.h +10 -25
- data/src/core/lib/iomgr/tcp_client.h +10 -25
- data/src/core/lib/iomgr/tcp_client_posix.c +21 -34
- data/src/core/lib/iomgr/tcp_client_posix.h +10 -25
- data/src/core/lib/iomgr/tcp_client_uv.c +18 -27
- data/src/core/lib/iomgr/tcp_client_windows.c +14 -29
- data/src/core/lib/iomgr/tcp_posix.c +36 -55
- data/src/core/lib/iomgr/tcp_posix.h +10 -25
- data/src/core/lib/iomgr/tcp_server.h +10 -25
- data/src/core/lib/iomgr/tcp_server_posix.c +16 -31
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +10 -25
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.c +11 -26
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.c +10 -25
- data/src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.c +10 -25
- data/src/core/lib/iomgr/tcp_server_uv.c +103 -64
- data/src/core/lib/iomgr/tcp_server_windows.c +14 -29
- data/src/core/lib/iomgr/tcp_uv.c +41 -45
- data/src/core/lib/iomgr/tcp_uv.h +10 -25
- data/src/core/lib/iomgr/tcp_windows.c +39 -53
- data/src/core/lib/iomgr/tcp_windows.h +10 -25
- data/src/core/lib/iomgr/time_averaged_stats.c +10 -25
- data/src/core/lib/iomgr/time_averaged_stats.h +10 -25
- data/src/core/lib/iomgr/timer.h +18 -27
- data/src/core/lib/iomgr/timer_generic.c +91 -87
- data/src/core/lib/iomgr/timer_generic.h +10 -25
- data/src/core/lib/iomgr/timer_heap.c +10 -25
- data/src/core/lib/iomgr/timer_heap.h +10 -25
- data/src/core/lib/iomgr/timer_manager.c +178 -100
- data/src/core/lib/iomgr/timer_manager.h +10 -25
- data/src/core/lib/iomgr/timer_uv.c +23 -33
- data/src/core/lib/iomgr/timer_uv.h +10 -25
- data/src/core/lib/iomgr/udp_server.c +17 -32
- data/src/core/lib/iomgr/udp_server.h +10 -25
- data/src/core/lib/iomgr/unix_sockets_posix.c +10 -25
- data/src/core/lib/iomgr/unix_sockets_posix.h +10 -25
- data/src/core/lib/iomgr/unix_sockets_posix_noop.c +10 -25
- data/src/core/lib/iomgr/wakeup_fd_cv.c +10 -25
- data/src/core/lib/iomgr/wakeup_fd_cv.h +13 -28
- data/src/core/lib/iomgr/wakeup_fd_eventfd.c +10 -25
- data/src/core/lib/iomgr/wakeup_fd_nospecial.c +10 -25
- data/src/core/lib/iomgr/wakeup_fd_pipe.c +10 -25
- data/src/core/lib/iomgr/wakeup_fd_pipe.h +10 -25
- data/src/core/lib/iomgr/wakeup_fd_posix.c +10 -25
- data/src/core/lib/iomgr/wakeup_fd_posix.h +10 -25
- data/src/core/lib/json/json.c +10 -25
- data/src/core/lib/json/json.h +10 -25
- data/src/core/lib/json/json_common.h +10 -25
- data/src/core/lib/json/json_reader.c +11 -25
- data/src/core/lib/json/json_reader.h +10 -25
- data/src/core/lib/json/json_string.c +10 -25
- data/src/core/lib/json/json_writer.c +10 -25
- data/src/core/lib/json/json_writer.h +10 -25
- data/src/core/lib/profiling/basic_timers.c +10 -25
- data/src/core/lib/profiling/stap_timers.c +10 -25
- data/src/core/lib/profiling/timers.h +10 -25
- data/src/core/lib/security/context/security_context.c +32 -40
- data/src/core/lib/security/context/security_context.h +15 -26
- data/src/core/lib/security/credentials/composite/composite_credentials.c +76 -81
- data/src/core/lib/security/credentials/composite/composite_credentials.h +10 -25
- data/src/core/lib/security/credentials/credentials.c +29 -49
- data/src/core/lib/security/credentials/credentials.h +48 -61
- data/src/core/lib/security/credentials/credentials_metadata.c +34 -78
- data/src/core/lib/security/credentials/fake/fake_credentials.c +33 -56
- data/src/core/lib/security/credentials/fake/fake_credentials.h +12 -27
- data/src/core/lib/security/credentials/google_default/credentials_generic.c +10 -25
- data/src/core/lib/security/credentials/google_default/google_default_credentials.c +12 -27
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +10 -25
- data/src/core/lib/security/credentials/iam/iam_credentials.c +40 -40
- data/src/core/lib/security/credentials/iam/iam_credentials.h +11 -26
- data/src/core/lib/security/credentials/jwt/json_token.c +10 -25
- data/src/core/lib/security/credentials/jwt/json_token.h +10 -25
- data/src/core/lib/security/credentials/jwt/jwt_credentials.c +45 -48
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +11 -26
- data/src/core/lib/security/credentials/jwt/jwt_verifier.c +53 -33
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +10 -25
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +155 -87
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +24 -28
- data/src/core/lib/security/credentials/plugin/plugin_credentials.c +118 -82
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +24 -27
- data/src/core/lib/security/credentials/ssl/ssl_credentials.c +13 -32
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +10 -25
- data/src/core/lib/security/transport/auth_filters.h +10 -25
- data/src/core/lib/security/transport/client_auth_filter.c +217 -112
- data/src/core/lib/security/transport/lb_targets_info.c +16 -32
- data/src/core/lib/security/transport/lb_targets_info.h +10 -25
- data/src/core/lib/security/transport/secure_endpoint.c +29 -43
- data/src/core/lib/security/transport/secure_endpoint.h +10 -25
- data/src/core/lib/security/transport/security_connector.c +80 -61
- data/src/core/lib/security/transport/security_connector.h +35 -35
- data/src/core/lib/security/transport/security_handshaker.c +18 -33
- data/src/core/lib/security/transport/security_handshaker.h +10 -25
- data/src/core/lib/security/transport/server_auth_filter.c +62 -116
- data/src/core/lib/security/transport/tsi_error.c +10 -25
- data/src/core/lib/security/transport/tsi_error.h +10 -25
- data/src/core/lib/security/util/json_util.c +10 -25
- data/src/core/lib/security/util/json_util.h +10 -25
- data/src/core/lib/slice/b64.c +10 -25
- data/src/core/lib/slice/b64.h +10 -25
- data/src/core/lib/slice/percent_encoding.c +10 -25
- data/src/core/lib/slice/percent_encoding.h +10 -25
- data/src/core/lib/slice/slice.c +10 -25
- data/src/core/lib/slice/slice_buffer.c +10 -25
- data/src/core/lib/slice/slice_hash_table.c +48 -26
- data/src/core/lib/slice/slice_hash_table.h +26 -28
- data/src/core/lib/slice/slice_intern.c +10 -25
- data/src/core/lib/slice/slice_internal.h +10 -25
- data/src/core/lib/slice/slice_string_helpers.c +10 -25
- data/src/core/lib/slice/slice_string_helpers.h +10 -25
- data/src/core/lib/support/alloc.c +10 -25
- data/src/core/lib/support/arena.c +12 -27
- data/src/core/lib/support/arena.h +10 -25
- data/src/core/lib/support/atm.c +17 -32
- data/src/core/lib/support/atomic.h +10 -25
- data/src/core/lib/support/atomic_with_atm.h +10 -25
- data/src/core/lib/support/atomic_with_std.h +10 -25
- data/src/core/lib/support/avl.c +101 -101
- data/src/core/lib/support/backoff.c +10 -25
- data/src/core/lib/support/backoff.h +10 -25
- data/src/core/lib/support/block_annotate.h +10 -25
- data/src/core/lib/support/cmdline.c +10 -25
- data/src/core/lib/support/cpu_iphone.c +10 -25
- data/src/core/lib/support/cpu_linux.c +10 -25
- data/src/core/lib/support/cpu_posix.c +10 -25
- data/src/core/lib/support/cpu_windows.c +10 -25
- data/src/core/lib/support/env.h +16 -25
- data/src/core/lib/support/env_linux.c +30 -37
- data/src/core/lib/support/env_posix.c +15 -25
- data/src/core/lib/support/env_windows.c +15 -25
- data/src/core/lib/support/histogram.c +10 -25
- data/src/core/lib/support/host_port.c +10 -25
- data/src/core/lib/support/log.c +20 -29
- data/src/core/lib/support/log_android.c +10 -25
- data/src/core/lib/support/log_linux.c +13 -26
- data/src/core/lib/support/log_posix.c +10 -25
- data/src/core/lib/support/log_windows.c +10 -25
- data/src/core/lib/support/memory.h +10 -25
- data/src/core/lib/support/mpscq.c +11 -49
- data/src/core/lib/support/mpscq.h +11 -50
- data/src/core/lib/support/murmur_hash.c +12 -25
- data/src/core/lib/support/murmur_hash.h +10 -25
- data/src/core/lib/support/spinlock.h +10 -25
- data/src/core/lib/support/stack_lockfree.c +10 -25
- data/src/core/lib/support/stack_lockfree.h +10 -25
- data/src/core/lib/support/string.c +10 -25
- data/src/core/lib/support/string.h +10 -25
- data/src/core/lib/support/string_posix.c +10 -25
- data/src/core/lib/support/string_util_windows.c +10 -25
- data/src/core/lib/support/string_windows.c +10 -25
- data/src/core/lib/support/string_windows.h +10 -25
- data/src/core/lib/support/subprocess_posix.c +10 -25
- data/src/core/lib/support/subprocess_windows.c +10 -25
- data/src/core/lib/support/sync.c +10 -25
- data/src/core/lib/support/sync_posix.c +10 -25
- data/src/core/lib/support/sync_windows.c +10 -25
- data/src/core/lib/support/thd.c +10 -25
- data/src/core/lib/support/thd_internal.h +10 -25
- data/src/core/lib/support/thd_posix.c +10 -25
- data/src/core/lib/support/thd_windows.c +10 -25
- data/src/core/lib/support/time.c +10 -25
- data/src/core/lib/support/time_posix.c +10 -25
- data/src/core/lib/support/time_precise.c +18 -33
- data/src/core/lib/support/time_precise.h +10 -25
- data/src/core/lib/support/time_windows.c +10 -25
- data/src/core/lib/support/tls_pthread.c +10 -25
- data/src/core/lib/support/tmpfile.h +10 -25
- data/src/core/lib/support/tmpfile_msys.c +10 -25
- data/src/core/lib/support/tmpfile_posix.c +10 -25
- data/src/core/lib/support/tmpfile_windows.c +10 -25
- data/src/core/lib/support/wrap_memcpy.c +10 -25
- data/src/core/lib/surface/alarm.c +78 -35
- data/src/core/lib/surface/alarm_internal.h +40 -0
- data/src/core/lib/surface/api_trace.c +11 -26
- data/src/core/lib/surface/api_trace.h +10 -25
- data/src/core/lib/surface/byte_buffer.c +10 -25
- data/src/core/lib/surface/byte_buffer_reader.c +10 -25
- data/src/core/lib/surface/call.c +64 -84
- data/src/core/lib/surface/call.h +11 -26
- data/src/core/lib/surface/call_details.c +10 -25
- data/src/core/lib/surface/call_log_batch.c +10 -25
- data/src/core/lib/surface/call_test_only.h +10 -25
- data/src/core/lib/surface/channel.c +11 -26
- data/src/core/lib/surface/channel.h +11 -26
- data/src/core/lib/surface/channel_init.c +10 -25
- data/src/core/lib/surface/channel_init.h +10 -25
- data/src/core/lib/surface/channel_ping.c +12 -27
- data/src/core/lib/surface/channel_stack_type.c +10 -25
- data/src/core/lib/surface/channel_stack_type.h +10 -25
- data/src/core/lib/surface/completion_queue.c +442 -331
- data/src/core/lib/surface/completion_queue.h +16 -33
- data/src/core/lib/surface/completion_queue_factory.c +10 -25
- data/src/core/lib/surface/completion_queue_factory.h +10 -25
- data/src/core/lib/surface/event_string.c +10 -25
- data/src/core/lib/surface/event_string.h +10 -25
- data/src/core/lib/surface/init.c +38 -47
- data/src/core/lib/surface/init.h +10 -25
- data/src/core/lib/surface/init_secure.c +20 -27
- data/src/core/lib/surface/lame_client.cc +14 -29
- data/src/core/lib/surface/lame_client.h +10 -25
- data/src/core/lib/surface/metadata_array.c +10 -25
- data/src/core/lib/surface/server.c +128 -81
- data/src/core/lib/surface/server.h +10 -25
- data/src/core/lib/surface/validate_metadata.c +10 -25
- data/src/core/lib/surface/validate_metadata.h +10 -25
- data/src/core/lib/surface/version.c +11 -26
- data/src/core/lib/transport/bdp_estimator.c +19 -29
- data/src/core/lib/transport/bdp_estimator.h +16 -29
- data/src/core/lib/transport/byte_stream.c +127 -36
- data/src/core/lib/transport/byte_stream.h +88 -46
- data/src/core/lib/transport/connectivity_state.c +17 -31
- data/src/core/lib/transport/connectivity_state.h +10 -25
- data/src/core/lib/transport/error_utils.c +10 -25
- data/src/core/lib/transport/error_utils.h +10 -25
- data/src/core/lib/transport/http2_errors.h +10 -25
- data/src/core/lib/transport/metadata.c +87 -85
- data/src/core/lib/transport/metadata.h +15 -28
- data/src/core/lib/transport/metadata_batch.c +10 -25
- data/src/core/lib/transport/metadata_batch.h +10 -25
- data/src/core/lib/transport/pid_controller.c +10 -25
- data/src/core/lib/transport/pid_controller.h +10 -25
- data/src/core/lib/transport/service_config.c +11 -26
- data/src/core/lib/transport/service_config.h +10 -25
- data/src/core/lib/transport/static_metadata.c +12 -26
- data/src/core/lib/transport/static_metadata.h +10 -25
- data/src/core/lib/transport/status_conversion.c +10 -25
- data/src/core/lib/transport/status_conversion.h +10 -25
- data/src/core/lib/transport/timeout_encoding.c +10 -25
- data/src/core/lib/transport/timeout_encoding.h +10 -25
- data/src/core/lib/transport/transport.c +60 -53
- data/src/core/lib/transport/transport.h +36 -34
- data/src/core/lib/transport/transport_impl.h +10 -25
- data/src/core/lib/transport/transport_op_string.c +10 -28
- data/src/core/plugin_registry/grpc_plugin_registry.c +22 -25
- data/src/core/tsi/fake_transport_security.c +199 -94
- data/src/core/tsi/fake_transport_security.h +11 -26
- data/src/core/tsi/gts_transport_security.c +40 -0
- data/src/core/tsi/gts_transport_security.h +37 -0
- data/src/core/tsi/ssl_transport_security.c +13 -32
- data/src/core/tsi/ssl_transport_security.h +10 -25
- data/src/core/tsi/ssl_types.h +10 -25
- data/src/core/tsi/transport_security.c +48 -78
- data/src/core/tsi/transport_security.h +18 -27
- data/src/core/tsi/transport_security_adapter.c +17 -29
- data/src/core/tsi/transport_security_adapter.h +10 -25
- data/src/core/tsi/transport_security_grpc.c +64 -0
- data/src/core/tsi/transport_security_grpc.h +80 -0
- data/src/core/tsi/transport_security_interface.h +21 -27
- data/src/ruby/bin/apis/google/protobuf/empty.rb +10 -25
- data/src/ruby/bin/apis/pubsub_demo.rb +10 -25
- data/src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb +10 -25
- data/src/ruby/bin/apis/tech/pubsub/proto/pubsub_services.rb +10 -25
- data/src/ruby/bin/math_client.rb +10 -25
- data/src/ruby/bin/math_server.rb +10 -25
- data/src/ruby/bin/math_services_pb.rb +10 -25
- data/src/ruby/bin/noproto_client.rb +10 -25
- data/src/ruby/bin/noproto_server.rb +10 -25
- data/src/ruby/ext/grpc/extconf.rb +10 -25
- data/src/ruby/ext/grpc/rb_byte_buffer.c +10 -25
- data/src/ruby/ext/grpc/rb_byte_buffer.h +10 -25
- data/src/ruby/ext/grpc/rb_call.c +44 -25
- data/src/ruby/ext/grpc/rb_call.h +10 -25
- data/src/ruby/ext/grpc/rb_call_credentials.c +10 -25
- data/src/ruby/ext/grpc/rb_call_credentials.h +10 -25
- data/src/ruby/ext/grpc/rb_channel.c +10 -25
- data/src/ruby/ext/grpc/rb_channel.h +10 -25
- data/src/ruby/ext/grpc/rb_channel_args.c +10 -25
- data/src/ruby/ext/grpc/rb_channel_args.h +10 -25
- data/src/ruby/ext/grpc/rb_channel_credentials.c +10 -25
- data/src/ruby/ext/grpc/rb_channel_credentials.h +10 -25
- data/src/ruby/ext/grpc/rb_completion_queue.c +10 -25
- data/src/ruby/ext/grpc/rb_completion_queue.h +10 -25
- data/src/ruby/ext/grpc/rb_compression_options.c +10 -25
- data/src/ruby/ext/grpc/rb_compression_options.h +10 -25
- data/src/ruby/ext/grpc/rb_event_thread.c +10 -25
- data/src/ruby/ext/grpc/rb_event_thread.h +10 -25
- data/src/ruby/ext/grpc/rb_grpc.c +10 -25
- data/src/ruby/ext/grpc/rb_grpc.h +10 -25
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +10 -25
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +16 -31
- data/src/ruby/ext/grpc/rb_loader.c +10 -25
- data/src/ruby/ext/grpc/rb_loader.h +10 -25
- data/src/ruby/ext/grpc/rb_server.c +10 -25
- data/src/ruby/ext/grpc/rb_server.h +10 -25
- data/src/ruby/ext/grpc/rb_server_credentials.c +10 -25
- data/src/ruby/ext/grpc/rb_server_credentials.h +10 -25
- data/src/ruby/lib/grpc.rb +10 -25
- data/src/ruby/lib/grpc/core/time_consts.rb +10 -25
- data/src/ruby/lib/grpc/errors.rb +16 -30
- data/src/ruby/lib/grpc/generic/active_call.rb +25 -27
- data/src/ruby/lib/grpc/generic/bidi_call.rb +17 -27
- data/src/ruby/lib/grpc/generic/client_stub.rb +10 -25
- data/src/ruby/lib/grpc/generic/rpc_desc.rb +10 -25
- data/src/ruby/lib/grpc/generic/rpc_server.rb +10 -25
- data/src/ruby/lib/grpc/generic/service.rb +10 -25
- data/src/ruby/lib/grpc/grpc.rb +10 -25
- data/src/ruby/lib/grpc/logconfig.rb +10 -25
- data/src/ruby/lib/grpc/notifier.rb +10 -25
- data/src/ruby/lib/grpc/version.rb +11 -26
- data/src/ruby/pb/generate_proto_ruby.sh +10 -25
- data/src/ruby/pb/grpc/health/checker.rb +10 -25
- data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +10 -25
- data/src/ruby/pb/grpc/testing/duplicate/echo_duplicate_services_pb.rb +10 -25
- data/src/ruby/pb/grpc/testing/metrics_services_pb.rb +10 -25
- data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +10 -25
- data/src/ruby/pb/test/client.rb +10 -25
- data/src/ruby/pb/test/server.rb +10 -25
- data/src/ruby/spec/call_credentials_spec.rb +10 -25
- data/src/ruby/spec/call_spec.rb +43 -25
- data/src/ruby/spec/channel_connection_spec.rb +10 -25
- data/src/ruby/spec/channel_credentials_spec.rb +11 -26
- data/src/ruby/spec/channel_spec.rb +10 -25
- data/src/ruby/spec/client_auth_spec.rb +10 -25
- data/src/ruby/spec/client_server_spec.rb +66 -25
- data/src/ruby/spec/compression_options_spec.rb +10 -25
- data/src/ruby/spec/error_sanity_spec.rb +10 -25
- data/src/ruby/spec/generic/active_call_spec.rb +10 -25
- data/src/ruby/spec/generic/client_stub_spec.rb +146 -35
- data/src/ruby/spec/generic/rpc_desc_spec.rb +10 -25
- data/src/ruby/spec/generic/rpc_server_pool_spec.rb +10 -25
- data/src/ruby/spec/generic/rpc_server_spec.rb +124 -34
- data/src/ruby/spec/generic/service_spec.rb +10 -25
- data/src/ruby/spec/pb/duplicate/codegen_spec.rb +10 -25
- data/src/ruby/spec/pb/health/checker_spec.rb +10 -25
- data/src/ruby/spec/server_credentials_spec.rb +10 -25
- data/src/ruby/spec/server_spec.rb +10 -25
- data/src/ruby/spec/spec_helper.rb +10 -25
- data/src/ruby/spec/time_consts_spec.rb +10 -25
- data/third_party/boringssl/crypto/aes/key_wrap.c +138 -0
- data/third_party/boringssl/crypto/asn1/a_bitstr.c +6 -3
- data/third_party/boringssl/crypto/asn1/a_enum.c +4 -1
- data/third_party/boringssl/crypto/asn1/a_gentm.c +20 -15
- data/third_party/boringssl/crypto/asn1/a_int.c +7 -4
- data/third_party/boringssl/crypto/asn1/a_object.c +5 -2
- data/third_party/boringssl/crypto/asn1/a_time.c +0 -1
- data/third_party/boringssl/crypto/asn1/a_utctm.c +1 -2
- data/third_party/boringssl/crypto/asn1/asn1_lib.c +5 -2
- data/third_party/boringssl/crypto/asn1/asn1_locl.h +35 -0
- data/third_party/boringssl/crypto/asn1/tasn_dec.c +3 -1
- data/third_party/boringssl/crypto/asn1/tasn_enc.c +6 -3
- data/third_party/boringssl/crypto/asn1/tasn_new.c +12 -7
- data/third_party/boringssl/crypto/asn1/tasn_utl.c +22 -8
- data/third_party/boringssl/crypto/{time_support.c → asn1/time_support.c} +1 -1
- data/third_party/boringssl/crypto/asn1/x_long.c +5 -2
- data/third_party/boringssl/crypto/base64/base64.c +7 -5
- data/third_party/boringssl/crypto/bio/bio.c +24 -10
- data/third_party/boringssl/crypto/bio/bio_mem.c +12 -10
- data/third_party/boringssl/crypto/bio/connect.c +7 -18
- data/third_party/boringssl/crypto/bio/fd.c +3 -6
- data/third_party/boringssl/crypto/bio/file.c +6 -6
- data/third_party/boringssl/crypto/bio/hexdump.c +4 -2
- data/third_party/boringssl/crypto/bio/pair.c +30 -344
- data/third_party/boringssl/crypto/bio/socket.c +6 -7
- data/third_party/boringssl/crypto/bio/socket_helper.c +4 -3
- data/third_party/boringssl/crypto/bn/add.c +1 -1
- data/third_party/boringssl/crypto/bn/asm/x86_64-gcc.c +11 -10
- data/third_party/boringssl/crypto/bn/bn.c +6 -20
- data/third_party/boringssl/crypto/bn/cmp.c +14 -0
- data/third_party/boringssl/crypto/bn/convert.c +73 -2
- data/third_party/boringssl/crypto/bn/ctx.c +3 -1
- data/third_party/boringssl/crypto/bn/div.c +108 -51
- data/third_party/boringssl/crypto/bn/exponentiation.c +15 -33
- data/third_party/boringssl/crypto/bn/gcd.c +29 -22
- data/third_party/boringssl/crypto/bn/generic.c +71 -67
- data/third_party/boringssl/crypto/bn/internal.h +19 -6
- data/third_party/boringssl/crypto/bn/kronecker.c +1 -0
- data/third_party/boringssl/crypto/bn/montgomery.c +9 -10
- data/third_party/boringssl/crypto/bn/montgomery_inv.c +47 -0
- data/third_party/boringssl/crypto/bn/mul.c +11 -9
- data/third_party/boringssl/crypto/bn/random.c +6 -3
- data/third_party/boringssl/crypto/bn/rsaz_exp.c +0 -65
- data/third_party/boringssl/crypto/bn/rsaz_exp.h +0 -3
- data/third_party/boringssl/crypto/bn/shift.c +9 -1
- data/third_party/boringssl/crypto/bn/sqrt.c +3 -1
- data/third_party/boringssl/crypto/buf/buf.c +6 -4
- data/third_party/boringssl/crypto/bytestring/asn1_compat.c +2 -1
- data/third_party/boringssl/crypto/bytestring/ber.c +2 -1
- data/third_party/boringssl/crypto/bytestring/cbb.c +9 -7
- data/third_party/boringssl/crypto/bytestring/cbs.c +54 -2
- data/third_party/boringssl/crypto/chacha/chacha.c +1 -1
- data/third_party/boringssl/crypto/cipher/aead.c +3 -3
- data/third_party/boringssl/crypto/cipher/cipher.c +18 -13
- data/third_party/boringssl/crypto/cipher/e_aes.c +335 -281
- data/third_party/boringssl/crypto/cipher/e_chacha20poly1305.c +113 -137
- data/third_party/boringssl/crypto/cipher/e_null.c +2 -1
- data/third_party/boringssl/crypto/cipher/e_rc2.c +54 -49
- data/third_party/boringssl/crypto/cipher/e_ssl3.c +4 -3
- data/third_party/boringssl/crypto/cipher/e_tls.c +5 -5
- data/third_party/boringssl/crypto/cipher/tls_cbc.c +41 -112
- data/third_party/boringssl/crypto/cmac/cmac.c +6 -4
- data/third_party/boringssl/crypto/conf/conf.c +6 -3
- data/third_party/boringssl/crypto/cpu-arm-linux.c +2 -2
- data/third_party/boringssl/crypto/curve25519/curve25519.c +28 -34
- data/third_party/boringssl/crypto/curve25519/spake25519.c +7 -6
- data/third_party/boringssl/crypto/curve25519/x25519-x86_64.c +2 -1
- data/third_party/boringssl/crypto/des/des.c +1 -1
- data/third_party/boringssl/crypto/des/internal.h +58 -46
- data/third_party/boringssl/crypto/dh/dh.c +4 -8
- data/third_party/boringssl/crypto/digest/digest.c +5 -2
- data/third_party/boringssl/crypto/digest/digests.c +70 -33
- data/third_party/boringssl/crypto/digest/md32_common.h +39 -27
- data/third_party/boringssl/crypto/dsa/dsa.c +11 -19
- data/third_party/boringssl/crypto/ec/ec.c +1 -1
- data/third_party/boringssl/crypto/ec/ec_asn1.c +3 -2
- data/third_party/boringssl/crypto/ec/ec_key.c +1 -1
- data/third_party/boringssl/crypto/ec/ec_montgomery.c +6 -11
- data/third_party/boringssl/crypto/ec/oct.c +2 -14
- data/third_party/boringssl/crypto/ec/p224-64.c +78 -122
- data/third_party/boringssl/crypto/ec/p256-64.c +93 -133
- data/third_party/boringssl/crypto/ec/p256-x86_64.c +48 -61
- data/third_party/boringssl/crypto/ec/p256-x86_64.h +113 -0
- data/third_party/boringssl/crypto/ec/simple.c +2 -1
- data/third_party/boringssl/crypto/ec/wnaf.c +52 -43
- data/third_party/boringssl/crypto/ecdh/ecdh.c +4 -2
- data/third_party/boringssl/crypto/ecdsa/ecdsa.c +17 -16
- data/third_party/boringssl/crypto/engine/engine.c +3 -1
- data/third_party/boringssl/crypto/err/err.c +5 -5
- data/third_party/boringssl/crypto/evp/evp.c +1 -1
- data/third_party/boringssl/crypto/evp/evp_asn1.c +1 -1
- data/third_party/boringssl/crypto/evp/evp_ctx.c +23 -29
- data/third_party/boringssl/crypto/evp/p_ec.c +2 -1
- data/third_party/boringssl/crypto/evp/p_rsa.c +9 -3
- data/third_party/boringssl/crypto/evp/pbkdf.c +3 -1
- data/third_party/boringssl/crypto/hkdf/hkdf.c +3 -1
- data/third_party/boringssl/crypto/hmac/hmac.c +4 -2
- data/third_party/boringssl/crypto/internal.h +81 -0
- data/third_party/boringssl/crypto/lhash/lhash.c +7 -13
- data/third_party/boringssl/crypto/md4/md4.c +20 -18
- data/third_party/boringssl/crypto/md5/md5.c +31 -21
- data/third_party/boringssl/crypto/mem.c +4 -10
- data/third_party/boringssl/crypto/modes/cbc.c +2 -6
- data/third_party/boringssl/crypto/modes/cfb.c +2 -2
- data/third_party/boringssl/crypto/modes/ctr.c +1 -1
- data/third_party/boringssl/crypto/modes/gcm.c +117 -334
- data/third_party/boringssl/crypto/modes/internal.h +107 -84
- data/third_party/boringssl/crypto/modes/ofb.c +3 -3
- data/third_party/boringssl/crypto/modes/polyval.c +94 -0
- data/third_party/boringssl/crypto/obj/obj.c +13 -8
- data/third_party/boringssl/crypto/obj/obj_dat.h +6109 -5187
- data/third_party/boringssl/crypto/obj/obj_xref.c +55 -57
- data/third_party/boringssl/crypto/pem/pem_lib.c +6 -3
- data/third_party/boringssl/crypto/pkcs8/internal.h +27 -8
- data/third_party/boringssl/crypto/pkcs8/p5_pbev2.c +137 -352
- data/third_party/boringssl/crypto/pkcs8/pkcs8.c +371 -364
- data/third_party/boringssl/crypto/poly1305/poly1305.c +12 -18
- data/third_party/boringssl/crypto/poly1305/poly1305_arm.c +2 -2
- data/third_party/boringssl/crypto/{newhope/reduce.c → pool/internal.h} +24 -21
- data/third_party/boringssl/crypto/pool/pool.c +200 -0
- data/third_party/boringssl/crypto/rand/deterministic.c +6 -5
- data/third_party/boringssl/crypto/rand/fuchsia.c +43 -0
- data/third_party/boringssl/crypto/rand/rand.c +7 -7
- data/third_party/boringssl/crypto/rand/urandom.c +136 -22
- data/third_party/boringssl/crypto/rand/windows.c +2 -2
- data/third_party/boringssl/crypto/rsa/blinding.c +2 -1
- data/third_party/boringssl/crypto/rsa/padding.c +11 -11
- data/third_party/boringssl/crypto/rsa/rsa.c +4 -4
- data/third_party/boringssl/crypto/rsa/rsa_asn1.c +7 -1
- data/third_party/boringssl/crypto/rsa/rsa_impl.c +41 -80
- data/third_party/boringssl/crypto/sha/sha1-altivec.c +346 -0
- data/third_party/boringssl/crypto/sha/sha1.c +60 -42
- data/third_party/boringssl/crypto/sha/sha256.c +4 -2
- data/third_party/boringssl/crypto/sha/sha512.c +9 -7
- data/third_party/boringssl/crypto/stack/stack.c +10 -7
- data/third_party/boringssl/crypto/thread_pthread.c +2 -2
- data/third_party/boringssl/crypto/thread_win.c +2 -2
- data/third_party/boringssl/crypto/x509/a_verify.c +1 -1
- data/third_party/boringssl/crypto/x509/asn1_gen.c +1 -1
- data/third_party/boringssl/crypto/x509/by_dir.c +1 -1
- data/third_party/boringssl/crypto/x509/t_x509.c +78 -38
- data/third_party/boringssl/crypto/x509/x509_cmp.c +8 -5
- data/third_party/boringssl/crypto/x509/x509_lu.c +6 -1
- data/third_party/boringssl/crypto/x509/x509_obj.c +4 -1
- data/third_party/boringssl/crypto/x509/x509_vfy.c +42 -8
- data/third_party/boringssl/crypto/x509/x509_vpm.c +8 -6
- data/third_party/boringssl/crypto/x509/x509name.c +4 -1
- data/third_party/boringssl/crypto/x509/x_crl.c +4 -2
- data/third_party/boringssl/crypto/x509/x_name.c +23 -13
- data/third_party/boringssl/crypto/x509/x_pkey.c +4 -1
- data/third_party/boringssl/crypto/x509/x_x509.c +42 -3
- data/third_party/boringssl/crypto/x509v3/pcy_int.h +2 -2
- data/third_party/boringssl/crypto/x509v3/pcy_tree.c +2 -1
- data/third_party/boringssl/crypto/x509v3/v3_cpols.c +1 -1
- data/third_party/boringssl/crypto/x509v3/v3_ia5.c +4 -1
- data/third_party/boringssl/crypto/x509v3/v3_ncons.c +4 -1
- data/third_party/boringssl/crypto/x509v3/v3_pci.c +6 -3
- data/third_party/boringssl/crypto/x509v3/v3_purp.c +13 -21
- data/third_party/boringssl/crypto/x509v3/v3_utl.c +19 -33
- data/third_party/boringssl/include/openssl/aead.h +9 -20
- data/third_party/boringssl/include/openssl/aes.h +21 -9
- data/third_party/boringssl/include/openssl/asn1.h +9 -1
- data/third_party/boringssl/include/openssl/base.h +33 -6
- data/third_party/boringssl/include/openssl/bio.h +10 -103
- data/third_party/boringssl/include/openssl/bn.h +58 -42
- data/third_party/boringssl/include/openssl/bytestring.h +17 -0
- data/third_party/boringssl/include/openssl/cipher.h +4 -3
- data/third_party/boringssl/include/openssl/conf.h +4 -1
- data/third_party/boringssl/include/openssl/curve25519.h +13 -0
- data/third_party/boringssl/include/openssl/digest.h +5 -3
- data/third_party/boringssl/include/openssl/dsa.h +5 -5
- data/third_party/boringssl/include/openssl/ec.h +2 -2
- data/third_party/boringssl/include/openssl/ecdh.h +3 -4
- data/third_party/boringssl/include/openssl/ecdsa.h +10 -10
- data/third_party/boringssl/include/openssl/err.h +5 -5
- data/third_party/boringssl/include/openssl/evp.h +11 -7
- data/third_party/boringssl/include/openssl/lhash.h +2 -3
- data/third_party/boringssl/include/openssl/lhash_macros.h +56 -14
- data/third_party/boringssl/include/openssl/nid.h +2949 -2916
- data/third_party/boringssl/include/openssl/obj.h +1 -1
- data/third_party/boringssl/include/openssl/pkcs8.h +21 -42
- data/third_party/boringssl/include/openssl/pool.h +87 -0
- data/third_party/boringssl/include/openssl/rand.h +1 -1
- data/third_party/boringssl/include/openssl/rsa.h +4 -2
- data/third_party/boringssl/include/openssl/sha.h +0 -4
- data/third_party/boringssl/include/openssl/ssl.h +327 -662
- data/third_party/boringssl/include/openssl/ssl3.h +1 -21
- data/third_party/boringssl/include/openssl/stack.h +1 -0
- data/third_party/boringssl/include/openssl/stack_macros.h +85 -0
- data/third_party/boringssl/include/openssl/tls1.h +23 -52
- data/third_party/boringssl/include/openssl/type_check.h +4 -0
- data/third_party/boringssl/include/openssl/x509.h +10 -59
- data/third_party/boringssl/include/openssl/x509_vfy.h +7 -1
- data/third_party/boringssl/include/openssl/x509v3.h +4 -4
- data/third_party/boringssl/ssl/bio_ssl.c +175 -0
- data/third_party/boringssl/ssl/custom_extensions.c +24 -21
- data/third_party/boringssl/ssl/d1_both.c +259 -289
- data/third_party/boringssl/ssl/d1_lib.c +8 -20
- data/third_party/boringssl/ssl/d1_pkt.c +6 -15
- data/third_party/boringssl/ssl/dtls_method.c +22 -8
- data/third_party/boringssl/ssl/dtls_record.c +27 -2
- data/third_party/boringssl/ssl/handshake_client.c +460 -579
- data/third_party/boringssl/ssl/handshake_server.c +662 -644
- data/third_party/boringssl/ssl/internal.h +1009 -375
- data/third_party/boringssl/ssl/s3_both.c +312 -162
- data/third_party/boringssl/ssl/s3_lib.c +12 -128
- data/third_party/boringssl/ssl/s3_pkt.c +22 -30
- data/third_party/boringssl/ssl/ssl_aead_ctx.c +28 -22
- data/third_party/boringssl/ssl/ssl_asn1.c +210 -114
- data/third_party/boringssl/ssl/ssl_buffer.c +2 -1
- data/third_party/boringssl/ssl/ssl_cert.c +417 -219
- data/third_party/boringssl/ssl/ssl_cipher.c +191 -393
- data/third_party/boringssl/ssl/ssl_ecdh.c +19 -164
- data/third_party/boringssl/ssl/ssl_file.c +0 -11
- data/third_party/boringssl/ssl/ssl_lib.c +325 -652
- data/third_party/boringssl/ssl/{ssl_rsa.c → ssl_privkey.c} +21 -131
- data/third_party/boringssl/ssl/ssl_privkey_cc.cc +76 -0
- data/third_party/boringssl/ssl/ssl_session.c +206 -95
- data/third_party/boringssl/ssl/ssl_stat.c +18 -84
- data/third_party/boringssl/ssl/{s3_enc.c → ssl_transcript.c} +150 -157
- data/third_party/boringssl/ssl/ssl_x509.c +815 -0
- data/third_party/boringssl/ssl/t1_enc.c +188 -174
- data/third_party/boringssl/ssl/t1_lib.c +1064 -764
- data/third_party/boringssl/ssl/tls13_both.c +290 -96
- data/third_party/boringssl/ssl/tls13_client.c +344 -314
- data/third_party/boringssl/ssl/tls13_enc.c +239 -200
- data/third_party/boringssl/ssl/tls13_server.c +374 -366
- data/third_party/boringssl/ssl/tls_method.c +40 -5
- data/third_party/boringssl/ssl/tls_record.c +166 -71
- metadata +39 -25
- data/src/core/lib/iomgr/workqueue.h +0 -87
- data/src/core/lib/iomgr/workqueue_uv.c +0 -65
- data/src/core/lib/iomgr/workqueue_uv.h +0 -37
- data/src/core/lib/iomgr/workqueue_windows.c +0 -63
- data/src/core/lib/iomgr/workqueue_windows.h +0 -37
- data/third_party/boringssl/crypto/bio/buffer.c +0 -496
- data/third_party/boringssl/crypto/newhope/error_correction.c +0 -131
- data/third_party/boringssl/crypto/newhope/internal.h +0 -71
- data/third_party/boringssl/crypto/newhope/newhope.c +0 -174
- data/third_party/boringssl/crypto/newhope/ntt.c +0 -148
- data/third_party/boringssl/crypto/newhope/poly.c +0 -183
- data/third_party/boringssl/crypto/newhope/precomp.c +0 -306
- data/third_party/boringssl/crypto/obj/obj_xref.h +0 -96
- data/third_party/boringssl/crypto/pkcs8/p5_pbe.c +0 -151
- data/third_party/boringssl/include/openssl/newhope.h +0 -158
- data/third_party/boringssl/include/openssl/time_support.h +0 -91
@@ -171,13 +171,14 @@ extern "C" {
|
|
171
171
|
#define SSL_kECDHE 0x00000004L
|
172
172
|
/* SSL_kPSK is only set for plain PSK, not ECDHE_PSK. */
|
173
173
|
#define SSL_kPSK 0x00000008L
|
174
|
-
#define
|
174
|
+
#define SSL_kGENERIC 0x00000010L
|
175
175
|
|
176
176
|
/* Bits for |algorithm_auth| (server authentication). */
|
177
177
|
#define SSL_aRSA 0x00000001L
|
178
178
|
#define SSL_aECDSA 0x00000002L
|
179
179
|
/* SSL_aPSK is set for both PSK and ECDHE_PSK. */
|
180
180
|
#define SSL_aPSK 0x00000004L
|
181
|
+
#define SSL_aGENERIC 0x00000008L
|
181
182
|
|
182
183
|
#define SSL_aCERT (SSL_aRSA | SSL_aECDSA)
|
183
184
|
|
@@ -187,19 +188,17 @@ extern "C" {
|
|
187
188
|
#define SSL_AES256 0x00000004L
|
188
189
|
#define SSL_AES128GCM 0x00000008L
|
189
190
|
#define SSL_AES256GCM 0x00000010L
|
190
|
-
#define
|
191
|
-
#define
|
192
|
-
#define SSL_CHACHA20POLY1305 0x00000080L
|
191
|
+
#define SSL_eNULL 0x00000020L
|
192
|
+
#define SSL_CHACHA20POLY1305 0x00000040L
|
193
193
|
|
194
194
|
#define SSL_AES (SSL_AES128 | SSL_AES256 | SSL_AES128GCM | SSL_AES256GCM)
|
195
195
|
|
196
196
|
/* Bits for |algorithm_mac| (symmetric authentication). */
|
197
|
-
#define
|
198
|
-
#define
|
199
|
-
#define
|
200
|
-
#define SSL_SHA384 0x00000008L
|
197
|
+
#define SSL_SHA1 0x00000001L
|
198
|
+
#define SSL_SHA256 0x00000002L
|
199
|
+
#define SSL_SHA384 0x00000004L
|
201
200
|
/* SSL_AEAD is set for all AEADs. */
|
202
|
-
#define SSL_AEAD
|
201
|
+
#define SSL_AEAD 0x00000008L
|
203
202
|
|
204
203
|
/* Bits for |algorithm_prf| (handshake digest). */
|
205
204
|
#define SSL_HANDSHAKE_MAC_DEFAULT 0x1
|
@@ -221,31 +220,24 @@ int ssl_cipher_get_evp_aead(const EVP_AEAD **out_aead,
|
|
221
220
|
const SSL_CIPHER *cipher, uint16_t version);
|
222
221
|
|
223
222
|
/* ssl_get_handshake_digest returns the |EVP_MD| corresponding to
|
224
|
-
* |algorithm_prf
|
225
|
-
*
|
226
|
-
|
227
|
-
const EVP_MD *ssl_get_handshake_digest(uint32_t algorithm_prf);
|
223
|
+
* |algorithm_prf| and the |version|. */
|
224
|
+
const EVP_MD *ssl_get_handshake_digest(uint32_t algorithm_prf,
|
225
|
+
uint16_t version);
|
228
226
|
|
229
227
|
/* ssl_create_cipher_list evaluates |rule_str| according to the ciphers in
|
230
228
|
* |ssl_method|. It sets |*out_cipher_list| to a newly-allocated
|
231
|
-
* |ssl_cipher_preference_list_st| containing the result.
|
232
|
-
*
|
233
|
-
*
|
234
|
-
*
|
229
|
+
* |ssl_cipher_preference_list_st| containing the result. It returns
|
230
|
+
* |(*out_cipher_list)->ciphers| on success and NULL on failure. If |strict| is
|
231
|
+
* true, nonsense will be rejected. If false, nonsense will be silently
|
232
|
+
* ignored. */
|
235
233
|
STACK_OF(SSL_CIPHER) *
|
236
234
|
ssl_create_cipher_list(const SSL_PROTOCOL_METHOD *ssl_method,
|
237
235
|
struct ssl_cipher_preference_list_st **out_cipher_list,
|
238
|
-
|
239
|
-
const char *rule_str);
|
236
|
+
const char *rule_str, int strict);
|
240
237
|
|
241
238
|
/* ssl_cipher_get_value returns the cipher suite id of |cipher|. */
|
242
239
|
uint16_t ssl_cipher_get_value(const SSL_CIPHER *cipher);
|
243
240
|
|
244
|
-
/* ssl_cipher_get_resumption_cipher returns the cipher suite id of the cipher
|
245
|
-
* matching |cipher| with PSK enabled. */
|
246
|
-
int ssl_cipher_get_ecdhe_psk_cipher(const SSL_CIPHER *cipher,
|
247
|
-
uint16_t *out_cipher);
|
248
|
-
|
249
241
|
/* ssl_cipher_get_key_type returns the |EVP_PKEY_*| value corresponding to the
|
250
242
|
* server key used in |cipher| or |EVP_PKEY_NONE| if there is none. */
|
251
243
|
int ssl_cipher_get_key_type(const SSL_CIPHER *cipher);
|
@@ -268,11 +260,92 @@ int ssl_cipher_requires_server_key_exchange(const SSL_CIPHER *cipher);
|
|
268
260
|
size_t ssl_cipher_get_record_split_len(const SSL_CIPHER *cipher);
|
269
261
|
|
270
262
|
|
263
|
+
/* Transcript layer. */
|
264
|
+
|
265
|
+
/* SSL_TRANSCRIPT maintains the handshake transcript as a combination of a
|
266
|
+
* buffer and running hash. */
|
267
|
+
typedef struct ssl_transcript_st {
|
268
|
+
/* buffer, if non-NULL, contains the handshake transcript. */
|
269
|
+
BUF_MEM *buffer;
|
270
|
+
/* hash, if initialized with an |EVP_MD|, maintains the handshake hash. For
|
271
|
+
* TLS 1.1 and below, it is the SHA-1 half. */
|
272
|
+
EVP_MD_CTX hash;
|
273
|
+
/* md5, if initialized with an |EVP_MD|, maintains the MD5 half of the
|
274
|
+
* handshake hash for TLS 1.1 and below. */
|
275
|
+
EVP_MD_CTX md5;
|
276
|
+
} SSL_TRANSCRIPT;
|
277
|
+
|
278
|
+
/* SSL_TRANSCRIPT_init initializes the handshake transcript. If called on an
|
279
|
+
* existing transcript, it resets the transcript and hash. It returns one on
|
280
|
+
* success and zero on failure. */
|
281
|
+
int SSL_TRANSCRIPT_init(SSL_TRANSCRIPT *transcript);
|
282
|
+
|
283
|
+
/* SSL_TRANSCRIPT_init_hash initializes the handshake hash based on the PRF and
|
284
|
+
* contents of the handshake transcript. Subsequent calls to
|
285
|
+
* |SSL_TRANSCRIPT_update| will update the rolling hash. It returns one on
|
286
|
+
* success and zero on failure. It is an error to call this function after the
|
287
|
+
* handshake buffer is released. */
|
288
|
+
int SSL_TRANSCRIPT_init_hash(SSL_TRANSCRIPT *transcript, uint16_t version,
|
289
|
+
int algorithm_prf);
|
290
|
+
|
291
|
+
/* SSL_TRANSCRIPT_cleanup cleans up the hash and transcript. */
|
292
|
+
void SSL_TRANSCRIPT_cleanup(SSL_TRANSCRIPT *transcript);
|
293
|
+
|
294
|
+
/* SSL_TRANSCRIPT_free_buffer releases the handshake buffer. Subsequent calls to
|
295
|
+
* |SSL_TRANSCRIPT_update| will not update the handshake buffer. */
|
296
|
+
void SSL_TRANSCRIPT_free_buffer(SSL_TRANSCRIPT *transcript);
|
297
|
+
|
298
|
+
/* SSL_TRANSCRIPT_digest_len returns the length of the PRF hash. */
|
299
|
+
size_t SSL_TRANSCRIPT_digest_len(const SSL_TRANSCRIPT *transcript);
|
300
|
+
|
301
|
+
/* SSL_TRANSCRIPT_md returns the PRF hash. For TLS 1.1 and below, this is
|
302
|
+
* |EVP_md5_sha1|. */
|
303
|
+
const EVP_MD *SSL_TRANSCRIPT_md(const SSL_TRANSCRIPT *transcript);
|
304
|
+
|
305
|
+
/* SSL_TRANSCRIPT_update adds |in| to the handshake buffer and handshake hash,
|
306
|
+
* whichever is enabled. It returns one on success and zero on failure. */
|
307
|
+
int SSL_TRANSCRIPT_update(SSL_TRANSCRIPT *transcript, const uint8_t *in,
|
308
|
+
size_t in_len);
|
309
|
+
|
310
|
+
/* SSL_TRANSCRIPT_get_hash writes the handshake hash to |out| which must have
|
311
|
+
* room for at least |SSL_TRANSCRIPT_digest_len| bytes. On success, it returns
|
312
|
+
* one and sets |*out_len| to the number of bytes written. Otherwise, it returns
|
313
|
+
* zero. */
|
314
|
+
int SSL_TRANSCRIPT_get_hash(const SSL_TRANSCRIPT *transcript, uint8_t *out,
|
315
|
+
size_t *out_len);
|
316
|
+
|
317
|
+
/* SSL_TRANSCRIPT_ssl3_cert_verify_hash writes the SSL 3.0 CertificateVerify
|
318
|
+
* hash into the bytes pointed to by |out| and writes the number of bytes to
|
319
|
+
* |*out_len|. |out| must have room for |EVP_MAX_MD_SIZE| bytes. It returns one
|
320
|
+
* on success and zero on failure. */
|
321
|
+
int SSL_TRANSCRIPT_ssl3_cert_verify_hash(SSL_TRANSCRIPT *transcript,
|
322
|
+
uint8_t *out, size_t *out_len,
|
323
|
+
const SSL_SESSION *session,
|
324
|
+
int signature_algorithm);
|
325
|
+
|
326
|
+
/* SSL_TRANSCRIPT_finish_mac computes the MAC for the Finished message into the
|
327
|
+
* bytes pointed by |out| and writes the number of bytes to |*out_len|. |out|
|
328
|
+
* must have room for |EVP_MAX_MD_SIZE| bytes. It returns one on success and
|
329
|
+
* zero on failure. */
|
330
|
+
int SSL_TRANSCRIPT_finish_mac(SSL_TRANSCRIPT *transcript, uint8_t *out,
|
331
|
+
size_t *out_len, const SSL_SESSION *session,
|
332
|
+
int from_server, uint16_t version);
|
333
|
+
|
334
|
+
/* tls1_prf computes the PRF function for |ssl|. It writes |out_len| bytes to
|
335
|
+
* |out|, using |secret| as the secret and |label| as the label. |seed1| and
|
336
|
+
* |seed2| are concatenated to form the seed parameter. It returns one on
|
337
|
+
* success and zero on failure. */
|
338
|
+
int tls1_prf(const EVP_MD *digest, uint8_t *out, size_t out_len,
|
339
|
+
const uint8_t *secret, size_t secret_len, const char *label,
|
340
|
+
size_t label_len, const uint8_t *seed1, size_t seed1_len,
|
341
|
+
const uint8_t *seed2, size_t seed2_len);
|
342
|
+
|
343
|
+
|
271
344
|
/* Encryption layer. */
|
272
345
|
|
273
346
|
/* SSL_AEAD_CTX contains information about an AEAD that is being used to encrypt
|
274
347
|
* an SSL connection. */
|
275
|
-
struct ssl_aead_ctx_st {
|
348
|
+
typedef struct ssl_aead_ctx_st {
|
276
349
|
const SSL_CIPHER *cipher;
|
277
350
|
EVP_AEAD_CTX ctx;
|
278
351
|
/* fixed_nonce contains any bytes of the nonce that are fixed for all
|
@@ -281,23 +354,23 @@ struct ssl_aead_ctx_st {
|
|
281
354
|
uint8_t fixed_nonce_len, variable_nonce_len;
|
282
355
|
/* variable_nonce_included_in_record is non-zero if the variable nonce
|
283
356
|
* for a record is included as a prefix before the ciphertext. */
|
284
|
-
|
357
|
+
unsigned variable_nonce_included_in_record : 1;
|
285
358
|
/* random_variable_nonce is non-zero if the variable nonce is
|
286
359
|
* randomly generated, rather than derived from the sequence
|
287
360
|
* number. */
|
288
|
-
|
361
|
+
unsigned random_variable_nonce : 1;
|
289
362
|
/* omit_length_in_ad is non-zero if the length should be omitted in the
|
290
363
|
* AEAD's ad parameter. */
|
291
|
-
|
364
|
+
unsigned omit_length_in_ad : 1;
|
292
365
|
/* omit_version_in_ad is non-zero if the version should be omitted
|
293
366
|
* in the AEAD's ad parameter. */
|
294
|
-
|
367
|
+
unsigned omit_version_in_ad : 1;
|
295
368
|
/* omit_ad is non-zero if the AEAD's ad parameter should be omitted. */
|
296
|
-
|
369
|
+
unsigned omit_ad : 1;
|
297
370
|
/* xor_fixed_nonce is non-zero if the fixed nonce should be XOR'd into the
|
298
371
|
* variable nonce rather than prepended. */
|
299
|
-
|
300
|
-
}
|
372
|
+
unsigned xor_fixed_nonce : 1;
|
373
|
+
} SSL_AEAD_CTX;
|
301
374
|
|
302
375
|
/* SSL_AEAD_CTX_new creates a newly-allocated |SSL_AEAD_CTX| using the supplied
|
303
376
|
* key material. It returns NULL on error. Only one of |SSL_AEAD_CTX_open| or
|
@@ -315,11 +388,11 @@ void SSL_AEAD_CTX_free(SSL_AEAD_CTX *ctx);
|
|
315
388
|
|
316
389
|
/* SSL_AEAD_CTX_explicit_nonce_len returns the length of the explicit nonce for
|
317
390
|
* |ctx|, if any. |ctx| may be NULL to denote the null cipher. */
|
318
|
-
size_t SSL_AEAD_CTX_explicit_nonce_len(SSL_AEAD_CTX *ctx);
|
391
|
+
size_t SSL_AEAD_CTX_explicit_nonce_len(const SSL_AEAD_CTX *ctx);
|
319
392
|
|
320
393
|
/* SSL_AEAD_CTX_max_overhead returns the maximum overhead of calling
|
321
394
|
* |SSL_AEAD_CTX_seal|. |ctx| may be NULL to denote the null cipher. */
|
322
|
-
size_t SSL_AEAD_CTX_max_overhead(SSL_AEAD_CTX *ctx);
|
395
|
+
size_t SSL_AEAD_CTX_max_overhead(const SSL_AEAD_CTX *ctx);
|
323
396
|
|
324
397
|
/* SSL_AEAD_CTX_open authenticates and decrypts |in_len| bytes from |in|
|
325
398
|
* in-place. On success, it sets |*out| to the plaintext in |in| and returns
|
@@ -415,21 +488,13 @@ enum ssl_open_record_t dtls_open_record(SSL *ssl, uint8_t *out_type, CBS *out,
|
|
415
488
|
* use this to align buffers.
|
416
489
|
*
|
417
490
|
* Note when TLS 1.0 CBC record-splitting is enabled, this includes the one byte
|
418
|
-
* record and is the offset into second record's ciphertext. Thus
|
419
|
-
*
|
420
|
-
* a smaller output than this value.
|
491
|
+
* record and is the offset into second record's ciphertext. Thus sealing a
|
492
|
+
* small record may result in a smaller output than this value.
|
421
493
|
*
|
422
|
-
* TODO(davidben):
|
423
|
-
*
|
494
|
+
* TODO(davidben): Is this alignment valuable? Record-splitting makes this a
|
495
|
+
* mess. */
|
424
496
|
size_t ssl_seal_align_prefix_len(const SSL *ssl);
|
425
497
|
|
426
|
-
/* ssl_max_seal_overhead returns the maximum overhead of sealing a record with
|
427
|
-
* |ssl|.
|
428
|
-
*
|
429
|
-
* TODO(davidben): Expose this as part of public API once the high-level
|
430
|
-
* buffer-free APIs are available. */
|
431
|
-
size_t ssl_max_seal_overhead(const SSL *ssl);
|
432
|
-
|
433
498
|
/* tls_seal_record seals a new record of type |type| and body |in| and writes it
|
434
499
|
* to |out|. At most |max_out| bytes will be written. It returns one on success
|
435
500
|
* and zero on error. If enabled, |tls_seal_record| implements TLS 1.0 CBC 1/n-1
|
@@ -437,7 +502,7 @@ size_t ssl_max_seal_overhead(const SSL *ssl);
|
|
437
502
|
*
|
438
503
|
* For a large record, the bulk of the ciphertext will begin
|
439
504
|
* |ssl_seal_align_prefix_len| bytes into out. Aligning |out| appropriately may
|
440
|
-
* improve performance. It writes at most |in_len| + |
|
505
|
+
* improve performance. It writes at most |in_len| + |SSL_max_seal_overhead|
|
441
506
|
* bytes to |out|.
|
442
507
|
*
|
443
508
|
* |in| and |out| may not alias. */
|
@@ -449,8 +514,18 @@ enum dtls1_use_epoch_t {
|
|
449
514
|
dtls1_use_current_epoch,
|
450
515
|
};
|
451
516
|
|
517
|
+
/* dtls_max_seal_overhead returns the maximum overhead, in bytes, of sealing a
|
518
|
+
* record. */
|
519
|
+
size_t dtls_max_seal_overhead(const SSL *ssl, enum dtls1_use_epoch_t use_epoch);
|
520
|
+
|
521
|
+
/* dtls_seal_prefix_len returns the number of bytes of prefix to reserve in
|
522
|
+
* front of the plaintext when sealing a record in-place. */
|
523
|
+
size_t dtls_seal_prefix_len(const SSL *ssl, enum dtls1_use_epoch_t use_epoch);
|
524
|
+
|
452
525
|
/* dtls_seal_record implements |tls_seal_record| for DTLS. |use_epoch| selects
|
453
|
-
* which epoch's cipher state to use.
|
526
|
+
* which epoch's cipher state to use. Unlike |tls_seal_record|, |in| and |out|
|
527
|
+
* may alias but, if they do, |in| must be exactly |dtls_seal_prefix_len| bytes
|
528
|
+
* ahead of |out|. */
|
454
529
|
int dtls_seal_record(SSL *ssl, uint8_t *out, size_t *out_len, size_t max_out,
|
455
530
|
uint8_t type, const uint8_t *in, size_t in_len,
|
456
531
|
enum dtls1_use_epoch_t use_epoch);
|
@@ -508,6 +583,8 @@ int ssl_public_key_verify(
|
|
508
583
|
|
509
584
|
/* Custom extensions */
|
510
585
|
|
586
|
+
typedef struct ssl_handshake_st SSL_HANDSHAKE;
|
587
|
+
|
511
588
|
/* ssl_custom_extension (a.k.a. SSL_CUSTOM_EXTENSION) is a structure that
|
512
589
|
* contains information about custom-extension callbacks. */
|
513
590
|
struct ssl_custom_extension {
|
@@ -521,48 +598,21 @@ struct ssl_custom_extension {
|
|
521
598
|
|
522
599
|
void SSL_CUSTOM_EXTENSION_free(SSL_CUSTOM_EXTENSION *custom_extension);
|
523
600
|
|
524
|
-
int custom_ext_add_clienthello(
|
525
|
-
int custom_ext_parse_serverhello(
|
526
|
-
const CBS *extension);
|
527
|
-
int custom_ext_parse_clienthello(
|
528
|
-
const CBS *extension);
|
529
|
-
int custom_ext_add_serverhello(
|
530
|
-
|
531
|
-
|
532
|
-
/* Handshake hash.
|
533
|
-
*
|
534
|
-
* The TLS handshake maintains a transcript of all handshake messages. At
|
535
|
-
* various points in the protocol, this is either a handshake buffer, a rolling
|
536
|
-
* hash (selected by cipher suite) or both. */
|
537
|
-
|
538
|
-
/* ssl3_init_handshake_buffer initializes the handshake buffer and resets the
|
539
|
-
* handshake hash. It returns one success and zero on failure. */
|
540
|
-
int ssl3_init_handshake_buffer(SSL *ssl);
|
541
|
-
|
542
|
-
/* ssl3_init_handshake_hash initializes the handshake hash based on the pending
|
543
|
-
* cipher and the contents of the handshake buffer. Subsequent calls to
|
544
|
-
* |ssl3_update_handshake_hash| will update the rolling hash. It returns one on
|
545
|
-
* success and zero on failure. It is an error to call this function after the
|
546
|
-
* handshake buffer is released. */
|
547
|
-
int ssl3_init_handshake_hash(SSL *ssl);
|
548
|
-
|
549
|
-
/* ssl3_free_handshake_buffer releases the handshake buffer. Subsequent calls
|
550
|
-
* to |ssl3_update_handshake_hash| will not update the handshake buffer. */
|
551
|
-
void ssl3_free_handshake_buffer(SSL *ssl);
|
552
|
-
|
553
|
-
/* ssl3_free_handshake_hash releases the handshake hash. */
|
554
|
-
void ssl3_free_handshake_hash(SSL *ssl);
|
555
|
-
|
556
|
-
/* ssl3_update_handshake_hash adds |in| to the handshake buffer and handshake
|
557
|
-
* hash, whichever is enabled. It returns one on success and zero on failure. */
|
558
|
-
int ssl3_update_handshake_hash(SSL *ssl, const uint8_t *in, size_t in_len);
|
601
|
+
int custom_ext_add_clienthello(SSL_HANDSHAKE *hs, CBB *extensions);
|
602
|
+
int custom_ext_parse_serverhello(SSL_HANDSHAKE *hs, int *out_alert,
|
603
|
+
uint16_t value, const CBS *extension);
|
604
|
+
int custom_ext_parse_clienthello(SSL_HANDSHAKE *hs, int *out_alert,
|
605
|
+
uint16_t value, const CBS *extension);
|
606
|
+
int custom_ext_add_serverhello(SSL_HANDSHAKE *hs, CBB *extensions);
|
559
607
|
|
560
608
|
|
561
609
|
/* ECDH groups. */
|
562
610
|
|
611
|
+
typedef struct ssl_ecdh_ctx_st SSL_ECDH_CTX;
|
612
|
+
|
563
613
|
/* An SSL_ECDH_METHOD is an implementation of ECDH-like key exchanges for
|
564
614
|
* TLS. */
|
565
|
-
struct ssl_ecdh_method_st {
|
615
|
+
typedef struct ssl_ecdh_method_st {
|
566
616
|
int nid;
|
567
617
|
uint16_t group_id;
|
568
618
|
const char name[8];
|
@@ -602,13 +652,23 @@ struct ssl_ecdh_method_st {
|
|
602
652
|
* be passed to |offer| or |accept|. It returns one on success and zero on
|
603
653
|
* error. */
|
604
654
|
int (*add_key)(CBB *cbb, CBB *out_contents);
|
605
|
-
}
|
655
|
+
} SSL_ECDH_METHOD;
|
656
|
+
|
657
|
+
struct ssl_ecdh_ctx_st {
|
658
|
+
const SSL_ECDH_METHOD *method;
|
659
|
+
void *data;
|
660
|
+
};
|
606
661
|
|
607
662
|
/* ssl_nid_to_group_id looks up the group corresponding to |nid|. On success, it
|
608
663
|
* sets |*out_group_id| to the group ID and returns one. Otherwise, it returns
|
609
664
|
* zero. */
|
610
665
|
int ssl_nid_to_group_id(uint16_t *out_group_id, int nid);
|
611
666
|
|
667
|
+
/* ssl_name_to_group_id looks up the group corresponding to the |name| string
|
668
|
+
* of length |len|. On success, it sets |*out_group_id| to the group ID and
|
669
|
+
* returns one. Otherwise, it returns zero. */
|
670
|
+
int ssl_name_to_group_id(uint16_t *out_group_id, const char *name, size_t len);
|
671
|
+
|
612
672
|
/* SSL_ECDH_CTX_init sets up |ctx| for use with curve |group_id|. It returns one
|
613
673
|
* on success and zero on error. */
|
614
674
|
int SSL_ECDH_CTX_init(SSL_ECDH_CTX *ctx, uint16_t group_id);
|
@@ -617,9 +677,6 @@ int SSL_ECDH_CTX_init(SSL_ECDH_CTX *ctx, uint16_t group_id);
|
|
617
677
|
* where the server specifies a group. It takes ownership of |params|. */
|
618
678
|
void SSL_ECDH_CTX_init_for_dhe(SSL_ECDH_CTX *ctx, DH *params);
|
619
679
|
|
620
|
-
/* SSL_ECDH_CTX_init_for_cecpq1 sets up |ctx| for use with CECPQ1. */
|
621
|
-
void SSL_ECDH_CTX_init_for_cecpq1(SSL_ECDH_CTX *ctx);
|
622
|
-
|
623
680
|
/* SSL_ECDH_CTX_cleanup releases memory associated with |ctx|. It is legal to
|
624
681
|
* call it in the zero state. */
|
625
682
|
void SSL_ECDH_CTX_cleanup(SSL_ECDH_CTX *ctx);
|
@@ -750,22 +807,41 @@ int ssl_has_certificate(const SSL *ssl);
|
|
750
807
|
|
751
808
|
/* ssl_parse_cert_chain parses a certificate list from |cbs| in the format used
|
752
809
|
* by a TLS Certificate message. On success, it returns a newly-allocated
|
753
|
-
* |
|
754
|
-
* |*out_alert| to an alert to send to the peer.
|
755
|
-
*
|
756
|
-
* |
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
*
|
762
|
-
|
810
|
+
* |CRYPTO_BUFFER| list and advances |cbs|. Otherwise, it returns NULL and sets
|
811
|
+
* |*out_alert| to an alert to send to the peer.
|
812
|
+
*
|
813
|
+
* If the list is non-empty then |*out_pubkey| will be set to a freshly
|
814
|
+
* allocated public-key from the leaf certificate.
|
815
|
+
*
|
816
|
+
* If the list is non-empty and |out_leaf_sha256| is non-NULL, it writes the
|
817
|
+
* SHA-256 hash of the leaf to |out_leaf_sha256|. */
|
818
|
+
STACK_OF(CRYPTO_BUFFER) *ssl_parse_cert_chain(uint8_t *out_alert,
|
819
|
+
EVP_PKEY **out_pubkey,
|
820
|
+
uint8_t *out_leaf_sha256,
|
821
|
+
CBS *cbs,
|
822
|
+
CRYPTO_BUFFER_POOL *pool);
|
763
823
|
|
764
824
|
/* ssl_add_cert_chain adds |ssl|'s certificate chain to |cbb| in the format used
|
765
825
|
* by a TLS Certificate message. If there is no certificate chain, it emits an
|
766
826
|
* empty certificate list. It returns one on success and zero on error. */
|
767
827
|
int ssl_add_cert_chain(SSL *ssl, CBB *cbb);
|
768
828
|
|
829
|
+
/* ssl_auto_chain_if_needed runs the deprecated auto-chaining logic if
|
830
|
+
* necessary. On success, it updates |ssl|'s certificate configuration as needed
|
831
|
+
* and returns one. Otherwise, it returns zero. */
|
832
|
+
int ssl_auto_chain_if_needed(SSL *ssl);
|
833
|
+
|
834
|
+
/* ssl_cert_check_digital_signature_key_usage parses the DER-encoded, X.509
|
835
|
+
* certificate in |in| and returns one if doesn't specify a key usage or, if it
|
836
|
+
* does, if it includes digitalSignature. Otherwise it pushes to the error
|
837
|
+
* queue and returns zero. */
|
838
|
+
int ssl_cert_check_digital_signature_key_usage(const CBS *in);
|
839
|
+
|
840
|
+
/* ssl_cert_parse_pubkey extracts the public key from the DER-encoded, X.509
|
841
|
+
* certificate in |in|. It returns an allocated |EVP_PKEY| or else returns NULL
|
842
|
+
* and pushes to the error queue. */
|
843
|
+
EVP_PKEY *ssl_cert_parse_pubkey(const CBS *in);
|
844
|
+
|
769
845
|
/* ssl_parse_client_CA_list parses a CA list from |cbs| in the format used by a
|
770
846
|
* TLS CertificateRequest message. On success, it returns a newly-allocated
|
771
847
|
* |X509_NAME| list and advances |cbs|. Otherwise, it returns NULL and sets
|
@@ -778,69 +854,48 @@ STACK_OF(X509_NAME) *
|
|
778
854
|
* on error. */
|
779
855
|
int ssl_add_client_CA_list(SSL *ssl, CBB *cbb);
|
780
856
|
|
781
|
-
/* ssl_check_leaf_certificate returns one if |leaf|
|
782
|
-
* certificate for |
|
783
|
-
* error queue. */
|
784
|
-
int ssl_check_leaf_certificate(
|
785
|
-
|
786
|
-
/* ssl_do_client_cert_cb runs the client_cert_cb, if any, and returns one on
|
787
|
-
* success and zero on error. On error, it sets |*out_should_retry| to one if
|
788
|
-
* the callback failed and should be retried and zero otherwise. */
|
789
|
-
int ssl_do_client_cert_cb(SSL *ssl, int *out_should_retry);
|
857
|
+
/* ssl_check_leaf_certificate returns one if |pkey| and |leaf| are suitable as
|
858
|
+
* a server's leaf certificate for |hs|. Otherwise, it returns zero and pushes
|
859
|
+
* an error on the error queue. */
|
860
|
+
int ssl_check_leaf_certificate(SSL_HANDSHAKE *hs, EVP_PKEY *pkey,
|
861
|
+
const CRYPTO_BUFFER *leaf);
|
790
862
|
|
791
863
|
|
792
864
|
/* TLS 1.3 key derivation. */
|
793
865
|
|
794
866
|
/* tls13_init_key_schedule initializes the handshake hash and key derivation
|
795
|
-
* state
|
796
|
-
*
|
797
|
-
*
|
798
|
-
int tls13_init_key_schedule(SSL *ssl, const uint8_t *resumption_ctx,
|
799
|
-
size_t resumption_ctx_len);
|
867
|
+
* state. The cipher suite and PRF hash must have been selected at this point.
|
868
|
+
* It returns one on success and zero on error. */
|
869
|
+
int tls13_init_key_schedule(SSL_HANDSHAKE *hs);
|
800
870
|
|
801
871
|
/* tls13_advance_key_schedule incorporates |in| into the key schedule with
|
802
872
|
* HKDF-Extract. It returns one on success and zero on error. */
|
803
|
-
int tls13_advance_key_schedule(
|
804
|
-
|
805
|
-
/* tls13_get_context_hashes writes Hash(Handshake Context) +
|
806
|
-
* Hash(resumption_context) to |out| which much have room for at least 2 *
|
807
|
-
* |EVP_MAX_MD_SIZE| bytes. On success, it returns one and sets |*out_len| to
|
808
|
-
* the number of bytes written. Otherwise, it returns zero. */
|
809
|
-
int tls13_get_context_hashes(SSL *ssl, uint8_t *out, size_t *out_len);
|
810
|
-
|
811
|
-
enum tls_record_type_t {
|
812
|
-
type_early_handshake,
|
813
|
-
type_early_data,
|
814
|
-
type_handshake,
|
815
|
-
type_data,
|
816
|
-
};
|
873
|
+
int tls13_advance_key_schedule(SSL_HANDSHAKE *hs, const uint8_t *in,
|
874
|
+
size_t len);
|
817
875
|
|
818
|
-
/* tls13_set_traffic_key sets the read or write traffic keys to
|
819
|
-
*
|
820
|
-
*
|
821
|
-
int tls13_set_traffic_key(SSL *ssl, enum tls_record_type_t type,
|
822
|
-
enum evp_aead_direction_t direction,
|
876
|
+
/* tls13_set_traffic_key sets the read or write traffic keys to
|
877
|
+
* |traffic_secret|. It returns one on success and zero on error. */
|
878
|
+
int tls13_set_traffic_key(SSL *ssl, enum evp_aead_direction_t direction,
|
823
879
|
const uint8_t *traffic_secret,
|
824
880
|
size_t traffic_secret_len);
|
825
881
|
|
826
|
-
/*
|
827
|
-
*
|
828
|
-
*
|
829
|
-
int tls13_set_handshake_traffic(SSL *ssl);
|
882
|
+
/* tls13_derive_handshake_secrets derives the handshake traffic secret. It
|
883
|
+
* returns one on success and zero on error. */
|
884
|
+
int tls13_derive_handshake_secrets(SSL_HANDSHAKE *hs);
|
830
885
|
|
831
886
|
/* tls13_rotate_traffic_key derives the next read or write traffic secret. It
|
832
887
|
* returns one on success and zero on error. */
|
833
888
|
int tls13_rotate_traffic_key(SSL *ssl, enum evp_aead_direction_t direction);
|
834
889
|
|
835
|
-
/*
|
836
|
-
*
|
837
|
-
* on success and zero on error. */
|
838
|
-
int
|
890
|
+
/* tls13_derive_application_secrets derives the initial application data traffic
|
891
|
+
* and exporter secrets based on the handshake transcripts and |master_secret|.
|
892
|
+
* It returns one on success and zero on error. */
|
893
|
+
int tls13_derive_application_secrets(SSL_HANDSHAKE *hs);
|
839
894
|
|
840
|
-
/*
|
841
|
-
int
|
895
|
+
/* tls13_derive_resumption_secret derives the |resumption_secret|. */
|
896
|
+
int tls13_derive_resumption_secret(SSL_HANDSHAKE *hs);
|
842
897
|
|
843
|
-
/* tls13_export_keying_material provides
|
898
|
+
/* tls13_export_keying_material provides an exporter interface to use the
|
844
899
|
* |exporter_secret|. */
|
845
900
|
int tls13_export_keying_material(SSL *ssl, uint8_t *out, size_t out_len,
|
846
901
|
const char *label, size_t label_len,
|
@@ -851,19 +906,19 @@ int tls13_export_keying_material(SSL *ssl, uint8_t *out, size_t out_len,
|
|
851
906
|
* the integrity of the Finished message, and stores the result in |out| and
|
852
907
|
* length in |out_len|. |is_server| is 1 if this is for the Server Finished and
|
853
908
|
* 0 for the Client Finished. */
|
854
|
-
int tls13_finished_mac(
|
909
|
+
int tls13_finished_mac(SSL_HANDSHAKE *hs, uint8_t *out,
|
910
|
+
size_t *out_len, int is_server);
|
855
911
|
|
856
|
-
/*
|
857
|
-
* |
|
858
|
-
*
|
859
|
-
int
|
860
|
-
const SSL_SESSION *session);
|
912
|
+
/* tls13_write_psk_binder calculates the PSK binder value and replaces the last
|
913
|
+
* bytes of |msg| with the resulting value. It returns 1 on success, and 0 on
|
914
|
+
* failure. */
|
915
|
+
int tls13_write_psk_binder(SSL_HANDSHAKE *hs, uint8_t *msg, size_t len);
|
861
916
|
|
862
|
-
/*
|
863
|
-
*
|
864
|
-
*
|
865
|
-
int
|
866
|
-
|
917
|
+
/* tls13_verify_psk_binder verifies that the handshake transcript, truncated
|
918
|
+
* up to the binders has a valid signature using the value of |session|'s
|
919
|
+
* resumption secret. It returns 1 on success, and 0 on failure. */
|
920
|
+
int tls13_verify_psk_binder(SSL_HANDSHAKE *hs, SSL_SESSION *session,
|
921
|
+
CBS *binders);
|
867
922
|
|
868
923
|
|
869
924
|
/* Handshake functions. */
|
@@ -872,37 +927,78 @@ enum ssl_hs_wait_t {
|
|
872
927
|
ssl_hs_error,
|
873
928
|
ssl_hs_ok,
|
874
929
|
ssl_hs_read_message,
|
875
|
-
ssl_hs_write_message,
|
876
930
|
ssl_hs_flush,
|
877
931
|
ssl_hs_flush_and_read_message,
|
878
932
|
ssl_hs_x509_lookup,
|
933
|
+
ssl_hs_channel_id_lookup,
|
879
934
|
ssl_hs_private_key_operation,
|
880
935
|
};
|
881
936
|
|
882
937
|
struct ssl_handshake_st {
|
883
|
-
/*
|
884
|
-
|
885
|
-
|
938
|
+
/* ssl is a non-owning pointer to the parent |SSL| object. */
|
939
|
+
SSL *ssl;
|
940
|
+
|
941
|
+
/* do_tls13_handshake runs the TLS 1.3 handshake. On completion, it returns
|
942
|
+
* |ssl_hs_ok|. Otherwise, it returns a value corresponding to what operation
|
943
|
+
* is needed to progress. */
|
944
|
+
enum ssl_hs_wait_t (*do_tls13_handshake)(SSL_HANDSHAKE *hs);
|
886
945
|
|
887
|
-
/*
|
888
|
-
*
|
889
|
-
|
890
|
-
enum ssl_hs_wait_t (*do_handshake)(SSL *ssl);
|
946
|
+
/* wait contains the operation |do_tls13_handshake| is currently blocking on
|
947
|
+
* or |ssl_hs_ok| if none. */
|
948
|
+
enum ssl_hs_wait_t wait;
|
891
949
|
|
950
|
+
/* state contains one of the SSL3_ST_* values. */
|
892
951
|
int state;
|
893
952
|
|
953
|
+
/* next_state is used when SSL_ST_FLUSH_DATA is entered */
|
954
|
+
int next_state;
|
955
|
+
|
956
|
+
/* tls13_state is the internal state for the TLS 1.3 handshake. Its values
|
957
|
+
* depend on |do_tls13_handshake| but the starting state is always zero. */
|
958
|
+
int tls13_state;
|
959
|
+
|
894
960
|
size_t hash_len;
|
895
|
-
uint8_t resumption_hash[EVP_MAX_MD_SIZE];
|
896
961
|
uint8_t secret[EVP_MAX_MD_SIZE];
|
897
|
-
uint8_t
|
898
|
-
|
899
|
-
|
900
|
-
|
962
|
+
uint8_t client_handshake_secret[EVP_MAX_MD_SIZE];
|
963
|
+
uint8_t server_handshake_secret[EVP_MAX_MD_SIZE];
|
964
|
+
uint8_t client_traffic_secret_0[EVP_MAX_MD_SIZE];
|
965
|
+
uint8_t server_traffic_secret_0[EVP_MAX_MD_SIZE];
|
966
|
+
|
967
|
+
union {
|
968
|
+
/* sent is a bitset where the bits correspond to elements of kExtensions
|
969
|
+
* in t1_lib.c. Each bit is set if that extension was sent in a
|
970
|
+
* ClientHello. It's not used by servers. */
|
971
|
+
uint32_t sent;
|
972
|
+
/* received is a bitset, like |sent|, but is used by servers to record
|
973
|
+
* which extensions were received from a client. */
|
974
|
+
uint32_t received;
|
975
|
+
} extensions;
|
976
|
+
|
977
|
+
union {
|
978
|
+
/* sent is a bitset where the bits correspond to elements of
|
979
|
+
* |client_custom_extensions| in the |SSL_CTX|. Each bit is set if that
|
980
|
+
* extension was sent in a ClientHello. It's not used by servers. */
|
981
|
+
uint16_t sent;
|
982
|
+
/* received is a bitset, like |sent|, but is used by servers to record
|
983
|
+
* which custom extensions were received from a client. The bits here
|
984
|
+
* correspond to |server_custom_extensions|. */
|
985
|
+
uint16_t received;
|
986
|
+
} custom_extensions;
|
901
987
|
|
902
988
|
/* retry_group is the group ID selected by the server in HelloRetryRequest in
|
903
989
|
* TLS 1.3. */
|
904
990
|
uint16_t retry_group;
|
905
991
|
|
992
|
+
/* ecdh_ctx is the current ECDH instance. */
|
993
|
+
SSL_ECDH_CTX ecdh_ctx;
|
994
|
+
|
995
|
+
/* transcript is the current handshake transcript. */
|
996
|
+
SSL_TRANSCRIPT transcript;
|
997
|
+
|
998
|
+
/* cookie is the value of the cookie received from the server, if any. */
|
999
|
+
uint8_t *cookie;
|
1000
|
+
size_t cookie_len;
|
1001
|
+
|
906
1002
|
/* key_share_bytes is the value of the previously sent KeyShare extension by
|
907
1003
|
* the client in TLS 1.3. */
|
908
1004
|
uint8_t *key_share_bytes;
|
@@ -920,78 +1016,203 @@ struct ssl_handshake_st {
|
|
920
1016
|
/* num_peer_sigalgs is the number of entries in |peer_sigalgs|. */
|
921
1017
|
size_t num_peer_sigalgs;
|
922
1018
|
|
923
|
-
|
1019
|
+
/* peer_supported_group_list contains the supported group IDs advertised by
|
1020
|
+
* the peer. This is only set on the server's end. The server does not
|
1021
|
+
* advertise this extension to the client. */
|
1022
|
+
uint16_t *peer_supported_group_list;
|
1023
|
+
size_t peer_supported_group_list_len;
|
1024
|
+
|
1025
|
+
/* peer_key is the peer's ECDH key for a TLS 1.2 client. */
|
1026
|
+
uint8_t *peer_key;
|
1027
|
+
size_t peer_key_len;
|
1028
|
+
|
1029
|
+
/* server_params, in TLS 1.2, stores the ServerKeyExchange parameters to be
|
1030
|
+
* signed while the signature is being computed. */
|
1031
|
+
uint8_t *server_params;
|
1032
|
+
size_t server_params_len;
|
924
1033
|
|
925
1034
|
/* peer_psk_identity_hint, on the client, is the psk_identity_hint sent by the
|
926
1035
|
* server when using a TLS 1.2 PSK key exchange. */
|
927
1036
|
char *peer_psk_identity_hint;
|
1037
|
+
|
1038
|
+
/* ca_names, on the client, contains the list of CAs received in a
|
1039
|
+
* CertificateRequest message. */
|
1040
|
+
STACK_OF(X509_NAME) *ca_names;
|
1041
|
+
|
1042
|
+
/* certificate_types, on the client, contains the set of certificate types
|
1043
|
+
* received in a CertificateRequest message. */
|
1044
|
+
uint8_t *certificate_types;
|
1045
|
+
size_t num_certificate_types;
|
1046
|
+
|
1047
|
+
/* hostname, on the server, is the value of the SNI extension. */
|
1048
|
+
char *hostname;
|
1049
|
+
|
1050
|
+
/* peer_pubkey is the public key parsed from the peer's leaf certificate. */
|
1051
|
+
EVP_PKEY *peer_pubkey;
|
1052
|
+
|
1053
|
+
/* new_session is the new mutable session being established by the current
|
1054
|
+
* handshake. It should not be cached. */
|
1055
|
+
SSL_SESSION *new_session;
|
1056
|
+
|
1057
|
+
/* new_cipher is the cipher being negotiated in this handshake. */
|
1058
|
+
const SSL_CIPHER *new_cipher;
|
1059
|
+
|
1060
|
+
/* key_block is the record-layer key block for TLS 1.2 and earlier. */
|
1061
|
+
uint8_t *key_block;
|
1062
|
+
uint8_t key_block_len;
|
1063
|
+
|
1064
|
+
/* session_tickets_sent, in TLS 1.3, is the number of tickets the server has
|
1065
|
+
* sent. */
|
1066
|
+
uint8_t session_tickets_sent;
|
1067
|
+
|
1068
|
+
/* scts_requested is one if the SCT extension is in the ClientHello. */
|
1069
|
+
unsigned scts_requested:1;
|
1070
|
+
|
1071
|
+
/* needs_psk_binder if the ClientHello has a placeholder PSK binder to be
|
1072
|
+
* filled in. */
|
1073
|
+
unsigned needs_psk_binder:1;
|
1074
|
+
|
1075
|
+
unsigned received_hello_retry_request:1;
|
1076
|
+
|
1077
|
+
/* accept_psk_mode stores whether the client's PSK mode is compatible with our
|
1078
|
+
* preferences. */
|
1079
|
+
unsigned accept_psk_mode:1;
|
1080
|
+
|
1081
|
+
/* cert_request is one if a client certificate was requested and zero
|
1082
|
+
* otherwise. */
|
1083
|
+
unsigned cert_request:1;
|
1084
|
+
|
1085
|
+
/* certificate_status_expected is one if OCSP stapling was negotiated and the
|
1086
|
+
* server is expected to send a CertificateStatus message. (This is used on
|
1087
|
+
* both the client and server sides.) */
|
1088
|
+
unsigned certificate_status_expected:1;
|
1089
|
+
|
1090
|
+
/* ocsp_stapling_requested is one if a client requested OCSP stapling. */
|
1091
|
+
unsigned ocsp_stapling_requested:1;
|
1092
|
+
|
1093
|
+
/* should_ack_sni is used by a server and indicates that the SNI extension
|
1094
|
+
* should be echoed in the ServerHello. */
|
1095
|
+
unsigned should_ack_sni:1;
|
1096
|
+
|
1097
|
+
/* in_false_start is one if there is a pending client handshake in False
|
1098
|
+
* Start. The client may write data at this point. */
|
1099
|
+
unsigned in_false_start:1;
|
1100
|
+
|
1101
|
+
/* next_proto_neg_seen is one of NPN was negotiated. */
|
1102
|
+
unsigned next_proto_neg_seen:1;
|
1103
|
+
|
1104
|
+
/* ticket_expected is one if a TLS 1.2 NewSessionTicket message is to be sent
|
1105
|
+
* or received. */
|
1106
|
+
unsigned ticket_expected:1;
|
1107
|
+
|
1108
|
+
/* v2_clienthello is one if we received a V2ClientHello. */
|
1109
|
+
unsigned v2_clienthello:1;
|
1110
|
+
|
1111
|
+
/* extended_master_secret is one if the extended master secret extension is
|
1112
|
+
* negotiated in this handshake. */
|
1113
|
+
unsigned extended_master_secret:1;
|
1114
|
+
|
1115
|
+
/* client_version is the value sent or received in the ClientHello version. */
|
1116
|
+
uint16_t client_version;
|
928
1117
|
} /* SSL_HANDSHAKE */;
|
929
1118
|
|
930
|
-
SSL_HANDSHAKE *ssl_handshake_new(
|
1119
|
+
SSL_HANDSHAKE *ssl_handshake_new(SSL *ssl);
|
931
1120
|
|
932
1121
|
/* ssl_handshake_free releases all memory associated with |hs|. */
|
933
1122
|
void ssl_handshake_free(SSL_HANDSHAKE *hs);
|
934
1123
|
|
1124
|
+
/* ssl_check_message_type checks if the current message has type |type|. If so
|
1125
|
+
* it returns one. Otherwise, it sends an alert and returns zero. */
|
1126
|
+
int ssl_check_message_type(SSL *ssl, int type);
|
1127
|
+
|
935
1128
|
/* tls13_handshake runs the TLS 1.3 handshake. It returns one on success and <=
|
936
1129
|
* 0 on error. */
|
937
|
-
int tls13_handshake(
|
1130
|
+
int tls13_handshake(SSL_HANDSHAKE *hs);
|
938
1131
|
|
939
|
-
/* The following are implementations of |
|
1132
|
+
/* The following are implementations of |do_tls13_handshake| for the client and
|
940
1133
|
* server. */
|
941
|
-
enum ssl_hs_wait_t tls13_client_handshake(
|
942
|
-
enum ssl_hs_wait_t tls13_server_handshake(
|
1134
|
+
enum ssl_hs_wait_t tls13_client_handshake(SSL_HANDSHAKE *hs);
|
1135
|
+
enum ssl_hs_wait_t tls13_server_handshake(SSL_HANDSHAKE *hs);
|
943
1136
|
|
944
1137
|
/* tls13_post_handshake processes a post-handshake message. It returns one on
|
945
1138
|
* success and zero on failure. */
|
946
1139
|
int tls13_post_handshake(SSL *ssl);
|
947
1140
|
|
948
|
-
|
949
|
-
*
|
950
|
-
int
|
951
|
-
|
952
|
-
int tls13_process_certificate(SSL *ssl, int allow_anonymous);
|
953
|
-
int tls13_process_certificate_verify(SSL *ssl);
|
954
|
-
int tls13_process_finished(SSL *ssl);
|
1141
|
+
int tls13_process_certificate(SSL_HANDSHAKE *hs, int allow_anonymous);
|
1142
|
+
int tls13_process_certificate_verify(SSL_HANDSHAKE *hs);
|
1143
|
+
int tls13_process_finished(SSL_HANDSHAKE *hs);
|
955
1144
|
|
956
|
-
int
|
957
|
-
enum ssl_private_key_result_t
|
958
|
-
|
959
|
-
int
|
1145
|
+
int tls13_add_certificate(SSL_HANDSHAKE *hs);
|
1146
|
+
enum ssl_private_key_result_t tls13_add_certificate_verify(SSL_HANDSHAKE *hs,
|
1147
|
+
int is_first_run);
|
1148
|
+
int tls13_add_finished(SSL_HANDSHAKE *hs);
|
960
1149
|
int tls13_process_new_session_ticket(SSL *ssl);
|
961
1150
|
|
962
|
-
int ssl_ext_key_share_parse_serverhello(
|
1151
|
+
int ssl_ext_key_share_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t **out_secret,
|
963
1152
|
size_t *out_secret_len,
|
964
1153
|
uint8_t *out_alert, CBS *contents);
|
965
|
-
int ssl_ext_key_share_parse_clienthello(
|
1154
|
+
int ssl_ext_key_share_parse_clienthello(SSL_HANDSHAKE *hs, int *out_found,
|
966
1155
|
uint8_t **out_secret,
|
967
1156
|
size_t *out_secret_len,
|
968
1157
|
uint8_t *out_alert, CBS *contents);
|
969
|
-
int ssl_ext_key_share_add_serverhello(
|
1158
|
+
int ssl_ext_key_share_add_serverhello(SSL_HANDSHAKE *hs, CBB *out);
|
970
1159
|
|
971
|
-
int ssl_ext_pre_shared_key_parse_serverhello(
|
972
|
-
CBS *contents);
|
973
|
-
int ssl_ext_pre_shared_key_parse_clienthello(
|
1160
|
+
int ssl_ext_pre_shared_key_parse_serverhello(SSL_HANDSHAKE *hs,
|
1161
|
+
uint8_t *out_alert, CBS *contents);
|
1162
|
+
int ssl_ext_pre_shared_key_parse_clienthello(SSL_HANDSHAKE *hs,
|
974
1163
|
SSL_SESSION **out_session,
|
1164
|
+
CBS *out_binders,
|
975
1165
|
uint8_t *out_alert, CBS *contents);
|
976
|
-
int ssl_ext_pre_shared_key_add_serverhello(
|
1166
|
+
int ssl_ext_pre_shared_key_add_serverhello(SSL_HANDSHAKE *hs, CBB *out);
|
1167
|
+
|
1168
|
+
/* ssl_is_sct_list_valid does a shallow parse of the SCT list in |contents| and
|
1169
|
+
* returns one iff it's valid. */
|
1170
|
+
int ssl_is_sct_list_valid(const CBS *contents);
|
977
1171
|
|
978
|
-
int
|
1172
|
+
int ssl_write_client_hello(SSL_HANDSHAKE *hs);
|
979
1173
|
|
980
1174
|
/* ssl_clear_tls13_state releases client state only needed for TLS 1.3. It
|
981
1175
|
* should be called once the version is known to be TLS 1.2 or earlier. */
|
982
|
-
void ssl_clear_tls13_state(
|
1176
|
+
void ssl_clear_tls13_state(SSL_HANDSHAKE *hs);
|
983
1177
|
|
1178
|
+
enum ssl_cert_verify_context_t {
|
1179
|
+
ssl_cert_verify_server,
|
1180
|
+
ssl_cert_verify_client,
|
1181
|
+
ssl_cert_verify_channel_id,
|
1182
|
+
};
|
984
1183
|
|
985
|
-
/*
|
1184
|
+
/* tls13_get_cert_verify_signature_input generates the message to be signed for
|
1185
|
+
* TLS 1.3's CertificateVerify message. |cert_verify_context| determines the
|
1186
|
+
* type of signature. It sets |*out| and |*out_len| to a newly allocated buffer
|
1187
|
+
* containing the result. The caller must free it with |OPENSSL_free| to release
|
1188
|
+
* it. This function returns one on success and zero on failure. */
|
1189
|
+
int tls13_get_cert_verify_signature_input(
|
1190
|
+
SSL_HANDSHAKE *hs, uint8_t **out, size_t *out_len,
|
1191
|
+
enum ssl_cert_verify_context_t cert_verify_context);
|
1192
|
+
|
1193
|
+
/* ssl_negotiate_alpn negotiates the ALPN extension, if applicable. It returns
|
1194
|
+
* one on successful negotiation or if nothing was negotiated. It returns zero
|
1195
|
+
* and sets |*out_alert| to an alert on error. */
|
1196
|
+
int ssl_negotiate_alpn(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
1197
|
+
const SSL_CLIENT_HELLO *client_hello);
|
1198
|
+
|
1199
|
+
typedef struct {
|
1200
|
+
uint16_t type;
|
1201
|
+
int *out_present;
|
1202
|
+
CBS *out_data;
|
1203
|
+
} SSL_EXTENSION_TYPE;
|
1204
|
+
|
1205
|
+
/* ssl_parse_extensions parses a TLS extensions block out of |cbs| and advances
|
1206
|
+
* it. It writes the parsed extensions to pointers denoted by |ext_types|. On
|
1207
|
+
* success, it fills in the |out_present| and |out_data| fields and returns one.
|
1208
|
+
* Otherwise, it sets |*out_alert| to an alert to send and returns zero. Unknown
|
1209
|
+
* extensions are rejected unless |ignore_unknown| is 1. */
|
1210
|
+
int ssl_parse_extensions(const CBS *cbs, uint8_t *out_alert,
|
1211
|
+
const SSL_EXTENSION_TYPE *ext_types,
|
1212
|
+
size_t num_ext_types, int ignore_unknown);
|
986
1213
|
|
987
|
-
|
988
|
-
|
989
|
-
* by the first 8 bytes of |encrypted_premaster|. */
|
990
|
-
int ssl_log_rsa_client_key_exchange(const SSL *ssl,
|
991
|
-
const uint8_t *encrypted_premaster,
|
992
|
-
size_t encrypted_premaster_len,
|
993
|
-
const uint8_t *premaster,
|
994
|
-
size_t premaster_len);
|
1214
|
+
|
1215
|
+
/* SSLKEYLOGFILE functions. */
|
995
1216
|
|
996
1217
|
/* ssl_log_secret logs |secret| with label |label|, if logging is enabled for
|
997
1218
|
* |ssl|. It returns one on success and zero on failure. */
|
@@ -1001,17 +1222,14 @@ int ssl_log_secret(const SSL *ssl, const char *label, const uint8_t *secret,
|
|
1001
1222
|
|
1002
1223
|
/* ClientHello functions. */
|
1003
1224
|
|
1004
|
-
int
|
1005
|
-
|
1225
|
+
int ssl_client_hello_init(SSL *ssl, SSL_CLIENT_HELLO *out, const uint8_t *in,
|
1226
|
+
size_t in_len);
|
1006
1227
|
|
1007
|
-
int
|
1008
|
-
|
1228
|
+
int ssl_client_hello_get_extension(const SSL_CLIENT_HELLO *client_hello,
|
1229
|
+
CBS *out, uint16_t extension_type);
|
1009
1230
|
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
int ssl_client_cipher_list_contains_cipher(
|
1014
|
-
const struct ssl_early_callback_ctx *client_hello, uint16_t id);
|
1231
|
+
int ssl_client_cipher_list_contains_cipher(const SSL_CLIENT_HELLO *client_hello,
|
1232
|
+
uint16_t id);
|
1015
1233
|
|
1016
1234
|
|
1017
1235
|
/* GREASE. */
|
@@ -1022,6 +1240,7 @@ enum ssl_grease_index_t {
|
|
1022
1240
|
ssl_grease_extension1,
|
1023
1241
|
ssl_grease_extension2,
|
1024
1242
|
ssl_grease_version,
|
1243
|
+
ssl_grease_ticket_extension,
|
1025
1244
|
};
|
1026
1245
|
|
1027
1246
|
/* ssl_get_grease_value returns a GREASE value for |ssl|. For a given
|
@@ -1031,6 +1250,28 @@ enum ssl_grease_index_t {
|
|
1031
1250
|
uint16_t ssl_get_grease_value(const SSL *ssl, enum ssl_grease_index_t index);
|
1032
1251
|
|
1033
1252
|
|
1253
|
+
/* Signature algorithms. */
|
1254
|
+
|
1255
|
+
/* tls1_parse_peer_sigalgs parses |sigalgs| as the list of peer signature
|
1256
|
+
* algorithms and saves them on |hs|. It returns one on success and zero on
|
1257
|
+
* error. */
|
1258
|
+
int tls1_parse_peer_sigalgs(SSL_HANDSHAKE *hs, const CBS *sigalgs);
|
1259
|
+
|
1260
|
+
/* tls1_choose_signature_algorithm sets |*out| to a signature algorithm for use
|
1261
|
+
* with |hs|'s private key based on the peer's preferences and the algorithms
|
1262
|
+
* supported. It returns one on success and zero on error. */
|
1263
|
+
int tls1_choose_signature_algorithm(SSL_HANDSHAKE *hs, uint16_t *out);
|
1264
|
+
|
1265
|
+
/* tls12_get_verify_sigalgs sets |*out| to the signature algorithms acceptable
|
1266
|
+
* for the peer signature and returns the length of the list. */
|
1267
|
+
size_t tls12_get_verify_sigalgs(const SSL *ssl, const uint16_t **out);
|
1268
|
+
|
1269
|
+
/* tls12_check_peer_sigalg checks if |sigalg| is acceptable for the peer
|
1270
|
+
* signature. It returns one on success and zero on error, setting |*out_alert|
|
1271
|
+
* to an alert to send. */
|
1272
|
+
int tls12_check_peer_sigalg(SSL *ssl, int *out_alert, uint16_t sigalg);
|
1273
|
+
|
1274
|
+
|
1034
1275
|
/* Underdocumented functions.
|
1035
1276
|
*
|
1036
1277
|
* Functions below here haven't been touched up and may be underdocumented. */
|
@@ -1040,28 +1281,39 @@ uint16_t ssl_get_grease_value(const SSL *ssl, enum ssl_grease_index_t index);
|
|
1040
1281
|
/* From RFC4492, used in encoding the curve type in ECParameters */
|
1041
1282
|
#define NAMED_CURVE_TYPE 3
|
1042
1283
|
|
1043
|
-
enum ssl_hash_message_t {
|
1044
|
-
ssl_dont_hash_message,
|
1045
|
-
ssl_hash_message,
|
1046
|
-
};
|
1047
|
-
|
1048
1284
|
typedef struct cert_st {
|
1049
|
-
X509 *x509;
|
1050
1285
|
EVP_PKEY *privatekey;
|
1051
|
-
|
1052
|
-
|
1286
|
+
|
1287
|
+
/* chain contains the certificate chain, with the leaf at the beginning. The
|
1288
|
+
* first element of |chain| may be NULL to indicate that the leaf certificate
|
1289
|
+
* has not yet been set.
|
1290
|
+
* If |chain| != NULL -> len(chain) >= 1
|
1291
|
+
* If |chain[0]| == NULL -> len(chain) >= 2.
|
1292
|
+
* |chain[1..]| != NULL */
|
1293
|
+
STACK_OF(CRYPTO_BUFFER) *chain;
|
1294
|
+
|
1295
|
+
/* x509_chain may contain a parsed copy of |chain[1..]|. This is only used as
|
1296
|
+
* a cache in order to implement “get0” functions that return a non-owning
|
1297
|
+
* pointer to the certificate chain. */
|
1298
|
+
STACK_OF(X509) *x509_chain;
|
1299
|
+
|
1300
|
+
/* x509_leaf may contain a parsed copy of the first element of |chain|. This
|
1301
|
+
* is only used as a cache in order to implement “get0” functions that return
|
1302
|
+
* a non-owning pointer to the certificate chain. */
|
1303
|
+
X509 *x509_leaf;
|
1304
|
+
|
1305
|
+
/* x509_stash contains the last |X509| object append to the chain. This is a
|
1306
|
+
* workaround for some third-party code that continue to use an |X509| object
|
1307
|
+
* even after passing ownership with an “add0” function. */
|
1308
|
+
X509 *x509_stash;
|
1053
1309
|
|
1054
1310
|
/* key_method, if non-NULL, is a set of callbacks to call for private key
|
1055
1311
|
* operations. */
|
1056
1312
|
const SSL_PRIVATE_KEY_METHOD *key_method;
|
1057
1313
|
|
1058
|
-
/*
|
1059
|
-
*
|
1060
|
-
|
1061
|
-
* TODO(davidben): Remove these. They get checked twice: when sending the
|
1062
|
-
* ClientHello and when processing the ServerHello. */
|
1063
|
-
uint32_t mask_k;
|
1064
|
-
uint32_t mask_a;
|
1314
|
+
/* x509_method contains pointers to functions that might deal with |X509|
|
1315
|
+
* compatibility, or might be a no-op, depending on the application. */
|
1316
|
+
const SSL_X509_METHOD *x509_method;
|
1065
1317
|
|
1066
1318
|
DH *dh_tmp;
|
1067
1319
|
DH *(*dh_tmp_cb)(SSL *ssl, int is_export, int keysize);
|
@@ -1083,6 +1335,17 @@ typedef struct cert_st {
|
|
1083
1335
|
/* Optional X509_STORE for certificate validation. If NULL the parent SSL_CTX
|
1084
1336
|
* store is used instead. */
|
1085
1337
|
X509_STORE *verify_store;
|
1338
|
+
|
1339
|
+
/* Signed certificate timestamp list to be sent to the client, if requested */
|
1340
|
+
CRYPTO_BUFFER *signed_cert_timestamp_list;
|
1341
|
+
|
1342
|
+
/* OCSP response to be sent to the client, if requested. */
|
1343
|
+
CRYPTO_BUFFER *ocsp_response;
|
1344
|
+
|
1345
|
+
/* sid_ctx partitions the session space within a shared session cache or
|
1346
|
+
* ticket key. Only sessions with a matching value will be accepted. */
|
1347
|
+
uint8_t sid_ctx_length;
|
1348
|
+
uint8_t sid_ctx[SSL_MAX_SID_CTX_LENGTH];
|
1086
1349
|
} CERT;
|
1087
1350
|
|
1088
1351
|
/* SSL_METHOD is a compatibility structure to support the legacy version-locked
|
@@ -1094,6 +1357,9 @@ struct ssl_method_st {
|
|
1094
1357
|
/* method is the underlying SSL_PROTOCOL_METHOD that initializes the
|
1095
1358
|
* SSL_CTX. */
|
1096
1359
|
const SSL_PROTOCOL_METHOD *method;
|
1360
|
+
/* x509_method contains pointers to functions that might deal with |X509|
|
1361
|
+
* compatibility, or might be a no-op, depending on the application. */
|
1362
|
+
const SSL_X509_METHOD *x509_method;
|
1097
1363
|
};
|
1098
1364
|
|
1099
1365
|
/* Used to hold functions for SSLv2 or SSLv3/TLSv1 functions */
|
@@ -1113,16 +1379,13 @@ struct ssl_protocol_method_st {
|
|
1113
1379
|
uint16_t (*version_to_wire)(uint16_t version);
|
1114
1380
|
int (*ssl_new)(SSL *ssl);
|
1115
1381
|
void (*ssl_free)(SSL *ssl);
|
1116
|
-
/* ssl_get_message reads the next handshake message.
|
1117
|
-
*
|
1118
|
-
*
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
* handshake hash. It returns one on success and zero on allocation
|
1124
|
-
* failure. */
|
1125
|
-
int (*hash_current_message)(SSL *ssl);
|
1382
|
+
/* ssl_get_message reads the next handshake message. On success, it returns
|
1383
|
+
* one and sets |ssl->s3->tmp.message_type|, |ssl->init_msg|, and
|
1384
|
+
* |ssl->init_num|. Otherwise, it returns <= 0. */
|
1385
|
+
int (*ssl_get_message)(SSL *ssl);
|
1386
|
+
/* get_current_message sets |*out| to the current handshake message. This
|
1387
|
+
* includes the protocol-specific message header. */
|
1388
|
+
void (*get_current_message)(const SSL *ssl, CBS *out);
|
1126
1389
|
/* release_current_message is called to release the current handshake message.
|
1127
1390
|
* If |free_buffer| is one, buffers will also be released. */
|
1128
1391
|
void (*release_current_message)(SSL *ssl, int free_buffer);
|
@@ -1131,11 +1394,11 @@ struct ssl_protocol_method_st {
|
|
1131
1394
|
* and sets |*out_got_handshake| to whether the failure was due to a
|
1132
1395
|
* post-handshake handshake message. If so, it fills in the current message as
|
1133
1396
|
* in |ssl_get_message|. */
|
1134
|
-
int (*read_app_data)(SSL *ssl, int *out_got_handshake,
|
1397
|
+
int (*read_app_data)(SSL *ssl, int *out_got_handshake, uint8_t *buf, int len,
|
1135
1398
|
int peek);
|
1136
1399
|
int (*read_change_cipher_spec)(SSL *ssl);
|
1137
1400
|
void (*read_close_notify)(SSL *ssl);
|
1138
|
-
int (*write_app_data)(SSL *ssl, const
|
1401
|
+
int (*write_app_data)(SSL *ssl, const uint8_t *buf, int len);
|
1139
1402
|
int (*dispatch_alert)(SSL *ssl);
|
1140
1403
|
/* supports_cipher returns one if |cipher| is supported by this protocol and
|
1141
1404
|
* zero otherwise. */
|
@@ -1144,14 +1407,24 @@ struct ssl_protocol_method_st {
|
|
1144
1407
|
* root CBB to be passed into |finish_message|. |*body| is set to a child CBB
|
1145
1408
|
* the caller should write to. It returns one on success and zero on error. */
|
1146
1409
|
int (*init_message)(SSL *ssl, CBB *cbb, CBB *body, uint8_t type);
|
1147
|
-
/* finish_message finishes a handshake message
|
1148
|
-
*
|
1149
|
-
|
1150
|
-
|
1410
|
+
/* finish_message finishes a handshake message. It sets |*out_msg| to a
|
1411
|
+
* newly-allocated buffer with the serialized message. The caller must
|
1412
|
+
* release it with |OPENSSL_free| when done. It returns one on success and
|
1413
|
+
* zero on error. */
|
1414
|
+
int (*finish_message)(SSL *ssl, CBB *cbb, uint8_t **out_msg, size_t *out_len);
|
1415
|
+
/* add_message adds a handshake message to the pending flight. It returns one
|
1416
|
+
* on success and zero on error. In either case, it takes ownership of |msg|
|
1417
|
+
* and releases it with |OPENSSL_free| when done. */
|
1418
|
+
int (*add_message)(SSL *ssl, uint8_t *msg, size_t len);
|
1419
|
+
/* add_change_cipher_spec adds a ChangeCipherSpec record to the pending
|
1420
|
+
* flight. It returns one on success and zero on error. */
|
1421
|
+
int (*add_change_cipher_spec)(SSL *ssl);
|
1422
|
+
/* add_alert adds an alert to the pending flight. It returns one on success
|
1423
|
+
* and zero on error. */
|
1424
|
+
int (*add_alert)(SSL *ssl, uint8_t level, uint8_t desc);
|
1425
|
+
/* flush_flight flushes the pending flight to the transport. It returns one on
|
1151
1426
|
* success and <= 0 on error. */
|
1152
|
-
int (*
|
1153
|
-
/* send_change_cipher_spec sends a ChangeCipherSpec message. */
|
1154
|
-
int (*send_change_cipher_spec)(SSL *ssl);
|
1427
|
+
int (*flush_flight)(SSL *ssl);
|
1155
1428
|
/* expect_flight is called when the handshake expects a flight of messages from
|
1156
1429
|
* the peer. */
|
1157
1430
|
void (*expect_flight)(SSL *ssl);
|
@@ -1168,20 +1441,221 @@ struct ssl_protocol_method_st {
|
|
1168
1441
|
int (*set_write_state)(SSL *ssl, SSL_AEAD_CTX *aead_ctx);
|
1169
1442
|
};
|
1170
1443
|
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
/*
|
1175
|
-
*
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1444
|
+
struct ssl_x509_method_st {
|
1445
|
+
/* cert_clear frees and NULLs all X509-related state. */
|
1446
|
+
void (*cert_clear)(CERT *cert);
|
1447
|
+
/* cert_flush_cached_chain drops any cached |X509|-based certificate chain
|
1448
|
+
* from |cert|. */
|
1449
|
+
void (*cert_flush_cached_chain)(CERT *cert);
|
1450
|
+
/* cert_flush_cached_chain drops any cached |X509|-based leaf certificate
|
1451
|
+
* from |cert|. */
|
1452
|
+
void (*cert_flush_cached_leaf)(CERT *cert);
|
1453
|
+
|
1454
|
+
/* session_cache_objects fills out |sess->x509_peer| and |sess->x509_chain|
|
1455
|
+
* from |sess->certs| and erases |sess->x509_chain_without_leaf|. It returns
|
1456
|
+
* one on success or zero on error. */
|
1457
|
+
int (*session_cache_objects)(SSL_SESSION *session);
|
1458
|
+
/* session_dup duplicates any needed fields from |session| to |new_session|.
|
1459
|
+
* It returns one on success or zero on error. */
|
1460
|
+
int (*session_dup)(SSL_SESSION *new_session, const SSL_SESSION *session);
|
1461
|
+
/* session_clear frees any X509-related state from |session|. */
|
1462
|
+
void (*session_clear)(SSL_SESSION *session);
|
1463
|
+
};
|
1464
|
+
|
1465
|
+
/* ssl_noop_x509_method is implements the |ssl_x509_method_st| functions by
|
1466
|
+
* doing nothing. */
|
1467
|
+
extern const struct ssl_x509_method_st ssl_noop_x509_method;
|
1468
|
+
|
1469
|
+
/* ssl_crypto_x509_method provides the |ssl_x509_method_st| functions using
|
1470
|
+
* crypto/x509. */
|
1471
|
+
extern const struct ssl_x509_method_st ssl_crypto_x509_method;
|
1472
|
+
|
1473
|
+
typedef struct ssl3_record_st {
|
1474
|
+
/* type is the record type. */
|
1475
|
+
uint8_t type;
|
1476
|
+
/* length is the number of unconsumed bytes in the record. */
|
1477
|
+
uint16_t length;
|
1478
|
+
/* data is a non-owning pointer to the first unconsumed byte of the record. */
|
1479
|
+
uint8_t *data;
|
1480
|
+
} SSL3_RECORD;
|
1481
|
+
|
1482
|
+
typedef struct ssl3_buffer_st {
|
1483
|
+
/* buf is the memory allocated for this buffer. */
|
1484
|
+
uint8_t *buf;
|
1485
|
+
/* offset is the offset into |buf| which the buffer contents start at. */
|
1486
|
+
uint16_t offset;
|
1487
|
+
/* len is the length of the buffer contents from |buf| + |offset|. */
|
1488
|
+
uint16_t len;
|
1489
|
+
/* cap is how much memory beyond |buf| + |offset| is available. */
|
1490
|
+
uint16_t cap;
|
1491
|
+
} SSL3_BUFFER;
|
1492
|
+
|
1493
|
+
/* An ssl_shutdown_t describes the shutdown state of one end of the connection,
|
1494
|
+
* whether it is alive or has been shutdown via close_notify or fatal alert. */
|
1495
|
+
enum ssl_shutdown_t {
|
1496
|
+
ssl_shutdown_none = 0,
|
1497
|
+
ssl_shutdown_close_notify = 1,
|
1498
|
+
ssl_shutdown_fatal_alert = 2,
|
1183
1499
|
};
|
1184
1500
|
|
1501
|
+
typedef struct ssl3_state_st {
|
1502
|
+
uint8_t read_sequence[8];
|
1503
|
+
uint8_t write_sequence[8];
|
1504
|
+
|
1505
|
+
uint8_t server_random[SSL3_RANDOM_SIZE];
|
1506
|
+
uint8_t client_random[SSL3_RANDOM_SIZE];
|
1507
|
+
|
1508
|
+
/* read_buffer holds data from the transport to be processed. */
|
1509
|
+
SSL3_BUFFER read_buffer;
|
1510
|
+
/* write_buffer holds data to be written to the transport. */
|
1511
|
+
SSL3_BUFFER write_buffer;
|
1512
|
+
|
1513
|
+
SSL3_RECORD rrec; /* each decoded record goes in here */
|
1514
|
+
|
1515
|
+
/* partial write - check the numbers match */
|
1516
|
+
unsigned int wnum; /* number of bytes sent so far */
|
1517
|
+
int wpend_tot; /* number bytes written */
|
1518
|
+
int wpend_type;
|
1519
|
+
int wpend_ret; /* number of bytes submitted */
|
1520
|
+
const uint8_t *wpend_buf;
|
1521
|
+
|
1522
|
+
/* recv_shutdown is the shutdown state for the receive half of the
|
1523
|
+
* connection. */
|
1524
|
+
enum ssl_shutdown_t recv_shutdown;
|
1525
|
+
|
1526
|
+
/* recv_shutdown is the shutdown state for the send half of the connection. */
|
1527
|
+
enum ssl_shutdown_t send_shutdown;
|
1528
|
+
|
1529
|
+
int alert_dispatch;
|
1530
|
+
|
1531
|
+
int total_renegotiations;
|
1532
|
+
|
1533
|
+
/* early_data_skipped is the amount of early data that has been skipped by the
|
1534
|
+
* record layer. */
|
1535
|
+
uint16_t early_data_skipped;
|
1536
|
+
|
1537
|
+
/* empty_record_count is the number of consecutive empty records received. */
|
1538
|
+
uint8_t empty_record_count;
|
1539
|
+
|
1540
|
+
/* warning_alert_count is the number of consecutive warning alerts
|
1541
|
+
* received. */
|
1542
|
+
uint8_t warning_alert_count;
|
1543
|
+
|
1544
|
+
/* key_update_count is the number of consecutive KeyUpdates received. */
|
1545
|
+
uint8_t key_update_count;
|
1546
|
+
|
1547
|
+
/* skip_early_data instructs the record layer to skip unexpected early data
|
1548
|
+
* messages when 0RTT is rejected. */
|
1549
|
+
unsigned skip_early_data:1;
|
1550
|
+
|
1551
|
+
/* have_version is true if the connection's final version is known. Otherwise
|
1552
|
+
* the version has not been negotiated yet. */
|
1553
|
+
unsigned have_version:1;
|
1554
|
+
|
1555
|
+
/* v2_hello_done is true if the peer's V2ClientHello, if any, has been handled
|
1556
|
+
* and future messages should use the record layer. */
|
1557
|
+
unsigned v2_hello_done:1;
|
1558
|
+
|
1559
|
+
/* is_v2_hello is true if the current handshake message was derived from a
|
1560
|
+
* V2ClientHello rather than received from the peer directly. */
|
1561
|
+
unsigned is_v2_hello:1;
|
1562
|
+
|
1563
|
+
/* initial_handshake_complete is true if the initial handshake has
|
1564
|
+
* completed. */
|
1565
|
+
unsigned initial_handshake_complete:1;
|
1566
|
+
|
1567
|
+
/* session_reused indicates whether a session was resumed. */
|
1568
|
+
unsigned session_reused:1;
|
1569
|
+
|
1570
|
+
unsigned send_connection_binding:1;
|
1571
|
+
|
1572
|
+
/* In a client, this means that the server supported Channel ID and that a
|
1573
|
+
* Channel ID was sent. In a server it means that we echoed support for
|
1574
|
+
* Channel IDs and that tlsext_channel_id will be valid after the
|
1575
|
+
* handshake. */
|
1576
|
+
unsigned tlsext_channel_id_valid:1;
|
1577
|
+
|
1578
|
+
/* short_header is one if https://github.com/tlswg/tls13-spec/pull/762 has
|
1579
|
+
* been negotiated. */
|
1580
|
+
unsigned short_header:1;
|
1581
|
+
|
1582
|
+
uint8_t send_alert[2];
|
1583
|
+
|
1584
|
+
/* pending_flight is the pending outgoing flight. This is used to flush each
|
1585
|
+
* handshake flight in a single write. */
|
1586
|
+
BUF_MEM *pending_flight;
|
1587
|
+
|
1588
|
+
/* pending_flight_offset is the number of bytes of |pending_flight| which have
|
1589
|
+
* been successfully written. */
|
1590
|
+
uint32_t pending_flight_offset;
|
1591
|
+
|
1592
|
+
/* aead_read_ctx is the current read cipher state. */
|
1593
|
+
SSL_AEAD_CTX *aead_read_ctx;
|
1594
|
+
|
1595
|
+
/* aead_write_ctx is the current write cipher state. */
|
1596
|
+
SSL_AEAD_CTX *aead_write_ctx;
|
1597
|
+
|
1598
|
+
/* hs is the handshake state for the current handshake or NULL if there isn't
|
1599
|
+
* one. */
|
1600
|
+
SSL_HANDSHAKE *hs;
|
1601
|
+
|
1602
|
+
uint8_t write_traffic_secret[EVP_MAX_MD_SIZE];
|
1603
|
+
uint8_t read_traffic_secret[EVP_MAX_MD_SIZE];
|
1604
|
+
uint8_t exporter_secret[EVP_MAX_MD_SIZE];
|
1605
|
+
uint8_t write_traffic_secret_len;
|
1606
|
+
uint8_t read_traffic_secret_len;
|
1607
|
+
uint8_t exporter_secret_len;
|
1608
|
+
|
1609
|
+
/* Connection binding to prevent renegotiation attacks */
|
1610
|
+
uint8_t previous_client_finished[12];
|
1611
|
+
uint8_t previous_client_finished_len;
|
1612
|
+
uint8_t previous_server_finished_len;
|
1613
|
+
uint8_t previous_server_finished[12];
|
1614
|
+
|
1615
|
+
/* State pertaining to the pending handshake.
|
1616
|
+
*
|
1617
|
+
* TODO(davidben): Move everything not needed after the handshake completes to
|
1618
|
+
* |hs| and remove this. */
|
1619
|
+
struct {
|
1620
|
+
int message_type;
|
1621
|
+
|
1622
|
+
int reuse_message;
|
1623
|
+
|
1624
|
+
uint8_t new_mac_secret_len;
|
1625
|
+
uint8_t new_key_len;
|
1626
|
+
uint8_t new_fixed_iv_len;
|
1627
|
+
} tmp;
|
1628
|
+
|
1629
|
+
/* established_session is the session established by the connection. This
|
1630
|
+
* session is only filled upon the completion of the handshake and is
|
1631
|
+
* immutable. */
|
1632
|
+
SSL_SESSION *established_session;
|
1633
|
+
|
1634
|
+
/* Next protocol negotiation. For the client, this is the protocol that we
|
1635
|
+
* sent in NextProtocol and is set when handling ServerHello extensions.
|
1636
|
+
*
|
1637
|
+
* For a server, this is the client's selected_protocol from NextProtocol and
|
1638
|
+
* is set when handling the NextProtocol message, before the Finished
|
1639
|
+
* message. */
|
1640
|
+
uint8_t *next_proto_negotiated;
|
1641
|
+
size_t next_proto_negotiated_len;
|
1642
|
+
|
1643
|
+
/* ALPN information
|
1644
|
+
* (we are in the process of transitioning from NPN to ALPN.) */
|
1645
|
+
|
1646
|
+
/* In a server these point to the selected ALPN protocol after the
|
1647
|
+
* ClientHello has been processed. In a client these contain the protocol
|
1648
|
+
* that the server selected once the ServerHello has been processed. */
|
1649
|
+
uint8_t *alpn_selected;
|
1650
|
+
size_t alpn_selected_len;
|
1651
|
+
|
1652
|
+
/* For a server:
|
1653
|
+
* If |tlsext_channel_id_valid| is true, then this contains the
|
1654
|
+
* verified Channel ID from the client: a P256 point, (x,y), where
|
1655
|
+
* each are big-endian values. */
|
1656
|
+
uint8_t tlsext_channel_id[64];
|
1657
|
+
} SSL3_STATE;
|
1658
|
+
|
1185
1659
|
/* lengths of messages */
|
1186
1660
|
#define DTLS1_COOKIE_LENGTH 256
|
1187
1661
|
|
@@ -1250,6 +1724,13 @@ typedef struct dtls1_state_st {
|
|
1250
1724
|
DTLS_OUTGOING_MESSAGE outgoing_messages[SSL_MAX_HANDSHAKE_FLIGHT];
|
1251
1725
|
uint8_t outgoing_messages_len;
|
1252
1726
|
|
1727
|
+
/* outgoing_written is the number of outgoing messages that have been
|
1728
|
+
* written. */
|
1729
|
+
uint8_t outgoing_written;
|
1730
|
+
/* outgoing_offset is the number of bytes of the next outgoing message have
|
1731
|
+
* been written. */
|
1732
|
+
uint32_t outgoing_offset;
|
1733
|
+
|
1253
1734
|
unsigned int mtu; /* max DTLS packet size */
|
1254
1735
|
|
1255
1736
|
/* num_timeouts is the number of times the retransmit timer has fired since
|
@@ -1264,21 +1745,186 @@ typedef struct dtls1_state_st {
|
|
1264
1745
|
unsigned timeout_duration_ms;
|
1265
1746
|
} DTLS1_STATE;
|
1266
1747
|
|
1267
|
-
|
1268
|
-
|
1748
|
+
struct ssl_st {
|
1749
|
+
/* method is the method table corresponding to the current protocol (DTLS or
|
1750
|
+
* TLS). */
|
1751
|
+
const SSL_PROTOCOL_METHOD *method;
|
1752
|
+
|
1753
|
+
/* version is the protocol version. */
|
1754
|
+
int version;
|
1755
|
+
|
1756
|
+
/* max_version is the maximum acceptable protocol version. Note this version
|
1757
|
+
* is normalized in DTLS. */
|
1758
|
+
uint16_t max_version;
|
1759
|
+
|
1760
|
+
/* min_version is the minimum acceptable protocol version. Note this version
|
1761
|
+
* is normalized in DTLS. */
|
1762
|
+
uint16_t min_version;
|
1763
|
+
|
1764
|
+
uint16_t max_send_fragment;
|
1765
|
+
|
1766
|
+
/* There are 2 BIO's even though they are normally both the same. This is so
|
1767
|
+
* data can be read and written to different handlers */
|
1768
|
+
|
1769
|
+
BIO *rbio; /* used by SSL_read */
|
1770
|
+
BIO *wbio; /* used by SSL_write */
|
1771
|
+
|
1772
|
+
int (*handshake_func)(SSL_HANDSHAKE *hs);
|
1773
|
+
|
1774
|
+
BUF_MEM *init_buf; /* buffer used during init */
|
1775
|
+
|
1776
|
+
/* init_msg is a pointer to the current handshake message body. */
|
1777
|
+
const uint8_t *init_msg;
|
1778
|
+
/* init_num is the length of the current handshake message body. */
|
1779
|
+
uint32_t init_num;
|
1780
|
+
|
1781
|
+
struct ssl3_state_st *s3; /* SSLv3 variables */
|
1782
|
+
struct dtls1_state_st *d1; /* DTLSv1 variables */
|
1269
1783
|
|
1270
|
-
/*
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1784
|
+
/* callback that allows applications to peek at protocol messages */
|
1785
|
+
void (*msg_callback)(int write_p, int version, int content_type,
|
1786
|
+
const void *buf, size_t len, SSL *ssl, void *arg);
|
1787
|
+
void *msg_callback_arg;
|
1274
1788
|
|
1275
|
-
|
1789
|
+
X509_VERIFY_PARAM *param;
|
1790
|
+
|
1791
|
+
/* crypto */
|
1792
|
+
struct ssl_cipher_preference_list_st *cipher_list;
|
1793
|
+
|
1794
|
+
/* session info */
|
1795
|
+
|
1796
|
+
/* client cert? */
|
1797
|
+
/* This is used to hold the server certificate used */
|
1798
|
+
struct cert_st /* CERT */ *cert;
|
1799
|
+
|
1800
|
+
/* This holds a variable that indicates what we were doing when a 0 or -1 is
|
1801
|
+
* returned. This is needed for non-blocking IO so we know what request
|
1802
|
+
* needs re-doing when in SSL_accept or SSL_connect */
|
1803
|
+
int rwstate;
|
1804
|
+
|
1805
|
+
/* initial_timeout_duration_ms is the default DTLS timeout duration in
|
1806
|
+
* milliseconds. It's used to initialize the timer any time it's restarted. */
|
1807
|
+
unsigned initial_timeout_duration_ms;
|
1808
|
+
|
1809
|
+
/* session is the configured session to be offered by the client. This session
|
1810
|
+
* is immutable. */
|
1811
|
+
SSL_SESSION *session;
|
1812
|
+
|
1813
|
+
int (*verify_callback)(int ok,
|
1814
|
+
X509_STORE_CTX *ctx); /* fail if callback returns 0 */
|
1815
|
+
|
1816
|
+
void (*info_callback)(const SSL *ssl, int type, int value);
|
1817
|
+
|
1818
|
+
/* Server-only: psk_identity_hint is the identity hint to send in
|
1819
|
+
* PSK-based key exchanges. */
|
1820
|
+
char *psk_identity_hint;
|
1821
|
+
|
1822
|
+
unsigned int (*psk_client_callback)(SSL *ssl, const char *hint,
|
1823
|
+
char *identity,
|
1824
|
+
unsigned int max_identity_len,
|
1825
|
+
uint8_t *psk, unsigned int max_psk_len);
|
1826
|
+
unsigned int (*psk_server_callback)(SSL *ssl, const char *identity,
|
1827
|
+
uint8_t *psk, unsigned int max_psk_len);
|
1828
|
+
|
1829
|
+
SSL_CTX *ctx;
|
1830
|
+
|
1831
|
+
/* extra application data */
|
1832
|
+
CRYPTO_EX_DATA ex_data;
|
1833
|
+
|
1834
|
+
/* for server side, keep the list of CA_dn we can use */
|
1835
|
+
STACK_OF(X509_NAME) *client_CA;
|
1836
|
+
|
1837
|
+
uint32_t options; /* protocol behaviour */
|
1838
|
+
uint32_t mode; /* API behaviour */
|
1839
|
+
uint32_t max_cert_list;
|
1840
|
+
char *tlsext_hostname;
|
1841
|
+
size_t supported_group_list_len;
|
1842
|
+
uint16_t *supported_group_list; /* our list */
|
1843
|
+
|
1844
|
+
SSL_CTX *initial_ctx; /* initial ctx, used to store sessions */
|
1845
|
+
|
1846
|
+
/* srtp_profiles is the list of configured SRTP protection profiles for
|
1847
|
+
* DTLS-SRTP. */
|
1848
|
+
STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles;
|
1849
|
+
|
1850
|
+
/* srtp_profile is the selected SRTP protection profile for
|
1851
|
+
* DTLS-SRTP. */
|
1852
|
+
const SRTP_PROTECTION_PROFILE *srtp_profile;
|
1853
|
+
|
1854
|
+
/* The client's Channel ID private key. */
|
1855
|
+
EVP_PKEY *tlsext_channel_id_private;
|
1856
|
+
|
1857
|
+
/* For a client, this contains the list of supported protocols in wire
|
1858
|
+
* format. */
|
1859
|
+
uint8_t *alpn_client_proto_list;
|
1860
|
+
unsigned alpn_client_proto_list_len;
|
1861
|
+
|
1862
|
+
/* renegotiate_mode controls how peer renegotiation attempts are handled. */
|
1863
|
+
enum ssl_renegotiate_mode_t renegotiate_mode;
|
1864
|
+
|
1865
|
+
/* verify_mode is a bitmask of |SSL_VERIFY_*| values. */
|
1866
|
+
uint8_t verify_mode;
|
1867
|
+
|
1868
|
+
/* server is true iff the this SSL* is the server half. Note: before the SSL*
|
1869
|
+
* is initialized by either SSL_set_accept_state or SSL_set_connect_state,
|
1870
|
+
* the side is not determined. In this state, server is always false. */
|
1871
|
+
unsigned server:1;
|
1872
|
+
|
1873
|
+
/* quiet_shutdown is true if the connection should not send a close_notify on
|
1874
|
+
* shutdown. */
|
1875
|
+
unsigned quiet_shutdown:1;
|
1876
|
+
|
1877
|
+
/* Enable signed certificate time stamps. Currently client only. */
|
1878
|
+
unsigned signed_cert_timestamps_enabled:1;
|
1879
|
+
|
1880
|
+
/* ocsp_stapling_enabled is only used by client connections and indicates
|
1881
|
+
* whether OCSP stapling will be requested. */
|
1882
|
+
unsigned ocsp_stapling_enabled:1;
|
1883
|
+
|
1884
|
+
/* tlsext_channel_id_enabled is copied from the |SSL_CTX|. For a server,
|
1885
|
+
* means that we'll accept Channel IDs from clients. For a client, means that
|
1886
|
+
* we'll advertise support. */
|
1887
|
+
unsigned tlsext_channel_id_enabled:1;
|
1888
|
+
|
1889
|
+
/* retain_only_sha256_of_client_certs is true if we should compute the SHA256
|
1890
|
+
* hash of the peer's certificate and then discard it to save memory and
|
1891
|
+
* session space. Only effective on the server side. */
|
1892
|
+
unsigned retain_only_sha256_of_client_certs:1;
|
1893
|
+
};
|
1894
|
+
|
1895
|
+
/* From draft-ietf-tls-tls13-18, used in determining PSK modes. */
|
1896
|
+
#define SSL_PSK_KE 0x0
|
1897
|
+
#define SSL_PSK_DHE_KE 0x1
|
1898
|
+
|
1899
|
+
/* From draft-ietf-tls-tls13-16, used in determining whether to respond with a
|
1900
|
+
* KeyUpdate. */
|
1901
|
+
#define SSL_KEY_UPDATE_NOT_REQUESTED 0
|
1902
|
+
#define SSL_KEY_UPDATE_REQUESTED 1
|
1903
|
+
|
1904
|
+
CERT *ssl_cert_new(const SSL_X509_METHOD *x509_method);
|
1276
1905
|
CERT *ssl_cert_dup(CERT *cert);
|
1277
1906
|
void ssl_cert_clear_certs(CERT *c);
|
1278
1907
|
void ssl_cert_free(CERT *c);
|
1279
|
-
int
|
1908
|
+
int ssl_set_cert(CERT *cert, CRYPTO_BUFFER *buffer);
|
1909
|
+
int ssl_is_key_type_supported(int key_type);
|
1910
|
+
/* ssl_compare_public_and_private_key returns one if |pubkey| is the public
|
1911
|
+
* counterpart to |privkey|. Otherwise it returns zero and pushes a helpful
|
1912
|
+
* message on the error queue. */
|
1913
|
+
int ssl_compare_public_and_private_key(const EVP_PKEY *pubkey,
|
1914
|
+
const EVP_PKEY *privkey);
|
1915
|
+
int ssl_cert_check_private_key(const CERT *cert, const EVP_PKEY *privkey);
|
1916
|
+
int ssl_get_new_session(SSL_HANDSHAKE *hs, int is_server);
|
1280
1917
|
int ssl_encrypt_ticket(SSL *ssl, CBB *out, const SSL_SESSION *session);
|
1281
1918
|
|
1919
|
+
/* ssl_session_new returns a newly-allocated blank |SSL_SESSION| or NULL on
|
1920
|
+
* error. */
|
1921
|
+
SSL_SESSION *ssl_session_new(const SSL_X509_METHOD *x509_method);
|
1922
|
+
|
1923
|
+
/* SSL_SESSION_parse parses an |SSL_SESSION| from |cbs| and advances |cbs| over
|
1924
|
+
* the parsed data. */
|
1925
|
+
SSL_SESSION *SSL_SESSION_parse(CBS *cbs, const SSL_X509_METHOD *x509_method,
|
1926
|
+
CRYPTO_BUFFER_POOL *pool);
|
1927
|
+
|
1282
1928
|
/* ssl_session_is_context_valid returns one if |session|'s session ID context
|
1283
1929
|
* matches the one set on |ssl| and zero otherwise. */
|
1284
1930
|
int ssl_session_is_context_valid(const SSL *ssl, const SSL_SESSION *session);
|
@@ -1287,6 +1933,16 @@ int ssl_session_is_context_valid(const SSL *ssl, const SSL_SESSION *session);
|
|
1287
1933
|
* it has expired. */
|
1288
1934
|
int ssl_session_is_time_valid(const SSL *ssl, const SSL_SESSION *session);
|
1289
1935
|
|
1936
|
+
/* ssl_session_is_resumable returns one if |session| is resumable for |hs| and
|
1937
|
+
* zero otherwise. */
|
1938
|
+
int ssl_session_is_resumable(const SSL_HANDSHAKE *hs,
|
1939
|
+
const SSL_SESSION *session);
|
1940
|
+
|
1941
|
+
/* SSL_SESSION_get_digest returns the digest used in |session|. If the digest is
|
1942
|
+
* invalid, it returns NULL. */
|
1943
|
+
const EVP_MD *SSL_SESSION_get_digest(const SSL_SESSION *session,
|
1944
|
+
const SSL *ssl);
|
1945
|
+
|
1290
1946
|
void ssl_set_session(SSL *ssl, SSL_SESSION *session);
|
1291
1947
|
|
1292
1948
|
enum ssl_session_result_t {
|
@@ -1295,15 +1951,14 @@ enum ssl_session_result_t {
|
|
1295
1951
|
ssl_session_retry,
|
1296
1952
|
};
|
1297
1953
|
|
1298
|
-
/* ssl_get_prev_session looks up the previous session based on |
|
1299
|
-
* success, it sets |*out_session| to the session or NULL if none was found.
|
1300
|
-
*
|
1301
|
-
* handshake. If the session could not be looked up synchronously, it returns
|
1954
|
+
/* ssl_get_prev_session looks up the previous session based on |client_hello|.
|
1955
|
+
* On success, it sets |*out_session| to the session or NULL if none was found.
|
1956
|
+
* If the session could not be looked up synchronously, it returns
|
1302
1957
|
* |ssl_session_retry| and should be called again. Otherwise, it returns
|
1303
1958
|
* |ssl_session_error|. */
|
1304
1959
|
enum ssl_session_result_t ssl_get_prev_session(
|
1305
|
-
SSL *ssl, SSL_SESSION **out_session, int *
|
1306
|
-
const
|
1960
|
+
SSL *ssl, SSL_SESSION **out_session, int *out_tickets_supported,
|
1961
|
+
int *out_renew_ticket, const SSL_CLIENT_HELLO *client_hello);
|
1307
1962
|
|
1308
1963
|
/* The following flags determine which parts of the session are duplicated. */
|
1309
1964
|
#define SSL_SESSION_DUP_AUTH_ONLY 0x0
|
@@ -1318,77 +1973,72 @@ enum ssl_session_result_t ssl_get_prev_session(
|
|
1318
1973
|
OPENSSL_EXPORT SSL_SESSION *SSL_SESSION_dup(SSL_SESSION *session,
|
1319
1974
|
int dup_flags);
|
1320
1975
|
|
1976
|
+
/* ssl_session_rebase_time updates |session|'s start time to the current time,
|
1977
|
+
* adjusting the timeout so the expiration time is unchanged. */
|
1978
|
+
void ssl_session_rebase_time(SSL *ssl, SSL_SESSION *session);
|
1979
|
+
|
1980
|
+
/* ssl_session_renew_timeout calls |ssl_session_rebase_time| and renews
|
1981
|
+
* |session|'s timeout to |timeout| (measured from the current time). The
|
1982
|
+
* renewal is clamped to the session's auth_timeout. */
|
1983
|
+
void ssl_session_renew_timeout(SSL *ssl, SSL_SESSION *session, long timeout);
|
1984
|
+
|
1321
1985
|
void ssl_cipher_preference_list_free(
|
1322
1986
|
struct ssl_cipher_preference_list_st *cipher_list);
|
1323
|
-
struct ssl_cipher_preference_list_st *ssl_get_cipher_preferences(SSL *ssl);
|
1324
1987
|
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
void ssl_cert_set_cert_cb(CERT *cert,
|
1330
|
-
int (*cb)(SSL *ssl, void *arg), void *arg);
|
1988
|
+
/* ssl_get_cipher_preferences returns the cipher preference list for TLS 1.2 and
|
1989
|
+
* below. */
|
1990
|
+
const struct ssl_cipher_preference_list_st *ssl_get_cipher_preferences(
|
1991
|
+
const SSL *ssl);
|
1331
1992
|
|
1332
1993
|
int ssl_verify_cert_chain(SSL *ssl, long *out_verify_result,
|
1333
|
-
STACK_OF(X509) *
|
1334
|
-
void ssl_update_cache(
|
1994
|
+
STACK_OF(X509) *cert_chain);
|
1995
|
+
void ssl_update_cache(SSL_HANDSHAKE *hs, int mode);
|
1335
1996
|
|
1336
|
-
/* ssl_get_compatible_server_ciphers determines the key exchange and
|
1337
|
-
* authentication cipher suite masks compatible with the server configuration
|
1338
|
-
* and current ClientHello parameters of |ssl|. It sets |*out_mask_k| to the key
|
1339
|
-
* exchange mask and |*out_mask_a| to the authentication mask. */
|
1340
|
-
void ssl_get_compatible_server_ciphers(SSL *ssl, uint32_t *out_mask_k,
|
1341
|
-
uint32_t *out_mask_a);
|
1342
|
-
|
1343
|
-
STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *ssl);
|
1344
1997
|
int ssl_verify_alarm_type(long type);
|
1345
1998
|
|
1346
|
-
int ssl3_get_finished(
|
1347
|
-
int ssl3_send_change_cipher_spec(SSL *ssl);
|
1348
|
-
void ssl3_cleanup_key_block(SSL *ssl);
|
1999
|
+
int ssl3_get_finished(SSL_HANDSHAKE *hs);
|
1349
2000
|
int ssl3_send_alert(SSL *ssl, int level, int desc);
|
1350
|
-
int ssl3_get_message(SSL *ssl
|
1351
|
-
|
1352
|
-
int ssl3_hash_current_message(SSL *ssl);
|
2001
|
+
int ssl3_get_message(SSL *ssl);
|
2002
|
+
void ssl3_get_current_message(const SSL *ssl, CBS *out);
|
1353
2003
|
void ssl3_release_current_message(SSL *ssl, int free_buffer);
|
1354
2004
|
|
1355
|
-
|
1356
|
-
* bytes pointed to by |out| and writes the number of bytes to |*out_len|. |out|
|
1357
|
-
* must have room for |EVP_MAX_MD_SIZE| bytes. It sets |*out_md| to the hash
|
1358
|
-
* function used. It returns one on success and zero on failure. */
|
1359
|
-
int ssl3_cert_verify_hash(SSL *ssl, const EVP_MD **out_md, uint8_t *out,
|
1360
|
-
size_t *out_len, uint16_t signature_algorithm);
|
1361
|
-
|
1362
|
-
int ssl3_send_finished(SSL *ssl, int a, int b);
|
1363
|
-
int ssl3_supports_cipher(const SSL_CIPHER *cipher);
|
2005
|
+
int ssl3_send_finished(SSL_HANDSHAKE *hs);
|
1364
2006
|
int ssl3_dispatch_alert(SSL *ssl);
|
1365
2007
|
int ssl3_read_app_data(SSL *ssl, int *out_got_handshake, uint8_t *buf, int len,
|
1366
2008
|
int peek);
|
1367
2009
|
int ssl3_read_change_cipher_spec(SSL *ssl);
|
1368
2010
|
void ssl3_read_close_notify(SSL *ssl);
|
1369
2011
|
int ssl3_read_handshake_bytes(SSL *ssl, uint8_t *buf, int len);
|
1370
|
-
int ssl3_write_app_data(SSL *ssl, const
|
1371
|
-
int ssl3_write_bytes(SSL *ssl, int type, const void *buf, int len);
|
2012
|
+
int ssl3_write_app_data(SSL *ssl, const uint8_t *buf, int len);
|
1372
2013
|
int ssl3_output_cert_chain(SSL *ssl);
|
1373
|
-
const SSL_CIPHER *ssl3_choose_cipher(
|
1374
|
-
SSL *ssl, const struct ssl_early_callback_ctx *client_hello,
|
1375
|
-
const struct ssl_cipher_preference_list_st *srvr);
|
1376
2014
|
|
1377
2015
|
int ssl3_new(SSL *ssl);
|
1378
2016
|
void ssl3_free(SSL *ssl);
|
1379
|
-
int ssl3_accept(
|
1380
|
-
int ssl3_connect(
|
2017
|
+
int ssl3_accept(SSL_HANDSHAKE *hs);
|
2018
|
+
int ssl3_connect(SSL_HANDSHAKE *hs);
|
1381
2019
|
|
1382
2020
|
int ssl3_init_message(SSL *ssl, CBB *cbb, CBB *body, uint8_t type);
|
1383
|
-
int ssl3_finish_message(SSL *ssl, CBB *cbb);
|
1384
|
-
int
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
2021
|
+
int ssl3_finish_message(SSL *ssl, CBB *cbb, uint8_t **out_msg, size_t *out_len);
|
2022
|
+
int ssl3_add_message(SSL *ssl, uint8_t *msg, size_t len);
|
2023
|
+
int ssl3_add_change_cipher_spec(SSL *ssl);
|
2024
|
+
int ssl3_add_alert(SSL *ssl, uint8_t level, uint8_t desc);
|
2025
|
+
int ssl3_flush_flight(SSL *ssl);
|
1388
2026
|
|
1389
2027
|
int dtls1_init_message(SSL *ssl, CBB *cbb, CBB *body, uint8_t type);
|
1390
|
-
int dtls1_finish_message(SSL *ssl, CBB *cbb
|
1391
|
-
|
2028
|
+
int dtls1_finish_message(SSL *ssl, CBB *cbb, uint8_t **out_msg,
|
2029
|
+
size_t *out_len);
|
2030
|
+
int dtls1_add_message(SSL *ssl, uint8_t *msg, size_t len);
|
2031
|
+
int dtls1_add_change_cipher_spec(SSL *ssl);
|
2032
|
+
int dtls1_add_alert(SSL *ssl, uint8_t level, uint8_t desc);
|
2033
|
+
int dtls1_flush_flight(SSL *ssl);
|
2034
|
+
|
2035
|
+
/* ssl_add_message_cbb finishes the handshake message in |cbb| and adds it to
|
2036
|
+
* the pending flight. It returns one on success and zero on error. */
|
2037
|
+
int ssl_add_message_cbb(SSL *ssl, CBB *cbb);
|
2038
|
+
|
2039
|
+
/* ssl_hash_current_message incorporates the current handshake message into the
|
2040
|
+
* handshake hash. It returns one on success and zero on allocation failure. */
|
2041
|
+
int ssl_hash_current_message(SSL_HANDSHAKE *hs);
|
1392
2042
|
|
1393
2043
|
/* dtls1_get_record reads a new input record. On success, it places it in
|
1394
2044
|
* |ssl->s3->rrec| and returns one. Otherwise it returns <= 0 on error or if
|
@@ -1400,14 +2050,13 @@ int dtls1_read_app_data(SSL *ssl, int *out_got_handshake, uint8_t *buf, int len,
|
|
1400
2050
|
int dtls1_read_change_cipher_spec(SSL *ssl);
|
1401
2051
|
void dtls1_read_close_notify(SSL *ssl);
|
1402
2052
|
|
1403
|
-
int dtls1_write_app_data(SSL *ssl, const
|
2053
|
+
int dtls1_write_app_data(SSL *ssl, const uint8_t *buf, int len);
|
1404
2054
|
|
1405
2055
|
/* dtls1_write_record sends a record. It returns one on success and <= 0 on
|
1406
2056
|
* error. */
|
1407
2057
|
int dtls1_write_record(SSL *ssl, int type, const uint8_t *buf, size_t len,
|
1408
2058
|
enum dtls1_use_epoch_t use_epoch);
|
1409
2059
|
|
1410
|
-
int dtls1_send_change_cipher_spec(SSL *ssl);
|
1411
2060
|
int dtls1_send_finished(SSL *ssl, int a, int b, const char *sender, int slen);
|
1412
2061
|
int dtls1_retransmit_outgoing_messages(SSL *ssl);
|
1413
2062
|
void dtls1_clear_record_buffer(SSL *ssl);
|
@@ -1415,10 +2064,7 @@ int dtls1_parse_fragment(CBS *cbs, struct hm_header_st *out_hdr,
|
|
1415
2064
|
CBS *out_body);
|
1416
2065
|
int dtls1_check_timeout_num(SSL *ssl);
|
1417
2066
|
int dtls1_handshake_write(SSL *ssl);
|
1418
|
-
void dtls1_expect_flight(SSL *ssl);
|
1419
|
-
void dtls1_received_flight(SSL *ssl);
|
1420
2067
|
|
1421
|
-
int dtls1_supports_cipher(const SSL_CIPHER *cipher);
|
1422
2068
|
void dtls1_start_timer(SSL *ssl);
|
1423
2069
|
void dtls1_stop_timer(SSL *ssl);
|
1424
2070
|
int dtls1_is_timer_expired(SSL *ssl);
|
@@ -1430,40 +2076,28 @@ int dtls1_accept(SSL *ssl);
|
|
1430
2076
|
int dtls1_connect(SSL *ssl);
|
1431
2077
|
void dtls1_free(SSL *ssl);
|
1432
2078
|
|
1433
|
-
int dtls1_get_message(SSL *ssl
|
1434
|
-
|
2079
|
+
int dtls1_get_message(SSL *ssl);
|
2080
|
+
void dtls1_get_current_message(const SSL *ssl, CBS *out);
|
1435
2081
|
void dtls1_release_current_message(SSL *ssl, int free_buffer);
|
1436
2082
|
int dtls1_dispatch_alert(SSL *ssl);
|
1437
2083
|
|
1438
|
-
|
1439
|
-
*
|
1440
|
-
|
1441
|
-
|
1442
|
-
int ssl_init_wbio_buffer(SSL *ssl);
|
1443
|
-
void ssl_free_wbio_buffer(SSL *ssl);
|
1444
|
-
|
1445
|
-
int tls1_change_cipher_state(SSL *ssl, int which);
|
1446
|
-
int tls1_setup_key_block(SSL *ssl);
|
1447
|
-
int tls1_handshake_digest(SSL *ssl, uint8_t *out, size_t out_len);
|
1448
|
-
int tls1_generate_master_secret(SSL *ssl, uint8_t *out, const uint8_t *premaster,
|
1449
|
-
size_t premaster_len);
|
2084
|
+
int tls1_change_cipher_state(SSL_HANDSHAKE *hs, int which);
|
2085
|
+
int tls1_generate_master_secret(SSL_HANDSHAKE *hs, uint8_t *out,
|
2086
|
+
const uint8_t *premaster, size_t premaster_len);
|
1450
2087
|
|
1451
2088
|
/* tls1_get_grouplist sets |*out_group_ids| and |*out_group_ids_len| to the
|
1452
|
-
*
|
1453
|
-
*
|
1454
|
-
void tls1_get_grouplist(SSL *ssl, int get_peer_groups,
|
1455
|
-
const uint16_t **out_group_ids,
|
2089
|
+
* locally-configured group preference list. */
|
2090
|
+
void tls1_get_grouplist(SSL *ssl, const uint16_t **out_group_ids,
|
1456
2091
|
size_t *out_group_ids_len);
|
1457
2092
|
|
1458
|
-
/* tls1_check_group_id returns one if |group_id| is consistent with
|
1459
|
-
*
|
1460
|
-
* preferences are checked; the peer (the server) does not send preferences. */
|
2093
|
+
/* tls1_check_group_id returns one if |group_id| is consistent with
|
2094
|
+
* locally-configured group preferences. */
|
1461
2095
|
int tls1_check_group_id(SSL *ssl, uint16_t group_id);
|
1462
2096
|
|
1463
2097
|
/* tls1_get_shared_group sets |*out_group_id| to the first preferred shared
|
1464
2098
|
* group between client and server preferences and returns one. If none may be
|
1465
2099
|
* found, it returns zero. */
|
1466
|
-
int tls1_get_shared_group(
|
2100
|
+
int tls1_get_shared_group(SSL_HANDSHAKE *hs, uint16_t *out_group_id);
|
1467
2101
|
|
1468
2102
|
/* tls1_set_curves converts the array of |ncurves| NIDs pointed to by |curves|
|
1469
2103
|
* into a newly allocated array of TLS group IDs. On success, the function
|
@@ -1472,21 +2106,23 @@ int tls1_get_shared_group(SSL *ssl, uint16_t *out_group_id);
|
|
1472
2106
|
int tls1_set_curves(uint16_t **out_group_ids, size_t *out_group_ids_len,
|
1473
2107
|
const int *curves, size_t ncurves);
|
1474
2108
|
|
1475
|
-
/*
|
1476
|
-
*
|
1477
|
-
*
|
1478
|
-
|
2109
|
+
/* tls1_set_curves_list converts the string of curves pointed to by |curves|
|
2110
|
+
* into a newly allocated array of TLS group IDs. On success, the function
|
2111
|
+
* returns one and writes the array to |*out_group_ids| and its size to
|
2112
|
+
* |*out_group_ids_len|. Otherwise, it returns zero. */
|
2113
|
+
int tls1_set_curves_list(uint16_t **out_group_ids, size_t *out_group_ids_len,
|
2114
|
+
const char *curves);
|
1479
2115
|
|
1480
2116
|
/* ssl_add_clienthello_tlsext writes ClientHello extensions to |out|. It
|
1481
2117
|
* returns one on success and zero on failure. The |header_len| argument is the
|
1482
2118
|
* length of the ClientHello written so far and is used to compute the padding
|
1483
2119
|
* length. (It does not include the record header.) */
|
1484
|
-
int ssl_add_clienthello_tlsext(
|
2120
|
+
int ssl_add_clienthello_tlsext(SSL_HANDSHAKE *hs, CBB *out, size_t header_len);
|
1485
2121
|
|
1486
|
-
int ssl_add_serverhello_tlsext(
|
1487
|
-
int ssl_parse_clienthello_tlsext(
|
1488
|
-
|
1489
|
-
int ssl_parse_serverhello_tlsext(
|
2122
|
+
int ssl_add_serverhello_tlsext(SSL_HANDSHAKE *hs, CBB *out);
|
2123
|
+
int ssl_parse_clienthello_tlsext(SSL_HANDSHAKE *hs,
|
2124
|
+
const SSL_CLIENT_HELLO *client_hello);
|
2125
|
+
int ssl_parse_serverhello_tlsext(SSL_HANDSHAKE *hs, CBS *cbs);
|
1490
2126
|
|
1491
2127
|
#define tlsext_tick_md EVP_sha256
|
1492
2128
|
|
@@ -1500,21 +2136,33 @@ int tls_process_ticket(SSL *ssl, SSL_SESSION **out_session,
|
|
1500
2136
|
size_t ticket_len, const uint8_t *session_id,
|
1501
2137
|
size_t session_id_len);
|
1502
2138
|
|
2139
|
+
/* tls1_verify_channel_id processes the current message as a Channel ID message,
|
2140
|
+
* and verifies the signature. If the key is valid, it saves the Channel ID and
|
2141
|
+
* returns one. Otherwise, it returns zero. */
|
2142
|
+
int tls1_verify_channel_id(SSL_HANDSHAKE *hs);
|
2143
|
+
|
2144
|
+
/* tls1_write_channel_id generates a Channel ID message and puts the output in
|
2145
|
+
* |cbb|. |ssl->tlsext_channel_id_private| must already be set before calling.
|
2146
|
+
* This function returns one on success and zero on error. */
|
2147
|
+
int tls1_write_channel_id(SSL_HANDSHAKE *hs, CBB *cbb);
|
2148
|
+
|
1503
2149
|
/* tls1_channel_id_hash computes the hash to be signed by Channel ID and writes
|
1504
2150
|
* it to |out|, which must contain at least |EVP_MAX_MD_SIZE| bytes. It returns
|
1505
2151
|
* one on success and zero on failure. */
|
1506
|
-
int tls1_channel_id_hash(
|
2152
|
+
int tls1_channel_id_hash(SSL_HANDSHAKE *hs, uint8_t *out, size_t *out_len);
|
1507
2153
|
|
1508
|
-
int tls1_record_handshake_hashes_for_channel_id(
|
2154
|
+
int tls1_record_handshake_hashes_for_channel_id(SSL_HANDSHAKE *hs);
|
2155
|
+
|
2156
|
+
/* ssl_do_channel_id_callback checks runs |ssl->ctx->channel_id_cb| if
|
2157
|
+
* necessary. It returns one on success and zero on fatal error. Note that, on
|
2158
|
+
* success, |ssl->tlsext_channel_id_private| may be unset, in which case the
|
2159
|
+
* operation should be retried later. */
|
2160
|
+
int ssl_do_channel_id_callback(SSL *ssl);
|
1509
2161
|
|
1510
2162
|
/* ssl3_can_false_start returns one if |ssl| is allowed to False Start and zero
|
1511
2163
|
* otherwise. */
|
1512
2164
|
int ssl3_can_false_start(const SSL *ssl);
|
1513
2165
|
|
1514
|
-
/* ssl3_get_enc_method returns the SSL3_ENC_METHOD corresponding to
|
1515
|
-
* |version|. */
|
1516
|
-
const SSL3_ENC_METHOD *ssl3_get_enc_method(uint16_t version);
|
1517
|
-
|
1518
2166
|
/* ssl_get_version_range sets |*out_min_version| and |*out_max_version| to the
|
1519
2167
|
* minimum and maximum enabled protocol versions, respectively. */
|
1520
2168
|
int ssl_get_version_range(const SSL *ssl, uint16_t *out_min_version,
|
@@ -1524,25 +2172,11 @@ int ssl_get_version_range(const SSL *ssl, uint16_t *out_min_version,
|
|
1524
2172
|
* call this function before the version is determined. */
|
1525
2173
|
uint16_t ssl3_protocol_version(const SSL *ssl);
|
1526
2174
|
|
1527
|
-
uint32_t ssl_get_algorithm_prf(const SSL *ssl);
|
1528
|
-
int tls1_parse_peer_sigalgs(SSL *ssl, const CBS *sigalgs);
|
1529
|
-
|
1530
|
-
/* tls1_choose_signature_algorithm sets |*out| to a signature algorithm for use
|
1531
|
-
* with |ssl|'s private key based on the peer's preferences and the digests
|
1532
|
-
* supported. It returns one on success and zero on error. */
|
1533
|
-
int tls1_choose_signature_algorithm(SSL *ssl, uint16_t *out);
|
1534
|
-
|
1535
|
-
size_t tls12_get_psigalgs(SSL *ssl, const uint16_t **psigs);
|
1536
|
-
|
1537
|
-
/* tls12_check_peer_sigalg checks that |signature_algorithm| is consistent with
|
1538
|
-
* |ssl|'s sent, supported signature algorithms and returns 1. Otherwise it
|
1539
|
-
* returns 0 and writes an alert into |*out_alert|. */
|
1540
|
-
int tls12_check_peer_sigalg(SSL *ssl, int *out_alert,
|
1541
|
-
uint16_t signature_algorithm);
|
1542
|
-
void ssl_set_client_disabled(SSL *ssl);
|
1543
|
-
|
1544
2175
|
void ssl_get_current_time(const SSL *ssl, struct timeval *out_clock);
|
1545
2176
|
|
2177
|
+
/* ssl_reset_error_state resets state for |SSL_get_error|. */
|
2178
|
+
void ssl_reset_error_state(SSL *ssl);
|
2179
|
+
|
1546
2180
|
|
1547
2181
|
#if defined(__cplusplus)
|
1548
2182
|
} /* extern C */
|