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
@@ -23,7 +23,6 @@
|
|
23
23
|
#include <openssl/ec.h>
|
24
24
|
#include <openssl/err.h>
|
25
25
|
#include <openssl/mem.h>
|
26
|
-
#include <openssl/newhope.h>
|
27
26
|
#include <openssl/nid.h>
|
28
27
|
|
29
28
|
#include "internal.h"
|
@@ -220,153 +219,6 @@ static int ssl_x25519_accept(SSL_ECDH_CTX *ctx, CBB *out_public_key,
|
|
220
219
|
}
|
221
220
|
|
222
221
|
|
223
|
-
/* Combined X25119 + New Hope (post-quantum) implementation. */
|
224
|
-
|
225
|
-
typedef struct {
|
226
|
-
uint8_t x25519_key[32];
|
227
|
-
NEWHOPE_POLY *newhope_sk;
|
228
|
-
} cecpq1_data;
|
229
|
-
|
230
|
-
#define CECPQ1_OFFERMSG_LENGTH (32 + NEWHOPE_OFFERMSG_LENGTH)
|
231
|
-
#define CECPQ1_ACCEPTMSG_LENGTH (32 + NEWHOPE_ACCEPTMSG_LENGTH)
|
232
|
-
#define CECPQ1_SECRET_LENGTH (32 + SHA256_DIGEST_LENGTH)
|
233
|
-
|
234
|
-
static void ssl_cecpq1_cleanup(SSL_ECDH_CTX *ctx) {
|
235
|
-
if (ctx->data == NULL) {
|
236
|
-
return;
|
237
|
-
}
|
238
|
-
cecpq1_data *data = ctx->data;
|
239
|
-
NEWHOPE_POLY_free(data->newhope_sk);
|
240
|
-
OPENSSL_cleanse(data, sizeof(cecpq1_data));
|
241
|
-
OPENSSL_free(data);
|
242
|
-
}
|
243
|
-
|
244
|
-
static int ssl_cecpq1_offer(SSL_ECDH_CTX *ctx, CBB *out) {
|
245
|
-
assert(ctx->data == NULL);
|
246
|
-
cecpq1_data *data = OPENSSL_malloc(sizeof(cecpq1_data));
|
247
|
-
if (data == NULL) {
|
248
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_MALLOC_FAILURE);
|
249
|
-
return 0;
|
250
|
-
}
|
251
|
-
ctx->data = data;
|
252
|
-
data->newhope_sk = NEWHOPE_POLY_new();
|
253
|
-
if (data->newhope_sk == NULL) {
|
254
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_MALLOC_FAILURE);
|
255
|
-
return 0;
|
256
|
-
}
|
257
|
-
|
258
|
-
uint8_t x25519_public_key[32];
|
259
|
-
X25519_keypair(x25519_public_key, data->x25519_key);
|
260
|
-
|
261
|
-
uint8_t newhope_offermsg[NEWHOPE_OFFERMSG_LENGTH];
|
262
|
-
NEWHOPE_offer(newhope_offermsg, data->newhope_sk);
|
263
|
-
|
264
|
-
if (!CBB_add_bytes(out, x25519_public_key, sizeof(x25519_public_key)) ||
|
265
|
-
!CBB_add_bytes(out, newhope_offermsg, sizeof(newhope_offermsg))) {
|
266
|
-
return 0;
|
267
|
-
}
|
268
|
-
return 1;
|
269
|
-
}
|
270
|
-
|
271
|
-
static int ssl_cecpq1_accept(SSL_ECDH_CTX *ctx, CBB *cbb, uint8_t **out_secret,
|
272
|
-
size_t *out_secret_len, uint8_t *out_alert,
|
273
|
-
const uint8_t *peer_key, size_t peer_key_len) {
|
274
|
-
if (peer_key_len != CECPQ1_OFFERMSG_LENGTH) {
|
275
|
-
*out_alert = SSL_AD_DECODE_ERROR;
|
276
|
-
return 0;
|
277
|
-
}
|
278
|
-
|
279
|
-
*out_alert = SSL_AD_INTERNAL_ERROR;
|
280
|
-
|
281
|
-
assert(ctx->data == NULL);
|
282
|
-
cecpq1_data *data = OPENSSL_malloc(sizeof(cecpq1_data));
|
283
|
-
if (data == NULL) {
|
284
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_MALLOC_FAILURE);
|
285
|
-
return 0;
|
286
|
-
}
|
287
|
-
data->newhope_sk = NULL;
|
288
|
-
ctx->data = data;
|
289
|
-
|
290
|
-
uint8_t *secret = OPENSSL_malloc(CECPQ1_SECRET_LENGTH);
|
291
|
-
if (secret == NULL) {
|
292
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_MALLOC_FAILURE);
|
293
|
-
return 0;
|
294
|
-
}
|
295
|
-
|
296
|
-
/* Generate message to server, and secret key, at once. */
|
297
|
-
|
298
|
-
uint8_t x25519_public_key[32];
|
299
|
-
X25519_keypair(x25519_public_key, data->x25519_key);
|
300
|
-
if (!X25519(secret, data->x25519_key, peer_key)) {
|
301
|
-
*out_alert = SSL_AD_DECODE_ERROR;
|
302
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_BAD_ECPOINT);
|
303
|
-
goto err;
|
304
|
-
}
|
305
|
-
|
306
|
-
uint8_t newhope_acceptmsg[NEWHOPE_ACCEPTMSG_LENGTH];
|
307
|
-
if (!NEWHOPE_accept(secret + 32, newhope_acceptmsg, peer_key + 32,
|
308
|
-
NEWHOPE_OFFERMSG_LENGTH)) {
|
309
|
-
*out_alert = SSL_AD_DECODE_ERROR;
|
310
|
-
goto err;
|
311
|
-
}
|
312
|
-
|
313
|
-
if (!CBB_add_bytes(cbb, x25519_public_key, sizeof(x25519_public_key)) ||
|
314
|
-
!CBB_add_bytes(cbb, newhope_acceptmsg, sizeof(newhope_acceptmsg))) {
|
315
|
-
goto err;
|
316
|
-
}
|
317
|
-
|
318
|
-
*out_secret = secret;
|
319
|
-
*out_secret_len = CECPQ1_SECRET_LENGTH;
|
320
|
-
return 1;
|
321
|
-
|
322
|
-
err:
|
323
|
-
OPENSSL_cleanse(secret, CECPQ1_SECRET_LENGTH);
|
324
|
-
OPENSSL_free(secret);
|
325
|
-
return 0;
|
326
|
-
}
|
327
|
-
|
328
|
-
static int ssl_cecpq1_finish(SSL_ECDH_CTX *ctx, uint8_t **out_secret,
|
329
|
-
size_t *out_secret_len, uint8_t *out_alert,
|
330
|
-
const uint8_t *peer_key, size_t peer_key_len) {
|
331
|
-
if (peer_key_len != CECPQ1_ACCEPTMSG_LENGTH) {
|
332
|
-
*out_alert = SSL_AD_DECODE_ERROR;
|
333
|
-
return 0;
|
334
|
-
}
|
335
|
-
|
336
|
-
*out_alert = SSL_AD_INTERNAL_ERROR;
|
337
|
-
|
338
|
-
assert(ctx->data != NULL);
|
339
|
-
cecpq1_data *data = ctx->data;
|
340
|
-
|
341
|
-
uint8_t *secret = OPENSSL_malloc(CECPQ1_SECRET_LENGTH);
|
342
|
-
if (secret == NULL) {
|
343
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_MALLOC_FAILURE);
|
344
|
-
return 0;
|
345
|
-
}
|
346
|
-
|
347
|
-
if (!X25519(secret, data->x25519_key, peer_key)) {
|
348
|
-
*out_alert = SSL_AD_DECODE_ERROR;
|
349
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_BAD_ECPOINT);
|
350
|
-
goto err;
|
351
|
-
}
|
352
|
-
|
353
|
-
if (!NEWHOPE_finish(secret + 32, data->newhope_sk, peer_key + 32,
|
354
|
-
NEWHOPE_ACCEPTMSG_LENGTH)) {
|
355
|
-
*out_alert = SSL_AD_DECODE_ERROR;
|
356
|
-
goto err;
|
357
|
-
}
|
358
|
-
|
359
|
-
*out_secret = secret;
|
360
|
-
*out_secret_len = CECPQ1_SECRET_LENGTH;
|
361
|
-
return 1;
|
362
|
-
|
363
|
-
err:
|
364
|
-
OPENSSL_cleanse(secret, CECPQ1_SECRET_LENGTH);
|
365
|
-
OPENSSL_free(secret);
|
366
|
-
return 0;
|
367
|
-
}
|
368
|
-
|
369
|
-
|
370
222
|
/* Legacy DHE-based implementation. */
|
371
223
|
|
372
224
|
static void ssl_dhe_cleanup(SSL_ECDH_CTX *ctx) {
|
@@ -446,16 +298,6 @@ static const SSL_ECDH_METHOD kDHEMethod = {
|
|
446
298
|
CBB_add_u16_length_prefixed,
|
447
299
|
};
|
448
300
|
|
449
|
-
static const SSL_ECDH_METHOD kCECPQ1Method = {
|
450
|
-
NID_undef, 0, "",
|
451
|
-
ssl_cecpq1_cleanup,
|
452
|
-
ssl_cecpq1_offer,
|
453
|
-
ssl_cecpq1_accept,
|
454
|
-
ssl_cecpq1_finish,
|
455
|
-
CBS_get_u16_length_prefixed,
|
456
|
-
CBB_add_u16_length_prefixed,
|
457
|
-
};
|
458
|
-
|
459
301
|
static const SSL_ECDH_METHOD kMethods[] = {
|
460
302
|
{
|
461
303
|
NID_X9_62_prime256v1,
|
@@ -521,6 +363,16 @@ static const SSL_ECDH_METHOD *method_from_nid(int nid) {
|
|
521
363
|
return NULL;
|
522
364
|
}
|
523
365
|
|
366
|
+
static const SSL_ECDH_METHOD *method_from_name(const char *name, size_t len) {
|
367
|
+
for (size_t i = 0; i < OPENSSL_ARRAY_SIZE(kMethods); i++) {
|
368
|
+
if (len == strlen(kMethods[i].name) &&
|
369
|
+
!strncmp(kMethods[i].name, name, len)) {
|
370
|
+
return &kMethods[i];
|
371
|
+
}
|
372
|
+
}
|
373
|
+
return NULL;
|
374
|
+
}
|
375
|
+
|
524
376
|
const char* SSL_get_curve_name(uint16_t group_id) {
|
525
377
|
const SSL_ECDH_METHOD *method = method_from_group_id(group_id);
|
526
378
|
if (method == NULL) {
|
@@ -538,6 +390,15 @@ int ssl_nid_to_group_id(uint16_t *out_group_id, int nid) {
|
|
538
390
|
return 1;
|
539
391
|
}
|
540
392
|
|
393
|
+
int ssl_name_to_group_id(uint16_t *out_group_id, const char *name, size_t len) {
|
394
|
+
const SSL_ECDH_METHOD *method = method_from_name(name, len);
|
395
|
+
if (method == NULL) {
|
396
|
+
return 0;
|
397
|
+
}
|
398
|
+
*out_group_id = method->group_id;
|
399
|
+
return 1;
|
400
|
+
}
|
401
|
+
|
541
402
|
int SSL_ECDH_CTX_init(SSL_ECDH_CTX *ctx, uint16_t group_id) {
|
542
403
|
SSL_ECDH_CTX_cleanup(ctx);
|
543
404
|
|
@@ -557,12 +418,6 @@ void SSL_ECDH_CTX_init_for_dhe(SSL_ECDH_CTX *ctx, DH *params) {
|
|
557
418
|
ctx->data = params;
|
558
419
|
}
|
559
420
|
|
560
|
-
void SSL_ECDH_CTX_init_for_cecpq1(SSL_ECDH_CTX *ctx) {
|
561
|
-
SSL_ECDH_CTX_cleanup(ctx);
|
562
|
-
|
563
|
-
ctx->method = &kCECPQ1Method;
|
564
|
-
}
|
565
|
-
|
566
421
|
void SSL_ECDH_CTX_cleanup(SSL_ECDH_CTX *ctx) {
|
567
422
|
if (ctx->method == NULL) {
|
568
423
|
return;
|
@@ -573,14 +573,3 @@ void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb) {
|
|
573
573
|
void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *data) {
|
574
574
|
ctx->default_passwd_callback_userdata = data;
|
575
575
|
}
|
576
|
-
|
577
|
-
SSL_SESSION *d2i_SSL_SESSION_bio(BIO *bio, SSL_SESSION **out) {
|
578
|
-
return ASN1_d2i_bio_of(SSL_SESSION, SSL_SESSION_new, d2i_SSL_SESSION, bio,
|
579
|
-
out);
|
580
|
-
}
|
581
|
-
|
582
|
-
int i2d_SSL_SESSION_bio(BIO *bio, const SSL_SESSION *session) {
|
583
|
-
return ASN1_i2d_bio_of(SSL_SESSION, i2d_SSL_SESSION, bio, session);
|
584
|
-
}
|
585
|
-
|
586
|
-
IMPLEMENT_PEM_rw(SSL_SESSION, SSL_SESSION, PEM_STRING_SSL_SESSION, SSL_SESSION)
|
@@ -151,7 +151,6 @@
|
|
151
151
|
#include <openssl/lhash.h>
|
152
152
|
#include <openssl/mem.h>
|
153
153
|
#include <openssl/rand.h>
|
154
|
-
#include <openssl/x509v3.h>
|
155
154
|
|
156
155
|
#include "internal.h"
|
157
156
|
#include "../crypto/internal.h"
|
@@ -197,8 +196,8 @@ static uint32_t ssl_session_hash(const SSL_SESSION *sess) {
|
|
197
196
|
|
198
197
|
uint8_t tmp_storage[sizeof(uint32_t)];
|
199
198
|
if (sess->session_id_length < sizeof(tmp_storage)) {
|
200
|
-
|
201
|
-
|
199
|
+
OPENSSL_memset(tmp_storage, 0, sizeof(tmp_storage));
|
200
|
+
OPENSSL_memcpy(tmp_storage, sess->session_id, sess->session_id_length);
|
202
201
|
session_id = tmp_storage;
|
203
202
|
}
|
204
203
|
|
@@ -225,7 +224,7 @@ static int ssl_session_cmp(const SSL_SESSION *a, const SSL_SESSION *b) {
|
|
225
224
|
return 1;
|
226
225
|
}
|
227
226
|
|
228
|
-
return
|
227
|
+
return OPENSSL_memcmp(a->session_id, b->session_id, a->session_id_length);
|
229
228
|
}
|
230
229
|
|
231
230
|
SSL_CTX *SSL_CTX_new(const SSL_METHOD *method) {
|
@@ -246,23 +245,24 @@ SSL_CTX *SSL_CTX_new(const SSL_METHOD *method) {
|
|
246
245
|
goto err;
|
247
246
|
}
|
248
247
|
|
249
|
-
|
248
|
+
OPENSSL_memset(ret, 0, sizeof(SSL_CTX));
|
250
249
|
|
251
250
|
ret->method = method->method;
|
251
|
+
ret->x509_method = method->x509_method;
|
252
252
|
|
253
253
|
CRYPTO_MUTEX_init(&ret->lock);
|
254
254
|
|
255
255
|
ret->session_cache_mode = SSL_SESS_CACHE_SERVER;
|
256
256
|
ret->session_cache_size = SSL_SESSION_CACHE_MAX_SIZE_DEFAULT;
|
257
257
|
|
258
|
-
/* We take the system default */
|
259
258
|
ret->session_timeout = SSL_DEFAULT_SESSION_TIMEOUT;
|
259
|
+
ret->session_psk_dhe_timeout = SSL_DEFAULT_SESSION_PSK_DHE_TIMEOUT;
|
260
260
|
|
261
261
|
ret->references = 1;
|
262
262
|
|
263
263
|
ret->max_cert_list = SSL_MAX_CERT_LIST_DEFAULT;
|
264
264
|
ret->verify_mode = SSL_VERIFY_NONE;
|
265
|
-
ret->cert = ssl_cert_new();
|
265
|
+
ret->cert = ssl_cert_new(method->x509_method);
|
266
266
|
if (ret->cert == NULL) {
|
267
267
|
goto err;
|
268
268
|
}
|
@@ -277,7 +277,7 @@ SSL_CTX *SSL_CTX_new(const SSL_METHOD *method) {
|
|
277
277
|
}
|
278
278
|
|
279
279
|
ssl_create_cipher_list(ret->method, &ret->cipher_list,
|
280
|
-
|
280
|
+
SSL_DEFAULT_CIPHER_LIST, 1 /* strict */);
|
281
281
|
if (ret->cipher_list == NULL ||
|
282
282
|
sk_SSL_CIPHER_num(ret->cipher_list->ciphers) <= 0) {
|
283
283
|
OPENSSL_PUT_ERROR(SSL, SSL_R_LIBRARY_HAS_NO_CIPHERS);
|
@@ -305,6 +305,10 @@ SSL_CTX *SSL_CTX_new(const SSL_METHOD *method) {
|
|
305
305
|
ret->options |= SSL_OP_NO_TICKET;
|
306
306
|
}
|
307
307
|
|
308
|
+
/* Disable the auto-chaining feature by default. Once this has stuck without
|
309
|
+
* problems, the feature will be removed entirely. */
|
310
|
+
ret->mode = SSL_MODE_NO_AUTO_CHAIN;
|
311
|
+
|
308
312
|
/* Lock the SSL_CTX to the specified version, for compatibility with legacy
|
309
313
|
* uses of SSL_METHOD. */
|
310
314
|
if (!SSL_CTX_set_max_proto_version(ret, method->version) ||
|
@@ -349,9 +353,6 @@ void SSL_CTX_free(SSL_CTX *ctx) {
|
|
349
353
|
lh_SSL_SESSION_free(ctx->sessions);
|
350
354
|
X509_STORE_free(ctx->cert_store);
|
351
355
|
ssl_cipher_preference_list_free(ctx->cipher_list);
|
352
|
-
sk_SSL_CIPHER_free(ctx->cipher_list_by_id);
|
353
|
-
ssl_cipher_preference_list_free(ctx->cipher_list_tls10);
|
354
|
-
ssl_cipher_preference_list_free(ctx->cipher_list_tls11);
|
355
356
|
ssl_cert_free(ctx->cert);
|
356
357
|
sk_SSL_CUSTOM_EXTENSION_pop_free(ctx->client_custom_extensions,
|
357
358
|
SSL_CUSTOM_EXTENSION_free);
|
@@ -362,8 +363,6 @@ void SSL_CTX_free(SSL_CTX *ctx) {
|
|
362
363
|
OPENSSL_free(ctx->psk_identity_hint);
|
363
364
|
OPENSSL_free(ctx->supported_group_list);
|
364
365
|
OPENSSL_free(ctx->alpn_client_proto_list);
|
365
|
-
OPENSSL_free(ctx->ocsp_response);
|
366
|
-
OPENSSL_free(ctx->signed_cert_timestamp_list);
|
367
366
|
EVP_PKEY_free(ctx->tlsext_channel_id_private);
|
368
367
|
|
369
368
|
OPENSSL_free(ctx);
|
@@ -383,13 +382,11 @@ SSL *SSL_new(SSL_CTX *ctx) {
|
|
383
382
|
if (ssl == NULL) {
|
384
383
|
goto err;
|
385
384
|
}
|
386
|
-
|
385
|
+
OPENSSL_memset(ssl, 0, sizeof(SSL));
|
387
386
|
|
388
387
|
ssl->min_version = ctx->min_version;
|
389
388
|
ssl->max_version = ctx->max_version;
|
390
389
|
|
391
|
-
ssl->state = SSL_ST_INIT;
|
392
|
-
|
393
390
|
/* RFC 6347 states that implementations SHOULD use an initial timer value of
|
394
391
|
* 1 second. */
|
395
392
|
ssl->initial_timeout_duration_ms = 1000;
|
@@ -406,10 +403,9 @@ SSL *SSL_new(SSL_CTX *ctx) {
|
|
406
403
|
ssl->msg_callback = ctx->msg_callback;
|
407
404
|
ssl->msg_callback_arg = ctx->msg_callback_arg;
|
408
405
|
ssl->verify_mode = ctx->verify_mode;
|
409
|
-
ssl->sid_ctx_length = ctx->sid_ctx_length;
|
410
|
-
assert(ssl->sid_ctx_length <= sizeof ssl->sid_ctx);
|
411
|
-
memcpy(&ssl->sid_ctx, &ctx->sid_ctx, sizeof(ssl->sid_ctx));
|
412
406
|
ssl->verify_callback = ctx->default_verify_callback;
|
407
|
+
ssl->retain_only_sha256_of_client_certs =
|
408
|
+
ctx->retain_only_sha256_of_client_certs;
|
413
409
|
|
414
410
|
ssl->param = X509_VERIFY_PARAM_new();
|
415
411
|
if (!ssl->param) {
|
@@ -419,28 +415,27 @@ SSL *SSL_new(SSL_CTX *ctx) {
|
|
419
415
|
ssl->quiet_shutdown = ctx->quiet_shutdown;
|
420
416
|
ssl->max_send_fragment = ctx->max_send_fragment;
|
421
417
|
|
422
|
-
|
418
|
+
SSL_CTX_up_ref(ctx);
|
423
419
|
ssl->ctx = ctx;
|
424
|
-
|
420
|
+
SSL_CTX_up_ref(ctx);
|
425
421
|
ssl->initial_ctx = ctx;
|
426
422
|
|
427
423
|
if (ctx->supported_group_list) {
|
428
|
-
ssl->supported_group_list =
|
429
|
-
|
430
|
-
ctx->supported_group_list_len * 2);
|
424
|
+
ssl->supported_group_list = BUF_memdup(ctx->supported_group_list,
|
425
|
+
ctx->supported_group_list_len * 2);
|
431
426
|
if (!ssl->supported_group_list) {
|
432
427
|
goto err;
|
433
428
|
}
|
434
429
|
ssl->supported_group_list_len = ctx->supported_group_list_len;
|
435
430
|
}
|
436
431
|
|
437
|
-
if (
|
438
|
-
ssl->alpn_client_proto_list = BUF_memdup(
|
439
|
-
|
432
|
+
if (ctx->alpn_client_proto_list) {
|
433
|
+
ssl->alpn_client_proto_list = BUF_memdup(ctx->alpn_client_proto_list,
|
434
|
+
ctx->alpn_client_proto_list_len);
|
440
435
|
if (ssl->alpn_client_proto_list == NULL) {
|
441
436
|
goto err;
|
442
437
|
}
|
443
|
-
ssl->alpn_client_proto_list_len =
|
438
|
+
ssl->alpn_client_proto_list_len = ctx->alpn_client_proto_list_len;
|
444
439
|
}
|
445
440
|
|
446
441
|
ssl->method = ctx->method;
|
@@ -469,9 +464,8 @@ SSL *SSL_new(SSL_CTX *ctx) {
|
|
469
464
|
ssl->tlsext_channel_id_private = ctx->tlsext_channel_id_private;
|
470
465
|
}
|
471
466
|
|
472
|
-
ssl->signed_cert_timestamps_enabled =
|
473
|
-
|
474
|
-
ssl->ocsp_stapling_enabled = ssl->ctx->ocsp_stapling_enabled;
|
467
|
+
ssl->signed_cert_timestamps_enabled = ctx->signed_cert_timestamps_enabled;
|
468
|
+
ssl->ocsp_stapling_enabled = ctx->ocsp_stapling_enabled;
|
475
469
|
|
476
470
|
return ssl;
|
477
471
|
|
@@ -491,9 +485,6 @@ void SSL_free(SSL *ssl) {
|
|
491
485
|
|
492
486
|
CRYPTO_free_ex_data(&g_ex_data_class_ssl, ssl, &ssl->ex_data);
|
493
487
|
|
494
|
-
ssl_free_wbio_buffer(ssl);
|
495
|
-
assert(ssl->bbio == NULL);
|
496
|
-
|
497
488
|
BIO_free_all(ssl->rbio);
|
498
489
|
BIO_free_all(ssl->wbio);
|
499
490
|
|
@@ -501,7 +492,6 @@ void SSL_free(SSL *ssl) {
|
|
501
492
|
|
502
493
|
/* add extra stuff */
|
503
494
|
ssl_cipher_preference_list_free(ssl->cipher_list);
|
504
|
-
sk_SSL_CIPHER_free(ssl->cipher_list_by_id);
|
505
495
|
|
506
496
|
SSL_SESSION_free(ssl->session);
|
507
497
|
|
@@ -540,18 +530,8 @@ void SSL_set0_rbio(SSL *ssl, BIO *rbio) {
|
|
540
530
|
}
|
541
531
|
|
542
532
|
void SSL_set0_wbio(SSL *ssl, BIO *wbio) {
|
543
|
-
/* If the output buffering BIO is still in place, remove it. */
|
544
|
-
if (ssl->bbio != NULL) {
|
545
|
-
ssl->wbio = BIO_pop(ssl->wbio);
|
546
|
-
}
|
547
|
-
|
548
533
|
BIO_free_all(ssl->wbio);
|
549
534
|
ssl->wbio = wbio;
|
550
|
-
|
551
|
-
/* Re-attach |bbio| to the new |wbio|. */
|
552
|
-
if (ssl->bbio != NULL) {
|
553
|
-
ssl->wbio = BIO_push(ssl->bbio, ssl->wbio);
|
554
|
-
}
|
555
535
|
}
|
556
536
|
|
557
537
|
void SSL_set_bio(SSL *ssl, BIO *rbio, BIO *wbio) {
|
@@ -590,20 +570,18 @@ void SSL_set_bio(SSL *ssl, BIO *rbio, BIO *wbio) {
|
|
590
570
|
|
591
571
|
BIO *SSL_get_rbio(const SSL *ssl) { return ssl->rbio; }
|
592
572
|
|
593
|
-
BIO *SSL_get_wbio(const SSL *ssl) {
|
594
|
-
if (ssl->bbio != NULL) {
|
595
|
-
/* If |bbio| is active, the true caller-configured BIO is its |next_bio|. */
|
596
|
-
assert(ssl->bbio == ssl->wbio);
|
597
|
-
return ssl->bbio->next_bio;
|
598
|
-
}
|
599
|
-
return ssl->wbio;
|
600
|
-
}
|
573
|
+
BIO *SSL_get_wbio(const SSL *ssl) { return ssl->wbio; }
|
601
574
|
|
602
|
-
|
575
|
+
void ssl_reset_error_state(SSL *ssl) {
|
576
|
+
/* Functions which use |SSL_get_error| must reset I/O and error state on
|
577
|
+
* entry. */
|
603
578
|
ssl->rwstate = SSL_NOTHING;
|
604
|
-
/* Functions which use SSL_get_error must clear the error queue on entry. */
|
605
579
|
ERR_clear_error();
|
606
580
|
ERR_clear_system_error();
|
581
|
+
}
|
582
|
+
|
583
|
+
int SSL_do_handshake(SSL *ssl) {
|
584
|
+
ssl_reset_error_state(ssl);
|
607
585
|
|
608
586
|
if (ssl->handshake_func == NULL) {
|
609
587
|
OPENSSL_PUT_ERROR(SSL, SSL_R_CONNECTION_TYPE_NOT_SET);
|
@@ -614,7 +592,25 @@ int SSL_do_handshake(SSL *ssl) {
|
|
614
592
|
return 1;
|
615
593
|
}
|
616
594
|
|
617
|
-
|
595
|
+
if (ssl->s3->hs == NULL) {
|
596
|
+
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
|
597
|
+
return -1;
|
598
|
+
}
|
599
|
+
|
600
|
+
/* Run the handshake. */
|
601
|
+
assert(ssl->s3->hs != NULL);
|
602
|
+
int ret = ssl->handshake_func(ssl->s3->hs);
|
603
|
+
if (ret <= 0) {
|
604
|
+
return ret;
|
605
|
+
}
|
606
|
+
|
607
|
+
/* Destroy the handshake object if the handshake has completely finished. */
|
608
|
+
if (!SSL_in_init(ssl)) {
|
609
|
+
ssl_handshake_free(ssl->s3->hs);
|
610
|
+
ssl->s3->hs = NULL;
|
611
|
+
}
|
612
|
+
|
613
|
+
return 1;
|
618
614
|
}
|
619
615
|
|
620
616
|
int SSL_connect(SSL *ssl) {
|
@@ -636,8 +632,10 @@ int SSL_accept(SSL *ssl) {
|
|
636
632
|
}
|
637
633
|
|
638
634
|
static int ssl_do_renegotiate(SSL *ssl) {
|
639
|
-
/* We do not accept renegotiations as a server.
|
640
|
-
|
635
|
+
/* We do not accept renegotiations as a server or SSL 3.0. SSL 3.0 will be
|
636
|
+
* removed entirely in the future and requires retaining more data for
|
637
|
+
* renegotiation_info. */
|
638
|
+
if (ssl->server || ssl->version == SSL3_VERSION) {
|
641
639
|
goto no_renegotiation;
|
642
640
|
}
|
643
641
|
|
@@ -675,8 +673,16 @@ static int ssl_do_renegotiate(SSL *ssl) {
|
|
675
673
|
}
|
676
674
|
|
677
675
|
/* Begin a new handshake. */
|
676
|
+
if (ssl->s3->hs != NULL) {
|
677
|
+
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
|
678
|
+
return 0;
|
679
|
+
}
|
680
|
+
ssl->s3->hs = ssl_handshake_new(ssl);
|
681
|
+
if (ssl->s3->hs == NULL) {
|
682
|
+
return 0;
|
683
|
+
}
|
684
|
+
|
678
685
|
ssl->s3->total_renegotiations++;
|
679
|
-
ssl->state = SSL_ST_INIT;
|
680
686
|
return 1;
|
681
687
|
|
682
688
|
no_renegotiation:
|
@@ -694,10 +700,7 @@ static int ssl_do_post_handshake(SSL *ssl) {
|
|
694
700
|
}
|
695
701
|
|
696
702
|
static int ssl_read_impl(SSL *ssl, void *buf, int num, int peek) {
|
697
|
-
ssl
|
698
|
-
/* Functions which use SSL_get_error must clear the error queue on entry. */
|
699
|
-
ERR_clear_error();
|
700
|
-
ERR_clear_system_error();
|
703
|
+
ssl_reset_error_state(ssl);
|
701
704
|
|
702
705
|
if (ssl->handshake_func == NULL) {
|
703
706
|
OPENSSL_PUT_ERROR(SSL, SSL_R_UNINITIALIZED);
|
@@ -743,10 +746,7 @@ int SSL_peek(SSL *ssl, void *buf, int num) {
|
|
743
746
|
}
|
744
747
|
|
745
748
|
int SSL_write(SSL *ssl, const void *buf, int num) {
|
746
|
-
ssl
|
747
|
-
/* Functions which use SSL_get_error must clear the error queue on entry. */
|
748
|
-
ERR_clear_error();
|
749
|
-
ERR_clear_system_error();
|
749
|
+
ssl_reset_error_state(ssl);
|
750
750
|
|
751
751
|
if (ssl->handshake_func == NULL) {
|
752
752
|
OPENSSL_PUT_ERROR(SSL, SSL_R_UNINITIALIZED);
|
@@ -774,20 +774,18 @@ int SSL_write(SSL *ssl, const void *buf, int num) {
|
|
774
774
|
}
|
775
775
|
|
776
776
|
int SSL_shutdown(SSL *ssl) {
|
777
|
-
ssl
|
778
|
-
/* Functions which use SSL_get_error must clear the error queue on entry. */
|
779
|
-
ERR_clear_error();
|
780
|
-
ERR_clear_system_error();
|
777
|
+
ssl_reset_error_state(ssl);
|
781
778
|
|
782
779
|
if (ssl->handshake_func == NULL) {
|
783
780
|
OPENSSL_PUT_ERROR(SSL, SSL_R_UNINITIALIZED);
|
784
781
|
return -1;
|
785
782
|
}
|
786
783
|
|
787
|
-
/*
|
784
|
+
/* If we are in the middle of a handshake, silently succeed. Consumers often
|
785
|
+
* call this function before |SSL_free|, whether the handshake succeeded or
|
786
|
+
* not. We assume the caller has already handled failed handshakes. */
|
788
787
|
if (SSL_in_init(ssl)) {
|
789
|
-
|
790
|
-
return -1;
|
788
|
+
return 1;
|
791
789
|
}
|
792
790
|
|
793
791
|
if (ssl->quiet_shutdown) {
|
@@ -837,18 +835,29 @@ int SSL_send_fatal_alert(SSL *ssl, uint8_t alert) {
|
|
837
835
|
return ssl3_send_alert(ssl, SSL3_AL_FATAL, alert);
|
838
836
|
}
|
839
837
|
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
BIO *bio;
|
838
|
+
void SSL_CTX_set_early_data_enabled(SSL_CTX *ctx, int enabled) {
|
839
|
+
ctx->enable_early_data = !!enabled;
|
840
|
+
}
|
844
841
|
|
842
|
+
static int bio_retry_reason_to_error(int reason) {
|
843
|
+
switch (reason) {
|
844
|
+
case BIO_RR_CONNECT:
|
845
|
+
return SSL_ERROR_WANT_CONNECT;
|
846
|
+
case BIO_RR_ACCEPT:
|
847
|
+
return SSL_ERROR_WANT_ACCEPT;
|
848
|
+
default:
|
849
|
+
return SSL_ERROR_SYSCALL;
|
850
|
+
}
|
851
|
+
}
|
852
|
+
|
853
|
+
int SSL_get_error(const SSL *ssl, int ret_code) {
|
845
854
|
if (ret_code > 0) {
|
846
855
|
return SSL_ERROR_NONE;
|
847
856
|
}
|
848
857
|
|
849
858
|
/* Make things return SSL_ERROR_SYSCALL when doing SSL_do_handshake etc,
|
850
859
|
* where we do encode the error */
|
851
|
-
err = ERR_peek_error();
|
860
|
+
uint32_t err = ERR_peek_error();
|
852
861
|
if (err != 0) {
|
853
862
|
if (ERR_GET_LIB(err) == ERR_LIB_SYS) {
|
854
863
|
return SSL_ERROR_SYSCALL;
|
@@ -866,79 +875,59 @@ int SSL_get_error(const SSL *ssl, int ret_code) {
|
|
866
875
|
return SSL_ERROR_SYSCALL;
|
867
876
|
}
|
868
877
|
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
if (SSL_want_certificate(ssl)) {
|
874
|
-
return SSL_ERROR_PENDING_CERTIFICATE;
|
875
|
-
}
|
878
|
+
switch (ssl->rwstate) {
|
879
|
+
case SSL_PENDING_SESSION:
|
880
|
+
return SSL_ERROR_PENDING_SESSION;
|
876
881
|
|
877
|
-
|
878
|
-
|
879
|
-
if (BIO_should_read(bio)) {
|
880
|
-
return SSL_ERROR_WANT_READ;
|
881
|
-
}
|
882
|
-
|
883
|
-
if (BIO_should_write(bio)) {
|
884
|
-
/* This one doesn't make too much sense ... We never try to write to the
|
885
|
-
* rbio, and an application program where rbio and wbio are separate
|
886
|
-
* couldn't even know what it should wait for. However if we ever set
|
887
|
-
* ssl->rwstate incorrectly (so that we have SSL_want_read(ssl) instead of
|
888
|
-
* SSL_want_write(ssl)) and rbio and wbio *are* the same, this test works
|
889
|
-
* around that bug; so it might be safer to keep it. */
|
890
|
-
return SSL_ERROR_WANT_WRITE;
|
891
|
-
}
|
882
|
+
case SSL_CERTIFICATE_SELECTION_PENDING:
|
883
|
+
return SSL_ERROR_PENDING_CERTIFICATE;
|
892
884
|
|
893
|
-
|
894
|
-
|
895
|
-
if (
|
896
|
-
return
|
885
|
+
case SSL_READING: {
|
886
|
+
BIO *bio = SSL_get_rbio(ssl);
|
887
|
+
if (BIO_should_read(bio)) {
|
888
|
+
return SSL_ERROR_WANT_READ;
|
897
889
|
}
|
898
890
|
|
899
|
-
if (
|
900
|
-
|
891
|
+
if (BIO_should_write(bio)) {
|
892
|
+
/* TODO(davidben): OpenSSL historically checked for writes on the read
|
893
|
+
* BIO. Can this be removed? */
|
894
|
+
return SSL_ERROR_WANT_WRITE;
|
901
895
|
}
|
902
896
|
|
903
|
-
|
904
|
-
|
905
|
-
|
897
|
+
if (BIO_should_io_special(bio)) {
|
898
|
+
return bio_retry_reason_to_error(BIO_get_retry_reason(bio));
|
899
|
+
}
|
906
900
|
|
907
|
-
|
908
|
-
bio = SSL_get_wbio(ssl);
|
909
|
-
if (BIO_should_write(bio)) {
|
910
|
-
return SSL_ERROR_WANT_WRITE;
|
901
|
+
break;
|
911
902
|
}
|
912
903
|
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
904
|
+
case SSL_WRITING: {
|
905
|
+
BIO *bio = SSL_get_wbio(ssl);
|
906
|
+
if (BIO_should_write(bio)) {
|
907
|
+
return SSL_ERROR_WANT_WRITE;
|
908
|
+
}
|
917
909
|
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
return
|
910
|
+
if (BIO_should_read(bio)) {
|
911
|
+
/* TODO(davidben): OpenSSL historically checked for reads on the write
|
912
|
+
* BIO. Can this be removed? */
|
913
|
+
return SSL_ERROR_WANT_READ;
|
922
914
|
}
|
923
915
|
|
924
|
-
if (
|
925
|
-
return
|
916
|
+
if (BIO_should_io_special(bio)) {
|
917
|
+
return bio_retry_reason_to_error(BIO_get_retry_reason(bio));
|
926
918
|
}
|
927
919
|
|
928
|
-
|
920
|
+
break;
|
929
921
|
}
|
930
|
-
}
|
931
922
|
|
932
|
-
|
933
|
-
|
934
|
-
}
|
923
|
+
case SSL_X509_LOOKUP:
|
924
|
+
return SSL_ERROR_WANT_X509_LOOKUP;
|
935
925
|
|
936
|
-
|
937
|
-
|
938
|
-
}
|
926
|
+
case SSL_CHANNEL_ID_LOOKUP:
|
927
|
+
return SSL_ERROR_WANT_CHANNEL_ID_LOOKUP;
|
939
928
|
|
940
|
-
|
941
|
-
|
929
|
+
case SSL_PRIVATE_KEY_OPERATION:
|
930
|
+
return SSL_ERROR_WANT_PRIVATE_KEY_OPERATION;
|
942
931
|
}
|
943
932
|
|
944
933
|
return SSL_ERROR_SYSCALL;
|
@@ -1040,31 +1029,19 @@ uint32_t SSL_clear_mode(SSL *ssl, uint32_t mode) {
|
|
1040
1029
|
|
1041
1030
|
uint32_t SSL_get_mode(const SSL *ssl) { return ssl->mode; }
|
1042
1031
|
|
1043
|
-
|
1044
|
-
|
1045
|
-
return NULL;
|
1046
|
-
}
|
1047
|
-
SSL_SESSION *session = SSL_get_session(ssl);
|
1048
|
-
if (session == NULL || session->peer == NULL) {
|
1049
|
-
return NULL;
|
1050
|
-
}
|
1051
|
-
X509_up_ref(session->peer);
|
1052
|
-
return session->peer;
|
1053
|
-
}
|
1054
|
-
|
1055
|
-
STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *ssl) {
|
1056
|
-
if (ssl == NULL) {
|
1057
|
-
return NULL;
|
1058
|
-
}
|
1059
|
-
SSL_SESSION *session = SSL_get_session(ssl);
|
1060
|
-
if (session == NULL) {
|
1061
|
-
return NULL;
|
1062
|
-
}
|
1063
|
-
return session->cert_chain;
|
1032
|
+
void SSL_CTX_set0_buffer_pool(SSL_CTX *ctx, CRYPTO_BUFFER_POOL *pool) {
|
1033
|
+
ctx->pool = pool;
|
1064
1034
|
}
|
1065
1035
|
|
1066
1036
|
int SSL_get_tls_unique(const SSL *ssl, uint8_t *out, size_t *out_len,
|
1067
1037
|
size_t max_out) {
|
1038
|
+
/* tls-unique is not defined for SSL 3.0 or TLS 1.3. */
|
1039
|
+
if (!ssl->s3->initial_handshake_complete ||
|
1040
|
+
ssl3_protocol_version(ssl) < TLS1_VERSION ||
|
1041
|
+
ssl3_protocol_version(ssl) >= TLS1_3_VERSION) {
|
1042
|
+
goto err;
|
1043
|
+
}
|
1044
|
+
|
1068
1045
|
/* The tls-unique value is the first Finished message in the handshake, which
|
1069
1046
|
* is the client's in a full handshake and the server's for a resumption. See
|
1070
1047
|
* https://tools.ietf.org/html/rfc5929#section-3.1. */
|
@@ -1079,71 +1056,46 @@ int SSL_get_tls_unique(const SSL *ssl, uint8_t *out, size_t *out_len,
|
|
1079
1056
|
finished_len = ssl->s3->previous_server_finished_len;
|
1080
1057
|
}
|
1081
1058
|
|
1082
|
-
if (!ssl->s3->initial_handshake_complete ||
|
1083
|
-
ssl->version < TLS1_VERSION) {
|
1084
|
-
goto err;
|
1085
|
-
}
|
1086
|
-
|
1087
1059
|
*out_len = finished_len;
|
1088
1060
|
if (finished_len > max_out) {
|
1089
1061
|
*out_len = max_out;
|
1090
1062
|
}
|
1091
1063
|
|
1092
|
-
|
1064
|
+
OPENSSL_memcpy(out, finished, *out_len);
|
1093
1065
|
return 1;
|
1094
1066
|
|
1095
1067
|
err:
|
1096
1068
|
*out_len = 0;
|
1097
|
-
|
1069
|
+
OPENSSL_memset(out, 0, max_out);
|
1098
1070
|
return 0;
|
1099
1071
|
}
|
1100
1072
|
|
1101
|
-
int
|
1102
|
-
|
1103
|
-
if (sid_ctx_len > sizeof(
|
1104
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG);
|
1105
|
-
return 0;
|
1106
|
-
}
|
1107
|
-
ctx->sid_ctx_length = sid_ctx_len;
|
1108
|
-
memcpy(ctx->sid_ctx, sid_ctx, sid_ctx_len);
|
1109
|
-
|
1110
|
-
return 1;
|
1111
|
-
}
|
1112
|
-
|
1113
|
-
int SSL_set_session_id_context(SSL *ssl, const uint8_t *sid_ctx,
|
1114
|
-
unsigned sid_ctx_len) {
|
1115
|
-
if (sid_ctx_len > SSL_MAX_SID_CTX_LENGTH) {
|
1073
|
+
static int set_session_id_context(CERT *cert, const uint8_t *sid_ctx,
|
1074
|
+
size_t sid_ctx_len) {
|
1075
|
+
if (sid_ctx_len > sizeof(cert->sid_ctx)) {
|
1116
1076
|
OPENSSL_PUT_ERROR(SSL, SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG);
|
1117
1077
|
return 0;
|
1118
1078
|
}
|
1119
|
-
ssl->sid_ctx_length = sid_ctx_len;
|
1120
|
-
memcpy(ssl->sid_ctx, sid_ctx, sid_ctx_len);
|
1121
1079
|
|
1080
|
+
OPENSSL_COMPILE_ASSERT(sizeof(cert->sid_ctx) < 256, sid_ctx_too_large);
|
1081
|
+
cert->sid_ctx_length = (uint8_t)sid_ctx_len;
|
1082
|
+
OPENSSL_memcpy(cert->sid_ctx, sid_ctx, sid_ctx_len);
|
1122
1083
|
return 1;
|
1123
1084
|
}
|
1124
1085
|
|
1125
|
-
int
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
int SSL_set_purpose(SSL *ssl, int purpose) {
|
1130
|
-
return X509_VERIFY_PARAM_set_purpose(ssl->param, purpose);
|
1131
|
-
}
|
1132
|
-
|
1133
|
-
int SSL_CTX_set_trust(SSL_CTX *ctx, int trust) {
|
1134
|
-
return X509_VERIFY_PARAM_set_trust(ctx->param, trust);
|
1135
|
-
}
|
1136
|
-
|
1137
|
-
int SSL_set_trust(SSL *ssl, int trust) {
|
1138
|
-
return X509_VERIFY_PARAM_set_trust(ssl->param, trust);
|
1086
|
+
int SSL_CTX_set_session_id_context(SSL_CTX *ctx, const uint8_t *sid_ctx,
|
1087
|
+
size_t sid_ctx_len) {
|
1088
|
+
return set_session_id_context(ctx->cert, sid_ctx, sid_ctx_len);
|
1139
1089
|
}
|
1140
1090
|
|
1141
|
-
int
|
1142
|
-
|
1091
|
+
int SSL_set_session_id_context(SSL *ssl, const uint8_t *sid_ctx,
|
1092
|
+
size_t sid_ctx_len) {
|
1093
|
+
return set_session_id_context(ssl->cert, sid_ctx, sid_ctx_len);
|
1143
1094
|
}
|
1144
1095
|
|
1145
|
-
|
1146
|
-
|
1096
|
+
const uint8_t *SSL_get0_session_id_context(const SSL *ssl, size_t *out_len) {
|
1097
|
+
*out_len = ssl->cert->sid_ctx_length;
|
1098
|
+
return ssl->cert->sid_ctx;
|
1147
1099
|
}
|
1148
1100
|
|
1149
1101
|
void ssl_cipher_preference_list_free(
|
@@ -1156,10 +1108,6 @@ void ssl_cipher_preference_list_free(
|
|
1156
1108
|
OPENSSL_free(cipher_list);
|
1157
1109
|
}
|
1158
1110
|
|
1159
|
-
X509_VERIFY_PARAM *SSL_CTX_get0_param(SSL_CTX *ctx) { return ctx->param; }
|
1160
|
-
|
1161
|
-
X509_VERIFY_PARAM *SSL_get0_param(SSL *ssl) { return ssl->param; }
|
1162
|
-
|
1163
1111
|
void SSL_certs_clear(SSL *ssl) { ssl_cert_clear_certs(ssl->cert); }
|
1164
1112
|
|
1165
1113
|
int SSL_get_fd(const SSL *ssl) { return SSL_get_rfd(ssl); }
|
@@ -1232,73 +1180,70 @@ int SSL_set_rfd(SSL *ssl, int fd) {
|
|
1232
1180
|
return 1;
|
1233
1181
|
}
|
1234
1182
|
|
1183
|
+
static size_t copy_finished(void *out, size_t out_len, const uint8_t *in,
|
1184
|
+
size_t in_len) {
|
1185
|
+
if (out_len > in_len) {
|
1186
|
+
out_len = in_len;
|
1187
|
+
}
|
1188
|
+
OPENSSL_memcpy(out, in, out_len);
|
1189
|
+
return in_len;
|
1190
|
+
}
|
1191
|
+
|
1235
1192
|
size_t SSL_get_finished(const SSL *ssl, void *buf, size_t count) {
|
1236
|
-
|
1193
|
+
if (!ssl->s3->initial_handshake_complete ||
|
1194
|
+
ssl3_protocol_version(ssl) < TLS1_VERSION ||
|
1195
|
+
ssl3_protocol_version(ssl) >= TLS1_3_VERSION) {
|
1196
|
+
return 0;
|
1197
|
+
}
|
1237
1198
|
|
1238
|
-
if (ssl->
|
1239
|
-
|
1240
|
-
|
1241
|
-
count = ret;
|
1242
|
-
}
|
1243
|
-
memcpy(buf, ssl->s3->tmp.finish_md, count);
|
1199
|
+
if (ssl->server) {
|
1200
|
+
return copy_finished(buf, count, ssl->s3->previous_server_finished,
|
1201
|
+
ssl->s3->previous_server_finished_len);
|
1244
1202
|
}
|
1245
1203
|
|
1246
|
-
return
|
1204
|
+
return copy_finished(buf, count, ssl->s3->previous_client_finished,
|
1205
|
+
ssl->s3->previous_client_finished_len);
|
1247
1206
|
}
|
1248
1207
|
|
1249
1208
|
size_t SSL_get_peer_finished(const SSL *ssl, void *buf, size_t count) {
|
1250
|
-
|
1209
|
+
if (!ssl->s3->initial_handshake_complete ||
|
1210
|
+
ssl3_protocol_version(ssl) < TLS1_VERSION ||
|
1211
|
+
ssl3_protocol_version(ssl) >= TLS1_3_VERSION) {
|
1212
|
+
return 0;
|
1213
|
+
}
|
1251
1214
|
|
1252
|
-
if (ssl->
|
1253
|
-
|
1254
|
-
|
1255
|
-
count = ret;
|
1256
|
-
}
|
1257
|
-
memcpy(buf, ssl->s3->tmp.peer_finish_md, count);
|
1215
|
+
if (ssl->server) {
|
1216
|
+
return copy_finished(buf, count, ssl->s3->previous_client_finished,
|
1217
|
+
ssl->s3->previous_client_finished_len);
|
1258
1218
|
}
|
1259
1219
|
|
1260
|
-
return
|
1220
|
+
return copy_finished(buf, count, ssl->s3->previous_server_finished,
|
1221
|
+
ssl->s3->previous_server_finished_len);
|
1261
1222
|
}
|
1262
1223
|
|
1263
1224
|
int SSL_get_verify_mode(const SSL *ssl) { return ssl->verify_mode; }
|
1264
1225
|
|
1265
|
-
int SSL_get_verify_depth(const SSL *ssl) {
|
1266
|
-
return X509_VERIFY_PARAM_get_depth(ssl->param);
|
1267
|
-
}
|
1268
|
-
|
1269
1226
|
int SSL_get_extms_support(const SSL *ssl) {
|
1227
|
+
/* TLS 1.3 does not require extended master secret and always reports as
|
1228
|
+
* supporting it. */
|
1270
1229
|
if (!ssl->s3->have_version) {
|
1271
1230
|
return 0;
|
1272
1231
|
}
|
1273
|
-
|
1274
|
-
|
1275
|
-
}
|
1276
|
-
|
1277
|
-
int (*SSL_get_verify_callback(const SSL *ssl))(int, X509_STORE_CTX *) {
|
1278
|
-
return ssl->verify_callback;
|
1279
|
-
}
|
1280
|
-
|
1281
|
-
int SSL_CTX_get_verify_mode(const SSL_CTX *ctx) { return ctx->verify_mode; }
|
1282
|
-
|
1283
|
-
int SSL_CTX_get_verify_depth(const SSL_CTX *ctx) {
|
1284
|
-
return X509_VERIFY_PARAM_get_depth(ctx->param);
|
1285
|
-
}
|
1286
|
-
|
1287
|
-
int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(
|
1288
|
-
int ok, X509_STORE_CTX *store_ctx) {
|
1289
|
-
return ctx->default_verify_callback;
|
1290
|
-
}
|
1232
|
+
if (ssl3_protocol_version(ssl) >= TLS1_3_VERSION) {
|
1233
|
+
return 1;
|
1234
|
+
}
|
1291
1235
|
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
if (callback != NULL) {
|
1296
|
-
ssl->verify_callback = callback;
|
1236
|
+
/* If the initial handshake completed, query the established session. */
|
1237
|
+
if (ssl->s3->established_session != NULL) {
|
1238
|
+
return ssl->s3->established_session->extended_master_secret;
|
1297
1239
|
}
|
1298
|
-
}
|
1299
1240
|
|
1300
|
-
|
1301
|
-
|
1241
|
+
/* Otherwise, query the in-progress handshake. */
|
1242
|
+
if (ssl->s3->hs != NULL) {
|
1243
|
+
return ssl->s3->hs->extended_master_secret;
|
1244
|
+
}
|
1245
|
+
assert(0);
|
1246
|
+
return 0;
|
1302
1247
|
}
|
1303
1248
|
|
1304
1249
|
int SSL_CTX_get_read_ahead(const SSL_CTX *ctx) { return 0; }
|
@@ -1318,32 +1263,12 @@ int SSL_pending(const SSL *ssl) {
|
|
1318
1263
|
|
1319
1264
|
/* Fix this so it checks all the valid key/cert options */
|
1320
1265
|
int SSL_CTX_check_private_key(const SSL_CTX *ctx) {
|
1321
|
-
|
1322
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_NO_CERTIFICATE_ASSIGNED);
|
1323
|
-
return 0;
|
1324
|
-
}
|
1325
|
-
|
1326
|
-
if (ctx->cert->privatekey == NULL) {
|
1327
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_NO_PRIVATE_KEY_ASSIGNED);
|
1328
|
-
return 0;
|
1329
|
-
}
|
1330
|
-
|
1331
|
-
return X509_check_private_key(ctx->cert->x509, ctx->cert->privatekey);
|
1266
|
+
return ssl_cert_check_private_key(ctx->cert, ctx->cert->privatekey);
|
1332
1267
|
}
|
1333
1268
|
|
1334
1269
|
/* Fix this function so that it takes an optional type parameter */
|
1335
1270
|
int SSL_check_private_key(const SSL *ssl) {
|
1336
|
-
|
1337
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_NO_CERTIFICATE_ASSIGNED);
|
1338
|
-
return 0;
|
1339
|
-
}
|
1340
|
-
|
1341
|
-
if (ssl->cert->privatekey == NULL) {
|
1342
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_NO_PRIVATE_KEY_ASSIGNED);
|
1343
|
-
return 0;
|
1344
|
-
}
|
1345
|
-
|
1346
|
-
return X509_check_private_key(ssl->cert->x509, ssl->cert->privatekey);
|
1271
|
+
return ssl_cert_check_private_key(ssl->cert, ssl->cert->privatekey);
|
1347
1272
|
}
|
1348
1273
|
|
1349
1274
|
long SSL_get_default_timeout(const SSL *ssl) {
|
@@ -1419,7 +1344,11 @@ int SSL_set_mtu(SSL *ssl, unsigned mtu) {
|
|
1419
1344
|
}
|
1420
1345
|
|
1421
1346
|
int SSL_get_secure_renegotiation_support(const SSL *ssl) {
|
1422
|
-
|
1347
|
+
if (!ssl->s3->have_version) {
|
1348
|
+
return 0;
|
1349
|
+
}
|
1350
|
+
return ssl3_protocol_version(ssl) >= TLS1_3_VERSION ||
|
1351
|
+
ssl->s3->send_connection_binding;
|
1423
1352
|
}
|
1424
1353
|
|
1425
1354
|
LHASH_OF(SSL_SESSION) *SSL_CTX_sessions(SSL_CTX *ctx) { return ctx->sessions; }
|
@@ -1458,9 +1387,9 @@ int SSL_CTX_get_tlsext_ticket_keys(SSL_CTX *ctx, void *out, size_t len) {
|
|
1458
1387
|
return 0;
|
1459
1388
|
}
|
1460
1389
|
uint8_t *out_bytes = out;
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1390
|
+
OPENSSL_memcpy(out_bytes, ctx->tlsext_tick_key_name, 16);
|
1391
|
+
OPENSSL_memcpy(out_bytes + 16, ctx->tlsext_tick_hmac_key, 16);
|
1392
|
+
OPENSSL_memcpy(out_bytes + 32, ctx->tlsext_tick_aes_key, 16);
|
1464
1393
|
return 1;
|
1465
1394
|
}
|
1466
1395
|
|
@@ -1473,9 +1402,9 @@ int SSL_CTX_set_tlsext_ticket_keys(SSL_CTX *ctx, const void *in, size_t len) {
|
|
1473
1402
|
return 0;
|
1474
1403
|
}
|
1475
1404
|
const uint8_t *in_bytes = in;
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1405
|
+
OPENSSL_memcpy(ctx->tlsext_tick_key_name, in_bytes, 16);
|
1406
|
+
OPENSSL_memcpy(ctx->tlsext_tick_hmac_key, in_bytes + 16, 16);
|
1407
|
+
OPENSSL_memcpy(ctx->tlsext_tick_aes_key, in_bytes + 32, 16);
|
1479
1408
|
return 1;
|
1480
1409
|
}
|
1481
1410
|
|
@@ -1499,17 +1428,25 @@ int SSL_set1_curves(SSL *ssl, const int *curves, size_t curves_len) {
|
|
1499
1428
|
curves_len);
|
1500
1429
|
}
|
1501
1430
|
|
1431
|
+
int SSL_CTX_set1_curves_list(SSL_CTX *ctx, const char *curves) {
|
1432
|
+
return tls1_set_curves_list(&ctx->supported_group_list,
|
1433
|
+
&ctx->supported_group_list_len, curves);
|
1434
|
+
}
|
1435
|
+
|
1436
|
+
int SSL_set1_curves_list(SSL *ssl, const char *curves) {
|
1437
|
+
return tls1_set_curves_list(&ssl->supported_group_list,
|
1438
|
+
&ssl->supported_group_list_len, curves);
|
1439
|
+
}
|
1440
|
+
|
1502
1441
|
uint16_t SSL_get_curve_id(const SSL *ssl) {
|
1503
1442
|
/* TODO(davidben): This checks the wrong session if there is a renegotiation in
|
1504
1443
|
* progress. */
|
1505
1444
|
SSL_SESSION *session = SSL_get_session(ssl);
|
1506
|
-
if (session == NULL
|
1507
|
-
session->cipher == NULL ||
|
1508
|
-
!SSL_CIPHER_is_ECDHE(session->cipher)) {
|
1445
|
+
if (session == NULL) {
|
1509
1446
|
return 0;
|
1510
1447
|
}
|
1511
1448
|
|
1512
|
-
return
|
1449
|
+
return session->group_id;
|
1513
1450
|
}
|
1514
1451
|
|
1515
1452
|
int SSL_CTX_set_tmp_dh(SSL_CTX *ctx, const DH *dh) {
|
@@ -1537,41 +1474,13 @@ STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *ssl) {
|
|
1537
1474
|
return NULL;
|
1538
1475
|
}
|
1539
1476
|
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
if (ssl->version >= TLS1_1_VERSION && ssl->ctx->cipher_list_tls11 != NULL) {
|
1545
|
-
return ssl->ctx->cipher_list_tls11->ciphers;
|
1546
|
-
}
|
1547
|
-
|
1548
|
-
if (ssl->version >= TLS1_VERSION && ssl->ctx->cipher_list_tls10 != NULL) {
|
1549
|
-
return ssl->ctx->cipher_list_tls10->ciphers;
|
1550
|
-
}
|
1551
|
-
|
1552
|
-
if (ssl->ctx->cipher_list != NULL) {
|
1553
|
-
return ssl->ctx->cipher_list->ciphers;
|
1554
|
-
}
|
1555
|
-
|
1556
|
-
return NULL;
|
1557
|
-
}
|
1558
|
-
|
1559
|
-
/* return a STACK of the ciphers available for the SSL and in order of
|
1560
|
-
* algorithm id */
|
1561
|
-
STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *ssl) {
|
1562
|
-
if (ssl == NULL) {
|
1477
|
+
const struct ssl_cipher_preference_list_st *prefs =
|
1478
|
+
ssl_get_cipher_preferences(ssl);
|
1479
|
+
if (prefs == NULL) {
|
1563
1480
|
return NULL;
|
1564
1481
|
}
|
1565
1482
|
|
1566
|
-
|
1567
|
-
return ssl->cipher_list_by_id;
|
1568
|
-
}
|
1569
|
-
|
1570
|
-
if (ssl->ctx->cipher_list_by_id != NULL) {
|
1571
|
-
return ssl->ctx->cipher_list_by_id;
|
1572
|
-
}
|
1573
|
-
|
1574
|
-
return NULL;
|
1483
|
+
return prefs->ciphers;
|
1575
1484
|
}
|
1576
1485
|
|
1577
1486
|
const char *SSL_get_cipher_list(const SSL *ssl, int n) {
|
@@ -1596,8 +1505,9 @@ const char *SSL_get_cipher_list(const SSL *ssl, int n) {
|
|
1596
1505
|
}
|
1597
1506
|
|
1598
1507
|
int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str) {
|
1599
|
-
STACK_OF(SSL_CIPHER) *cipher_list =
|
1600
|
-
ctx->method, &ctx->cipher_list,
|
1508
|
+
STACK_OF(SSL_CIPHER) *cipher_list =
|
1509
|
+
ssl_create_cipher_list(ctx->method, &ctx->cipher_list, str,
|
1510
|
+
0 /* not strict */);
|
1601
1511
|
if (cipher_list == NULL) {
|
1602
1512
|
return 0;
|
1603
1513
|
}
|
@@ -1611,9 +1521,10 @@ int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str) {
|
|
1611
1521
|
return 1;
|
1612
1522
|
}
|
1613
1523
|
|
1614
|
-
int
|
1615
|
-
STACK_OF(SSL_CIPHER) *cipher_list =
|
1616
|
-
ctx->method, &ctx->
|
1524
|
+
int SSL_CTX_set_strict_cipher_list(SSL_CTX *ctx, const char *str) {
|
1525
|
+
STACK_OF(SSL_CIPHER) *cipher_list =
|
1526
|
+
ssl_create_cipher_list(ctx->method, &ctx->cipher_list, str,
|
1527
|
+
1 /* strict */);
|
1617
1528
|
if (cipher_list == NULL) {
|
1618
1529
|
return 0;
|
1619
1530
|
}
|
@@ -1627,9 +1538,10 @@ int SSL_CTX_set_cipher_list_tls10(SSL_CTX *ctx, const char *str) {
|
|
1627
1538
|
return 1;
|
1628
1539
|
}
|
1629
1540
|
|
1630
|
-
int
|
1631
|
-
STACK_OF(SSL_CIPHER) *cipher_list =
|
1632
|
-
ctx->method, &
|
1541
|
+
int SSL_set_cipher_list(SSL *ssl, const char *str) {
|
1542
|
+
STACK_OF(SSL_CIPHER) *cipher_list =
|
1543
|
+
ssl_create_cipher_list(ssl->ctx->method, &ssl->cipher_list, str,
|
1544
|
+
0 /* not strict */);
|
1633
1545
|
if (cipher_list == NULL) {
|
1634
1546
|
return 0;
|
1635
1547
|
}
|
@@ -1643,9 +1555,10 @@ int SSL_CTX_set_cipher_list_tls11(SSL_CTX *ctx, const char *str) {
|
|
1643
1555
|
return 1;
|
1644
1556
|
}
|
1645
1557
|
|
1646
|
-
int
|
1647
|
-
STACK_OF(SSL_CIPHER) *cipher_list =
|
1648
|
-
ssl->ctx->method, &ssl->cipher_list,
|
1558
|
+
int SSL_set_strict_cipher_list(SSL *ssl, const char *str) {
|
1559
|
+
STACK_OF(SSL_CIPHER) *cipher_list =
|
1560
|
+
ssl_create_cipher_list(ssl->ctx->method, &ssl->cipher_list, str,
|
1561
|
+
1 /* strict */);
|
1649
1562
|
if (cipher_list == NULL) {
|
1650
1563
|
return 0;
|
1651
1564
|
}
|
@@ -1659,39 +1572,6 @@ int SSL_set_cipher_list(SSL *ssl, const char *str) {
|
|
1659
1572
|
return 1;
|
1660
1573
|
}
|
1661
1574
|
|
1662
|
-
STACK_OF(SSL_CIPHER) *
|
1663
|
-
ssl_parse_client_cipher_list(const struct ssl_early_callback_ctx *ctx) {
|
1664
|
-
CBS cipher_suites;
|
1665
|
-
CBS_init(&cipher_suites, ctx->cipher_suites, ctx->cipher_suites_len);
|
1666
|
-
|
1667
|
-
STACK_OF(SSL_CIPHER) *sk = sk_SSL_CIPHER_new_null();
|
1668
|
-
if (sk == NULL) {
|
1669
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_MALLOC_FAILURE);
|
1670
|
-
goto err;
|
1671
|
-
}
|
1672
|
-
|
1673
|
-
while (CBS_len(&cipher_suites) > 0) {
|
1674
|
-
uint16_t cipher_suite;
|
1675
|
-
|
1676
|
-
if (!CBS_get_u16(&cipher_suites, &cipher_suite)) {
|
1677
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST);
|
1678
|
-
goto err;
|
1679
|
-
}
|
1680
|
-
|
1681
|
-
const SSL_CIPHER *c = SSL_get_cipher_by_value(cipher_suite);
|
1682
|
-
if (c != NULL && !sk_SSL_CIPHER_push(sk, c)) {
|
1683
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_MALLOC_FAILURE);
|
1684
|
-
goto err;
|
1685
|
-
}
|
1686
|
-
}
|
1687
|
-
|
1688
|
-
return sk;
|
1689
|
-
|
1690
|
-
err:
|
1691
|
-
sk_SSL_CIPHER_free(sk);
|
1692
|
-
return NULL;
|
1693
|
-
}
|
1694
|
-
|
1695
1575
|
const char *SSL_get_servername(const SSL *ssl, const int type) {
|
1696
1576
|
if (type != TLSEXT_NAMETYPE_host_name) {
|
1697
1577
|
return NULL;
|
@@ -1703,6 +1583,15 @@ const char *SSL_get_servername(const SSL *ssl, const int type) {
|
|
1703
1583
|
return ssl->tlsext_hostname;
|
1704
1584
|
}
|
1705
1585
|
|
1586
|
+
/* During the handshake, report the handshake value. */
|
1587
|
+
if (ssl->s3->hs != NULL) {
|
1588
|
+
return ssl->s3->hs->hostname;
|
1589
|
+
}
|
1590
|
+
|
1591
|
+
/* SSL_get_servername may also be called after the handshake to look up the
|
1592
|
+
* SNI value.
|
1593
|
+
*
|
1594
|
+
* TODO(davidben): This is almost unused. Can we remove it? */
|
1706
1595
|
SSL_SESSION *session = SSL_get_session(ssl);
|
1707
1596
|
if (session == NULL) {
|
1708
1597
|
return NULL;
|
@@ -1722,18 +1611,16 @@ void SSL_CTX_enable_signed_cert_timestamps(SSL_CTX *ctx) {
|
|
1722
1611
|
ctx->signed_cert_timestamps_enabled = 1;
|
1723
1612
|
}
|
1724
1613
|
|
1725
|
-
|
1614
|
+
void SSL_enable_signed_cert_timestamps(SSL *ssl) {
|
1726
1615
|
ssl->signed_cert_timestamps_enabled = 1;
|
1727
|
-
return 1;
|
1728
1616
|
}
|
1729
1617
|
|
1730
1618
|
void SSL_CTX_enable_ocsp_stapling(SSL_CTX *ctx) {
|
1731
1619
|
ctx->ocsp_stapling_enabled = 1;
|
1732
1620
|
}
|
1733
1621
|
|
1734
|
-
|
1622
|
+
void SSL_enable_ocsp_stapling(SSL *ssl) {
|
1735
1623
|
ssl->ocsp_stapling_enabled = 1;
|
1736
|
-
return 1;
|
1737
1624
|
}
|
1738
1625
|
|
1739
1626
|
void SSL_get0_signed_cert_timestamp_list(const SSL *ssl, const uint8_t **out,
|
@@ -1763,34 +1650,6 @@ void SSL_get0_ocsp_response(const SSL *ssl, const uint8_t **out,
|
|
1763
1650
|
*out_len = session->ocsp_response_length;
|
1764
1651
|
}
|
1765
1652
|
|
1766
|
-
int SSL_CTX_set_signed_cert_timestamp_list(SSL_CTX *ctx, const uint8_t *list,
|
1767
|
-
size_t list_len) {
|
1768
|
-
OPENSSL_free(ctx->signed_cert_timestamp_list);
|
1769
|
-
ctx->signed_cert_timestamp_list_length = 0;
|
1770
|
-
|
1771
|
-
ctx->signed_cert_timestamp_list = BUF_memdup(list, list_len);
|
1772
|
-
if (ctx->signed_cert_timestamp_list == NULL) {
|
1773
|
-
return 0;
|
1774
|
-
}
|
1775
|
-
ctx->signed_cert_timestamp_list_length = list_len;
|
1776
|
-
|
1777
|
-
return 1;
|
1778
|
-
}
|
1779
|
-
|
1780
|
-
int SSL_CTX_set_ocsp_response(SSL_CTX *ctx, const uint8_t *response,
|
1781
|
-
size_t response_len) {
|
1782
|
-
OPENSSL_free(ctx->ocsp_response);
|
1783
|
-
ctx->ocsp_response_length = 0;
|
1784
|
-
|
1785
|
-
ctx->ocsp_response = BUF_memdup(response, response_len);
|
1786
|
-
if (ctx->ocsp_response == NULL) {
|
1787
|
-
return 0;
|
1788
|
-
}
|
1789
|
-
ctx->ocsp_response_length = response_len;
|
1790
|
-
|
1791
|
-
return 1;
|
1792
|
-
}
|
1793
|
-
|
1794
1653
|
int SSL_set_tlsext_host_name(SSL *ssl, const char *name) {
|
1795
1654
|
OPENSSL_free(ssl->tlsext_hostname);
|
1796
1655
|
ssl->tlsext_hostname = NULL;
|
@@ -1834,7 +1693,7 @@ int SSL_select_next_proto(uint8_t **out, uint8_t *out_len,
|
|
1834
1693
|
for (i = 0; i < server_len;) {
|
1835
1694
|
for (j = 0; j < client_len;) {
|
1836
1695
|
if (server[i] == client[j] &&
|
1837
|
-
|
1696
|
+
OPENSSL_memcmp(&server[i + 1], &client[j + 1], server[i]) == 0) {
|
1838
1697
|
/* We found a match */
|
1839
1698
|
result = &server[i];
|
1840
1699
|
status = OPENSSL_NPN_NEGOTIATED;
|
@@ -1929,13 +1788,21 @@ void SSL_get0_alpn_selected(const SSL *ssl, const uint8_t **out_data,
|
|
1929
1788
|
}
|
1930
1789
|
|
1931
1790
|
|
1791
|
+
void SSL_CTX_set_tls_channel_id_enabled(SSL_CTX *ctx, int enabled) {
|
1792
|
+
ctx->tlsext_channel_id_enabled = !!enabled;
|
1793
|
+
}
|
1794
|
+
|
1932
1795
|
int SSL_CTX_enable_tls_channel_id(SSL_CTX *ctx) {
|
1933
|
-
ctx
|
1796
|
+
SSL_CTX_set_tls_channel_id_enabled(ctx, 1);
|
1934
1797
|
return 1;
|
1935
1798
|
}
|
1936
1799
|
|
1800
|
+
void SSL_set_tls_channel_id_enabled(SSL *ssl, int enabled) {
|
1801
|
+
ssl->tlsext_channel_id_enabled = !!enabled;
|
1802
|
+
}
|
1803
|
+
|
1937
1804
|
int SSL_enable_tls_channel_id(SSL *ssl) {
|
1938
|
-
ssl
|
1805
|
+
SSL_set_tls_channel_id_enabled(ssl, 1);
|
1939
1806
|
return 1;
|
1940
1807
|
}
|
1941
1808
|
|
@@ -1978,95 +1845,22 @@ size_t SSL_get_tls_channel_id(SSL *ssl, uint8_t *out, size_t max_out) {
|
|
1978
1845
|
if (!ssl->s3->tlsext_channel_id_valid) {
|
1979
1846
|
return 0;
|
1980
1847
|
}
|
1981
|
-
|
1848
|
+
OPENSSL_memcpy(out, ssl->s3->tlsext_channel_id,
|
1849
|
+
(max_out < 64) ? max_out : 64);
|
1982
1850
|
return 64;
|
1983
1851
|
}
|
1984
1852
|
|
1985
|
-
void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx,
|
1986
|
-
int (*cb)(X509_STORE_CTX *store_ctx,
|
1987
|
-
void *arg),
|
1988
|
-
void *arg) {
|
1989
|
-
ctx->app_verify_callback = cb;
|
1990
|
-
ctx->app_verify_arg = arg;
|
1991
|
-
}
|
1992
|
-
|
1993
|
-
void SSL_CTX_set_verify(SSL_CTX *ctx, int mode,
|
1994
|
-
int (*cb)(int, X509_STORE_CTX *)) {
|
1995
|
-
ctx->verify_mode = mode;
|
1996
|
-
ctx->default_verify_callback = cb;
|
1997
|
-
}
|
1998
|
-
|
1999
|
-
void SSL_CTX_set_verify_depth(SSL_CTX *ctx, int depth) {
|
2000
|
-
X509_VERIFY_PARAM_set_depth(ctx->param, depth);
|
2001
|
-
}
|
2002
|
-
|
2003
|
-
void SSL_CTX_set_cert_cb(SSL_CTX *ctx, int (*cb)(SSL *ssl, void *arg),
|
2004
|
-
void *arg) {
|
2005
|
-
ssl_cert_set_cert_cb(ctx->cert, cb, arg);
|
2006
|
-
}
|
2007
|
-
|
2008
|
-
void SSL_set_cert_cb(SSL *ssl, int (*cb)(SSL *ssl, void *arg), void *arg) {
|
2009
|
-
ssl_cert_set_cert_cb(ssl->cert, cb, arg);
|
2010
|
-
}
|
2011
|
-
|
2012
1853
|
size_t SSL_get0_certificate_types(SSL *ssl, const uint8_t **out_types) {
|
2013
|
-
if (ssl->server) {
|
1854
|
+
if (ssl->server || ssl->s3->hs == NULL) {
|
2014
1855
|
*out_types = NULL;
|
2015
1856
|
return 0;
|
2016
1857
|
}
|
2017
|
-
*out_types = ssl->s3->
|
2018
|
-
return ssl->s3->
|
2019
|
-
}
|
2020
|
-
|
2021
|
-
void ssl_get_compatible_server_ciphers(SSL *ssl, uint32_t *out_mask_k,
|
2022
|
-
uint32_t *out_mask_a) {
|
2023
|
-
uint32_t mask_k = 0;
|
2024
|
-
uint32_t mask_a = 0;
|
2025
|
-
|
2026
|
-
if (ssl->cert->x509 != NULL && ssl_has_private_key(ssl)) {
|
2027
|
-
int type = ssl_private_key_type(ssl);
|
2028
|
-
if (type == NID_rsaEncryption) {
|
2029
|
-
mask_k |= SSL_kRSA;
|
2030
|
-
mask_a |= SSL_aRSA;
|
2031
|
-
} else if (ssl_is_ecdsa_key_type(type)) {
|
2032
|
-
/* An ECC certificate may be usable for ECDSA cipher suites depending on
|
2033
|
-
* the key usage extension and on the client's group preferences. */
|
2034
|
-
X509 *x = ssl->cert->x509;
|
2035
|
-
/* This call populates extension flags (ex_flags). */
|
2036
|
-
X509_check_purpose(x, -1, 0);
|
2037
|
-
int ecdsa_ok = (x->ex_flags & EXFLAG_KUSAGE)
|
2038
|
-
? (x->ex_kusage & X509v3_KU_DIGITAL_SIGNATURE)
|
2039
|
-
: 1;
|
2040
|
-
if (ecdsa_ok && tls1_check_ec_cert(ssl, x)) {
|
2041
|
-
mask_a |= SSL_aECDSA;
|
2042
|
-
}
|
2043
|
-
}
|
2044
|
-
}
|
2045
|
-
|
2046
|
-
if (ssl->cert->dh_tmp != NULL || ssl->cert->dh_tmp_cb != NULL) {
|
2047
|
-
mask_k |= SSL_kDHE;
|
2048
|
-
}
|
2049
|
-
|
2050
|
-
/* Check for a shared group to consider ECDHE ciphers. */
|
2051
|
-
uint16_t unused;
|
2052
|
-
if (tls1_get_shared_group(ssl, &unused)) {
|
2053
|
-
mask_k |= SSL_kECDHE;
|
2054
|
-
}
|
2055
|
-
|
2056
|
-
/* CECPQ1 ciphers are always acceptable if supported by both sides. */
|
2057
|
-
mask_k |= SSL_kCECPQ1;
|
2058
|
-
|
2059
|
-
/* PSK requires a server callback. */
|
2060
|
-
if (ssl->psk_server_callback != NULL) {
|
2061
|
-
mask_k |= SSL_kPSK;
|
2062
|
-
mask_a |= SSL_aPSK;
|
2063
|
-
}
|
2064
|
-
|
2065
|
-
*out_mask_k = mask_k;
|
2066
|
-
*out_mask_a = mask_a;
|
1858
|
+
*out_types = ssl->s3->hs->certificate_types;
|
1859
|
+
return ssl->s3->hs->num_certificate_types;
|
2067
1860
|
}
|
2068
1861
|
|
2069
|
-
void ssl_update_cache(
|
1862
|
+
void ssl_update_cache(SSL_HANDSHAKE *hs, int mode) {
|
1863
|
+
SSL *const ssl = hs->ssl;
|
2070
1864
|
SSL_CTX *ctx = ssl->initial_ctx;
|
2071
1865
|
/* Never cache sessions with empty session IDs. */
|
2072
1866
|
if (ssl->s3->established_session->session_id_length == 0 ||
|
@@ -2082,7 +1876,7 @@ void ssl_update_cache(SSL *ssl, int mode) {
|
|
2082
1876
|
* decides to renew the ticket. Once the handshake is completed, it should be
|
2083
1877
|
* inserted into the cache. */
|
2084
1878
|
if (ssl->s3->established_session != ssl->session ||
|
2085
|
-
(!ssl->server &&
|
1879
|
+
(!ssl->server && hs->ticket_expected)) {
|
2086
1880
|
if (use_internal_cache) {
|
2087
1881
|
SSL_CTX_add_session(ctx, ssl->s3->established_session);
|
2088
1882
|
}
|
@@ -2152,14 +1946,6 @@ const char *SSL_SESSION_get_version(const SSL_SESSION *session) {
|
|
2152
1946
|
return ssl_get_version(session->ssl_version);
|
2153
1947
|
}
|
2154
1948
|
|
2155
|
-
X509 *SSL_get_certificate(const SSL *ssl) {
|
2156
|
-
if (ssl->cert != NULL) {
|
2157
|
-
return ssl->cert->x509;
|
2158
|
-
}
|
2159
|
-
|
2160
|
-
return NULL;
|
2161
|
-
}
|
2162
|
-
|
2163
1949
|
EVP_PKEY *SSL_get_privatekey(const SSL *ssl) {
|
2164
1950
|
if (ssl->cert != NULL) {
|
2165
1951
|
return ssl->cert->privatekey;
|
@@ -2168,14 +1954,6 @@ EVP_PKEY *SSL_get_privatekey(const SSL *ssl) {
|
|
2168
1954
|
return NULL;
|
2169
1955
|
}
|
2170
1956
|
|
2171
|
-
X509 *SSL_CTX_get0_certificate(const SSL_CTX *ctx) {
|
2172
|
-
if (ctx->cert != NULL) {
|
2173
|
-
return ctx->cert->x509;
|
2174
|
-
}
|
2175
|
-
|
2176
|
-
return NULL;
|
2177
|
-
}
|
2178
|
-
|
2179
1957
|
EVP_PKEY *SSL_CTX_get0_privatekey(const SSL_CTX *ctx) {
|
2180
1958
|
if (ctx->cert != NULL) {
|
2181
1959
|
return ctx->cert->privatekey;
|
@@ -2201,41 +1979,6 @@ const COMP_METHOD *SSL_get_current_expansion(SSL *ssl) { return NULL; }
|
|
2201
1979
|
|
2202
1980
|
int *SSL_get_server_tmp_key(SSL *ssl, EVP_PKEY **out_key) { return 0; }
|
2203
1981
|
|
2204
|
-
int ssl_is_wbio_buffered(const SSL *ssl) {
|
2205
|
-
return ssl->bbio != NULL;
|
2206
|
-
}
|
2207
|
-
|
2208
|
-
int ssl_init_wbio_buffer(SSL *ssl) {
|
2209
|
-
if (ssl->bbio != NULL) {
|
2210
|
-
/* Already buffered. */
|
2211
|
-
assert(ssl->bbio == ssl->wbio);
|
2212
|
-
return 1;
|
2213
|
-
}
|
2214
|
-
|
2215
|
-
BIO *bbio = BIO_new(BIO_f_buffer());
|
2216
|
-
if (bbio == NULL ||
|
2217
|
-
!BIO_set_read_buffer_size(bbio, 1)) {
|
2218
|
-
BIO_free(bbio);
|
2219
|
-
return 0;
|
2220
|
-
}
|
2221
|
-
|
2222
|
-
ssl->bbio = bbio;
|
2223
|
-
ssl->wbio = BIO_push(bbio, ssl->wbio);
|
2224
|
-
return 1;
|
2225
|
-
}
|
2226
|
-
|
2227
|
-
void ssl_free_wbio_buffer(SSL *ssl) {
|
2228
|
-
if (ssl->bbio == NULL) {
|
2229
|
-
return;
|
2230
|
-
}
|
2231
|
-
|
2232
|
-
assert(ssl->bbio == ssl->wbio);
|
2233
|
-
|
2234
|
-
ssl->wbio = BIO_pop(ssl->wbio);
|
2235
|
-
BIO_free(ssl->bbio);
|
2236
|
-
ssl->bbio = NULL;
|
2237
|
-
}
|
2238
|
-
|
2239
1982
|
void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode) {
|
2240
1983
|
ctx->quiet_shutdown = (mode != 0);
|
2241
1984
|
}
|
@@ -2296,6 +2039,12 @@ SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx) {
|
|
2296
2039
|
return ssl->ctx;
|
2297
2040
|
}
|
2298
2041
|
|
2042
|
+
/* One cannot change the X.509 callbacks during a connection. */
|
2043
|
+
if (ssl->ctx->x509_method != ctx->x509_method) {
|
2044
|
+
assert(0);
|
2045
|
+
return NULL;
|
2046
|
+
}
|
2047
|
+
|
2299
2048
|
if (ctx == NULL) {
|
2300
2049
|
ctx = ssl->initial_ctx;
|
2301
2050
|
}
|
@@ -2303,26 +2052,13 @@ SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx) {
|
|
2303
2052
|
ssl_cert_free(ssl->cert);
|
2304
2053
|
ssl->cert = ssl_cert_dup(ctx->cert);
|
2305
2054
|
|
2306
|
-
|
2307
|
-
SSL_CTX_free(ssl->ctx);
|
2055
|
+
SSL_CTX_up_ref(ctx);
|
2056
|
+
SSL_CTX_free(ssl->ctx);
|
2308
2057
|
ssl->ctx = ctx;
|
2309
2058
|
|
2310
|
-
ssl->sid_ctx_length = ctx->sid_ctx_length;
|
2311
|
-
assert(ssl->sid_ctx_length <= sizeof(ssl->sid_ctx));
|
2312
|
-
memcpy(ssl->sid_ctx, ctx->sid_ctx, sizeof(ssl->sid_ctx));
|
2313
|
-
|
2314
2059
|
return ssl->ctx;
|
2315
2060
|
}
|
2316
2061
|
|
2317
|
-
int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx) {
|
2318
|
-
return X509_STORE_set_default_paths(ctx->cert_store);
|
2319
|
-
}
|
2320
|
-
|
2321
|
-
int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *ca_file,
|
2322
|
-
const char *ca_dir) {
|
2323
|
-
return X509_STORE_load_locations(ctx->cert_store, ca_file, ca_dir);
|
2324
|
-
}
|
2325
|
-
|
2326
2062
|
void SSL_set_info_callback(SSL *ssl,
|
2327
2063
|
void (*cb)(const SSL *ssl, int type, int value)) {
|
2328
2064
|
ssl->info_callback = cb;
|
@@ -2333,7 +2069,9 @@ void (*SSL_get_info_callback(const SSL *ssl))(const SSL *ssl, int type,
|
|
2333
2069
|
return ssl->info_callback;
|
2334
2070
|
}
|
2335
2071
|
|
2336
|
-
int SSL_state(const SSL *ssl) {
|
2072
|
+
int SSL_state(const SSL *ssl) {
|
2073
|
+
return SSL_in_init(ssl) ? SSL_ST_INIT : SSL_ST_OK;
|
2074
|
+
}
|
2337
2075
|
|
2338
2076
|
void SSL_set_state(SSL *ssl, int state) { }
|
2339
2077
|
|
@@ -2345,20 +2083,6 @@ char *SSL_get_shared_ciphers(const SSL *ssl, char *buf, int len) {
|
|
2345
2083
|
return buf;
|
2346
2084
|
}
|
2347
2085
|
|
2348
|
-
void SSL_set_verify_result(SSL *ssl, long result) {
|
2349
|
-
if (result != X509_V_OK) {
|
2350
|
-
abort();
|
2351
|
-
}
|
2352
|
-
}
|
2353
|
-
|
2354
|
-
long SSL_get_verify_result(const SSL *ssl) {
|
2355
|
-
SSL_SESSION *session = SSL_get_session(ssl);
|
2356
|
-
if (session == NULL) {
|
2357
|
-
return X509_V_ERR_INVALID_CALL;
|
2358
|
-
}
|
2359
|
-
return session->verify_result;
|
2360
|
-
}
|
2361
|
-
|
2362
2086
|
int SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_unused *unused,
|
2363
2087
|
CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func) {
|
2364
2088
|
int index;
|
@@ -2396,15 +2120,6 @@ void *SSL_CTX_get_ex_data(const SSL_CTX *ctx, int idx) {
|
|
2396
2120
|
return CRYPTO_get_ex_data(&ctx->ex_data, idx);
|
2397
2121
|
}
|
2398
2122
|
|
2399
|
-
X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *ctx) {
|
2400
|
-
return ctx->cert_store;
|
2401
|
-
}
|
2402
|
-
|
2403
|
-
void SSL_CTX_set_cert_store(SSL_CTX *ctx, X509_STORE *store) {
|
2404
|
-
X509_STORE_free(ctx->cert_store);
|
2405
|
-
ctx->cert_store = store;
|
2406
|
-
}
|
2407
|
-
|
2408
2123
|
int SSL_want(const SSL *ssl) { return ssl->rwstate; }
|
2409
2124
|
|
2410
2125
|
void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx,
|
@@ -2427,19 +2142,6 @@ void SSL_set_tmp_dh_callback(SSL *ssl, DH *(*callback)(SSL *ssl, int is_export,
|
|
2427
2142
|
ssl->cert->dh_tmp_cb = callback;
|
2428
2143
|
}
|
2429
2144
|
|
2430
|
-
unsigned SSL_get_dhe_group_size(const SSL *ssl) {
|
2431
|
-
/* TODO(davidben): This checks the wrong session if there is a renegotiation in
|
2432
|
-
* progress. */
|
2433
|
-
SSL_SESSION *session = SSL_get_session(ssl);
|
2434
|
-
if (session == NULL ||
|
2435
|
-
session->cipher == NULL ||
|
2436
|
-
!SSL_CIPHER_is_DHE(session->cipher)) {
|
2437
|
-
return 0;
|
2438
|
-
}
|
2439
|
-
|
2440
|
-
return session->key_exchange_info;
|
2441
|
-
}
|
2442
|
-
|
2443
2145
|
int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint) {
|
2444
2146
|
if (identity_hint != NULL && strlen(identity_hint) > PSK_MAX_IDENTITY_LEN) {
|
2445
2147
|
OPENSSL_PUT_ERROR(SSL, SSL_R_DATA_LENGTH_TOO_LONG);
|
@@ -2586,41 +2288,6 @@ static int cbb_add_hex(CBB *cbb, const uint8_t *in, size_t in_len) {
|
|
2586
2288
|
return 1;
|
2587
2289
|
}
|
2588
2290
|
|
2589
|
-
int ssl_log_rsa_client_key_exchange(const SSL *ssl,
|
2590
|
-
const uint8_t *encrypted_premaster,
|
2591
|
-
size_t encrypted_premaster_len,
|
2592
|
-
const uint8_t *premaster,
|
2593
|
-
size_t premaster_len) {
|
2594
|
-
if (ssl->ctx->keylog_callback == NULL) {
|
2595
|
-
return 1;
|
2596
|
-
}
|
2597
|
-
|
2598
|
-
if (encrypted_premaster_len < 8) {
|
2599
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
|
2600
|
-
return 0;
|
2601
|
-
}
|
2602
|
-
|
2603
|
-
CBB cbb;
|
2604
|
-
uint8_t *out;
|
2605
|
-
size_t out_len;
|
2606
|
-
if (!CBB_init(&cbb, 4 + 16 + 1 + premaster_len * 2 + 1) ||
|
2607
|
-
!CBB_add_bytes(&cbb, (const uint8_t *)"RSA ", 4) ||
|
2608
|
-
/* Only the first 8 bytes of the encrypted premaster secret are
|
2609
|
-
* logged. */
|
2610
|
-
!cbb_add_hex(&cbb, encrypted_premaster, 8) ||
|
2611
|
-
!CBB_add_bytes(&cbb, (const uint8_t *)" ", 1) ||
|
2612
|
-
!cbb_add_hex(&cbb, premaster, premaster_len) ||
|
2613
|
-
!CBB_add_u8(&cbb, 0 /* NUL */) ||
|
2614
|
-
!CBB_finish(&cbb, &out, &out_len)) {
|
2615
|
-
CBB_cleanup(&cbb);
|
2616
|
-
return 0;
|
2617
|
-
}
|
2618
|
-
|
2619
|
-
ssl->ctx->keylog_callback(ssl, (const char *)out);
|
2620
|
-
OPENSSL_free(out);
|
2621
|
-
return 1;
|
2622
|
-
}
|
2623
|
-
|
2624
2291
|
int ssl_log_secret(const SSL *ssl, const char *label, const uint8_t *secret,
|
2625
2292
|
size_t secret_len) {
|
2626
2293
|
if (ssl->ctx->keylog_callback == NULL) {
|
@@ -2649,15 +2316,19 @@ int ssl_log_secret(const SSL *ssl, const char *label, const uint8_t *secret,
|
|
2649
2316
|
}
|
2650
2317
|
|
2651
2318
|
int SSL_is_init_finished(const SSL *ssl) {
|
2652
|
-
return ssl
|
2319
|
+
return !SSL_in_init(ssl);
|
2653
2320
|
}
|
2654
2321
|
|
2655
2322
|
int SSL_in_init(const SSL *ssl) {
|
2656
|
-
|
2323
|
+
SSL_HANDSHAKE *hs = ssl->s3->hs;
|
2324
|
+
return hs != NULL && hs->state != SSL_ST_OK;
|
2657
2325
|
}
|
2658
2326
|
|
2659
2327
|
int SSL_in_false_start(const SSL *ssl) {
|
2660
|
-
|
2328
|
+
if (ssl->s3->hs == NULL) {
|
2329
|
+
return 0;
|
2330
|
+
}
|
2331
|
+
return ssl->s3->hs->in_false_start;
|
2661
2332
|
}
|
2662
2333
|
|
2663
2334
|
int SSL_cutthrough_complete(const SSL *ssl) {
|
@@ -2677,29 +2348,13 @@ int ssl3_can_false_start(const SSL *ssl) {
|
|
2677
2348
|
/* False Start only for TLS 1.2 with an ECDHE+AEAD cipher and ALPN or NPN. */
|
2678
2349
|
return !SSL_is_dtls(ssl) &&
|
2679
2350
|
SSL_version(ssl) == TLS1_2_VERSION &&
|
2680
|
-
(ssl->s3->alpn_selected
|
2351
|
+
(ssl->s3->alpn_selected != NULL ||
|
2352
|
+
ssl->s3->next_proto_negotiated != NULL) &&
|
2681
2353
|
cipher != NULL &&
|
2682
|
-
|
2683
|
-
cipher->algorithm_mkey == SSL_kCECPQ1) &&
|
2354
|
+
cipher->algorithm_mkey == SSL_kECDHE &&
|
2684
2355
|
cipher->algorithm_mac == SSL_AEAD;
|
2685
2356
|
}
|
2686
2357
|
|
2687
|
-
const SSL3_ENC_METHOD *ssl3_get_enc_method(uint16_t version) {
|
2688
|
-
switch (version) {
|
2689
|
-
case SSL3_VERSION:
|
2690
|
-
return &SSLv3_enc_data;
|
2691
|
-
|
2692
|
-
case TLS1_VERSION:
|
2693
|
-
case TLS1_1_VERSION:
|
2694
|
-
case TLS1_2_VERSION:
|
2695
|
-
case TLS1_3_VERSION:
|
2696
|
-
return &TLSv1_enc_data;
|
2697
|
-
|
2698
|
-
default:
|
2699
|
-
return NULL;
|
2700
|
-
}
|
2701
|
-
}
|
2702
|
-
|
2703
2358
|
const struct {
|
2704
2359
|
uint16_t version;
|
2705
2360
|
uint32_t flag;
|
@@ -2800,13 +2455,13 @@ int SSL_is_server(const SSL *ssl) { return ssl->server; }
|
|
2800
2455
|
|
2801
2456
|
int SSL_is_dtls(const SSL *ssl) { return ssl->method->is_dtls; }
|
2802
2457
|
|
2803
|
-
void SSL_CTX_set_select_certificate_cb(
|
2804
|
-
|
2458
|
+
void SSL_CTX_set_select_certificate_cb(SSL_CTX *ctx,
|
2459
|
+
int (*cb)(const SSL_CLIENT_HELLO *)) {
|
2805
2460
|
ctx->select_certificate_cb = cb;
|
2806
2461
|
}
|
2807
2462
|
|
2808
|
-
void SSL_CTX_set_dos_protection_cb(
|
2809
|
-
|
2463
|
+
void SSL_CTX_set_dos_protection_cb(SSL_CTX *ctx,
|
2464
|
+
int (*cb)(const SSL_CLIENT_HELLO *)) {
|
2810
2465
|
ctx->dos_protection_cb = cb;
|
2811
2466
|
}
|
2812
2467
|
|
@@ -2814,11 +2469,6 @@ void SSL_set_renegotiate_mode(SSL *ssl, enum ssl_renegotiate_mode_t mode) {
|
|
2814
2469
|
ssl->renegotiate_mode = mode;
|
2815
2470
|
}
|
2816
2471
|
|
2817
|
-
void SSL_set_reject_peer_renegotiations(SSL *ssl, int reject) {
|
2818
|
-
SSL_set_renegotiate_mode(
|
2819
|
-
ssl, reject ? ssl_renegotiate_never : ssl_renegotiate_freely);
|
2820
|
-
}
|
2821
|
-
|
2822
2472
|
int SSL_get_ivs(const SSL *ssl, const uint8_t **out_read_iv,
|
2823
2473
|
const uint8_t **out_write_iv, size_t *out_iv_len) {
|
2824
2474
|
if (ssl->s3->aead_read_ctx == NULL || ssl->s3->aead_write_ctx == NULL) {
|
@@ -2864,7 +2514,14 @@ uint64_t SSL_get_write_sequence(const SSL *ssl) {
|
|
2864
2514
|
}
|
2865
2515
|
|
2866
2516
|
uint16_t SSL_get_peer_signature_algorithm(const SSL *ssl) {
|
2867
|
-
|
2517
|
+
/* TODO(davidben): This checks the wrong session if there is a renegotiation
|
2518
|
+
* in progress. */
|
2519
|
+
SSL_SESSION *session = SSL_get_session(ssl);
|
2520
|
+
if (session == NULL) {
|
2521
|
+
return 0;
|
2522
|
+
}
|
2523
|
+
|
2524
|
+
return session->peer_signature_algorithm;
|
2868
2525
|
}
|
2869
2526
|
|
2870
2527
|
size_t SSL_get_client_random(const SSL *ssl, uint8_t *out, size_t max_out) {
|
@@ -2874,7 +2531,7 @@ size_t SSL_get_client_random(const SSL *ssl, uint8_t *out, size_t max_out) {
|
|
2874
2531
|
if (max_out > sizeof(ssl->s3->client_random)) {
|
2875
2532
|
max_out = sizeof(ssl->s3->client_random);
|
2876
2533
|
}
|
2877
|
-
|
2534
|
+
OPENSSL_memcpy(out, ssl->s3->client_random, max_out);
|
2878
2535
|
return max_out;
|
2879
2536
|
}
|
2880
2537
|
|
@@ -2885,15 +2542,20 @@ size_t SSL_get_server_random(const SSL *ssl, uint8_t *out, size_t max_out) {
|
|
2885
2542
|
if (max_out > sizeof(ssl->s3->server_random)) {
|
2886
2543
|
max_out = sizeof(ssl->s3->server_random);
|
2887
2544
|
}
|
2888
|
-
|
2545
|
+
OPENSSL_memcpy(out, ssl->s3->server_random, max_out);
|
2889
2546
|
return max_out;
|
2890
2547
|
}
|
2891
2548
|
|
2892
2549
|
const SSL_CIPHER *SSL_get_pending_cipher(const SSL *ssl) {
|
2893
|
-
|
2550
|
+
SSL_HANDSHAKE *hs = ssl->s3->hs;
|
2551
|
+
if (hs == NULL) {
|
2894
2552
|
return NULL;
|
2895
2553
|
}
|
2896
|
-
return
|
2554
|
+
return hs->new_cipher;
|
2555
|
+
}
|
2556
|
+
|
2557
|
+
void SSL_set_retain_only_sha256_of_client_certs(SSL *ssl, int enabled) {
|
2558
|
+
ssl->retain_only_sha256_of_client_certs = !!enabled;
|
2897
2559
|
}
|
2898
2560
|
|
2899
2561
|
void SSL_CTX_set_retain_only_sha256_of_client_certs(SSL_CTX *ctx, int enabled) {
|
@@ -2904,10 +2566,18 @@ void SSL_CTX_set_grease_enabled(SSL_CTX *ctx, int enabled) {
|
|
2904
2566
|
ctx->grease_enabled = !!enabled;
|
2905
2567
|
}
|
2906
2568
|
|
2569
|
+
void SSL_CTX_set_short_header_enabled(SSL_CTX *ctx, int enabled) {
|
2570
|
+
ctx->short_header_enabled = !!enabled;
|
2571
|
+
}
|
2572
|
+
|
2907
2573
|
int SSL_clear(SSL *ssl) {
|
2908
|
-
|
2909
|
-
|
2910
|
-
|
2574
|
+
/* In OpenSSL, reusing a client |SSL| with |SSL_clear| causes the previously
|
2575
|
+
* established session to be offered the next time around. wpa_supplicant
|
2576
|
+
* depends on this behavior, so emulate it. */
|
2577
|
+
SSL_SESSION *session = NULL;
|
2578
|
+
if (!ssl->server && ssl->s3->established_session != NULL) {
|
2579
|
+
session = ssl->s3->established_session;
|
2580
|
+
SSL_SESSION_up_ref(session);
|
2911
2581
|
}
|
2912
2582
|
|
2913
2583
|
/* TODO(davidben): Some state on |ssl| is reset both in |SSL_new| and
|
@@ -2916,7 +2586,6 @@ int SSL_clear(SSL *ssl) {
|
|
2916
2586
|
* naturally reset at the right points between |SSL_new|, |SSL_clear|, and
|
2917
2587
|
* |ssl3_new|. */
|
2918
2588
|
|
2919
|
-
ssl->state = SSL_ST_INIT;
|
2920
2589
|
ssl->rwstate = SSL_NOTHING;
|
2921
2590
|
|
2922
2591
|
BUF_MEM_free(ssl->init_buf);
|
@@ -2935,6 +2604,7 @@ int SSL_clear(SSL *ssl) {
|
|
2935
2604
|
|
2936
2605
|
ssl->method->ssl_free(ssl);
|
2937
2606
|
if (!ssl->method->ssl_new(ssl)) {
|
2607
|
+
SSL_SESSION_free(session);
|
2938
2608
|
return 0;
|
2939
2609
|
}
|
2940
2610
|
|
@@ -2942,7 +2612,10 @@ int SSL_clear(SSL *ssl) {
|
|
2942
2612
|
ssl->d1->mtu = mtu;
|
2943
2613
|
}
|
2944
2614
|
|
2945
|
-
|
2615
|
+
if (session != NULL) {
|
2616
|
+
SSL_set_session(ssl, session);
|
2617
|
+
SSL_SESSION_free(session);
|
2618
|
+
}
|
2946
2619
|
|
2947
2620
|
return 1;
|
2948
2621
|
}
|
@@ -3033,7 +2706,7 @@ void ssl_get_current_time(const SSL *ssl, struct timeval *out_clock) {
|
|
3033
2706
|
return;
|
3034
2707
|
}
|
3035
2708
|
|
3036
|
-
#if defined(
|
2709
|
+
#if defined(BORINGSSL_UNSAFE_DETERMINISTIC_MODE)
|
3037
2710
|
out_clock->tv_sec = 1234;
|
3038
2711
|
out_clock->tv_usec = 1234;
|
3039
2712
|
#elif defined(OPENSSL_WINDOWS)
|