grpc 1.38.0 → 1.40.0
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 +68 -21
- data/include/grpc/event_engine/endpoint_config.h +48 -0
- data/include/grpc/event_engine/event_engine.h +23 -29
- data/include/grpc/event_engine/port.h +2 -0
- data/include/grpc/event_engine/slice_allocator.h +21 -36
- data/include/grpc/grpc.h +9 -2
- data/include/grpc/grpc_security.h +32 -0
- data/include/grpc/grpc_security_constants.h +1 -0
- data/include/grpc/impl/codegen/grpc_types.h +33 -19
- data/include/grpc/impl/codegen/port_platform.h +41 -0
- data/src/core/ext/filters/client_channel/client_channel.cc +415 -249
- data/src/core/ext/filters/client_channel/client_channel.h +42 -18
- data/src/core/ext/filters/client_channel/config_selector.h +19 -6
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +2 -0
- data/src/core/ext/filters/client_channel/health/health_check_client.h +3 -3
- data/src/core/ext/filters/client_channel/http_proxy.cc +16 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +7 -8
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +12 -21
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +3 -5
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +734 -0
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +10 -0
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +8 -15
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +3 -6
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +18 -36
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +14 -22
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +2 -9
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +68 -103
- data/src/core/ext/filters/client_channel/lb_policy.cc +1 -15
- data/src/core/ext/filters/client_channel/lb_policy.h +70 -46
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +1 -3
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_event_engine.cc +31 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_event_engine.cc +28 -0
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +1 -3
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +7 -2
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +116 -76
- data/src/core/ext/filters/client_channel/retry_filter.cc +967 -544
- data/src/core/ext/filters/client_channel/retry_service_config.cc +57 -28
- data/src/core/ext/filters/client_channel/retry_service_config.h +9 -3
- data/src/core/ext/filters/client_channel/service_config_call_data.h +45 -5
- data/src/core/ext/filters/client_idle/client_idle_filter.cc +1 -1
- data/src/core/ext/filters/http/client/http_client_filter.cc +5 -2
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +2 -1
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +5 -1
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +3 -2
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +1 -1
- data/src/core/{lib/event_engine/slice_allocator.cc → ext/transport/chttp2/transport/chttp2_slice_allocator.cc} +23 -16
- data/src/core/ext/transport/chttp2/transport/chttp2_slice_allocator.h +74 -0
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +12 -10
- data/src/core/ext/transport/chttp2/transport/flow_control.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +4 -4
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +8 -8
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +5 -5
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +639 -752
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +190 -69
- data/src/core/ext/transport/chttp2/transport/internal.h +2 -1
- data/src/core/ext/transport/chttp2/transport/parsing.cc +72 -56
- data/src/core/ext/transport/chttp2/transport/varint.cc +6 -4
- data/src/core/ext/transport/inproc/inproc_transport.cc +42 -31
- data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.c +56 -35
- data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.h +180 -76
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +35 -27
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +97 -48
- data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +45 -9
- data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +67 -7
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +66 -9
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +227 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.c +46 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.h +121 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.c +35 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.h +90 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +32 -24
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +120 -73
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +4 -2
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +15 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.c +48 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.h +171 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +8 -6
- data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.h +27 -19
- data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +24 -7
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +57 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +29 -17
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +72 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +3 -2
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +4 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +6 -5
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +15 -11
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +85 -43
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +274 -91
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +11 -8
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +30 -13
- data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.c +33 -5
- data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.h +115 -0
- data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.c +60 -0
- data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.h +181 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.c +1 -0
- data/src/core/ext/upb-generated/validate/validate.upb.c +82 -66
- data/src/core/ext/upb-generated/validate/validate.upb.h +220 -124
- data/src/core/ext/upbdefs-generated/envoy/annotations/deprecation.upbdefs.c +15 -7
- data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.c +53 -52
- data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.c +318 -277
- data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.c +437 -410
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.c +198 -170
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.h +10 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.c +9 -8
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +219 -163
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.h +15 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/resolver.upbdefs.c +59 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/resolver.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/substitution_format_string.upbdefs.c +29 -25
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/udp_socket_config.upbdefs.c +52 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/udp_socket_config.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener.upbdefs.c +135 -125
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener_components.upbdefs.c +131 -123
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/quic_config.upbdefs.c +90 -0
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/quic_config.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/udp_listener_config.upbdefs.c +32 -24
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.c +69 -55
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.c +684 -664
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.c +13 -10
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.c +13 -10
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +441 -375
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +10 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +122 -114
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +1 -1
- data/src/core/ext/upbdefs-generated/envoy/service/status/v3/csds.upbdefs.c +112 -79
- data/src/core/ext/upbdefs-generated/envoy/service/status/v3/csds.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/type/http/v3/path_transformation.upbdefs.c +64 -0
- data/src/core/ext/upbdefs-generated/envoy/type/http/v3/path_transformation.upbdefs.h +50 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/regex.upbdefs.c +35 -32
- data/src/core/ext/upbdefs-generated/google/rpc/status.upbdefs.c +4 -4
- data/src/core/ext/upbdefs-generated/validate/validate.upbdefs.c +182 -160
- data/src/core/ext/xds/certificate_provider_store.h +1 -1
- data/src/core/ext/xds/xds_api.cc +582 -257
- data/src/core/ext/xds/xds_api.h +46 -8
- data/src/core/ext/xds/xds_bootstrap.cc +4 -1
- data/src/core/ext/xds/xds_client.cc +66 -43
- data/src/core/ext/xds/xds_client.h +0 -4
- data/src/core/ext/xds/xds_http_filters.cc +3 -2
- data/src/core/ext/xds/xds_http_filters.h +3 -0
- data/src/core/lib/address_utils/sockaddr_utils.cc +13 -0
- data/src/core/lib/address_utils/sockaddr_utils.h +10 -0
- data/src/core/lib/channel/call_tracer.h +85 -0
- data/src/core/lib/channel/channel_stack.h +1 -1
- data/src/core/lib/channel/channelz.h +3 -0
- data/src/core/lib/channel/context.h +3 -0
- data/src/core/lib/channel/status_util.h +4 -0
- data/src/core/lib/compression/stream_compression.h +1 -1
- data/src/core/lib/compression/stream_compression_gzip.h +1 -1
- data/src/core/lib/compression/stream_compression_identity.h +1 -1
- data/src/core/lib/debug/stats.h +1 -1
- data/src/core/lib/event_engine/endpoint_config.cc +46 -0
- data/src/core/lib/event_engine/endpoint_config_internal.h +42 -0
- data/src/core/lib/event_engine/event_engine.cc +50 -0
- data/src/core/lib/event_engine/sockaddr.cc +14 -12
- data/src/core/lib/event_engine/sockaddr.h +44 -0
- data/src/core/lib/gpr/murmur_hash.cc +4 -2
- data/src/core/lib/gpr/wrap_memcpy.cc +2 -1
- data/src/core/lib/gprpp/manual_constructor.h +1 -1
- data/src/core/lib/gprpp/orphanable.h +3 -3
- data/src/core/lib/gprpp/status_helper.h +3 -0
- data/src/core/lib/gprpp/sync.h +2 -30
- data/src/core/lib/iomgr/buffer_list.cc +1 -1
- data/src/core/lib/iomgr/endpoint_pair_event_engine.cc +33 -0
- data/src/core/lib/iomgr/error.cc +5 -4
- data/src/core/lib/iomgr/error.h +1 -1
- data/src/core/lib/iomgr/ev_apple.h +1 -1
- data/src/core/lib/iomgr/event_engine/closure.cc +54 -0
- data/src/core/lib/iomgr/event_engine/closure.h +33 -0
- data/src/core/lib/iomgr/event_engine/endpoint.cc +192 -0
- data/src/core/lib/iomgr/event_engine/endpoint.h +53 -0
- data/src/core/lib/iomgr/event_engine/iomgr.cc +105 -0
- data/src/core/lib/iomgr/event_engine/iomgr.h +24 -0
- data/src/core/lib/iomgr/event_engine/pollset.cc +87 -0
- data/{include/grpc/event_engine/channel_args.h → src/core/lib/iomgr/event_engine/pollset.h} +7 -10
- data/src/core/lib/iomgr/event_engine/promise.h +51 -0
- data/src/core/lib/iomgr/event_engine/resolved_address_internal.cc +41 -0
- data/src/core/lib/iomgr/event_engine/resolved_address_internal.h +35 -0
- data/src/core/lib/iomgr/event_engine/resolver.cc +110 -0
- data/src/core/lib/iomgr/event_engine/tcp.cc +263 -0
- data/src/core/lib/iomgr/event_engine/timer.cc +57 -0
- data/src/core/lib/iomgr/exec_ctx.cc +8 -0
- data/src/core/lib/iomgr/exec_ctx.h +3 -4
- data/src/core/lib/iomgr/executor/threadpool.cc +2 -3
- data/src/core/lib/iomgr/executor/threadpool.h +2 -2
- data/src/core/lib/iomgr/iomgr.cc +1 -1
- data/src/core/lib/iomgr/iomgr_posix.cc +2 -0
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +40 -10
- data/src/core/lib/iomgr/pollset_custom.cc +2 -2
- data/src/core/lib/iomgr/pollset_custom.h +3 -1
- data/src/core/lib/iomgr/pollset_uv.cc +3 -1
- data/src/core/lib/iomgr/pollset_uv.h +5 -1
- data/src/core/lib/iomgr/port.h +7 -5
- data/src/core/lib/iomgr/python_util.h +1 -1
- data/src/core/lib/iomgr/resolve_address.cc +5 -1
- data/src/core/lib/iomgr/resolve_address.h +6 -0
- data/src/core/lib/iomgr/resource_quota.cc +2 -0
- data/src/core/lib/iomgr/sockaddr.h +1 -0
- data/src/core/lib/iomgr/socket_mutator.cc +15 -2
- data/src/core/lib/iomgr/socket_mutator.h +26 -2
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +4 -4
- data/src/core/lib/iomgr/socket_utils_posix.h +2 -2
- data/src/core/lib/iomgr/tcp_client_posix.cc +7 -2
- data/src/core/lib/iomgr/tcp_client_windows.cc +2 -0
- data/src/core/lib/iomgr/tcp_posix.cc +42 -39
- data/src/core/lib/iomgr/tcp_posix.h +8 -0
- data/src/core/lib/iomgr/tcp_server_custom.cc +3 -4
- data/src/core/lib/iomgr/tcp_server_posix.cc +7 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +2 -1
- data/src/core/lib/iomgr/timer.h +6 -1
- data/src/core/lib/iomgr/timer_manager.cc +1 -1
- data/src/core/lib/json/json_reader.cc +1 -2
- data/src/core/lib/matchers/matchers.cc +8 -20
- data/src/core/lib/matchers/matchers.h +2 -1
- data/src/core/lib/security/authorization/authorization_engine.h +44 -0
- data/src/core/lib/security/authorization/authorization_policy_provider.h +32 -0
- data/src/core/lib/security/authorization/authorization_policy_provider_vtable.cc +46 -0
- data/src/core/lib/security/authorization/evaluate_args.cc +209 -0
- data/src/core/lib/security/authorization/evaluate_args.h +91 -0
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +3 -1
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +49 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +7 -0
- data/src/core/lib/security/credentials/tls/tls_utils.cc +32 -0
- data/src/core/lib/security/credentials/tls/tls_utils.h +13 -0
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +9 -6
- data/src/core/lib/security/security_connector/ssl_utils.cc +5 -0
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +6 -18
- data/src/core/lib/security/transport/security_handshaker.cc +12 -4
- data/src/core/lib/security/transport/server_auth_filter.cc +0 -7
- data/src/core/lib/slice/slice.cc +12 -2
- data/src/core/lib/slice/slice_internal.h +1 -0
- data/src/core/lib/surface/call.cc +26 -7
- data/src/core/lib/surface/call.h +11 -0
- data/src/core/lib/surface/completion_queue.cc +22 -22
- data/src/core/lib/surface/completion_queue.h +1 -1
- data/src/core/lib/surface/completion_queue_factory.cc +1 -2
- data/src/core/lib/surface/init.cc +1 -3
- data/src/core/lib/surface/init.h +10 -1
- data/src/core/lib/surface/server.cc +3 -1
- data/src/core/lib/surface/server.h +3 -3
- data/src/core/lib/surface/version.cc +2 -4
- data/src/core/lib/transport/error_utils.cc +2 -2
- data/src/core/lib/transport/metadata_batch.cc +13 -2
- data/src/core/lib/transport/metadata_batch.h +7 -0
- data/src/core/lib/transport/transport.h +2 -0
- data/src/core/lib/transport/transport_op_string.cc +1 -1
- data/src/core/plugin_registry/grpc_plugin_registry.cc +4 -0
- data/src/core/tsi/alts/crypt/gsec.h +2 -0
- data/src/ruby/ext/grpc/extconf.rb +2 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +6 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +10 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/boringssl-with-bazel/err_data.c +269 -263
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_object.c +8 -6
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/cipher_extra.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/evp/evp.c +9 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/prime.c +0 -4
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digest.c +7 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/md32_common.h +87 -121
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md4/md4.c +20 -30
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md5/md5.c +19 -30
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +1 -4
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +0 -13
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +26 -24
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +10 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha1.c +28 -39
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha256.c +48 -66
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha512.c +4 -5
- data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +362 -371
- data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7_x509.c +4 -2
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/passive.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/rsa_asn1.c +1 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/internal.h +101 -11
- data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509a.c +3 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_cmp.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_req.c +3 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +2 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +14 -15
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vpm.c +53 -73
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509cset.c +31 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509rset.c +3 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_all.c +3 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_req.c +5 -8
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_sig.c +5 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509a.c +3 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/internal.h +7 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_utl.c +5 -8
- data/third_party/boringssl-with-bazel/src/include/openssl/aead.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/arm_arch.h +66 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +40 -9
- data/third_party/boringssl-with-bazel/src/include/openssl/bytestring.h +1 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/chacha.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +6 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/ecdsa.h +14 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +19 -11
- data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +325 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/pkcs7.h +23 -7
- data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +99 -63
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +139 -109
- data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +12 -19
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +48 -50
- data/third_party/boringssl-with-bazel/src/include/openssl/x509_vfy.h +451 -435
- data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +0 -1
- data/third_party/boringssl-with-bazel/src/ssl/d1_both.cc +2 -2
- data/third_party/boringssl-with-bazel/src/ssl/d1_srtp.cc +1 -1
- data/third_party/boringssl-with-bazel/src/ssl/encrypted_client_hello.cc +773 -84
- data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +80 -47
- data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +24 -19
- data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +189 -86
- data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +45 -56
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +272 -167
- data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +2 -2
- data/third_party/boringssl-with-bazel/src/ssl/s3_lib.cc +2 -2
- data/third_party/boringssl-with-bazel/src/ssl/s3_pkt.cc +14 -19
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +34 -102
- data/third_party/boringssl-with-bazel/src/ssl/ssl_privkey.cc +2 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +8 -31
- data/third_party/boringssl-with-bazel/src/ssl/ssl_stat.cc +3 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_transcript.cc +4 -3
- data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +7 -3
- data/third_party/boringssl-with-bazel/src/ssl/t1_lib.cc +576 -648
- data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +31 -3
- data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +98 -39
- data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +141 -94
- data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +58 -68
- data/third_party/xxhash/xxhash.h +77 -195
- metadata +81 -39
- data/src/core/lib/gpr/arena.h +0 -47
- data/third_party/boringssl-with-bazel/src/crypto/hpke/internal.h +0 -267
- data/third_party/boringssl-with-bazel/src/crypto/x509/vpm_int.h +0 -71
@@ -250,3 +250,34 @@ int i2d_X509_CRL_tbs(X509_CRL *crl, unsigned char **outp)
|
|
250
250
|
{
|
251
251
|
return i2d_X509_CRL_INFO(crl->crl, outp);
|
252
252
|
}
|
253
|
+
|
254
|
+
int X509_CRL_set1_signature_algo(X509_CRL *crl, const X509_ALGOR *algo)
|
255
|
+
{
|
256
|
+
/* TODO(davidben): Const-correct generated ASN.1 dup functions.
|
257
|
+
* Alternatively, when the types are hidden and we can embed required fields
|
258
|
+
* directly in structs, import |X509_ALGOR_copy| from upstream. */
|
259
|
+
X509_ALGOR *copy1 = X509_ALGOR_dup((X509_ALGOR *)algo);
|
260
|
+
X509_ALGOR *copy2 = X509_ALGOR_dup((X509_ALGOR *)algo);
|
261
|
+
if (copy1 == NULL || copy2 == NULL) {
|
262
|
+
X509_ALGOR_free(copy1);
|
263
|
+
X509_ALGOR_free(copy2);
|
264
|
+
return 0;
|
265
|
+
}
|
266
|
+
|
267
|
+
X509_ALGOR_free(crl->sig_alg);
|
268
|
+
crl->sig_alg = copy1;
|
269
|
+
X509_ALGOR_free(crl->crl->sig_alg);
|
270
|
+
crl->crl->sig_alg = copy2;
|
271
|
+
return 1;
|
272
|
+
}
|
273
|
+
|
274
|
+
int X509_CRL_set1_signature_value(X509_CRL *crl, const uint8_t *sig,
|
275
|
+
size_t sig_len)
|
276
|
+
{
|
277
|
+
if (!ASN1_STRING_set(crl->signature, sig, sig_len)) {
|
278
|
+
return 0;
|
279
|
+
}
|
280
|
+
crl->signature->flags &= ~(ASN1_STRING_FLAG_BITS_LEFT | 0x07);
|
281
|
+
crl->signature->flags |= ASN1_STRING_FLAG_BITS_LEFT;
|
282
|
+
return 1;
|
283
|
+
}
|
@@ -60,17 +60,16 @@
|
|
60
60
|
#include <openssl/thread.h>
|
61
61
|
#include <openssl/x509.h>
|
62
62
|
|
63
|
+
#include "internal.h"
|
64
|
+
|
65
|
+
|
63
66
|
/*
|
64
67
|
* X509_REQ_INFO is handled in an unusual way to get round invalid encodings.
|
65
68
|
* Some broken certificate requests don't encode the attributes field if it
|
66
69
|
* is empty. This is in violation of PKCS#10 but we need to tolerate it. We
|
67
70
|
* do this by making the attributes field OPTIONAL then using the callback to
|
68
71
|
* initialise it to an empty STACK. This means that the field will be
|
69
|
-
* correctly encoded unless we NULL out the field.
|
70
|
-
* need the req_kludge field because the information is now contained in the
|
71
|
-
* attributes field: 1. If it is NULL then it's the invalid omission. 2. If
|
72
|
-
* it is empty it is the correct encoding. 3. If it is not empty then some
|
73
|
-
* attributes are present.
|
72
|
+
* correctly encoded unless we NULL out the field.
|
74
73
|
*/
|
75
74
|
|
76
75
|
static int rinf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
|
@@ -90,9 +89,7 @@ ASN1_SEQUENCE_enc(X509_REQ_INFO, enc, rinf_cb) = {
|
|
90
89
|
ASN1_SIMPLE(X509_REQ_INFO, version, ASN1_INTEGER),
|
91
90
|
ASN1_SIMPLE(X509_REQ_INFO, subject, X509_NAME),
|
92
91
|
ASN1_SIMPLE(X509_REQ_INFO, pubkey, X509_PUBKEY),
|
93
|
-
/* This isn't really OPTIONAL but it gets
|
94
|
-
* encodings
|
95
|
-
*/
|
92
|
+
/* This isn't really OPTIONAL but it gets around invalid encodings. */
|
96
93
|
ASN1_IMP_SET_OF_OPT(X509_REQ_INFO, attributes, X509_ATTRIBUTE, 0)
|
97
94
|
} ASN1_SEQUENCE_END_enc(X509_REQ_INFO, X509_REQ_INFO)
|
98
95
|
|
@@ -61,6 +61,11 @@
|
|
61
61
|
#include <openssl/x509.h>
|
62
62
|
|
63
63
|
|
64
|
+
struct X509_sig_st {
|
65
|
+
X509_ALGOR *algor;
|
66
|
+
ASN1_OCTET_STRING *digest;
|
67
|
+
} /* X509_SIG */;
|
68
|
+
|
64
69
|
ASN1_SEQUENCE(X509_SIG) = {
|
65
70
|
ASN1_SIMPLE(X509_SIG, algor, X509_ALGOR),
|
66
71
|
ASN1_SIMPLE(X509_SIG, digest, ASN1_OCTET_STRING)
|
@@ -53,6 +53,13 @@ OPENSSL_EXPORT int x509v3_looks_like_dns_name(const unsigned char *in,
|
|
53
53
|
// invalid.
|
54
54
|
int x509v3_cache_extensions(X509 *x);
|
55
55
|
|
56
|
+
// x509v3_a2i_ipadd decodes |ipasc| as an IPv4 or IPv6 address. IPv6 addresses
|
57
|
+
// use colon-separated syntax while IPv4 addresses use dotted decimal syntax. If
|
58
|
+
// it decodes an IPv4 address, it writes the result to the first four bytes of
|
59
|
+
// |ipout| and returns four. If it decodes an IPv6 address, it writes the result
|
60
|
+
// to all 16 bytes of |ipout| and returns 16. Otherwise, it returns zero.
|
61
|
+
int x509v3_a2i_ipadd(unsigned char ipout[16], const char *ipasc);
|
62
|
+
|
56
63
|
|
57
64
|
#if defined(__cplusplus)
|
58
65
|
} /* extern C */
|
@@ -440,7 +440,7 @@ int x509v3_cache_extensions(X509 *x)
|
|
440
440
|
if (!X509_digest(x, EVP_sha1(), x->sha1_hash, NULL))
|
441
441
|
x->ex_flags |= EXFLAG_INVALID;
|
442
442
|
/* V1 should mean no extensions ... */
|
443
|
-
if (X509_get_version(x) ==
|
443
|
+
if (X509_get_version(x) == X509_VERSION_1)
|
444
444
|
x->ex_flags |= EXFLAG_V1;
|
445
445
|
/* Handle basic constraints */
|
446
446
|
if ((bs = X509_get_ext_d2i(x, NID_basic_constraints, &j, NULL))) {
|
@@ -1112,7 +1112,7 @@ int X509_check_ip_asc(X509 *x, const char *ipasc, unsigned int flags)
|
|
1112
1112
|
|
1113
1113
|
if (ipasc == NULL)
|
1114
1114
|
return -2;
|
1115
|
-
iplen = (size_t)
|
1115
|
+
iplen = (size_t)x509v3_a2i_ipadd(ipout, ipasc);
|
1116
1116
|
if (iplen == 0)
|
1117
1117
|
return -2;
|
1118
1118
|
return do_x509_check(x, (char *)ipout, iplen, flags, GEN_IPADD, NULL);
|
@@ -1129,10 +1129,7 @@ ASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc)
|
|
1129
1129
|
ASN1_OCTET_STRING *ret;
|
1130
1130
|
int iplen;
|
1131
1131
|
|
1132
|
-
|
1133
|
-
|
1134
|
-
iplen = a2i_ipadd(ipout, ipasc);
|
1135
|
-
|
1132
|
+
iplen = x509v3_a2i_ipadd(ipout, ipasc);
|
1136
1133
|
if (!iplen)
|
1137
1134
|
return NULL;
|
1138
1135
|
|
@@ -1161,12 +1158,12 @@ ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc)
|
|
1161
1158
|
p = iptmp + (p - ipasc);
|
1162
1159
|
*p++ = 0;
|
1163
1160
|
|
1164
|
-
iplen1 =
|
1161
|
+
iplen1 = x509v3_a2i_ipadd(ipout, iptmp);
|
1165
1162
|
|
1166
1163
|
if (!iplen1)
|
1167
1164
|
goto err;
|
1168
1165
|
|
1169
|
-
iplen2 =
|
1166
|
+
iplen2 = x509v3_a2i_ipadd(ipout + iplen1, p);
|
1170
1167
|
|
1171
1168
|
OPENSSL_free(iptmp);
|
1172
1169
|
iptmp = NULL;
|
@@ -1190,7 +1187,7 @@ ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc)
|
|
1190
1187
|
return NULL;
|
1191
1188
|
}
|
1192
1189
|
|
1193
|
-
int
|
1190
|
+
int x509v3_a2i_ipadd(unsigned char *ipout, const char *ipasc)
|
1194
1191
|
{
|
1195
1192
|
/* If string contains a ':' assume IPv6 */
|
1196
1193
|
|
@@ -122,7 +122,7 @@ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_192_gcm(void);
|
|
122
122
|
OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_gcm(void);
|
123
123
|
|
124
124
|
// EVP_aead_chacha20_poly1305 is the AEAD built from ChaCha20 and
|
125
|
-
// Poly1305 as described in RFC
|
125
|
+
// Poly1305 as described in RFC 8439.
|
126
126
|
OPENSSL_EXPORT const EVP_AEAD *EVP_aead_chacha20_poly1305(void);
|
127
127
|
|
128
128
|
// EVP_aead_xchacha20_poly1305 is ChaCha20-Poly1305 with an extended nonce that
|
@@ -124,7 +124,72 @@
|
|
124
124
|
// - Armv8.5-A Branch Target Identification
|
125
125
|
// features which require emitting a .note.gnu.property section with the
|
126
126
|
// appropriate architecture-dependent feature bits set.
|
127
|
-
//
|
127
|
+
//
|
128
|
+
// |AARCH64_SIGN_LINK_REGISTER| and |AARCH64_VALIDATE_LINK_REGISTER| expand to
|
129
|
+
// PACIxSP and AUTIxSP, respectively. |AARCH64_SIGN_LINK_REGISTER| should be
|
130
|
+
// used immediately before saving the LR register (x30) to the stack.
|
131
|
+
// |AARCH64_VALIDATE_LINK_REGISTER| should be used immediately after restoring
|
132
|
+
// it. Note |AARCH64_SIGN_LINK_REGISTER|'s modifications to LR must be undone
|
133
|
+
// with |AARCH64_VALIDATE_LINK_REGISTER| before RET. The SP register must also
|
134
|
+
// have the same value at the two points. For example:
|
135
|
+
//
|
136
|
+
// .global f
|
137
|
+
// f:
|
138
|
+
// AARCH64_SIGN_LINK_REGISTER
|
139
|
+
// stp x29, x30, [sp, #-96]!
|
140
|
+
// mov x29, sp
|
141
|
+
// ...
|
142
|
+
// ldp x29, x30, [sp], #96
|
143
|
+
// AARCH64_VALIDATE_LINK_REGISTER
|
144
|
+
// ret
|
145
|
+
//
|
146
|
+
// |AARCH64_VALID_CALL_TARGET| expands to BTI 'c'. Either it, or
|
147
|
+
// |AARCH64_SIGN_LINK_REGISTER|, must be used at every point that may be an
|
148
|
+
// indirect call target. In particular, all symbols exported from a file must
|
149
|
+
// begin with one of these macros. For example, a leaf function that does not
|
150
|
+
// save LR can instead use |AARCH64_VALID_CALL_TARGET|:
|
151
|
+
//
|
152
|
+
// .globl return_zero
|
153
|
+
// return_zero:
|
154
|
+
// AARCH64_VALID_CALL_TARGET
|
155
|
+
// mov x0, #0
|
156
|
+
// ret
|
157
|
+
//
|
158
|
+
// A non-leaf function which does not immediately save LR may need both macros
|
159
|
+
// because |AARCH64_SIGN_LINK_REGISTER| appears late. For example, the function
|
160
|
+
// may jump to an alternate implementation before setting up the stack:
|
161
|
+
//
|
162
|
+
// .globl with_early_jump
|
163
|
+
// with_early_jump:
|
164
|
+
// AARCH64_VALID_CALL_TARGET
|
165
|
+
// cmp x0, #128
|
166
|
+
// b.lt .Lwith_early_jump_128
|
167
|
+
// AARCH64_SIGN_LINK_REGISTER
|
168
|
+
// stp x29, x30, [sp, #-96]!
|
169
|
+
// mov x29, sp
|
170
|
+
// ...
|
171
|
+
// ldp x29, x30, [sp], #96
|
172
|
+
// AARCH64_VALIDATE_LINK_REGISTER
|
173
|
+
// ret
|
174
|
+
//
|
175
|
+
// .Lwith_early_jump_128:
|
176
|
+
// ...
|
177
|
+
// ret
|
178
|
+
//
|
179
|
+
// These annotations are only required with indirect calls. Private symbols that
|
180
|
+
// are only the target of direct calls do not require annotations. Also note
|
181
|
+
// that |AARCH64_VALID_CALL_TARGET| is only valid for indirect calls (BLR), not
|
182
|
+
// indirect jumps (BR). Indirect jumps in assembly are currently not supported
|
183
|
+
// and would require a macro for BTI 'j'.
|
184
|
+
//
|
185
|
+
// Although not necessary, it is safe to use these macros in 32-bit ARM
|
186
|
+
// assembly. This may be used to simplify dual 32-bit and 64-bit files.
|
187
|
+
//
|
188
|
+
// References:
|
189
|
+
// - "ELF for the Arm® 64-bit Architecture"
|
190
|
+
// https://github.com/ARM-software/abi-aa/blob/master/aaelf64/aaelf64.rst
|
191
|
+
// - "Providing protection for complex software"
|
192
|
+
// https://developer.arm.com/architectures/learn-the-architecture/providing-protection-for-complex-software
|
128
193
|
|
129
194
|
#if defined(__ARM_FEATURE_BTI_DEFAULT) && __ARM_FEATURE_BTI_DEFAULT == 1
|
130
195
|
#define GNU_PROPERTY_AARCH64_BTI (1 << 0) // Has Branch Target Identification
|
@@ -160,10 +160,6 @@ extern "C" {
|
|
160
160
|
|
161
161
|
#if defined(__ANDROID_API__)
|
162
162
|
#define OPENSSL_ANDROID
|
163
|
-
#if defined(BORINGSSL_FIPS)
|
164
|
-
// The FIPS module on Android passively receives entropy.
|
165
|
-
#define BORINGSSL_FIPS_PASSIVE_ENTROPY
|
166
|
-
#endif
|
167
163
|
#endif
|
168
164
|
|
169
165
|
#if defined(__FreeBSD__)
|
@@ -199,7 +195,7 @@ extern "C" {
|
|
199
195
|
// A consumer may use this symbol in the preprocessor to temporarily build
|
200
196
|
// against multiple revisions of BoringSSL at the same time. It is not
|
201
197
|
// recommended to do so for longer than is necessary.
|
202
|
-
#define BORINGSSL_API_VERSION
|
198
|
+
#define BORINGSSL_API_VERSION 16
|
203
199
|
|
204
200
|
#if defined(BORINGSSL_SHARED_LIBRARY)
|
205
201
|
|
@@ -376,7 +372,6 @@ typedef struct X509_info_st X509_INFO;
|
|
376
372
|
typedef struct X509_name_entry_st X509_NAME_ENTRY;
|
377
373
|
typedef struct X509_name_st X509_NAME;
|
378
374
|
typedef struct X509_pubkey_st X509_PUBKEY;
|
379
|
-
typedef struct X509_req_info_st X509_REQ_INFO;
|
380
375
|
typedef struct X509_req_st X509_REQ;
|
381
376
|
typedef struct X509_sig_st X509_SIG;
|
382
377
|
typedef struct X509_val_st X509_VAL;
|
@@ -409,6 +404,11 @@ typedef struct evp_aead_st EVP_AEAD;
|
|
409
404
|
typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX;
|
410
405
|
typedef struct evp_cipher_st EVP_CIPHER;
|
411
406
|
typedef struct evp_encode_ctx_st EVP_ENCODE_CTX;
|
407
|
+
typedef struct evp_hpke_aead_st EVP_HPKE_AEAD;
|
408
|
+
typedef struct evp_hpke_ctx_st EVP_HPKE_CTX;
|
409
|
+
typedef struct evp_hpke_kdf_st EVP_HPKE_KDF;
|
410
|
+
typedef struct evp_hpke_kem_st EVP_HPKE_KEM;
|
411
|
+
typedef struct evp_hpke_key_st EVP_HPKE_KEY;
|
412
412
|
typedef struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD;
|
413
413
|
typedef struct evp_pkey_ctx_st EVP_PKEY_CTX;
|
414
414
|
typedef struct evp_pkey_method_st EVP_PKEY_METHOD;
|
@@ -431,7 +431,7 @@ typedef struct spake2_ctx_st SPAKE2_CTX;
|
|
431
431
|
typedef struct srtp_protection_profile_st SRTP_PROTECTION_PROFILE;
|
432
432
|
typedef struct ssl_cipher_st SSL_CIPHER;
|
433
433
|
typedef struct ssl_ctx_st SSL_CTX;
|
434
|
-
typedef struct
|
434
|
+
typedef struct ssl_ech_keys_st SSL_ECH_KEYS;
|
435
435
|
typedef struct ssl_method_st SSL_METHOD;
|
436
436
|
typedef struct ssl_private_key_method_st SSL_PRIVATE_KEY_METHOD;
|
437
437
|
typedef struct ssl_quic_method_st SSL_QUIC_METHOD;
|
@@ -537,8 +537,39 @@ class StackAllocated {
|
|
537
537
|
StackAllocated() { init(&ctx_); }
|
538
538
|
~StackAllocated() { cleanup(&ctx_); }
|
539
539
|
|
540
|
-
StackAllocated(const StackAllocated
|
541
|
-
|
540
|
+
StackAllocated(const StackAllocated &) = delete;
|
541
|
+
StackAllocated& operator=(const StackAllocated &) = delete;
|
542
|
+
|
543
|
+
T *get() { return &ctx_; }
|
544
|
+
const T *get() const { return &ctx_; }
|
545
|
+
|
546
|
+
T *operator->() { return &ctx_; }
|
547
|
+
const T *operator->() const { return &ctx_; }
|
548
|
+
|
549
|
+
void Reset() {
|
550
|
+
cleanup(&ctx_);
|
551
|
+
init(&ctx_);
|
552
|
+
}
|
553
|
+
|
554
|
+
private:
|
555
|
+
T ctx_;
|
556
|
+
};
|
557
|
+
|
558
|
+
template <typename T, typename CleanupRet, void (*init)(T *),
|
559
|
+
CleanupRet (*cleanup)(T *), void (*move)(T *, T *)>
|
560
|
+
class StackAllocatedMovable {
|
561
|
+
public:
|
562
|
+
StackAllocatedMovable() { init(&ctx_); }
|
563
|
+
~StackAllocatedMovable() { cleanup(&ctx_); }
|
564
|
+
|
565
|
+
StackAllocatedMovable(StackAllocatedMovable &&other) {
|
566
|
+
init(&ctx_);
|
567
|
+
move(&ctx_, &other.ctx_);
|
568
|
+
}
|
569
|
+
StackAllocatedMovable &operator=(StackAllocatedMovable &&other) {
|
570
|
+
move(&ctx_, &other.ctx_);
|
571
|
+
return *this;
|
572
|
+
}
|
542
573
|
|
543
574
|
T *get() { return &ctx_; }
|
544
575
|
const T *get() const { return &ctx_; }
|
@@ -23,7 +23,7 @@ extern "C" {
|
|
23
23
|
|
24
24
|
// ChaCha20.
|
25
25
|
//
|
26
|
-
// ChaCha20 is a stream cipher. See https://tools.ietf.org/html/
|
26
|
+
// ChaCha20 is a stream cipher. See https://tools.ietf.org/html/rfc8439.
|
27
27
|
|
28
28
|
|
29
29
|
// CRYPTO_chacha_20 encrypts |in_len| bytes from |in| with the given key and
|
@@ -124,6 +124,10 @@ OPENSSL_EXPORT void EVP_MD_CTX_free(EVP_MD_CTX *ctx);
|
|
124
124
|
// copy of |in|. It returns one on success and zero on allocation failure.
|
125
125
|
OPENSSL_EXPORT int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in);
|
126
126
|
|
127
|
+
// EVP_MD_CTX_move sets |out|, which must already be initialised, to the hash
|
128
|
+
// state in |in|. |in| is mutated and left in an empty state.
|
129
|
+
OPENSSL_EXPORT void EVP_MD_CTX_move(EVP_MD_CTX *out, EVP_MD_CTX *in);
|
130
|
+
|
127
131
|
// EVP_MD_CTX_reset calls |EVP_MD_CTX_cleanup| followed by |EVP_MD_CTX_init|. It
|
128
132
|
// returns one.
|
129
133
|
OPENSSL_EXPORT int EVP_MD_CTX_reset(EVP_MD_CTX *ctx);
|
@@ -324,8 +328,8 @@ BSSL_NAMESPACE_BEGIN
|
|
324
328
|
BORINGSSL_MAKE_DELETER(EVP_MD_CTX, EVP_MD_CTX_free)
|
325
329
|
|
326
330
|
using ScopedEVP_MD_CTX =
|
327
|
-
internal::
|
328
|
-
|
331
|
+
internal::StackAllocatedMovable<EVP_MD_CTX, int, EVP_MD_CTX_init,
|
332
|
+
EVP_MD_CTX_cleanup, EVP_MD_CTX_move>;
|
329
333
|
|
330
334
|
BSSL_NAMESPACE_END
|
331
335
|
|
@@ -73,6 +73,9 @@ extern "C" {
|
|
73
73
|
// space. On successful exit, |*sig_len| is set to the actual number of bytes
|
74
74
|
// written. The |type| argument should be zero. It returns one on success and
|
75
75
|
// zero otherwise.
|
76
|
+
//
|
77
|
+
// WARNING: |digest| must be the output of some hash function on the data to be
|
78
|
+
// signed. Passing unhashed inputs will not result in a secure signature scheme.
|
76
79
|
OPENSSL_EXPORT int ECDSA_sign(int type, const uint8_t *digest,
|
77
80
|
size_t digest_len, uint8_t *sig,
|
78
81
|
unsigned int *sig_len, const EC_KEY *key);
|
@@ -81,6 +84,10 @@ OPENSSL_EXPORT int ECDSA_sign(int type, const uint8_t *digest,
|
|
81
84
|
// signature by |key| of |digest|. (The |type| argument should be zero.) It
|
82
85
|
// returns one on success or zero if the signature is invalid or an error
|
83
86
|
// occurred.
|
87
|
+
//
|
88
|
+
// WARNING: |digest| must be the output of some hash function on the data to be
|
89
|
+
// verified. Passing unhashed inputs will not result in a secure signature
|
90
|
+
// scheme.
|
84
91
|
OPENSSL_EXPORT int ECDSA_verify(int type, const uint8_t *digest,
|
85
92
|
size_t digest_len, const uint8_t *sig,
|
86
93
|
size_t sig_len, const EC_KEY *key);
|
@@ -124,12 +131,19 @@ OPENSSL_EXPORT int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s);
|
|
124
131
|
|
125
132
|
// ECDSA_do_sign signs |digest_len| bytes from |digest| with |key| and returns
|
126
133
|
// the resulting signature structure, or NULL on error.
|
134
|
+
//
|
135
|
+
// WARNING: |digest| must be the output of some hash function on the data to be
|
136
|
+
// signed. Passing unhashed inputs will not result in a secure signature scheme.
|
127
137
|
OPENSSL_EXPORT ECDSA_SIG *ECDSA_do_sign(const uint8_t *digest,
|
128
138
|
size_t digest_len, const EC_KEY *key);
|
129
139
|
|
130
140
|
// ECDSA_do_verify verifies that |sig| constitutes a valid signature by |key|
|
131
141
|
// of |digest|. It returns one on success or zero if the signature is invalid
|
132
142
|
// or on error.
|
143
|
+
//
|
144
|
+
// WARNING: |digest| must be the output of some hash function on the data to be
|
145
|
+
// verified. Passing unhashed inputs will not result in a secure signature
|
146
|
+
// scheme.
|
133
147
|
OPENSSL_EXPORT int ECDSA_do_verify(const uint8_t *digest, size_t digest_len,
|
134
148
|
const ECDSA_SIG *sig, const EC_KEY *key);
|
135
149
|
|
@@ -545,14 +545,15 @@ OPENSSL_EXPORT EVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx);
|
|
545
545
|
OPENSSL_EXPORT int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx);
|
546
546
|
|
547
547
|
// EVP_PKEY_sign signs |digest_len| bytes from |digest| using |ctx|. If |sig| is
|
548
|
-
// NULL, the maximum size of the signature is written to
|
549
|
-
//
|
550
|
-
//
|
551
|
-
//
|
548
|
+
// NULL, the maximum size of the signature is written to |out_sig_len|.
|
549
|
+
// Otherwise, |*sig_len| must contain the number of bytes of space available at
|
550
|
+
// |sig|. If sufficient, the signature will be written to |sig| and |*sig_len|
|
551
|
+
// updated with the true length. This function will fail for signature
|
552
|
+
// algorithms like Ed25519 that do not support signing pre-hashed inputs.
|
552
553
|
//
|
553
|
-
//
|
554
|
-
//
|
555
|
-
// unhashed input.
|
554
|
+
// WARNING: |digest| must be the output of some hash function on the data to be
|
555
|
+
// signed. Passing unhashed inputs will not result in a secure signature scheme.
|
556
|
+
// Use |EVP_DigestSignInit| to sign an unhashed input.
|
556
557
|
//
|
557
558
|
// WARNING: Setting |sig| to NULL only gives the maximum size of the
|
558
559
|
// signature. The actual signature may be smaller.
|
@@ -570,11 +571,13 @@ OPENSSL_EXPORT int EVP_PKEY_sign(EVP_PKEY_CTX *ctx, uint8_t *sig,
|
|
570
571
|
OPENSSL_EXPORT int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx);
|
571
572
|
|
572
573
|
// EVP_PKEY_verify verifies that |sig_len| bytes from |sig| are a valid
|
573
|
-
// signature for |digest|.
|
574
|
+
// signature for |digest|. This function will fail for signature
|
575
|
+
// algorithms like Ed25519 that do not support signing pre-hashed inputs.
|
574
576
|
//
|
575
|
-
//
|
576
|
-
//
|
577
|
-
// signature given the unhashed
|
577
|
+
// WARNING: |digest| must be the output of some hash function on the data to be
|
578
|
+
// verified. Passing unhashed inputs will not result in a secure signature
|
579
|
+
// scheme. Use |EVP_DigestVerifyInit| to verify a signature given the unhashed
|
580
|
+
// input.
|
578
581
|
//
|
579
582
|
// It returns one on success or zero on error.
|
580
583
|
OPENSSL_EXPORT int EVP_PKEY_verify(EVP_PKEY_CTX *ctx, const uint8_t *sig,
|
@@ -833,6 +836,11 @@ OPENSSL_EXPORT int EVP_PKEY_CTX_set_ec_paramgen_curve_nid(EVP_PKEY_CTX *ctx,
|
|
833
836
|
// Ed448 and attempts to create keys will fail.
|
834
837
|
#define EVP_PKEY_ED448 NID_ED448
|
835
838
|
|
839
|
+
// EVP_PKEY_get0 returns NULL. This function is provided for compatibility with
|
840
|
+
// OpenSSL but does not return anything. Use the typed |EVP_PKEY_get0_*|
|
841
|
+
// functions instead.
|
842
|
+
OPENSSL_EXPORT void *EVP_PKEY_get0(const EVP_PKEY *pkey);
|
843
|
+
|
836
844
|
// OpenSSL_add_all_algorithms does nothing.
|
837
845
|
OPENSSL_EXPORT void OpenSSL_add_all_algorithms(void);
|
838
846
|
|