grpc 1.66.0 → 1.67.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Makefile +19 -10
- data/include/grpc/credentials.h +1 -1
- data/include/grpc/event_engine/README.md +1 -1
- data/include/grpc/event_engine/internal/slice_cast.h +1 -1
- data/include/grpc/event_engine/slice.h +0 -1
- data/include/grpc/event_engine/slice_buffer.h +0 -1
- data/include/grpc/grpc_crl_provider.h +1 -1
- data/include/grpc/impl/channel_arg_names.h +1 -1
- data/include/grpc/support/log.h +34 -32
- data/include/grpc/support/sync_generic.h +2 -4
- data/src/core/channelz/channelz.cc +0 -1
- data/src/core/channelz/channelz_registry.cc +0 -1
- data/src/core/client_channel/client_channel.cc +10 -7
- data/src/core/client_channel/client_channel.h +1 -1
- data/src/core/client_channel/client_channel_filter.cc +21 -18
- data/src/core/client_channel/client_channel_filter.h +1 -1
- data/src/core/client_channel/client_channel_internal.h +0 -2
- data/src/core/client_channel/config_selector.h +0 -1
- data/src/core/client_channel/dynamic_filters.cc +0 -2
- data/src/core/client_channel/local_subchannel_pool.cc +0 -2
- data/src/core/client_channel/retry_filter.h +0 -1
- data/src/core/client_channel/retry_filter_legacy_call_data.cc +175 -257
- data/src/core/client_channel/subchannel.cc +21 -27
- data/src/core/client_channel/subchannel_stream_client.cc +1 -1
- data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +8 -9
- data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +0 -1
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +3 -4
- data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.cc +167 -0
- data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.h +82 -0
- data/src/core/ext/filters/gcp_authentication/gcp_authentication_service_config_parser.cc +81 -0
- data/src/core/ext/filters/gcp_authentication/gcp_authentication_service_config_parser.h +87 -0
- data/src/core/ext/filters/http/message_compress/compression_filter.cc +7 -9
- data/src/core/ext/filters/http/server/http_server_filter.cc +2 -4
- data/src/core/ext/filters/message_size/message_size_filter.cc +6 -7
- data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +0 -2
- data/src/core/ext/transport/chttp2/alpn/alpn.cc +0 -1
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +6 -8
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +0 -1
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +288 -265
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +3 -4
- data/src/core/ext/transport/chttp2/transport/flow_control.h +0 -1
- data/src/core/ext/transport/chttp2/transport/frame.cc +0 -1
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +0 -1
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +0 -1
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +6 -6
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +3 -4
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +5 -6
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +0 -1
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +2 -3
- data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc +0 -1
- data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +0 -1
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +37 -5
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +27 -6
- data/src/core/ext/transport/chttp2/transport/internal.h +2 -3
- data/src/core/ext/transport/chttp2/transport/parsing.cc +21 -32
- data/src/core/ext/transport/chttp2/transport/ping_callbacks.cc +0 -1
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +6 -8
- data/src/core/ext/transport/chttp2/transport/varint.h +0 -1
- data/src/core/ext/transport/chttp2/transport/write_size_policy.cc +0 -1
- data/src/core/ext/transport/chttp2/transport/writing.cc +22 -22
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb.h +431 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb_minitable.c +129 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb_minitable.h +33 -0
- data/src/core/ext/upb-gen/google/api/expr/v1alpha1/checked.upb.h +16 -0
- data/src/core/ext/upb-gen/google/api/expr/v1alpha1/checked.upb_minitable.c +13 -2
- data/src/core/ext/upb-gen/google/api/expr/v1alpha1/syntax.upb.h +397 -22
- data/src/core/ext/upb-gen/google/api/expr/v1alpha1/syntax.upb_minitable.c +94 -20
- data/src/core/ext/upb-gen/google/api/expr/v1alpha1/syntax.upb_minitable.h +2 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upbdefs.c +86 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upbdefs.h +47 -0
- data/src/core/ext/upbdefs-gen/google/api/expr/v1alpha1/checked.upbdefs.c +108 -107
- data/src/core/ext/upbdefs-gen/google/api/expr/v1alpha1/syntax.upbdefs.c +101 -78
- data/src/core/ext/upbdefs-gen/google/api/expr/v1alpha1/syntax.upbdefs.h +10 -0
- data/src/core/handshaker/handshaker.cc +21 -29
- data/src/core/handshaker/security/secure_endpoint.cc +3 -3
- data/src/core/handshaker/security/security_handshaker.cc +60 -72
- data/src/core/handshaker/tcp_connect/tcp_connect_handshaker.cc +0 -1
- data/src/core/lib/backoff/backoff.cc +7 -10
- data/src/core/lib/backoff/backoff.h +4 -6
- data/src/core/lib/channel/channel_stack.cc +0 -1
- data/src/core/lib/channel/channel_stack.h +0 -1
- data/src/core/lib/channel/channel_stack_builder_impl.cc +0 -1
- data/src/core/lib/channel/connected_channel.cc +0 -1
- data/src/core/lib/channel/promise_based_filter.cc +146 -194
- data/src/core/lib/channel/promise_based_filter.h +1 -1
- data/src/core/lib/compression/compression_internal.cc +0 -1
- data/src/core/lib/config/config_vars.cc +11 -1
- data/src/core/lib/config/config_vars.h +8 -0
- data/src/core/lib/config/core_configuration.cc +0 -1
- data/src/core/lib/config/core_configuration.h +0 -1
- data/src/core/lib/debug/event_log.cc +0 -1
- data/src/core/lib/debug/trace_flags.cc +4 -18
- data/src/core/lib/debug/trace_flags.h +2 -5
- data/src/core/lib/debug/trace_impl.h +6 -0
- data/src/core/lib/event_engine/ares_resolver.cc +89 -56
- data/src/core/lib/event_engine/ares_resolver.h +0 -9
- data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +14 -1
- data/src/core/lib/event_engine/cf_engine/cftype_unique_ref.h +1 -1
- data/src/core/lib/event_engine/forkable.cc +0 -1
- data/src/core/lib/event_engine/forkable.h +0 -1
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +1 -1
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.h +4 -4
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +0 -1
- data/src/core/lib/event_engine/posix_engine/lockfree_event.cc +0 -1
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +9 -1
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +0 -1
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.h +2 -2
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +1 -2
- data/src/core/lib/event_engine/posix_engine/timer_manager.cc +4 -9
- data/src/core/lib/event_engine/posix_engine/traced_buffer_list.cc +0 -1
- data/src/core/lib/event_engine/resolved_address.cc +0 -1
- data/src/core/lib/event_engine/slice.cc +0 -1
- data/src/core/lib/event_engine/thread_pool/thread_count.cc +0 -1
- data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +3 -5
- data/src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc +121 -93
- data/src/core/lib/experiments/config.cc +12 -10
- data/src/core/lib/experiments/experiments.cc +45 -66
- data/src/core/lib/experiments/experiments.h +22 -27
- data/src/core/lib/gprpp/chunked_vector.h +0 -1
- data/src/core/lib/gprpp/down_cast.h +0 -1
- data/src/core/lib/gprpp/host_port.cc +0 -1
- data/src/core/lib/gprpp/load_file.cc +0 -1
- data/src/core/lib/gprpp/mpscq.h +0 -1
- data/src/core/lib/gprpp/single_set_ptr.h +0 -1
- data/src/core/lib/gprpp/status_helper.cc +0 -1
- data/src/core/lib/gprpp/sync.h +0 -1
- data/src/core/lib/gprpp/table.h +28 -0
- data/src/core/lib/gprpp/thd.h +0 -1
- data/src/core/lib/gprpp/time.h +0 -1
- data/src/core/lib/gprpp/time_util.cc +0 -1
- data/src/core/lib/gprpp/windows/directory_reader.cc +0 -2
- data/src/core/lib/gprpp/windows/thd.cc +0 -1
- data/src/core/lib/gprpp/work_serializer.cc +23 -34
- data/src/core/lib/iomgr/buffer_list.cc +0 -1
- data/src/core/lib/iomgr/call_combiner.h +6 -8
- data/src/core/lib/iomgr/cfstream_handle.cc +6 -8
- data/src/core/lib/iomgr/closure.h +5 -8
- data/src/core/lib/iomgr/combiner.cc +6 -8
- data/src/core/lib/iomgr/endpoint_cfstream.cc +17 -22
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +0 -1
- data/src/core/lib/iomgr/error.h +0 -1
- data/src/core/lib/iomgr/ev_apple.cc +13 -18
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +47 -85
- data/src/core/lib/iomgr/ev_poll_posix.cc +17 -24
- data/src/core/lib/iomgr/ev_posix.cc +55 -44
- data/src/core/lib/iomgr/ev_posix.h +0 -5
- data/src/core/lib/iomgr/event_engine_shims/closure.cc +7 -9
- data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +3 -4
- data/src/core/lib/iomgr/exec_ctx.cc +6 -9
- data/src/core/lib/iomgr/exec_ctx.h +26 -16
- data/src/core/lib/iomgr/executor.cc +43 -33
- data/src/core/lib/iomgr/fork_windows.cc +0 -1
- data/src/core/lib/iomgr/internal_errqueue.cc +0 -1
- data/src/core/lib/iomgr/iocp_windows.cc +0 -1
- data/src/core/lib/iomgr/iomgr_windows.cc +0 -2
- data/src/core/lib/iomgr/lockfree_event.cc +7 -11
- data/src/core/lib/iomgr/polling_entity.cc +10 -3
- data/src/core/lib/iomgr/pollset_windows.cc +0 -2
- data/src/core/lib/iomgr/resolve_address.cc +0 -1
- data/src/core/lib/iomgr/resolve_address_posix.cc +0 -1
- data/src/core/lib/iomgr/resolve_address_windows.cc +0 -1
- data/src/core/lib/iomgr/sockaddr_utils_posix.cc +0 -1
- data/src/core/lib/iomgr/socket_mutator.cc +0 -1
- data/src/core/lib/iomgr/socket_utils_linux.cc +0 -2
- data/src/core/lib/iomgr/socket_utils_posix.cc +0 -1
- data/src/core/lib/iomgr/socket_utils_windows.cc +0 -2
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +7 -12
- data/src/core/lib/iomgr/tcp_client_posix.cc +8 -12
- data/src/core/lib/iomgr/tcp_client_windows.cc +0 -1
- data/src/core/lib/iomgr/tcp_posix.cc +32 -68
- data/src/core/lib/iomgr/tcp_server_posix.cc +7 -11
- data/src/core/lib/iomgr/tcp_windows.cc +4 -12
- data/src/core/lib/iomgr/timer_generic.cc +46 -65
- data/src/core/lib/iomgr/timer_manager.cc +4 -5
- data/src/core/lib/iomgr/unix_sockets_posix.cc +0 -1
- data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +0 -2
- data/src/core/lib/iomgr/vsock.cc +0 -1
- data/src/core/lib/iomgr/wakeup_fd_eventfd.cc +0 -2
- data/src/core/lib/promise/activity.h +0 -1
- data/src/core/lib/promise/context.h +0 -1
- data/src/core/lib/promise/detail/join_state.h +44 -44
- data/src/core/lib/promise/detail/seq_state.h +1101 -1356
- data/src/core/lib/promise/for_each.h +8 -15
- data/src/core/lib/promise/interceptor_list.h +17 -27
- data/src/core/lib/promise/latch.h +16 -24
- data/src/core/lib/promise/map.h +1 -1
- data/src/core/lib/promise/party.cc +238 -114
- data/src/core/lib/promise/party.h +105 -308
- data/src/core/lib/promise/pipe.h +3 -4
- data/src/core/lib/promise/poll.h +0 -1
- data/src/core/lib/promise/status_flag.h +0 -1
- data/src/core/lib/resource_quota/connection_quota.cc +0 -1
- data/src/core/lib/resource_quota/memory_quota.cc +11 -19
- data/src/core/lib/resource_quota/memory_quota.h +2 -4
- data/src/core/lib/resource_quota/periodic_update.cc +2 -3
- data/src/core/lib/resource_quota/thread_quota.cc +0 -1
- data/src/core/lib/security/authorization/audit_logging.cc +0 -1
- data/src/core/lib/security/authorization/grpc_authorization_engine.cc +0 -1
- data/src/core/lib/security/authorization/grpc_server_authz_filter.cc +14 -19
- data/src/core/lib/security/authorization/stdout_logger.cc +0 -1
- data/src/core/lib/security/credentials/alts/check_gcp_environment.cc +0 -1
- data/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc +0 -1
- data/src/core/lib/security/credentials/call_creds_util.cc +0 -1
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +0 -1
- data/src/core/lib/security/credentials/composite/composite_credentials.h +2 -0
- data/src/core/lib/security/credentials/credentials.h +1 -2
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +322 -324
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.h +53 -42
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +391 -353
- data/src/core/lib/security/credentials/external/external_account_credentials.h +121 -51
- data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +83 -44
- data/src/core/lib/security/credentials/external/file_external_account_credentials.h +27 -7
- data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +91 -116
- data/src/core/lib/security/credentials/external/url_external_account_credentials.h +14 -17
- data/src/core/lib/security/credentials/fake/fake_credentials.h +2 -0
- data/src/core/lib/security/credentials/gcp_service_account_identity/gcp_service_account_identity_credentials.cc +196 -0
- data/src/core/lib/security/credentials/gcp_service_account_identity/gcp_service_account_identity_credentials.h +90 -0
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +27 -41
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +0 -1
- data/src/core/lib/security/credentials/iam/iam_credentials.h +2 -0
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +2 -0
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +163 -259
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +34 -56
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +12 -16
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +2 -0
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +0 -1
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc +0 -1
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +0 -1
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.cc +0 -1
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.h +0 -1
- data/src/core/lib/security/credentials/token_fetcher/token_fetcher_credentials.cc +298 -0
- data/src/core/lib/security/credentials/token_fetcher/token_fetcher_credentials.h +176 -0
- data/src/core/lib/security/credentials/xds/xds_credentials.cc +0 -1
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +0 -1
- data/src/core/lib/security/security_connector/insecure/insecure_security_connector.cc +0 -1
- data/src/core/lib/security/security_connector/load_system_roots_windows.cc +0 -1
- data/src/core/lib/security/transport/server_auth_filter.cc +4 -6
- data/src/core/lib/slice/percent_encoding.cc +0 -1
- data/src/core/lib/slice/slice.cc +0 -1
- data/src/core/lib/slice/slice.h +0 -1
- data/src/core/lib/slice/slice_buffer.cc +0 -1
- data/src/core/lib/slice/slice_internal.h +0 -1
- data/src/core/lib/slice/slice_refcount.h +6 -8
- data/src/core/lib/surface/byte_buffer_reader.cc +0 -1
- data/src/core/lib/surface/call.cc +3 -5
- data/src/core/lib/surface/call_utils.h +0 -1
- data/src/core/lib/surface/channel.cc +0 -1
- data/src/core/lib/surface/channel_create.cc +0 -1
- data/src/core/lib/surface/channel_init.h +0 -1
- data/src/core/lib/surface/client_call.cc +0 -1
- data/src/core/lib/surface/client_call.h +0 -1
- data/src/core/lib/surface/completion_queue.cc +28 -4
- data/src/core/lib/surface/completion_queue_factory.cc +0 -1
- data/src/core/lib/surface/filter_stack_call.cc +9 -9
- data/src/core/lib/surface/filter_stack_call.h +0 -1
- data/src/core/lib/surface/lame_client.cc +0 -1
- data/src/core/lib/surface/server_call.cc +0 -1
- data/src/core/lib/surface/server_call.h +0 -1
- data/src/core/lib/surface/validate_metadata.h +0 -1
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.cc +9 -12
- data/src/core/lib/transport/bdp_estimator.h +6 -8
- data/src/core/lib/transport/call_arena_allocator.cc +2 -16
- data/src/core/lib/transport/call_arena_allocator.h +20 -5
- data/src/core/lib/transport/call_filters.cc +6 -9
- data/src/core/lib/transport/call_spine.h +24 -13
- data/src/core/lib/transport/connectivity_state.cc +34 -42
- data/src/core/lib/transport/metadata_batch.h +41 -1
- data/src/core/lib/transport/timeout_encoding.cc +0 -1
- data/src/core/lib/transport/transport.h +6 -8
- data/src/core/lib/transport/transport_op_string.cc +0 -1
- data/src/core/lib/uri/uri_parser.cc +0 -1
- data/src/core/load_balancing/grpclb/grpclb.cc +55 -71
- data/src/core/load_balancing/health_check_client.cc +31 -42
- data/src/core/load_balancing/oob_backend_metric.cc +2 -4
- data/src/core/load_balancing/outlier_detection/outlier_detection.cc +99 -129
- data/src/core/load_balancing/pick_first/pick_first.cc +168 -228
- data/src/core/load_balancing/priority/priority.cc +77 -106
- data/src/core/load_balancing/ring_hash/ring_hash.cc +32 -46
- data/src/core/load_balancing/rls/rls.cc +142 -187
- data/src/core/load_balancing/round_robin/round_robin.cc +36 -55
- data/src/core/load_balancing/weighted_round_robin/static_stride_scheduler.cc +0 -1
- data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +85 -110
- data/src/core/load_balancing/weighted_target/weighted_target.cc +52 -75
- data/src/core/load_balancing/xds/cds.cc +26 -43
- data/src/core/load_balancing/xds/xds_cluster_impl.cc +57 -54
- data/src/core/load_balancing/xds/xds_cluster_manager.cc +36 -50
- data/src/core/load_balancing/xds/xds_override_host.cc +95 -131
- data/src/core/load_balancing/xds/xds_wrr_locality.cc +15 -23
- data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +3 -0
- data/src/core/resolver/binder/binder_resolver.cc +0 -2
- data/src/core/resolver/dns/c_ares/dns_resolver_ares.cc +62 -44
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +0 -2
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +110 -89
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.cc +132 -96
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.h +0 -7
- data/src/core/resolver/dns/dns_resolver_plugin.cc +0 -1
- data/src/core/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +40 -39
- data/src/core/resolver/dns/native/dns_resolver.cc +8 -14
- data/src/core/resolver/endpoint_addresses.cc +0 -1
- data/src/core/resolver/fake/fake_resolver.cc +0 -1
- data/src/core/resolver/polling_resolver.cc +6 -15
- data/src/core/resolver/polling_resolver.h +1 -1
- data/src/core/resolver/xds/xds_config.cc +96 -0
- data/src/core/resolver/xds/xds_config.h +109 -0
- data/src/core/resolver/xds/xds_dependency_manager.cc +59 -154
- data/src/core/resolver/xds/xds_dependency_manager.h +1 -69
- data/src/core/resolver/xds/xds_resolver.cc +51 -55
- data/src/core/server/server.cc +2 -2
- data/src/core/server/server_config_selector_filter.cc +0 -1
- data/src/core/server/xds_server_config_fetcher.cc +4 -6
- data/src/core/service_config/service_config_call_data.h +2 -3
- data/src/core/service_config/service_config_channel_arg_filter.cc +0 -1
- data/src/core/service_config/service_config_impl.h +0 -1
- data/src/core/telemetry/call_tracer.cc +0 -1
- data/src/core/telemetry/metrics.h +0 -1
- data/src/core/telemetry/stats_data.cc +67 -0
- data/src/core/telemetry/stats_data.h +48 -0
- data/src/core/tsi/alts/handshaker/alts_shared_resource.cc +0 -1
- data/src/core/tsi/alts/handshaker/transport_security_common_api.h +0 -1
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc +0 -1
- data/src/core/tsi/fake_transport_security.cc +6 -5
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +0 -1
- data/src/core/util/alloc.cc +0 -1
- data/src/core/util/gcp_metadata_query.cc +0 -1
- data/src/core/util/http_client/httpcli.cc +12 -15
- data/src/core/util/http_client/httpcli.h +16 -11
- data/src/core/util/http_client/parser.cc +3 -4
- data/src/core/util/json/json_reader.cc +0 -1
- data/src/core/util/latent_see.cc +29 -9
- data/src/core/util/latent_see.h +122 -27
- data/src/core/util/log.cc +36 -55
- data/src/core/util/lru_cache.h +104 -0
- data/src/core/util/msys/tmpfile.cc +0 -1
- data/src/core/util/posix/sync.cc +0 -1
- data/src/core/util/posix/time.cc +0 -1
- data/src/core/util/ring_buffer.h +123 -0
- data/src/core/util/spinlock.h +1 -2
- data/src/core/util/string.cc +7 -7
- data/src/core/util/sync.cc +0 -1
- data/src/core/util/sync_abseil.cc +0 -1
- data/src/core/util/time.cc +0 -1
- data/src/core/util/unique_ptr_with_bitset.h +86 -0
- data/src/core/util/useful.h +0 -24
- data/src/core/util/windows/cpu.cc +0 -1
- data/src/core/util/windows/sync.cc +0 -1
- data/src/core/util/windows/time.cc +0 -1
- data/src/core/util/windows/tmpfile.cc +0 -1
- data/src/core/xds/grpc/xds_bootstrap_grpc.cc +0 -32
- data/src/core/xds/grpc/xds_bootstrap_grpc.h +0 -5
- data/src/core/xds/grpc/xds_certificate_provider.cc +0 -1
- data/src/core/xds/grpc/xds_client_grpc.cc +11 -16
- data/src/core/xds/grpc/xds_cluster.cc +2 -8
- data/src/core/xds/grpc/xds_cluster.h +4 -4
- data/src/core/xds/grpc/xds_cluster_parser.cc +58 -96
- data/src/core/xds/grpc/xds_cluster_specifier_plugin.cc +0 -1
- data/src/core/xds/grpc/xds_common_types_parser.cc +4 -4
- data/src/core/xds/grpc/xds_common_types_parser.h +17 -0
- data/src/core/xds/grpc/xds_endpoint_parser.cc +14 -14
- data/src/core/xds/grpc/xds_http_fault_filter.cc +15 -6
- data/src/core/xds/grpc/xds_http_fault_filter.h +5 -1
- data/src/core/xds/grpc/xds_http_filter.h +11 -1
- data/src/core/xds/grpc/xds_http_filter_registry.cc +7 -1
- data/src/core/xds/grpc/xds_http_filter_registry.h +8 -1
- data/src/core/xds/grpc/xds_http_gcp_authn_filter.cc +142 -0
- data/src/core/xds/grpc/xds_http_gcp_authn_filter.h +61 -0
- data/src/core/xds/grpc/xds_http_rbac_filter.cc +14 -6
- data/src/core/xds/grpc/xds_http_rbac_filter.h +5 -1
- data/src/core/xds/grpc/xds_http_stateful_session_filter.cc +9 -1
- data/src/core/xds/grpc/xds_http_stateful_session_filter.h +5 -1
- data/src/core/xds/grpc/xds_lb_policy_registry.cc +14 -16
- data/src/core/xds/grpc/xds_listener_parser.cc +10 -11
- data/src/core/xds/grpc/xds_metadata.cc +62 -0
- data/src/core/xds/grpc/xds_metadata.h +127 -0
- data/src/core/xds/grpc/xds_metadata_parser.cc +143 -0
- data/src/core/xds/grpc/xds_metadata_parser.h +36 -0
- data/src/core/xds/grpc/xds_route_config_parser.cc +12 -17
- data/src/core/xds/grpc/xds_routing.cc +57 -22
- data/src/core/xds/grpc/xds_routing.h +10 -2
- data/src/core/xds/grpc/xds_transport_grpc.cc +0 -1
- data/src/core/xds/xds_client/xds_client.cc +124 -165
- data/src/core/xds/xds_client/xds_client_stats.cc +20 -27
- data/src/ruby/ext/grpc/rb_call.c +1 -1
- data/src/ruby/ext/grpc/rb_call_credentials.c +34 -27
- data/src/ruby/ext/grpc/rb_channel.c +22 -16
- data/src/ruby/ext/grpc/rb_event_thread.c +3 -2
- data/src/ruby/ext/grpc/rb_grpc.c +9 -8
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +6 -10
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +9 -15
- data/src/ruby/ext/grpc/rb_server.c +10 -8
- data/src/ruby/lib/grpc/generic/active_call.rb +8 -5
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/call_spec.rb +53 -40
- data/src/ruby/spec/channel_spec.rb +4 -2
- data/src/ruby/spec/client_server_spec.rb +148 -507
- data/src/ruby/spec/generic/active_call_spec.rb +64 -86
- data/src/ruby/spec/support/services.rb +3 -0
- data/third_party/boringssl-with-bazel/src/crypto/{fipsmodule/rand/fork_detect.h → bcm_support.h} +51 -6
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/internal.h +43 -0
- data/third_party/boringssl-with-bazel/src/crypto/cpu_intel.c +72 -23
- data/third_party/boringssl-with-bazel/src/crypto/crypto.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/ecdsa_extra/ecdsa_asn1.c +160 -14
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/internal.h +2 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +79 -78
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm_interface.h +89 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{div.c → div.c.inc} +146 -179
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{random.c → random.c.inc} +6 -8
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{sqrt.c → sqrt.c.inc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{e_aes.c → e_aes.c.inc} +9 -8
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{ec_key.c → ec_key.c.inc} +11 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{p256-nistz.c → p256-nistz.c.inc} +104 -12
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-nistz.h +65 -8
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/{ecdsa.c → ecdsa.c.inc} +52 -107
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/internal.h +28 -11
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +1 -80
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/{rand.c → rand.c.inc} +26 -40
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/{padding.c → padding.c.inc} +2 -5
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/{rsa_impl.c → rsa_impl.c.inc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/{self_check.c → self_check.c.inc} +9 -35
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/service_indicator/internal.h +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/service_indicator/{service_indicator.c → service_indicator.c.inc} +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +293 -2
- data/third_party/boringssl-with-bazel/src/crypto/internal.h +69 -14
- data/third_party/boringssl-with-bazel/src/crypto/mem.c +7 -3
- data/third_party/boringssl-with-bazel/src/crypto/mldsa/internal.h +73 -0
- data/third_party/boringssl-with-bazel/src/crypto/mldsa/mldsa.c +1687 -0
- data/third_party/boringssl-with-bazel/src/crypto/mlkem/internal.h +90 -0
- data/third_party/boringssl-with-bazel/src/crypto/mlkem/mlkem.cc +1097 -0
- data/third_party/boringssl-with-bazel/src/crypto/obj/obj_dat.h +4 -1
- data/third_party/boringssl-with-bazel/src/crypto/pem/pem_lib.c +4 -5
- data/third_party/boringssl-with-bazel/src/crypto/pem/pem_pk8.c +2 -3
- data/third_party/boringssl-with-bazel/src/crypto/pem/pem_pkey.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/deterministic.c +9 -1
- data/third_party/boringssl-with-bazel/src/crypto/{fipsmodule/rand → rand_extra}/fork_detect.c +26 -28
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/getentropy.c +9 -1
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/ios.c +9 -1
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/passive.c +19 -3
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/rand_extra.c +26 -23
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/sysrand_internal.h +37 -0
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/trusty.c +9 -1
- data/third_party/boringssl-with-bazel/src/crypto/{fipsmodule/rand → rand_extra}/urandom.c +19 -19
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/windows.c +8 -1
- data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/internal.h +2 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +14 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/bn.h +14 -9
- data/third_party/boringssl-with-bazel/src/include/openssl/experimental/dilithium.h +13 -15
- data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +8 -6
- data/third_party/boringssl-with-bazel/src/include/openssl/mldsa.h +136 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/mlkem.h +246 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/nid.h +3 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/pem.h +3 -4
- data/third_party/boringssl-with-bazel/src/include/openssl/service_indicator.h +2 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/span.h +22 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +35 -5
- data/third_party/boringssl-with-bazel/src/ssl/d1_both.cc +5 -6
- data/third_party/boringssl-with-bazel/src/ssl/d1_lib.cc +6 -0
- data/third_party/boringssl-with-bazel/src/ssl/d1_pkt.cc +6 -1
- data/third_party/boringssl-with-bazel/src/ssl/dtls_method.cc +13 -1
- data/third_party/boringssl-with-bazel/src/ssl/dtls_record.cc +289 -55
- data/third_party/boringssl-with-bazel/src/ssl/extensions.cc +2 -0
- data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +69 -38
- data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +14 -3
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +107 -14
- data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +44 -16
- data/third_party/boringssl-with-bazel/src/ssl/s3_pkt.cc +21 -1
- data/third_party/boringssl-with-bazel/src/ssl/ssl_aead_ctx.cc +86 -1
- data/third_party/boringssl-with-bazel/src/ssl/ssl_buffer.cc +7 -4
- data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +97 -3
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +31 -2
- data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +6 -0
- data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +18 -4
- data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +96 -34
- data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +15 -5
- data/third_party/boringssl-with-bazel/src/ssl/tls_record.cc +3 -23
- metadata +113 -87
- data/src/core/ext/transport/chttp2/transport/max_concurrent_streams_policy.cc +0 -45
- data/src/core/ext/transport/chttp2/transport/max_concurrent_streams_policy.h +0 -67
- data/src/core/util/android/log.cc +0 -48
- data/src/core/util/linux/log.cc +0 -69
- data/src/core/util/posix/log.cc +0 -69
- data/src/core/util/windows/log.cc +0 -73
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/{aes.c → aes.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/{aes_nohw.c → aes_nohw.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/{key_wrap.c → key_wrap.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/{mode_wrappers.c → mode_wrappers.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{add.c → add.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/asm/{x86_64-gcc.c → x86_64-gcc.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{bn.c → bn.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{bytes.c → bytes.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{cmp.c → cmp.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{ctx.c → ctx.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{div_extra.c → div_extra.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{exponentiation.c → exponentiation.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{gcd.c → gcd.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{gcd_extra.c → gcd_extra.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{generic.c → generic.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{jacobi.c → jacobi.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{montgomery.c → montgomery.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{montgomery_inv.c → montgomery_inv.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{mul.c → mul.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{prime.c → prime.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{rsaz_exp.c → rsaz_exp.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{shift.c → shift.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{aead.c → aead.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{cipher.c → cipher.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{e_aesccm.c → e_aesccm.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cmac/{cmac.c → cmac.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/{check.c → check.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/{dh.c → dh.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/{digest.c → digest.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/{digests.c → digests.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digestsign/{digestsign.c → digestsign.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{ec.c → ec.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{ec_montgomery.c → ec_montgomery.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{felem.c → felem.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{oct.c → oct.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{p224-64.c → p224-64.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{p256.c → p256.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{scalar.c → scalar.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{simple.c → simple.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{simple_mul.c → simple_mul.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{util.c → util.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{wnaf.c → wnaf.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdh/{ecdh.c → ecdh.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/hkdf/{hkdf.c → hkdf.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/hmac/{hmac.c → hmac.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md4/{md4.c → md4.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md5/{md5.c → md5.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{cbc.c → cbc.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{cfb.c → cfb.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{ctr.c → ctr.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{gcm.c → gcm.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{gcm_nohw.c → gcm_nohw.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{ofb.c → ofb.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{polyval.c → polyval.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/{ctrdrbg.c → ctrdrbg.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/{blinding.c → blinding.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/{rsa.c → rsa.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/{fips.c → fips.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/{sha1.c → sha1.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/{sha256.c → sha256.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/{sha512.c → sha512.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/tls/{kdf.c → kdf.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/{fipsmodule/rand → rand_extra}/getrandom_fillin.h +0 -0
data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{p256-nistz.c → p256-nistz.c.inc}
RENAMED
@@ -39,7 +39,7 @@
|
|
39
39
|
typedef P256_POINT_AFFINE PRECOMP256_ROW[64];
|
40
40
|
|
41
41
|
// One converted into the Montgomery domain
|
42
|
-
static const BN_ULONG
|
42
|
+
static const BN_ULONG ONE_MONT[P256_LIMBS] = {
|
43
43
|
TOBN(0x00000000, 0x00000001), TOBN(0xffffffff, 0x00000000),
|
44
44
|
TOBN(0xffffffff, 0xffffffff), TOBN(0x00000000, 0xfffffffe),
|
45
45
|
};
|
@@ -116,6 +116,103 @@ static BN_ULONG is_not_zero(BN_ULONG in) {
|
|
116
116
|
return in;
|
117
117
|
}
|
118
118
|
|
119
|
+
#if defined(OPENSSL_X86_64)
|
120
|
+
// Dispatch between CPU variations. The "_adx" suffixed functions use MULX in
|
121
|
+
// addition to ADCX/ADOX. MULX is part of BMI2, not ADX, so we must check both
|
122
|
+
// capabilities.
|
123
|
+
static void ecp_nistz256_mul_mont(BN_ULONG res[P256_LIMBS],
|
124
|
+
const BN_ULONG a[P256_LIMBS],
|
125
|
+
const BN_ULONG b[P256_LIMBS]) {
|
126
|
+
if (CRYPTO_is_BMI2_capable() && CRYPTO_is_ADX_capable()) {
|
127
|
+
ecp_nistz256_mul_mont_adx(res, a, b);
|
128
|
+
} else {
|
129
|
+
ecp_nistz256_mul_mont_nohw(res, a, b);
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
133
|
+
static void ecp_nistz256_sqr_mont(BN_ULONG res[P256_LIMBS],
|
134
|
+
const BN_ULONG a[P256_LIMBS]) {
|
135
|
+
if (CRYPTO_is_BMI2_capable() && CRYPTO_is_ADX_capable()) {
|
136
|
+
ecp_nistz256_sqr_mont_adx(res, a);
|
137
|
+
} else {
|
138
|
+
ecp_nistz256_sqr_mont_nohw(res, a);
|
139
|
+
}
|
140
|
+
}
|
141
|
+
|
142
|
+
static void ecp_nistz256_ord_mul_mont(BN_ULONG res[P256_LIMBS],
|
143
|
+
const BN_ULONG a[P256_LIMBS],
|
144
|
+
const BN_ULONG b[P256_LIMBS]) {
|
145
|
+
if (CRYPTO_is_BMI2_capable() && CRYPTO_is_ADX_capable()) {
|
146
|
+
ecp_nistz256_ord_mul_mont_adx(res, a, b);
|
147
|
+
} else {
|
148
|
+
ecp_nistz256_ord_mul_mont_nohw(res, a, b);
|
149
|
+
}
|
150
|
+
}
|
151
|
+
|
152
|
+
static void ecp_nistz256_ord_sqr_mont(BN_ULONG res[P256_LIMBS],
|
153
|
+
const BN_ULONG a[P256_LIMBS],
|
154
|
+
BN_ULONG rep) {
|
155
|
+
if (CRYPTO_is_BMI2_capable() && CRYPTO_is_ADX_capable()) {
|
156
|
+
ecp_nistz256_ord_sqr_mont_adx(res, a, rep);
|
157
|
+
} else {
|
158
|
+
ecp_nistz256_ord_sqr_mont_nohw(res, a, rep);
|
159
|
+
}
|
160
|
+
}
|
161
|
+
|
162
|
+
static void ecp_nistz256_select_w5(P256_POINT *val, const P256_POINT in_t[16],
|
163
|
+
int index) {
|
164
|
+
if (CRYPTO_is_AVX2_capable()) {
|
165
|
+
ecp_nistz256_select_w5_avx2(val, in_t, index);
|
166
|
+
} else {
|
167
|
+
ecp_nistz256_select_w5_nohw(val, in_t, index);
|
168
|
+
}
|
169
|
+
}
|
170
|
+
|
171
|
+
static void ecp_nistz256_select_w7(P256_POINT_AFFINE *val,
|
172
|
+
const P256_POINT_AFFINE in_t[64],
|
173
|
+
int index) {
|
174
|
+
if (CRYPTO_is_AVX2_capable()) {
|
175
|
+
ecp_nistz256_select_w7_avx2(val, in_t, index);
|
176
|
+
} else {
|
177
|
+
ecp_nistz256_select_w7_nohw(val, in_t, index);
|
178
|
+
}
|
179
|
+
}
|
180
|
+
|
181
|
+
static void ecp_nistz256_point_double(P256_POINT *r, const P256_POINT *a) {
|
182
|
+
if (CRYPTO_is_BMI2_capable() && CRYPTO_is_ADX_capable()) {
|
183
|
+
ecp_nistz256_point_double_adx(r, a);
|
184
|
+
} else {
|
185
|
+
ecp_nistz256_point_double_nohw(r, a);
|
186
|
+
}
|
187
|
+
}
|
188
|
+
|
189
|
+
static void ecp_nistz256_point_add(P256_POINT *r, const P256_POINT *a,
|
190
|
+
const P256_POINT *b) {
|
191
|
+
if (CRYPTO_is_BMI2_capable() && CRYPTO_is_ADX_capable()) {
|
192
|
+
ecp_nistz256_point_add_adx(r, a, b);
|
193
|
+
} else {
|
194
|
+
ecp_nistz256_point_add_nohw(r, a, b);
|
195
|
+
}
|
196
|
+
}
|
197
|
+
|
198
|
+
static void ecp_nistz256_point_add_affine(P256_POINT *r, const P256_POINT *a,
|
199
|
+
const P256_POINT_AFFINE *b) {
|
200
|
+
if (CRYPTO_is_BMI2_capable() && CRYPTO_is_ADX_capable()) {
|
201
|
+
ecp_nistz256_point_add_affine_adx(r, a, b);
|
202
|
+
} else {
|
203
|
+
ecp_nistz256_point_add_affine_nohw(r, a, b);
|
204
|
+
}
|
205
|
+
}
|
206
|
+
#endif // OPENSSL_X86_64
|
207
|
+
|
208
|
+
// ecp_nistz256_from_mont sets |res| to |in|, converted from Montgomery domain
|
209
|
+
// by multiplying with 1.
|
210
|
+
static void ecp_nistz256_from_mont(BN_ULONG res[P256_LIMBS],
|
211
|
+
const BN_ULONG in[P256_LIMBS]) {
|
212
|
+
static const BN_ULONG ONE[P256_LIMBS] = {1};
|
213
|
+
ecp_nistz256_mul_mont(res, in, ONE);
|
214
|
+
}
|
215
|
+
|
119
216
|
// ecp_nistz256_mod_inverse_sqr_mont sets |r| to (|in| * 2^-256)^-2 * 2^256 mod
|
120
217
|
// p. That is, |r| is the modular inverse square of |in| for input and output in
|
121
218
|
// the Montgomery domain.
|
@@ -328,12 +425,12 @@ static void ecp_nistz256_point_mul_base(const EC_GROUP *group, EC_JACOBIAN *r,
|
|
328
425
|
copy_conditional(t.Y, p.Z, wvalue & 1);
|
329
426
|
|
330
427
|
// Convert |t| from affine to Jacobian coordinates. We set Z to zero if |t|
|
331
|
-
// is infinity and |
|
332
|
-
// is infinity iff |wvalue >> 1| is zero.
|
428
|
+
// is infinity and |ONE_MONT| otherwise. |t| was computed from the table, so
|
429
|
+
// it is infinity iff |wvalue >> 1| is zero.
|
333
430
|
OPENSSL_memcpy(p.X, t.X, sizeof(p.X));
|
334
431
|
OPENSSL_memcpy(p.Y, t.Y, sizeof(p.Y));
|
335
432
|
OPENSSL_memset(p.Z, 0, sizeof(p.Z));
|
336
|
-
copy_conditional(p.Z,
|
433
|
+
copy_conditional(p.Z, ONE_MONT, is_not_zero(wvalue >> 1));
|
337
434
|
|
338
435
|
for (int i = 1; i < 37; i++) {
|
339
436
|
wvalue = calc_wvalue(&index, p_str);
|
@@ -372,14 +469,14 @@ static void ecp_nistz256_points_mul_public(const EC_GROUP *group,
|
|
372
469
|
size_t wvalue = calc_first_wvalue(&index, p_str);
|
373
470
|
|
374
471
|
// Convert |p| from affine to Jacobian coordinates. We set Z to zero if |p|
|
375
|
-
// is infinity and |
|
376
|
-
// is infinity iff |wvalue >> 1| is zero.
|
472
|
+
// is infinity and |ONE_MONT| otherwise. |p| was computed from the table, so
|
473
|
+
// it is infinity iff |wvalue >> 1| is zero.
|
377
474
|
if ((wvalue >> 1) != 0) {
|
378
475
|
OPENSSL_memcpy(p.X, &ecp_nistz256_precomputed[0][(wvalue >> 1) - 1].X,
|
379
476
|
sizeof(p.X));
|
380
477
|
OPENSSL_memcpy(p.Y, &ecp_nistz256_precomputed[0][(wvalue >> 1) - 1].Y,
|
381
478
|
sizeof(p.Y));
|
382
|
-
OPENSSL_memcpy(p.Z,
|
479
|
+
OPENSSL_memcpy(p.Z, ONE_MONT, sizeof(p.Z));
|
383
480
|
} else {
|
384
481
|
OPENSSL_memset(p.X, 0, sizeof(p.X));
|
385
482
|
OPENSSL_memset(p.Y, 0, sizeof(p.Y));
|
@@ -612,11 +709,6 @@ static int ecp_nistz256_cmp_x_coordinate(const EC_GROUP *group,
|
|
612
709
|
}
|
613
710
|
|
614
711
|
DEFINE_METHOD_FUNCTION(EC_METHOD, EC_GFp_nistz256_method) {
|
615
|
-
// TODO(crbug.com/42290548): The x86_64 assembly depends on initializing
|
616
|
-
// |OPENSSL_ia32cap_P|. Move the dispatch to C. For now, explicitly initialize
|
617
|
-
// things.
|
618
|
-
OPENSSL_init_cpuid();
|
619
|
-
|
620
712
|
out->point_get_affine_coordinates = ecp_nistz256_get_affine;
|
621
713
|
out->add = ecp_nistz256_add;
|
622
714
|
out->dbl = ecp_nistz256_dbl;
|
@@ -48,21 +48,29 @@ extern "C" {
|
|
48
48
|
void ecp_nistz256_neg(BN_ULONG res[P256_LIMBS], const BN_ULONG a[P256_LIMBS]);
|
49
49
|
|
50
50
|
// ecp_nistz256_mul_mont sets |res| to |a| * |b| * 2^-256 mod P.
|
51
|
+
#if defined(OPENSSL_X86_64)
|
52
|
+
void ecp_nistz256_mul_mont_nohw(BN_ULONG res[P256_LIMBS],
|
53
|
+
const BN_ULONG a[P256_LIMBS],
|
54
|
+
const BN_ULONG b[P256_LIMBS]);
|
55
|
+
void ecp_nistz256_mul_mont_adx(BN_ULONG res[P256_LIMBS],
|
56
|
+
const BN_ULONG a[P256_LIMBS],
|
57
|
+
const BN_ULONG b[P256_LIMBS]);
|
58
|
+
#else
|
51
59
|
void ecp_nistz256_mul_mont(BN_ULONG res[P256_LIMBS],
|
52
60
|
const BN_ULONG a[P256_LIMBS],
|
53
61
|
const BN_ULONG b[P256_LIMBS]);
|
62
|
+
#endif
|
54
63
|
|
55
64
|
// ecp_nistz256_sqr_mont sets |res| to |a| * |a| * 2^-256 mod P.
|
65
|
+
#if defined(OPENSSL_X86_64)
|
66
|
+
void ecp_nistz256_sqr_mont_nohw(BN_ULONG res[P256_LIMBS],
|
67
|
+
const BN_ULONG a[P256_LIMBS]);
|
68
|
+
void ecp_nistz256_sqr_mont_adx(BN_ULONG res[P256_LIMBS],
|
69
|
+
const BN_ULONG a[P256_LIMBS]);
|
70
|
+
#else
|
56
71
|
void ecp_nistz256_sqr_mont(BN_ULONG res[P256_LIMBS],
|
57
72
|
const BN_ULONG a[P256_LIMBS]);
|
58
|
-
|
59
|
-
// ecp_nistz256_from_mont sets |res| to |in|, converted from Montgomery domain
|
60
|
-
// by multiplying with 1.
|
61
|
-
static inline void ecp_nistz256_from_mont(BN_ULONG res[P256_LIMBS],
|
62
|
-
const BN_ULONG in[P256_LIMBS]) {
|
63
|
-
static const BN_ULONG ONE[P256_LIMBS] = { 1 };
|
64
|
-
ecp_nistz256_mul_mont(res, in, ONE);
|
65
|
-
}
|
73
|
+
#endif
|
66
74
|
|
67
75
|
|
68
76
|
// P-256 scalar operations.
|
@@ -72,15 +80,31 @@ static inline void ecp_nistz256_from_mont(BN_ULONG res[P256_LIMBS],
|
|
72
80
|
|
73
81
|
// ecp_nistz256_ord_mul_mont sets |res| to |a| * |b| where inputs and outputs
|
74
82
|
// are in Montgomery form. That is, |res| is |a| * |b| * 2^-256 mod N.
|
83
|
+
#if defined(OPENSSL_X86_64)
|
84
|
+
void ecp_nistz256_ord_mul_mont_nohw(BN_ULONG res[P256_LIMBS],
|
85
|
+
const BN_ULONG a[P256_LIMBS],
|
86
|
+
const BN_ULONG b[P256_LIMBS]);
|
87
|
+
void ecp_nistz256_ord_mul_mont_adx(BN_ULONG res[P256_LIMBS],
|
88
|
+
const BN_ULONG a[P256_LIMBS],
|
89
|
+
const BN_ULONG b[P256_LIMBS]);
|
90
|
+
#else
|
75
91
|
void ecp_nistz256_ord_mul_mont(BN_ULONG res[P256_LIMBS],
|
76
92
|
const BN_ULONG a[P256_LIMBS],
|
77
93
|
const BN_ULONG b[P256_LIMBS]);
|
94
|
+
#endif
|
78
95
|
|
79
96
|
// ecp_nistz256_ord_sqr_mont sets |res| to |a|^(2*|rep|) where inputs and
|
80
97
|
// outputs are in Montgomery form. That is, |res| is
|
81
98
|
// (|a| * 2^-256)^(2*|rep|) * 2^256 mod N.
|
99
|
+
#if defined(OPENSSL_X86_64)
|
100
|
+
void ecp_nistz256_ord_sqr_mont_nohw(BN_ULONG res[P256_LIMBS],
|
101
|
+
const BN_ULONG a[P256_LIMBS], BN_ULONG rep);
|
102
|
+
void ecp_nistz256_ord_sqr_mont_adx(BN_ULONG res[P256_LIMBS],
|
103
|
+
const BN_ULONG a[P256_LIMBS], BN_ULONG rep);
|
104
|
+
#else
|
82
105
|
void ecp_nistz256_ord_sqr_mont(BN_ULONG res[P256_LIMBS],
|
83
106
|
const BN_ULONG a[P256_LIMBS], BN_ULONG rep);
|
107
|
+
#endif
|
84
108
|
|
85
109
|
// beeu_mod_inverse_vartime sets out = a^-1 mod p using a Euclidean algorithm.
|
86
110
|
// Assumption: 0 < a < p < 2^(256) and p is odd.
|
@@ -111,27 +135,60 @@ typedef struct {
|
|
111
135
|
// ecp_nistz256_select_w5 sets |*val| to |in_t[index-1]| if 1 <= |index| <= 16
|
112
136
|
// and all zeros (the point at infinity) if |index| is 0. This is done in
|
113
137
|
// constant time.
|
138
|
+
#if defined(OPENSSL_X86_64)
|
139
|
+
void ecp_nistz256_select_w5_nohw(P256_POINT *val, const P256_POINT in_t[16],
|
140
|
+
int index);
|
141
|
+
void ecp_nistz256_select_w5_avx2(P256_POINT *val, const P256_POINT in_t[16],
|
142
|
+
int index);
|
143
|
+
#else
|
114
144
|
void ecp_nistz256_select_w5(P256_POINT *val, const P256_POINT in_t[16],
|
115
145
|
int index);
|
146
|
+
#endif
|
116
147
|
|
117
148
|
// ecp_nistz256_select_w7 sets |*val| to |in_t[index-1]| if 1 <= |index| <= 64
|
118
149
|
// and all zeros (the point at infinity) if |index| is 0. This is done in
|
119
150
|
// constant time.
|
151
|
+
#if defined(OPENSSL_X86_64)
|
152
|
+
void ecp_nistz256_select_w7_nohw(P256_POINT_AFFINE *val,
|
153
|
+
const P256_POINT_AFFINE in_t[64], int index);
|
154
|
+
void ecp_nistz256_select_w7_avx2(P256_POINT_AFFINE *val,
|
155
|
+
const P256_POINT_AFFINE in_t[64], int index);
|
156
|
+
#else
|
120
157
|
void ecp_nistz256_select_w7(P256_POINT_AFFINE *val,
|
121
158
|
const P256_POINT_AFFINE in_t[64], int index);
|
159
|
+
#endif
|
122
160
|
|
123
161
|
// ecp_nistz256_point_double sets |r| to |a| doubled.
|
162
|
+
#if defined(OPENSSL_X86_64)
|
163
|
+
void ecp_nistz256_point_double_nohw(P256_POINT *r, const P256_POINT *a);
|
164
|
+
void ecp_nistz256_point_double_adx(P256_POINT *r, const P256_POINT *a);
|
165
|
+
#else
|
124
166
|
void ecp_nistz256_point_double(P256_POINT *r, const P256_POINT *a);
|
167
|
+
#endif
|
125
168
|
|
126
169
|
// ecp_nistz256_point_add adds |a| to |b| and places the result in |r|.
|
170
|
+
#if defined(OPENSSL_X86_64)
|
171
|
+
void ecp_nistz256_point_add_nohw(P256_POINT *r, const P256_POINT *a,
|
172
|
+
const P256_POINT *b);
|
173
|
+
void ecp_nistz256_point_add_adx(P256_POINT *r, const P256_POINT *a,
|
174
|
+
const P256_POINT *b);
|
175
|
+
#else
|
127
176
|
void ecp_nistz256_point_add(P256_POINT *r, const P256_POINT *a,
|
128
177
|
const P256_POINT *b);
|
178
|
+
#endif
|
129
179
|
|
130
180
|
// ecp_nistz256_point_add_affine adds |a| to |b| and places the result in
|
131
181
|
// |r|. |a| and |b| must not represent the same point unless they are both
|
132
182
|
// infinity.
|
183
|
+
#if defined(OPENSSL_X86_64)
|
184
|
+
void ecp_nistz256_point_add_affine_adx(P256_POINT *r, const P256_POINT *a,
|
185
|
+
const P256_POINT_AFFINE *b);
|
186
|
+
void ecp_nistz256_point_add_affine_nohw(P256_POINT *r, const P256_POINT *a,
|
187
|
+
const P256_POINT_AFFINE *b);
|
188
|
+
#else
|
133
189
|
void ecp_nistz256_point_add_affine(P256_POINT *r, const P256_POINT *a,
|
134
190
|
const P256_POINT_AFFINE *b);
|
191
|
+
#endif
|
135
192
|
|
136
193
|
#endif /* !defined(OPENSSL_NO_ASM) && \
|
137
194
|
(defined(OPENSSL_X86_64) || defined(OPENSSL_AARCH64)) && \
|
@@ -95,61 +95,9 @@ static void digest_to_scalar(const EC_GROUP *group, EC_SCALAR *out,
|
|
95
95
|
order->width);
|
96
96
|
}
|
97
97
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
return NULL;
|
102
|
-
}
|
103
|
-
sig->r = BN_new();
|
104
|
-
sig->s = BN_new();
|
105
|
-
if (sig->r == NULL || sig->s == NULL) {
|
106
|
-
ECDSA_SIG_free(sig);
|
107
|
-
return NULL;
|
108
|
-
}
|
109
|
-
return sig;
|
110
|
-
}
|
111
|
-
|
112
|
-
void ECDSA_SIG_free(ECDSA_SIG *sig) {
|
113
|
-
if (sig == NULL) {
|
114
|
-
return;
|
115
|
-
}
|
116
|
-
|
117
|
-
BN_free(sig->r);
|
118
|
-
BN_free(sig->s);
|
119
|
-
OPENSSL_free(sig);
|
120
|
-
}
|
121
|
-
|
122
|
-
const BIGNUM *ECDSA_SIG_get0_r(const ECDSA_SIG *sig) {
|
123
|
-
return sig->r;
|
124
|
-
}
|
125
|
-
|
126
|
-
const BIGNUM *ECDSA_SIG_get0_s(const ECDSA_SIG *sig) {
|
127
|
-
return sig->s;
|
128
|
-
}
|
129
|
-
|
130
|
-
void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **out_r,
|
131
|
-
const BIGNUM **out_s) {
|
132
|
-
if (out_r != NULL) {
|
133
|
-
*out_r = sig->r;
|
134
|
-
}
|
135
|
-
if (out_s != NULL) {
|
136
|
-
*out_s = sig->s;
|
137
|
-
}
|
138
|
-
}
|
139
|
-
|
140
|
-
int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s) {
|
141
|
-
if (r == NULL || s == NULL) {
|
142
|
-
return 0;
|
143
|
-
}
|
144
|
-
BN_free(sig->r);
|
145
|
-
BN_free(sig->s);
|
146
|
-
sig->r = r;
|
147
|
-
sig->s = s;
|
148
|
-
return 1;
|
149
|
-
}
|
150
|
-
|
151
|
-
int ecdsa_do_verify_no_self_test(const uint8_t *digest, size_t digest_len,
|
152
|
-
const ECDSA_SIG *sig, const EC_KEY *eckey) {
|
98
|
+
int ecdsa_verify_fixed_no_self_test(const uint8_t *digest, size_t digest_len,
|
99
|
+
const uint8_t *sig, size_t sig_len,
|
100
|
+
const EC_KEY *eckey) {
|
153
101
|
const EC_GROUP *group = EC_KEY_get0_group(eckey);
|
154
102
|
const EC_POINT *pub_key = EC_KEY_get0_public_key(eckey);
|
155
103
|
if (group == NULL || pub_key == NULL || sig == NULL) {
|
@@ -157,11 +105,13 @@ int ecdsa_do_verify_no_self_test(const uint8_t *digest, size_t digest_len,
|
|
157
105
|
return 0;
|
158
106
|
}
|
159
107
|
|
108
|
+
size_t scalar_len = BN_num_bytes(EC_GROUP_get0_order(group));
|
160
109
|
EC_SCALAR r, s, u1, u2, s_inv_mont, m;
|
161
|
-
if (
|
162
|
-
!
|
163
|
-
|
164
|
-
!
|
110
|
+
if (sig_len != 2 * scalar_len ||
|
111
|
+
!ec_scalar_from_bytes(group, &r, sig, scalar_len) ||
|
112
|
+
ec_scalar_is_zero(group, &r) ||
|
113
|
+
!ec_scalar_from_bytes(group, &s, sig + scalar_len, scalar_len) ||
|
114
|
+
ec_scalar_is_zero(group, &s)) {
|
165
115
|
OPENSSL_PUT_ERROR(ECDSA, ECDSA_R_BAD_SIGNATURE);
|
166
116
|
return 0;
|
167
117
|
}
|
@@ -195,24 +145,31 @@ int ecdsa_do_verify_no_self_test(const uint8_t *digest, size_t digest_len,
|
|
195
145
|
return 1;
|
196
146
|
}
|
197
147
|
|
198
|
-
int
|
199
|
-
|
148
|
+
int ecdsa_verify_fixed(const uint8_t *digest, size_t digest_len,
|
149
|
+
const uint8_t *sig, size_t sig_len, const EC_KEY *key) {
|
200
150
|
boringssl_ensure_ecc_self_test();
|
201
151
|
|
202
|
-
return
|
152
|
+
return ecdsa_verify_fixed_no_self_test(digest, digest_len, sig, sig_len, key);
|
203
153
|
}
|
204
154
|
|
205
|
-
static
|
206
|
-
|
207
|
-
|
155
|
+
static int ecdsa_sign_impl(const EC_GROUP *group, int *out_retry, uint8_t *sig,
|
156
|
+
size_t *out_sig_len, size_t max_sig_len,
|
157
|
+
const EC_SCALAR *priv_key, const EC_SCALAR *k,
|
158
|
+
const uint8_t *digest, size_t digest_len) {
|
208
159
|
*out_retry = 0;
|
209
160
|
|
210
161
|
// Check that the size of the group order is FIPS compliant (FIPS 186-4
|
211
162
|
// B.5.2).
|
212
163
|
const BIGNUM *order = EC_GROUP_get0_order(group);
|
213
164
|
if (BN_num_bits(order) < 160) {
|
214
|
-
OPENSSL_PUT_ERROR(
|
215
|
-
return
|
165
|
+
OPENSSL_PUT_ERROR(EC, EC_R_INVALID_GROUP_ORDER);
|
166
|
+
return 0;
|
167
|
+
}
|
168
|
+
|
169
|
+
size_t sig_len = 2 * BN_num_bytes(order);
|
170
|
+
if (sig_len > max_sig_len) {
|
171
|
+
OPENSSL_PUT_ERROR(EC, EC_R_BUFFER_TOO_SMALL);
|
172
|
+
return 0;
|
216
173
|
}
|
217
174
|
|
218
175
|
// Compute r, the x-coordinate of k * generator.
|
@@ -220,12 +177,12 @@ static ECDSA_SIG *ecdsa_sign_impl(const EC_GROUP *group, int *out_retry,
|
|
220
177
|
EC_SCALAR r;
|
221
178
|
if (!ec_point_mul_scalar_base(group, &tmp_point, k) ||
|
222
179
|
!ec_get_x_coordinate_as_scalar(group, &r, &tmp_point)) {
|
223
|
-
return
|
180
|
+
return 0;
|
224
181
|
}
|
225
182
|
|
226
183
|
if (constant_time_declassify_int(ec_scalar_is_zero(group, &r))) {
|
227
184
|
*out_retry = 1;
|
228
|
-
return
|
185
|
+
return 0;
|
229
186
|
}
|
230
187
|
|
231
188
|
// s = priv_key * r. Note if only one parameter is in the Montgomery domain,
|
@@ -252,71 +209,59 @@ static ECDSA_SIG *ecdsa_sign_impl(const EC_GROUP *group, int *out_retry,
|
|
252
209
|
ec_scalar_mul_montgomery(group, &s, &s, &tmp);
|
253
210
|
if (constant_time_declassify_int(ec_scalar_is_zero(group, &s))) {
|
254
211
|
*out_retry = 1;
|
255
|
-
return
|
212
|
+
return 0;
|
256
213
|
}
|
257
214
|
|
258
215
|
CONSTTIME_DECLASSIFY(r.words, sizeof(r.words));
|
259
216
|
CONSTTIME_DECLASSIFY(s.words, sizeof(r.words));
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
return ret;
|
217
|
+
size_t len;
|
218
|
+
ec_scalar_to_bytes(group, sig, &len, &r);
|
219
|
+
assert(len == sig_len / 2);
|
220
|
+
ec_scalar_to_bytes(group, sig + len, &len, &s);
|
221
|
+
assert(len == sig_len / 2);
|
222
|
+
*out_sig_len = sig_len;
|
223
|
+
return 1;
|
268
224
|
}
|
269
225
|
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
size_t nonce_len) {
|
226
|
+
int ecdsa_sign_fixed_with_nonce_for_known_answer_test(
|
227
|
+
const uint8_t *digest, size_t digest_len, uint8_t *sig, size_t *out_sig_len,
|
228
|
+
size_t max_sig_len, const EC_KEY *eckey, const uint8_t *nonce,
|
229
|
+
size_t nonce_len) {
|
275
230
|
if (eckey->ecdsa_meth && eckey->ecdsa_meth->sign) {
|
276
231
|
OPENSSL_PUT_ERROR(ECDSA, ECDSA_R_NOT_IMPLEMENTED);
|
277
|
-
return
|
232
|
+
return 0;
|
278
233
|
}
|
279
234
|
|
280
235
|
const EC_GROUP *group = EC_KEY_get0_group(eckey);
|
281
236
|
if (group == NULL || eckey->priv_key == NULL) {
|
282
237
|
OPENSSL_PUT_ERROR(ECDSA, ERR_R_PASSED_NULL_PARAMETER);
|
283
|
-
return
|
238
|
+
return 0;
|
284
239
|
}
|
285
240
|
const EC_SCALAR *priv_key = &eckey->priv_key->scalar;
|
286
241
|
|
287
242
|
EC_SCALAR k;
|
288
243
|
if (!ec_scalar_from_bytes(group, &k, nonce, nonce_len)) {
|
289
|
-
return
|
244
|
+
return 0;
|
290
245
|
}
|
291
246
|
int retry_ignored;
|
292
|
-
return ecdsa_sign_impl(group, &retry_ignored,
|
293
|
-
digest_len);
|
294
|
-
}
|
295
|
-
|
296
|
-
// This function is only exported for testing and is not called in production
|
297
|
-
// code.
|
298
|
-
ECDSA_SIG *ECDSA_sign_with_nonce_and_leak_private_key_for_testing(
|
299
|
-
const uint8_t *digest, size_t digest_len, const EC_KEY *eckey,
|
300
|
-
const uint8_t *nonce, size_t nonce_len) {
|
301
|
-
boringssl_ensure_ecc_self_test();
|
302
|
-
|
303
|
-
return ecdsa_sign_with_nonce_for_known_answer_test(digest, digest_len, eckey,
|
304
|
-
nonce, nonce_len);
|
247
|
+
return ecdsa_sign_impl(group, &retry_ignored, sig, out_sig_len, max_sig_len,
|
248
|
+
priv_key, &k, digest, digest_len);
|
305
249
|
}
|
306
250
|
|
307
|
-
|
308
|
-
|
251
|
+
int ecdsa_sign_fixed(const uint8_t *digest, size_t digest_len, uint8_t *sig,
|
252
|
+
size_t *out_sig_len, size_t max_sig_len,
|
253
|
+
const EC_KEY *eckey) {
|
309
254
|
boringssl_ensure_ecc_self_test();
|
310
255
|
|
311
256
|
if (eckey->ecdsa_meth && eckey->ecdsa_meth->sign) {
|
312
257
|
OPENSSL_PUT_ERROR(ECDSA, ECDSA_R_NOT_IMPLEMENTED);
|
313
|
-
return
|
258
|
+
return 0;
|
314
259
|
}
|
315
260
|
|
316
261
|
const EC_GROUP *group = EC_KEY_get0_group(eckey);
|
317
262
|
if (group == NULL || eckey->priv_key == NULL) {
|
318
263
|
OPENSSL_PUT_ERROR(ECDSA, ERR_R_PASSED_NULL_PARAMETER);
|
319
|
-
return
|
264
|
+
return 0;
|
320
265
|
}
|
321
266
|
const BIGNUM *order = EC_GROUP_get0_order(group);
|
322
267
|
const EC_SCALAR *priv_key = &eckey->priv_key->scalar;
|
@@ -340,12 +285,11 @@ ECDSA_SIG *ECDSA_do_sign(const uint8_t *digest, size_t digest_len,
|
|
340
285
|
// FIPS) because the probability of requiring even one retry is negligible,
|
341
286
|
// let alone 32.
|
342
287
|
static const int kMaxIterations = 32;
|
343
|
-
|
288
|
+
int ret = 0;
|
344
289
|
int iters = 0;
|
345
290
|
for (;;) {
|
346
291
|
EC_SCALAR k;
|
347
292
|
if (!ec_random_nonzero_scalar(group, &k, additional_data)) {
|
348
|
-
ret = NULL;
|
349
293
|
goto out;
|
350
294
|
}
|
351
295
|
|
@@ -354,8 +298,9 @@ ECDSA_SIG *ECDSA_do_sign(const uint8_t *digest, size_t digest_len,
|
|
354
298
|
CONSTTIME_SECRET(k.words, sizeof(k.words));
|
355
299
|
|
356
300
|
int retry;
|
357
|
-
ret = ecdsa_sign_impl(group, &retry,
|
358
|
-
|
301
|
+
ret = ecdsa_sign_impl(group, &retry, sig, out_sig_len, max_sig_len,
|
302
|
+
priv_key, &k, digest, digest_len);
|
303
|
+
if (ret || !retry) {
|
359
304
|
goto out;
|
360
305
|
}
|
361
306
|
|
@@ -17,25 +17,42 @@
|
|
17
17
|
|
18
18
|
#include <openssl/base.h>
|
19
19
|
|
20
|
+
#include "../ec/internal.h"
|
21
|
+
|
20
22
|
#if defined(__cplusplus)
|
21
23
|
extern "C" {
|
22
24
|
#endif
|
23
25
|
|
24
26
|
|
25
|
-
//
|
26
|
-
//
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
// ECDSA_MAX_FIXED_LEN is the maximum length of an ECDSA signature in the
|
28
|
+
// fixed-width, big-endian format from IEEE P1363.
|
29
|
+
#define ECDSA_MAX_FIXED_LEN (2 * EC_MAX_BYTES)
|
30
|
+
|
31
|
+
// ecdsa_sign_fixed behaves like |ECDSA_sign| but uses the fixed-width,
|
32
|
+
// big-endian format from IEEE P1363.
|
33
|
+
int ecdsa_sign_fixed(const uint8_t *digest, size_t digest_len, uint8_t *sig,
|
34
|
+
size_t *out_sig_len, size_t max_sig_len,
|
35
|
+
const EC_KEY *key);
|
36
|
+
|
37
|
+
// ecdsa_sign_fixed_with_nonce_for_known_answer_test behaves like
|
38
|
+
// |ecdsa_sign_fixed| but takes a caller-supplied nonce. This function is used
|
39
|
+
// as part of known-answer tests in the FIPS module.
|
40
|
+
int ecdsa_sign_fixed_with_nonce_for_known_answer_test(
|
41
|
+
const uint8_t *digest, size_t digest_len, uint8_t *sig, size_t *out_sig_len,
|
42
|
+
size_t max_sig_len, const EC_KEY *key, const uint8_t *nonce,
|
43
|
+
size_t nonce_len);
|
44
|
+
|
45
|
+
// ecdsa_verify_fixed behaves like |ECDSA_verify| but uses the fixed-width,
|
46
|
+
// big-endian format from IEEE P1363.
|
47
|
+
int ecdsa_verify_fixed(const uint8_t *digest, size_t digest_len,
|
48
|
+
const uint8_t *sig, size_t sig_len, const EC_KEY *key);
|
33
49
|
|
34
|
-
//
|
50
|
+
// ecdsa_verify_fixed_no_self_test behaves like ecdsa_verify_fixed, but doesn't
|
35
51
|
// try to run the self-test first. This is for use in the self tests themselves,
|
36
52
|
// to prevent an infinite loop.
|
37
|
-
int
|
38
|
-
|
53
|
+
int ecdsa_verify_fixed_no_self_test(const uint8_t *digest, size_t digest_len,
|
54
|
+
const uint8_t *sig, size_t sig_len,
|
55
|
+
const EC_KEY *key);
|
39
56
|
|
40
57
|
|
41
58
|
#if defined(__cplusplus)
|