grpc 1.30.0 → 1.31.1
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 +560 -619
- data/include/grpc/grpc_security.h +8 -0
- data/include/grpc/grpc_security_constants.h +3 -0
- data/include/grpc/impl/codegen/grpc_types.h +7 -5
- data/include/grpc/impl/codegen/port_platform.h +0 -32
- data/src/core/ext/filters/client_channel/backend_metric.cc +12 -9
- data/src/core/ext/filters/client_channel/client_channel.cc +406 -261
- data/src/core/ext/filters/client_channel/config_selector.cc +62 -0
- data/src/core/ext/filters/client_channel/config_selector.h +93 -0
- data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +24 -2
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +2 -0
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +6 -5
- data/src/core/ext/filters/client_channel/http_proxy.cc +6 -4
- data/src/core/ext/filters/client_channel/lb_policy.h +2 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +39 -23
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +4 -6
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +3 -4
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc +381 -72
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +4 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +5 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +6 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +8 -6
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +9 -7
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +7 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +33 -48
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +6 -2
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +21 -18
- data/src/core/ext/filters/client_channel/resolver_registry.cc +13 -14
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +6 -7
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +33 -28
- data/src/core/ext/filters/client_channel/resolving_lb_policy.h +39 -20
- data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +142 -0
- data/src/core/ext/filters/client_channel/subchannel.cc +1 -1
- data/src/core/ext/filters/client_channel/xds/xds_api.cc +327 -123
- data/src/core/ext/filters/client_channel/xds/xds_api.h +72 -7
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc +12 -23
- data/src/core/ext/filters/client_channel/xds/xds_client.cc +112 -33
- data/src/core/ext/filters/client_channel/xds/xds_client_stats.h +10 -10
- data/src/core/ext/filters/http/client/http_client_filter.cc +5 -5
- data/src/core/ext/filters/http/http_filters_plugin.cc +2 -1
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +74 -33
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.h +3 -1
- data/src/core/ext/filters/message_size/message_size_filter.cc +56 -80
- data/src/core/ext/filters/message_size/message_size_filter.h +6 -0
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +383 -347
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +6 -2
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +1 -1
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +7 -13
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +7 -8
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +19 -4
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +22 -27
- data/src/core/ext/transport/chttp2/transport/flow_control.h +14 -16
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +9 -12
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +4 -6
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +5 -6
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +12 -13
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +6 -7
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +9 -12
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +25 -29
- data/src/core/ext/transport/chttp2/transport/hpack_table.cc +13 -17
- data/src/core/ext/transport/chttp2/transport/internal.h +13 -0
- data/src/core/ext/transport/chttp2/transport/parsing.cc +33 -43
- data/src/core/ext/transport/chttp2/transport/writing.cc +9 -14
- data/src/core/ext/transport/inproc/inproc_transport.cc +35 -15
- data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +3 -4
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.h +80 -69
- data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.h +24 -23
- data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.h +66 -56
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.c +2 -2
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.h +317 -311
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h +42 -34
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h +7 -7
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h +79 -61
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h +55 -49
- data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.h +9 -8
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +163 -169
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +51 -45
- data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.h +4 -5
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h +107 -100
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +137 -117
- data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h +9 -9
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +105 -87
- data/src/core/ext/upb-generated/envoy/api/v2/core/socket_option.upb.h +12 -13
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h +95 -101
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.h +49 -65
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.h +49 -42
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h +70 -62
- data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.h +81 -65
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.h +91 -80
- data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.h +9 -10
- data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/api/v2/route.upb.h +36 -31
- data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.c +7 -7
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.h +648 -696
- data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.h +16 -15
- data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.h +95 -88
- data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.h +234 -199
- data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.h +5 -5
- data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.h +13 -13
- data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h +20 -18
- data/src/core/ext/upb-generated/envoy/type/http.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.h +18 -17
- data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.h +14 -14
- data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.h +23 -23
- data/src/core/ext/upb-generated/envoy/type/percent.upb.h +8 -9
- data/src/core/ext/upb-generated/envoy/type/range.upb.h +15 -16
- data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.h +7 -8
- data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.h +36 -35
- data/src/core/ext/upb-generated/gogoproto/gogo.upb.h +0 -1
- data/src/core/ext/upb-generated/google/api/annotations.upb.h +0 -1
- data/src/core/ext/upb-generated/google/api/http.upb.h +29 -28
- data/src/core/ext/upb-generated/google/protobuf/any.upb.h +5 -6
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +3 -3
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +412 -386
- data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +5 -6
- data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +1 -2
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +1 -1
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +33 -54
- data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +5 -6
- data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +27 -28
- data/src/core/ext/upb-generated/google/rpc/status.upb.h +8 -8
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +1 -1
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +32 -45
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +4 -4
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +157 -178
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +14 -13
- data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +6 -7
- data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +59 -56
- data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +11 -12
- data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +0 -1
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +5 -6
- data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c +6 -6
- data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h +41 -68
- data/src/core/ext/upb-generated/validate/validate.upb.h +536 -535
- data/src/core/lib/channel/channel_trace.cc +2 -6
- data/src/core/lib/channel/channelz.cc +5 -15
- data/src/core/lib/gpr/log_linux.cc +6 -8
- data/src/core/lib/gpr/log_posix.cc +6 -8
- data/src/core/lib/gpr/string.cc +10 -9
- data/src/core/lib/gpr/string.h +4 -2
- data/src/core/lib/gprpp/global_config_env.cc +8 -6
- data/src/core/lib/http/httpcli.cc +13 -10
- data/src/core/lib/http/httpcli_security_connector.cc +5 -5
- data/src/core/lib/iomgr/cfstream_handle.cc +1 -0
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +10 -10
- data/src/core/lib/iomgr/error_cfstream.cc +9 -8
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +5 -6
- data/src/core/lib/iomgr/ev_epollex_linux.cc +15 -21
- data/src/core/lib/iomgr/ev_poll_posix.cc +6 -5
- data/src/core/lib/iomgr/ev_posix.cc +2 -0
- data/src/core/lib/iomgr/iomgr.cc +10 -0
- data/src/core/lib/iomgr/iomgr.h +10 -0
- data/src/core/lib/iomgr/is_epollexclusive_available.cc +14 -0
- data/src/core/lib/iomgr/port.h +1 -21
- data/src/core/lib/iomgr/resolve_address_custom.cc +13 -18
- data/src/core/lib/iomgr/resolve_address_windows.cc +8 -8
- data/src/core/lib/iomgr/resource_quota.cc +34 -31
- data/src/core/lib/iomgr/sockaddr_utils.cc +7 -5
- data/src/core/lib/iomgr/sockaddr_utils.h +1 -1
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +95 -55
- data/src/core/lib/iomgr/socket_windows.cc +4 -5
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +9 -11
- data/src/core/lib/iomgr/tcp_client_custom.cc +6 -9
- data/src/core/lib/iomgr/tcp_client_posix.cc +27 -36
- data/src/core/lib/iomgr/tcp_client_windows.cc +9 -9
- data/src/core/lib/iomgr/tcp_custom.cc +1 -1
- data/src/core/lib/iomgr/tcp_custom.h +1 -1
- data/src/core/lib/iomgr/tcp_server.cc +3 -4
- data/src/core/lib/iomgr/tcp_server.h +7 -5
- data/src/core/lib/iomgr/tcp_server_custom.cc +6 -14
- data/src/core/lib/iomgr/tcp_server_posix.cc +34 -41
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +3 -4
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +5 -7
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +4 -9
- data/src/core/lib/iomgr/tcp_server_windows.cc +16 -16
- data/src/core/lib/iomgr/timer_generic.cc +13 -12
- data/src/core/lib/iomgr/udp_server.cc +24 -23
- data/src/core/lib/iomgr/udp_server.h +5 -2
- data/src/core/lib/iomgr/unix_sockets_posix.cc +9 -14
- data/src/core/lib/iomgr/unix_sockets_posix.h +3 -1
- data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +5 -2
- data/src/core/lib/json/json_reader.cc +20 -21
- data/src/core/lib/security/credentials/credentials.h +5 -3
- data/src/core/lib/security/credentials/google_default/credentials_generic.cc +8 -6
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +12 -9
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +7 -4
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +19 -28
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +6 -6
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +20 -0
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +10 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +10 -0
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +10 -10
- data/src/core/lib/security/security_connector/security_connector.cc +2 -0
- data/src/core/lib/security/security_connector/security_connector.h +1 -1
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +18 -11
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +5 -0
- data/src/core/lib/security/security_connector/ssl_utils.cc +44 -23
- data/src/core/lib/security/security_connector/ssl_utils.h +6 -2
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +27 -24
- data/src/core/lib/security/transport/auth_filters.h +0 -5
- data/src/core/lib/security/transport/client_auth_filter.cc +10 -9
- data/src/core/lib/security/util/json_util.cc +12 -13
- data/src/core/lib/slice/slice.cc +38 -1
- data/src/core/lib/slice/slice_internal.h +1 -0
- data/src/core/lib/surface/call.cc +40 -41
- data/src/core/lib/surface/completion_queue.cc +271 -14
- data/src/core/lib/surface/completion_queue.h +8 -0
- data/src/core/lib/surface/init.cc +2 -0
- data/src/core/lib/surface/server.cc +565 -632
- data/src/core/lib/surface/server.h +34 -12
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/transport.h +6 -0
- data/src/core/lib/uri/uri_parser.cc +8 -15
- data/src/core/plugin_registry/grpc_plugin_registry.cc +4 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +23 -13
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +2 -0
- data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +2 -0
- data/src/core/tsi/ssl_transport_security.cc +108 -11
- data/src/core/tsi/ssl_transport_security.h +14 -2
- data/src/core/tsi/transport_security_interface.h +5 -0
- data/src/ruby/bin/math_services_pb.rb +4 -4
- data/src/ruby/ext/grpc/extconf.rb +5 -2
- data/src/ruby/ext/grpc/rb_call.c +3 -2
- data/src/ruby/ext/grpc/rb_call.h +4 -0
- data/src/ruby/ext/grpc/rb_call_credentials.c +57 -12
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +6 -0
- data/src/ruby/lib/grpc/generic/client_stub.rb +1 -1
- data/src/ruby/lib/grpc/generic/interceptors.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +2 -2
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +5 -0
- data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +28 -12
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options_import2.proto +23 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto +2 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/same_package_service_name.proto +27 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/same_ruby_package_service_name.proto +29 -0
- data/src/ruby/spec/pb/codegen/package_option_spec.rb +25 -1
- data/src/ruby/spec/support/services.rb +10 -4
- data/src/ruby/spec/user_agent_spec.rb +74 -0
- data/third_party/boringssl-with-bazel/err_data.c +89 -83
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bitstr.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_enum.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_int.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_object.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_time.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_type.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_lib.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/asn_pack.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/f_enum.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/f_int.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/f_string.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/tls_cbc.c +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +12 -52
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +0 -22
- data/third_party/boringssl-with-bazel/src/crypto/evp/evp_asn1.c +143 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/mode_wrappers.c +17 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +11 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +2 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p224-64.c +13 -11
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-x86_64.c +24 -23
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +20 -16
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/util.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +62 -0
- data/third_party/boringssl-with-bazel/src/crypto/mem.c +29 -15
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +7 -0
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +36 -5
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +0 -29
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +116 -363
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/trust_token.c +7 -45
- data/third_party/boringssl-with-bazel/src/crypto/x509/a_strex.c +4 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509/algorithm.c +8 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/asn1_gen.c +4 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509.c +0 -67
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_cmp.c +13 -6
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_req.c +10 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +41 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +4 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +28 -9
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509cset.c +25 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +35 -13
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_pubkey.c +0 -154
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +28 -6
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/internal.h +5 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +74 -35
- data/third_party/boringssl-with-bazel/src/include/openssl/aes.h +16 -4
- data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +22 -22
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +69 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +33 -16
- data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +1 -10
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +789 -715
- data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +3 -3
- data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +9 -2
- data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +2 -2
- data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +9 -0
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +17 -14
- data/third_party/boringssl-with-bazel/src/ssl/ssl_asn1.cc +7 -7
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +28 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +4 -24
- data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +5 -5
- data/third_party/boringssl-with-bazel/src/ssl/t1_enc.cc +45 -24
- data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +31 -21
- data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +12 -9
- data/third_party/re2/re2/bitmap256.h +117 -0
- data/third_party/re2/re2/bitstate.cc +385 -0
- data/third_party/re2/re2/compile.cc +1279 -0
- data/third_party/re2/re2/dfa.cc +2130 -0
- data/third_party/re2/re2/filtered_re2.cc +121 -0
- data/third_party/re2/re2/filtered_re2.h +109 -0
- data/third_party/re2/re2/mimics_pcre.cc +197 -0
- data/third_party/re2/re2/nfa.cc +713 -0
- data/third_party/re2/re2/onepass.cc +623 -0
- data/third_party/re2/re2/parse.cc +2464 -0
- data/third_party/re2/re2/perl_groups.cc +119 -0
- data/third_party/re2/re2/pod_array.h +55 -0
- data/third_party/re2/re2/prefilter.cc +710 -0
- data/third_party/re2/re2/prefilter.h +108 -0
- data/third_party/re2/re2/prefilter_tree.cc +407 -0
- data/third_party/re2/re2/prefilter_tree.h +139 -0
- data/third_party/re2/re2/prog.cc +988 -0
- data/third_party/re2/re2/prog.h +436 -0
- data/third_party/re2/re2/re2.cc +1362 -0
- data/third_party/re2/re2/re2.h +1002 -0
- data/third_party/re2/re2/regexp.cc +980 -0
- data/third_party/re2/re2/regexp.h +659 -0
- data/third_party/re2/re2/set.cc +154 -0
- data/third_party/re2/re2/set.h +80 -0
- data/third_party/re2/re2/simplify.cc +657 -0
- data/third_party/re2/re2/sparse_array.h +392 -0
- data/third_party/re2/re2/sparse_set.h +264 -0
- data/third_party/re2/re2/stringpiece.cc +65 -0
- data/third_party/re2/re2/stringpiece.h +210 -0
- data/third_party/re2/re2/tostring.cc +351 -0
- data/third_party/re2/re2/unicode_casefold.cc +582 -0
- data/third_party/re2/re2/unicode_casefold.h +78 -0
- data/third_party/re2/re2/unicode_groups.cc +6269 -0
- data/third_party/re2/re2/unicode_groups.h +67 -0
- data/third_party/re2/re2/walker-inl.h +246 -0
- data/third_party/re2/util/benchmark.h +156 -0
- data/third_party/re2/util/flags.h +26 -0
- data/third_party/re2/util/logging.h +109 -0
- data/third_party/re2/util/malloc_counter.h +19 -0
- data/third_party/re2/util/mix.h +41 -0
- data/third_party/re2/util/mutex.h +148 -0
- data/third_party/re2/util/pcre.cc +1025 -0
- data/third_party/re2/util/pcre.h +681 -0
- data/third_party/re2/util/rune.cc +260 -0
- data/third_party/re2/util/strutil.cc +149 -0
- data/third_party/re2/util/strutil.h +21 -0
- data/third_party/re2/util/test.h +50 -0
- data/third_party/re2/util/utf.h +44 -0
- data/third_party/re2/util/util.h +42 -0
- data/third_party/upb/upb/decode.c +467 -504
- data/third_party/upb/upb/encode.c +163 -121
- data/third_party/upb/upb/msg.c +130 -64
- data/third_party/upb/upb/msg.h +418 -14
- data/third_party/upb/upb/port_def.inc +35 -6
- data/third_party/upb/upb/port_undef.inc +8 -1
- data/third_party/upb/upb/table.c +53 -75
- data/third_party/upb/upb/table.int.h +11 -43
- data/third_party/upb/upb/upb.c +148 -124
- data/third_party/upb/upb/upb.h +65 -147
- data/third_party/upb/upb/upb.hpp +86 -0
- metadata +90 -30
- data/third_party/upb/upb/generated_util.h +0 -105
@@ -866,7 +866,7 @@ static void p224_select_point(const uint64_t idx, size_t size,
|
|
866
866
|
}
|
867
867
|
|
868
868
|
// p224_get_bit returns the |i|th bit in |in|
|
869
|
-
static
|
869
|
+
static crypto_word_t p224_get_bit(const p224_felem_bytearray in, size_t i) {
|
870
870
|
if (i >= 224) {
|
871
871
|
return 0;
|
872
872
|
}
|
@@ -977,13 +977,13 @@ static void ec_GFp_nistp224_point_mul(const EC_GROUP *group, EC_RAW_POINT *r,
|
|
977
977
|
|
978
978
|
// Add every 5 doublings.
|
979
979
|
if (i % 5 == 0) {
|
980
|
-
|
980
|
+
crypto_word_t bits = p224_get_bit(scalar->bytes, i + 4) << 5;
|
981
981
|
bits |= p224_get_bit(scalar->bytes, i + 3) << 4;
|
982
982
|
bits |= p224_get_bit(scalar->bytes, i + 2) << 3;
|
983
983
|
bits |= p224_get_bit(scalar->bytes, i + 1) << 2;
|
984
984
|
bits |= p224_get_bit(scalar->bytes, i) << 1;
|
985
985
|
bits |= p224_get_bit(scalar->bytes, i - 1);
|
986
|
-
|
986
|
+
crypto_word_t sign, digit;
|
987
987
|
ec_GFp_nistp_recode_scalar_bits(&sign, &digit, bits);
|
988
988
|
|
989
989
|
// Select the point to add or subtract.
|
@@ -1022,7 +1022,7 @@ static void ec_GFp_nistp224_point_mul_base(const EC_GROUP *group,
|
|
1022
1022
|
}
|
1023
1023
|
|
1024
1024
|
// First, look 28 bits upwards.
|
1025
|
-
|
1025
|
+
crypto_word_t bits = p224_get_bit(scalar->bytes, i + 196) << 3;
|
1026
1026
|
bits |= p224_get_bit(scalar->bytes, i + 140) << 2;
|
1027
1027
|
bits |= p224_get_bit(scalar->bytes, i + 84) << 1;
|
1028
1028
|
bits |= p224_get_bit(scalar->bytes, i + 28);
|
@@ -1080,14 +1080,15 @@ static void ec_GFp_nistp224_point_mul_public(const EC_GROUP *group,
|
|
1080
1080
|
// Add multiples of the generator.
|
1081
1081
|
if (i <= 27) {
|
1082
1082
|
// First, look 28 bits upwards.
|
1083
|
-
|
1083
|
+
crypto_word_t bits = p224_get_bit(g_scalar->bytes, i + 196) << 3;
|
1084
1084
|
bits |= p224_get_bit(g_scalar->bytes, i + 140) << 2;
|
1085
1085
|
bits |= p224_get_bit(g_scalar->bytes, i + 84) << 1;
|
1086
1086
|
bits |= p224_get_bit(g_scalar->bytes, i + 28);
|
1087
1087
|
|
1088
|
+
size_t index = (size_t)bits;
|
1088
1089
|
p224_point_add(nq[0], nq[1], nq[2], nq[0], nq[1], nq[2], 1 /* mixed */,
|
1089
|
-
g_p224_pre_comp[1][
|
1090
|
-
g_p224_pre_comp[1][
|
1090
|
+
g_p224_pre_comp[1][index][0], g_p224_pre_comp[1][index][1],
|
1091
|
+
g_p224_pre_comp[1][index][2]);
|
1091
1092
|
assert(!skip);
|
1092
1093
|
|
1093
1094
|
// Second, look at the current position.
|
@@ -1095,20 +1096,21 @@ static void ec_GFp_nistp224_point_mul_public(const EC_GROUP *group,
|
|
1095
1096
|
bits |= p224_get_bit(g_scalar->bytes, i + 112) << 2;
|
1096
1097
|
bits |= p224_get_bit(g_scalar->bytes, i + 56) << 1;
|
1097
1098
|
bits |= p224_get_bit(g_scalar->bytes, i);
|
1099
|
+
index = (size_t)bits;
|
1098
1100
|
p224_point_add(nq[0], nq[1], nq[2], nq[0], nq[1], nq[2], 1 /* mixed */,
|
1099
|
-
g_p224_pre_comp[0][
|
1100
|
-
g_p224_pre_comp[0][
|
1101
|
+
g_p224_pre_comp[0][index][0], g_p224_pre_comp[0][index][1],
|
1102
|
+
g_p224_pre_comp[0][index][2]);
|
1101
1103
|
}
|
1102
1104
|
|
1103
1105
|
// Incorporate |p_scalar| every 5 doublings.
|
1104
1106
|
if (i % 5 == 0) {
|
1105
|
-
|
1107
|
+
crypto_word_t bits = p224_get_bit(p_scalar->bytes, i + 4) << 5;
|
1106
1108
|
bits |= p224_get_bit(p_scalar->bytes, i + 3) << 4;
|
1107
1109
|
bits |= p224_get_bit(p_scalar->bytes, i + 2) << 3;
|
1108
1110
|
bits |= p224_get_bit(p_scalar->bytes, i + 1) << 2;
|
1109
1111
|
bits |= p224_get_bit(p_scalar->bytes, i) << 1;
|
1110
1112
|
bits |= p224_get_bit(p_scalar->bytes, i - 1);
|
1111
|
-
|
1113
|
+
crypto_word_t sign, digit;
|
1112
1114
|
ec_GFp_nistp_recode_scalar_bits(&sign, &digit, bits);
|
1113
1115
|
|
1114
1116
|
// Select the point to add or subtract.
|
@@ -50,8 +50,8 @@ static const BN_ULONG ONE[P256_LIMBS] = {
|
|
50
50
|
|
51
51
|
// Recode window to a signed digit, see |ec_GFp_nistp_recode_scalar_bits| in
|
52
52
|
// util.c for details
|
53
|
-
static
|
54
|
-
|
53
|
+
static crypto_word_t booth_recode_w5(crypto_word_t in) {
|
54
|
+
crypto_word_t s, d;
|
55
55
|
|
56
56
|
s = ~((in >> 5) - 1);
|
57
57
|
d = (1 << 6) - in - 1;
|
@@ -61,8 +61,8 @@ static unsigned booth_recode_w5(unsigned in) {
|
|
61
61
|
return (d << 1) + (s & 1);
|
62
62
|
}
|
63
63
|
|
64
|
-
static
|
65
|
-
|
64
|
+
static crypto_word_t booth_recode_w7(crypto_word_t in) {
|
65
|
+
crypto_word_t s, d;
|
66
66
|
|
67
67
|
s = ~((in >> 7) - 1);
|
68
68
|
d = (1 << 8) - in - 1;
|
@@ -194,8 +194,8 @@ static void ecp_nistz256_windowed_mul(const EC_GROUP *group, P256_POINT *r,
|
|
194
194
|
assert(p_scalar != NULL);
|
195
195
|
assert(group->field.width == P256_LIMBS);
|
196
196
|
|
197
|
-
static const
|
198
|
-
static const
|
197
|
+
static const size_t kWindowSize = 5;
|
198
|
+
static const crypto_word_t kMask = (1 << (5 /* kWindowSize */ + 1)) - 1;
|
199
199
|
|
200
200
|
// A |P256_POINT| is (3 * 32) = 96 bytes, and the 64-byte alignment should
|
201
201
|
// add no more than 63 bytes of overhead. Thus, |table| should require
|
@@ -232,17 +232,17 @@ static void ecp_nistz256_windowed_mul(const EC_GROUP *group, P256_POINT *r,
|
|
232
232
|
|
233
233
|
BN_ULONG tmp[P256_LIMBS];
|
234
234
|
alignas(32) P256_POINT h;
|
235
|
-
|
236
|
-
|
235
|
+
size_t index = 255;
|
236
|
+
crypto_word_t wvalue = p_str[(index - 1) / 8];
|
237
237
|
wvalue = (wvalue >> ((index - 1) % 8)) & kMask;
|
238
238
|
|
239
239
|
ecp_nistz256_select_w5(r, table, booth_recode_w5(wvalue) >> 1);
|
240
240
|
|
241
241
|
while (index >= 5) {
|
242
242
|
if (index != 255) {
|
243
|
-
|
243
|
+
size_t off = (index - 1) / 8;
|
244
244
|
|
245
|
-
wvalue = p_str[off] | p_str[off + 1] << 8;
|
245
|
+
wvalue = (crypto_word_t)p_str[off] | (crypto_word_t)p_str[off + 1] << 8;
|
246
246
|
wvalue = (wvalue >> ((index - 1) % 8)) & kMask;
|
247
247
|
|
248
248
|
wvalue = booth_recode_w5(wvalue);
|
@@ -283,21 +283,22 @@ typedef union {
|
|
283
283
|
P256_POINT_AFFINE a;
|
284
284
|
} p256_point_union_t;
|
285
285
|
|
286
|
-
static
|
287
|
-
static const
|
288
|
-
static const
|
286
|
+
static crypto_word_t calc_first_wvalue(size_t *index, const uint8_t p_str[33]) {
|
287
|
+
static const size_t kWindowSize = 7;
|
288
|
+
static const crypto_word_t kMask = (1 << (7 /* kWindowSize */ + 1)) - 1;
|
289
289
|
*index = kWindowSize;
|
290
290
|
|
291
|
-
|
291
|
+
crypto_word_t wvalue = (p_str[0] << 1) & kMask;
|
292
292
|
return booth_recode_w7(wvalue);
|
293
293
|
}
|
294
294
|
|
295
|
-
static
|
296
|
-
static const
|
297
|
-
static const
|
295
|
+
static crypto_word_t calc_wvalue(size_t *index, const uint8_t p_str[33]) {
|
296
|
+
static const size_t kWindowSize = 7;
|
297
|
+
static const crypto_word_t kMask = (1 << (7 /* kWindowSize */ + 1)) - 1;
|
298
298
|
|
299
|
-
const
|
300
|
-
|
299
|
+
const size_t off = (*index - 1) / 8;
|
300
|
+
crypto_word_t wvalue =
|
301
|
+
(crypto_word_t)p_str[off] | (crypto_word_t)p_str[off + 1] << 8;
|
301
302
|
wvalue = (wvalue >> ((*index - 1) % 8)) & kMask;
|
302
303
|
*index += kWindowSize;
|
303
304
|
|
@@ -325,8 +326,8 @@ static void ecp_nistz256_point_mul_base(const EC_GROUP *group, EC_RAW_POINT *r,
|
|
325
326
|
p_str[32] = 0;
|
326
327
|
|
327
328
|
// First window
|
328
|
-
|
329
|
-
|
329
|
+
size_t index = 0;
|
330
|
+
crypto_word_t wvalue = calc_first_wvalue(&index, p_str);
|
330
331
|
|
331
332
|
ecp_nistz256_select_w7(&p.a, ecp_nistz256_precomputed[0], wvalue >> 1);
|
332
333
|
ecp_nistz256_neg(p.p.Z, p.p.Y);
|
@@ -370,8 +371,8 @@ static void ecp_nistz256_points_mul_public(const EC_GROUP *group,
|
|
370
371
|
p_str[32] = 0;
|
371
372
|
|
372
373
|
// First window
|
373
|
-
|
374
|
-
|
374
|
+
size_t index = 0;
|
375
|
+
size_t wvalue = calc_first_wvalue(&index, p_str);
|
375
376
|
|
376
377
|
// Convert |p| from affine to Jacobian coordinates. We set Z to zero if |p|
|
377
378
|
// is infinity and |ONE| otherwise. |p| was computed from the table, so it
|
@@ -67,7 +67,7 @@ static fiat_p256_limb_t fiat_p256_nz(
|
|
67
67
|
|
68
68
|
static void fiat_p256_copy(fiat_p256_limb_t out[FIAT_P256_NLIMBS],
|
69
69
|
const fiat_p256_limb_t in1[FIAT_P256_NLIMBS]) {
|
70
|
-
for (
|
70
|
+
for (size_t i = 0; i < FIAT_P256_NLIMBS; i++) {
|
71
71
|
out[i] = in1[i];
|
72
72
|
}
|
73
73
|
}
|
@@ -393,7 +393,7 @@ static void fiat_p256_select_point(const fiat_p256_limb_t idx, size_t size,
|
|
393
393
|
}
|
394
394
|
|
395
395
|
// fiat_p256_get_bit returns the |i|th bit in |in|
|
396
|
-
static
|
396
|
+
static crypto_word_t fiat_p256_get_bit(const uint8_t *in, int i) {
|
397
397
|
if (i < 0 || i >= 256) {
|
398
398
|
return 0;
|
399
399
|
}
|
@@ -498,20 +498,20 @@ static void ec_GFp_nistp256_point_mul(const EC_GROUP *group, EC_RAW_POINT *r,
|
|
498
498
|
|
499
499
|
// do other additions every 5 doublings
|
500
500
|
if (i % 5 == 0) {
|
501
|
-
|
501
|
+
crypto_word_t bits = fiat_p256_get_bit(scalar->bytes, i + 4) << 5;
|
502
502
|
bits |= fiat_p256_get_bit(scalar->bytes, i + 3) << 4;
|
503
503
|
bits |= fiat_p256_get_bit(scalar->bytes, i + 2) << 3;
|
504
504
|
bits |= fiat_p256_get_bit(scalar->bytes, i + 1) << 2;
|
505
505
|
bits |= fiat_p256_get_bit(scalar->bytes, i) << 1;
|
506
506
|
bits |= fiat_p256_get_bit(scalar->bytes, i - 1);
|
507
|
-
|
507
|
+
crypto_word_t sign, digit;
|
508
508
|
ec_GFp_nistp_recode_scalar_bits(&sign, &digit, bits);
|
509
509
|
|
510
510
|
// select the point to add or subtract, in constant time.
|
511
|
-
fiat_p256_select_point(digit, 17,
|
512
|
-
tmp);
|
511
|
+
fiat_p256_select_point((fiat_p256_limb_t)digit, 17,
|
512
|
+
(const fiat_p256_felem(*)[3])p_pre_comp, tmp);
|
513
513
|
fiat_p256_opp(ftmp, tmp[1]); // (X, -Y, Z) is the negative point.
|
514
|
-
fiat_p256_cmovznz(tmp[1], sign, tmp[1], ftmp);
|
514
|
+
fiat_p256_cmovznz(tmp[1], (fiat_p256_limb_t)sign, tmp[1], ftmp);
|
515
515
|
|
516
516
|
if (!skip) {
|
517
517
|
fiat_p256_point_add(nq[0], nq[1], nq[2], nq[0], nq[1], nq[2],
|
@@ -543,12 +543,13 @@ static void ec_GFp_nistp256_point_mul_base(const EC_GROUP *group,
|
|
543
543
|
}
|
544
544
|
|
545
545
|
// First, look 32 bits upwards.
|
546
|
-
|
546
|
+
crypto_word_t bits = fiat_p256_get_bit(scalar->bytes, i + 224) << 3;
|
547
547
|
bits |= fiat_p256_get_bit(scalar->bytes, i + 160) << 2;
|
548
548
|
bits |= fiat_p256_get_bit(scalar->bytes, i + 96) << 1;
|
549
549
|
bits |= fiat_p256_get_bit(scalar->bytes, i + 32);
|
550
550
|
// Select the point to add, in constant time.
|
551
|
-
fiat_p256_select_point_affine(bits, 15,
|
551
|
+
fiat_p256_select_point_affine((fiat_p256_limb_t)bits, 15,
|
552
|
+
fiat_p256_g_pre_comp[1], tmp);
|
552
553
|
|
553
554
|
if (!skip) {
|
554
555
|
fiat_p256_point_add(nq[0], nq[1], nq[2], nq[0], nq[1], nq[2],
|
@@ -566,7 +567,8 @@ static void ec_GFp_nistp256_point_mul_base(const EC_GROUP *group,
|
|
566
567
|
bits |= fiat_p256_get_bit(scalar->bytes, i + 64) << 1;
|
567
568
|
bits |= fiat_p256_get_bit(scalar->bytes, i);
|
568
569
|
// Select the point to add, in constant time.
|
569
|
-
fiat_p256_select_point_affine(bits, 15,
|
570
|
+
fiat_p256_select_point_affine((fiat_p256_limb_t)bits, 15,
|
571
|
+
fiat_p256_g_pre_comp[0], tmp);
|
570
572
|
fiat_p256_point_add(nq[0], nq[1], nq[2], nq[0], nq[1], nq[2], 1 /* mixed */,
|
571
573
|
tmp[0], tmp[1], tmp[2]);
|
572
574
|
}
|
@@ -613,14 +615,15 @@ static void ec_GFp_nistp256_point_mul_public(const EC_GROUP *group,
|
|
613
615
|
// constant-time lookup.
|
614
616
|
if (i <= 31) {
|
615
617
|
// First, look 32 bits upwards.
|
616
|
-
|
618
|
+
crypto_word_t bits = fiat_p256_get_bit(g_scalar->bytes, i + 224) << 3;
|
617
619
|
bits |= fiat_p256_get_bit(g_scalar->bytes, i + 160) << 2;
|
618
620
|
bits |= fiat_p256_get_bit(g_scalar->bytes, i + 96) << 1;
|
619
621
|
bits |= fiat_p256_get_bit(g_scalar->bytes, i + 32);
|
620
622
|
if (bits != 0) {
|
623
|
+
size_t index = (size_t)(bits - 1);
|
621
624
|
fiat_p256_point_add(ret[0], ret[1], ret[2], ret[0], ret[1], ret[2],
|
622
|
-
1 /* mixed */, fiat_p256_g_pre_comp[1][
|
623
|
-
fiat_p256_g_pre_comp[1][
|
625
|
+
1 /* mixed */, fiat_p256_g_pre_comp[1][index][0],
|
626
|
+
fiat_p256_g_pre_comp[1][index][1],
|
624
627
|
fiat_p256_one);
|
625
628
|
skip = 0;
|
626
629
|
}
|
@@ -631,9 +634,10 @@ static void ec_GFp_nistp256_point_mul_public(const EC_GROUP *group,
|
|
631
634
|
bits |= fiat_p256_get_bit(g_scalar->bytes, i + 64) << 1;
|
632
635
|
bits |= fiat_p256_get_bit(g_scalar->bytes, i);
|
633
636
|
if (bits != 0) {
|
637
|
+
size_t index = (size_t)(bits - 1);
|
634
638
|
fiat_p256_point_add(ret[0], ret[1], ret[2], ret[0], ret[1], ret[2],
|
635
|
-
1 /* mixed */, fiat_p256_g_pre_comp[0][
|
636
|
-
fiat_p256_g_pre_comp[0][
|
639
|
+
1 /* mixed */, fiat_p256_g_pre_comp[0][index][0],
|
640
|
+
fiat_p256_g_pre_comp[0][index][1],
|
637
641
|
fiat_p256_one);
|
638
642
|
skip = 0;
|
639
643
|
}
|
@@ -642,7 +646,7 @@ static void ec_GFp_nistp256_point_mul_public(const EC_GROUP *group,
|
|
642
646
|
int digit = p_wNAF[i];
|
643
647
|
if (digit != 0) {
|
644
648
|
assert(digit & 1);
|
645
|
-
|
649
|
+
size_t idx = (size_t)(digit < 0 ? (-digit) >> 1 : digit >> 1);
|
646
650
|
fiat_p256_felem *y = &p_pre_comp[idx][1], tmp;
|
647
651
|
if (digit < 0) {
|
648
652
|
fiat_p256_opp(tmp, p_pre_comp[idx][1]);
|
@@ -108,7 +108,7 @@ static void ec_GFp_mont_batch_get_window(const EC_GROUP *group,
|
|
108
108
|
if (i > 0) {
|
109
109
|
window |= bn_is_bit_set_words(scalar->words, width, i - 1);
|
110
110
|
}
|
111
|
-
|
111
|
+
crypto_word_t sign, digit;
|
112
112
|
ec_GFp_nistp_recode_scalar_bits(&sign, &digit, window);
|
113
113
|
|
114
114
|
// Select the entry in constant-time.
|
@@ -121,7 +121,7 @@ static void ec_GFp_mont_batch_get_window(const EC_GROUP *group,
|
|
121
121
|
// Negate if necessary.
|
122
122
|
EC_FELEM neg_Y;
|
123
123
|
ec_felem_neg(group, &neg_Y, &out->Y);
|
124
|
-
|
124
|
+
crypto_word_t sign_mask = sign;
|
125
125
|
sign_mask = 0u - sign_mask;
|
126
126
|
ec_felem_select(group, &out->Y, sign_mask, &neg_Y, &out->Y);
|
127
127
|
}
|
@@ -240,9 +240,9 @@
|
|
240
240
|
// P-384: ...01110011; w = 2, 5, 6, 7 are okay
|
241
241
|
// P-256: ...01010001; w = 5, 7 are okay
|
242
242
|
// P-224: ...00111101; w = 3, 4, 5, 6 are okay
|
243
|
-
void ec_GFp_nistp_recode_scalar_bits(
|
244
|
-
|
245
|
-
|
243
|
+
void ec_GFp_nistp_recode_scalar_bits(crypto_word_t *sign, crypto_word_t *digit,
|
244
|
+
crypto_word_t in) {
|
245
|
+
crypto_word_t s, d;
|
246
246
|
|
247
247
|
s = ~((in >> 5) - 1); /* sets all bits to MSB(in), 'in' seen as
|
248
248
|
* 6-bit value */
|
@@ -21,6 +21,7 @@
|
|
21
21
|
#include <openssl/aes.h>
|
22
22
|
#include <openssl/bn.h>
|
23
23
|
#include <openssl/des.h>
|
24
|
+
#include <openssl/ec.h>
|
24
25
|
#include <openssl/ecdsa.h>
|
25
26
|
#include <openssl/ec_key.h>
|
26
27
|
#include <openssl/nid.h>
|
@@ -430,11 +431,44 @@ int boringssl_fips_self_test(
|
|
430
431
|
0xba, 0x4d, 0xd9, 0x86, 0x77, 0xda, 0x7d, 0x8f, 0xef, 0xc4, 0x1a,
|
431
432
|
0xf0, 0xcc, 0x81, 0xe5, 0xea, 0x3f, 0xc2, 0x41, 0x7f, 0xd8,
|
432
433
|
};
|
434
|
+
// kP256Point is SHA256("Primitive Z Computation KAT")×G within P-256.
|
435
|
+
const uint8_t kP256Point[65] = {
|
436
|
+
0x04, 0x4e, 0xc1, 0x94, 0x8c, 0x5c, 0xf4, 0x37, 0x35, 0x0d, 0xa3,
|
437
|
+
0xf9, 0x55, 0xf9, 0x8b, 0x26, 0x23, 0x5c, 0x43, 0xe0, 0x83, 0x51,
|
438
|
+
0x2b, 0x0d, 0x4b, 0x56, 0x24, 0xc3, 0xe4, 0xa5, 0xa8, 0xe2, 0xe9,
|
439
|
+
0x95, 0xf2, 0xc4, 0xb9, 0xb7, 0x48, 0x7d, 0x2a, 0xae, 0xc5, 0xc0,
|
440
|
+
0x0a, 0xcc, 0x1b, 0xd0, 0xec, 0xb8, 0xdc, 0xbe, 0x0c, 0xbe, 0x52,
|
441
|
+
0x79, 0x93, 0x7c, 0x0b, 0x92, 0x2b, 0x7f, 0x17, 0xa5, 0x80,
|
442
|
+
};
|
443
|
+
// kP256Scalar is SHA256("Primitive Z Computation KAT scalar").
|
444
|
+
const uint8_t kP256Scalar[32] = {
|
445
|
+
0xe7, 0x60, 0x44, 0x91, 0x26, 0x9a, 0xfb, 0x5b, 0x10, 0x2d, 0x6e,
|
446
|
+
0xa5, 0x2c, 0xb5, 0x9f, 0xeb, 0x70, 0xae, 0xde, 0x6c, 0xe3, 0xbf,
|
447
|
+
0xb3, 0xe0, 0x10, 0x54, 0x85, 0xab, 0xd8, 0x61, 0xd7, 0x7b,
|
448
|
+
};
|
449
|
+
// kP256PointResult is |kP256Scalar|×|kP256Point|.
|
450
|
+
const uint8_t kP256PointResult[65] = {
|
451
|
+
0x04, 0xf1, 0x63, 0x00, 0x88, 0xc5, 0xd5, 0xe9, 0x05, 0x52, 0xac,
|
452
|
+
0xb6, 0xec, 0x68, 0x76, 0xb8, 0x73, 0x7f, 0x0f, 0x72, 0x34, 0xe6,
|
453
|
+
0xbb, 0x30, 0x32, 0x22, 0x37, 0xb6, 0x2a, 0x80, 0xe8, 0x9e, 0x6e,
|
454
|
+
0x6f, 0x36, 0x02, 0xe7, 0x21, 0xd2, 0x31, 0xdb, 0x94, 0x63, 0xb7,
|
455
|
+
0xd8, 0x19, 0x0e, 0xc2, 0xc0, 0xa7, 0x2f, 0x15, 0x49, 0x1a, 0xa2,
|
456
|
+
0x7c, 0x41, 0x8f, 0xaf, 0x9c, 0x40, 0xaf, 0x2e, 0x4a,
|
457
|
+
#if !defined(BORINGSSL_FIPS_BREAK_Z_COMPUTATION)
|
458
|
+
0x0c,
|
459
|
+
#else
|
460
|
+
0x00,
|
461
|
+
#endif
|
462
|
+
};
|
433
463
|
|
434
464
|
EVP_AEAD_CTX aead_ctx;
|
435
465
|
EVP_AEAD_CTX_zero(&aead_ctx);
|
436
466
|
RSA *rsa_key = NULL;
|
437
467
|
EC_KEY *ec_key = NULL;
|
468
|
+
EC_GROUP *ec_group = NULL;
|
469
|
+
EC_POINT *ec_point_in = NULL;
|
470
|
+
EC_POINT *ec_point_out = NULL;
|
471
|
+
BIGNUM *ec_scalar = NULL;
|
438
472
|
ECDSA_SIG *sig = NULL;
|
439
473
|
int ret = 0;
|
440
474
|
|
@@ -602,6 +636,30 @@ int boringssl_fips_self_test(
|
|
602
636
|
goto err;
|
603
637
|
}
|
604
638
|
|
639
|
+
// Primitive Z Computation KAT (IG 9.6).
|
640
|
+
ec_group = EC_GROUP_new_by_curve_name(NID_X9_62_prime256v1);
|
641
|
+
if (ec_group == NULL) {
|
642
|
+
fprintf(stderr, "Failed to create P-256 group.\n");
|
643
|
+
goto err;
|
644
|
+
}
|
645
|
+
ec_point_in = EC_POINT_new(ec_group);
|
646
|
+
ec_point_out = EC_POINT_new(ec_group);
|
647
|
+
ec_scalar = BN_new();
|
648
|
+
uint8_t z_comp_result[65];
|
649
|
+
if (ec_point_in == NULL || ec_point_out == NULL || ec_scalar == NULL ||
|
650
|
+
!EC_POINT_oct2point(ec_group, ec_point_in, kP256Point, sizeof(kP256Point),
|
651
|
+
NULL) ||
|
652
|
+
!BN_bin2bn(kP256Scalar, sizeof(kP256Scalar), ec_scalar) ||
|
653
|
+
!EC_POINT_mul(ec_group, ec_point_out, NULL, ec_point_in, ec_scalar,
|
654
|
+
NULL) ||
|
655
|
+
!EC_POINT_point2oct(ec_group, ec_point_out, POINT_CONVERSION_UNCOMPRESSED,
|
656
|
+
z_comp_result, sizeof(z_comp_result), NULL) ||
|
657
|
+
!check_test(kP256PointResult, z_comp_result, sizeof(z_comp_result),
|
658
|
+
"Z Computation Result")) {
|
659
|
+
fprintf(stderr, "Z Computation KAT failed.\n");
|
660
|
+
goto err;
|
661
|
+
}
|
662
|
+
|
605
663
|
// DBRG KAT
|
606
664
|
CTR_DRBG_STATE drbg;
|
607
665
|
if (!CTR_DRBG_init(&drbg, kDRBGEntropy, kDRBGPersonalization,
|
@@ -642,6 +700,10 @@ err:
|
|
642
700
|
EVP_AEAD_CTX_cleanup(&aead_ctx);
|
643
701
|
RSA_free(rsa_key);
|
644
702
|
EC_KEY_free(ec_key);
|
703
|
+
EC_POINT_free(ec_point_in);
|
704
|
+
EC_POINT_free(ec_point_out);
|
705
|
+
EC_GROUP_free(ec_group);
|
706
|
+
BN_free(ec_scalar);
|
645
707
|
ECDSA_SIG_free(sig);
|
646
708
|
|
647
709
|
return ret;
|
@@ -72,6 +72,8 @@ OPENSSL_MSVC_PRAGMA(warning(pop))
|
|
72
72
|
|
73
73
|
|
74
74
|
#define OPENSSL_MALLOC_PREFIX 8
|
75
|
+
OPENSSL_STATIC_ASSERT(OPENSSL_MALLOC_PREFIX >= sizeof(size_t),
|
76
|
+
"size_t too large");
|
75
77
|
|
76
78
|
#if defined(OPENSSL_ASAN)
|
77
79
|
void __asan_poison_memory_region(const volatile void *addr, size_t size);
|
@@ -101,13 +103,21 @@ static void __asan_unpoison_memory_region(const void *addr, size_t size) {}
|
|
101
103
|
// linked. This isn't an ideal result, but its helps in some cases.
|
102
104
|
WEAK_SYMBOL_FUNC(void, sdallocx, (void *ptr, size_t size, int flags));
|
103
105
|
|
104
|
-
// The following
|
105
|
-
//
|
106
|
-
//
|
107
|
-
|
108
|
-
WEAK_SYMBOL_FUNC(void
|
106
|
+
// The following three functions can be defined to override default heap
|
107
|
+
// allocation and freeing. If defined, it is the responsibility of
|
108
|
+
// |OPENSSL_memory_free| to zero out the memory before returning it to the
|
109
|
+
// system. |OPENSSL_memory_free| will not be passed NULL pointers.
|
110
|
+
WEAK_SYMBOL_FUNC(void*, OPENSSL_memory_alloc, (size_t size));
|
111
|
+
WEAK_SYMBOL_FUNC(void, OPENSSL_memory_free, (void *ptr));
|
112
|
+
WEAK_SYMBOL_FUNC(size_t, OPENSSL_memory_get_size, (void *ptr));
|
109
113
|
|
110
114
|
void *OPENSSL_malloc(size_t size) {
|
115
|
+
if (OPENSSL_memory_alloc != NULL) {
|
116
|
+
assert(OPENSSL_memory_free != NULL);
|
117
|
+
assert(OPENSSL_memory_get_size != NULL);
|
118
|
+
return OPENSSL_memory_alloc(size);
|
119
|
+
}
|
120
|
+
|
111
121
|
if (size + OPENSSL_MALLOC_PREFIX < size) {
|
112
122
|
return NULL;
|
113
123
|
}
|
@@ -120,9 +130,6 @@ void *OPENSSL_malloc(size_t size) {
|
|
120
130
|
*(size_t *)ptr = size;
|
121
131
|
|
122
132
|
__asan_poison_memory_region(ptr, OPENSSL_MALLOC_PREFIX);
|
123
|
-
if (OPENSSL_track_memory_alloc) {
|
124
|
-
OPENSSL_track_memory_alloc(ptr, size + OPENSSL_MALLOC_PREFIX);
|
125
|
-
}
|
126
133
|
return ((uint8_t *)ptr) + OPENSSL_MALLOC_PREFIX;
|
127
134
|
}
|
128
135
|
|
@@ -131,13 +138,15 @@ void OPENSSL_free(void *orig_ptr) {
|
|
131
138
|
return;
|
132
139
|
}
|
133
140
|
|
141
|
+
if (OPENSSL_memory_free != NULL) {
|
142
|
+
OPENSSL_memory_free(orig_ptr);
|
143
|
+
return;
|
144
|
+
}
|
145
|
+
|
134
146
|
void *ptr = ((uint8_t *)orig_ptr) - OPENSSL_MALLOC_PREFIX;
|
135
147
|
__asan_unpoison_memory_region(ptr, OPENSSL_MALLOC_PREFIX);
|
136
148
|
|
137
149
|
size_t size = *(size_t *)ptr;
|
138
|
-
if (OPENSSL_track_memory_free) {
|
139
|
-
OPENSSL_track_memory_free(ptr, size + OPENSSL_MALLOC_PREFIX);
|
140
|
-
}
|
141
150
|
OPENSSL_cleanse(ptr, size + OPENSSL_MALLOC_PREFIX);
|
142
151
|
if (sdallocx) {
|
143
152
|
sdallocx(ptr, size + OPENSSL_MALLOC_PREFIX, 0 /* flags */);
|
@@ -151,10 +160,15 @@ void *OPENSSL_realloc(void *orig_ptr, size_t new_size) {
|
|
151
160
|
return OPENSSL_malloc(new_size);
|
152
161
|
}
|
153
162
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
163
|
+
size_t old_size;
|
164
|
+
if (OPENSSL_memory_get_size != NULL) {
|
165
|
+
old_size = OPENSSL_memory_get_size(orig_ptr);
|
166
|
+
} else {
|
167
|
+
void *ptr = ((uint8_t *)orig_ptr) - OPENSSL_MALLOC_PREFIX;
|
168
|
+
__asan_unpoison_memory_region(ptr, OPENSSL_MALLOC_PREFIX);
|
169
|
+
old_size = *(size_t *)ptr;
|
170
|
+
__asan_poison_memory_region(ptr, OPENSSL_MALLOC_PREFIX);
|
171
|
+
}
|
158
172
|
|
159
173
|
void *ret = OPENSSL_malloc(new_size);
|
160
174
|
if (ret == NULL) {
|