grpc 1.84.0 → 1.85.0.pre1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Makefile +40 -27
- data/include/grpc/event_engine/memory_allocator.h +1 -0
- data/include/grpc/grpc.h +3 -0
- data/include/grpc/grpc_security_constants.h +2 -0
- data/include/grpc/impl/channel_arg_names.h +4 -0
- data/src/core/call/call_filters.h +10 -10
- data/src/core/{lib/security/authorization → call}/evaluate_args.cc +22 -1
- data/src/core/{lib/security/authorization → call}/evaluate_args.h +19 -5
- data/src/core/call/filter_fusion.h +15 -15
- data/src/core/call/interception_chain.h +3 -3
- data/src/core/call/metadata_batch.cc +1 -0
- data/src/core/call/metadata_batch.h +45 -33
- data/src/core/call/parsed_metadata.h +3 -3
- data/src/core/call/request_buffer.cc +6 -6
- data/src/core/call/request_buffer.h +1 -1
- data/src/core/channelz/channel_trace.cc +5 -5
- data/src/core/channelz/channel_trace.h +1 -1
- data/src/core/channelz/channelz.cc +9 -9
- data/src/core/channelz/channelz.h +12 -12
- data/src/core/channelz/channelz_registry.cc +10 -10
- data/src/core/channelz/ztrace_collector.h +5 -5
- data/src/core/client_channel/client_channel.cc +4 -4
- data/src/core/client_channel/client_channel_filter.cc +14 -14
- data/src/core/client_channel/global_subchannel_pool.cc +4 -4
- data/src/core/client_channel/subchannel.cc +24 -23
- data/src/core/client_channel/subchannel_stream_client.cc +5 -5
- data/src/core/credentials/call/external/aws_external_account_credentials.cc +7 -7
- data/src/core/credentials/call/external/aws_request_signer.cc +16 -0
- data/src/core/credentials/call/external/external_account_credentials.cc +4 -4
- data/src/core/credentials/call/regional_access_boundary_fetcher.cc +9 -9
- data/src/core/credentials/call/token_fetcher/token_fetcher_credentials.cc +4 -4
- data/src/core/credentials/transport/google_default/google_default_credentials.cc +3 -3
- data/src/core/credentials/transport/ssl/ssl_security_connector.cc +1 -1
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.cc +9 -9
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.h +1 -1
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.cc +6 -6
- data/src/core/credentials/transport/tls/grpc_tls_certificate_verifier.cc +3 -3
- data/src/core/credentials/transport/tls/grpc_tls_crl_provider.cc +4 -4
- data/src/core/credentials/transport/tls/ssl_utils.cc +10 -0
- data/src/core/credentials/transport/tls/tls_security_connector.cc +10 -10
- data/src/core/credentials/transport/tls/tls_security_connector.h +6 -6
- data/src/core/credentials/transport/tls/tls_utils.h +9 -0
- data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +1 -1
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +1 -1
- data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.cc +2 -2
- data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.h +1 -1
- data/src/core/ext/filters/http/message_compress/compression_filter.cc +15 -0
- data/src/core/ext/filters/rbac/rbac_filter.h +1 -1
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +5 -5
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +30 -21
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +5 -11
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +14 -11
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +1 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.h +0 -4
- data/src/core/ext/transport/chttp2/transport/frame.h +9 -0
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +12 -9
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +4 -2
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +16 -18
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +2 -1
- data/src/core/ext/transport/chttp2/transport/http2_server_transport.cc +277 -189
- data/src/core/ext/transport/chttp2/transport/http2_server_transport.h +40 -17
- data/src/core/ext/transport/chttp2/transport/http2_transport.cc +12 -24
- data/src/core/ext/transport/chttp2/transport/http2_transport.h +3 -29
- data/src/core/ext/transport/chttp2/transport/internal.h +2 -2
- data/src/core/ext/transport/chttp2/transport/parsing.cc +3 -2
- data/src/core/ext/transport/chttp2/transport/read_context.h +96 -3
- data/src/core/ext/transport/chttp2/transport/reclaimer.cc +32 -0
- data/src/core/ext/transport/chttp2/transport/reclaimer.h +64 -0
- data/src/core/ext/transport/chttp2/transport/security_frame.h +8 -8
- data/src/core/ext/transport/chttp2/transport/stream_data_queue.h +17 -9
- data/src/core/ext/transport/chttp2/transport/write_cycle.h +23 -3
- data/src/core/ext/transport/inproc/inproc_transport.cc +5 -5
- data/src/core/ext/upb-gen/grpc/channelz/v1/channelz.upb.h +137 -73
- data/src/core/ext/upb-gen/grpc/channelz/v1/channelz.upb_minitable.c +45 -25
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/gcp/altscontext.upb.h +6 -6
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/gcp/altscontext.upb_minitable.c +4 -4
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/gcp/altscontext.upb_minitable.h +5 -5
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/gcp/handshaker.upb.h +46 -26
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/gcp/handshaker.upb_minitable.c +17 -14
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/gcp/handshaker.upb_minitable.h +5 -5
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/gcp/transport_security_common.upb.h +5 -5
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/gcp/transport_security_common.upb_minitable.c +3 -3
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/gcp/transport_security_common.upb_minitable.h +5 -5
- data/src/core/ext/upb-gen/grpc/health/v1/health.upb.h +329 -0
- data/src/core/ext/upb-gen/grpc/health/v1/health.upb_minitable.c +128 -0
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/health/v1/health.upb_minitable.h +8 -5
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/lb/v1/load_balancer.upb.h +5 -5
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/lb/v1/load_balancer.upb_minitable.c +3 -3
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/lb/v1/load_balancer.upb_minitable.h +5 -5
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/lookup/v1/rls.upb.h +185 -23
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/lookup/v1/rls.upb_minitable.c +20 -12
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/lookup/v1/rls.upb_minitable.h +5 -5
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/lookup/v1/rls_config.upb.h +58 -42
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/lookup/v1/rls_config.upb_minitable.c +17 -12
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/lookup/v1/rls_config.upb_minitable.h +5 -5
- data/src/core/ext/upbdefs-gen/grpc/channelz/v1/channelz.upbdefs.c +567 -549
- data/src/core/ext/upbdefs-gen/grpc/lookup/v1/rls_config.upbdefs.c +182 -0
- data/src/core/ext/upbdefs-gen/{src/proto/grpc → grpc}/lookup/v1/rls_config.upbdefs.h +14 -14
- data/src/core/filter/ext_proc/ext_proc_filter.cc +1603 -46
- data/src/core/filter/ext_proc/ext_proc_filter.h +55 -22
- data/src/core/filter/ext_proc/ext_proc_messages.cc +106 -51
- data/src/core/filter/ext_proc/ext_proc_messages.h +36 -9
- data/src/core/handshaker/handshaker.cc +4 -4
- data/src/core/handshaker/http_connect/http_connect_client_handshaker.cc +3 -3
- data/src/core/handshaker/security/pipelined_secure_endpoint.cc +10 -10
- data/src/core/handshaker/security/secure_endpoint.cc +13 -13
- data/src/core/handshaker/security/security_handshaker.cc +6 -6
- data/src/core/handshaker/tcp_connect/tcp_connect_handshaker.cc +4 -4
- data/src/core/lib/channel/channel_args.cc +20 -0
- data/src/core/lib/channel/channel_args.h +17 -17
- data/src/core/lib/channel/promise_based_filter.cc +2 -2
- data/src/core/lib/channel/promise_based_filter.h +66 -27
- data/src/core/lib/debug/trace_flags.cc +2 -0
- data/src/core/lib/debug/trace_flags.h +1 -0
- data/src/core/lib/event_engine/ares_resolver.cc +14 -14
- data/src/core/lib/event_engine/cf_engine/cf_engine.cc +7 -7
- data/src/core/lib/event_engine/cf_engine/cfsocket_listener.cc +4 -4
- data/src/core/lib/event_engine/default_event_engine.cc +5 -5
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +9 -9
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +16 -14
- data/src/core/lib/event_engine/posix_engine/file_descriptor_collection.cc +6 -6
- data/src/core/lib/event_engine/posix_engine/grpc_polled_fd_posix.h +3 -3
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +1 -1
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +7 -7
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +17 -17
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +3 -3
- data/src/core/lib/event_engine/posix_engine/timer.cc +5 -5
- data/src/core/lib/event_engine/posix_engine/timer_manager.cc +5 -5
- data/src/core/lib/event_engine/posix_engine/traced_buffer_list.cc +3 -3
- data/src/core/lib/event_engine/posix_engine/traced_buffer_list.h +1 -1
- data/src/core/lib/event_engine/thread_pool/thread_count.cc +1 -1
- data/src/core/lib/event_engine/thread_pool/thread_count.h +3 -3
- data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +50 -21
- data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc +3 -3
- data/src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc +3 -3
- data/src/core/lib/event_engine/windows/windows_engine.cc +15 -15
- data/src/core/lib/event_engine/windows/windows_listener.cc +6 -6
- data/src/core/lib/event_engine/work_queue/basic_work_queue.cc +6 -6
- data/src/core/lib/experiments/experiments.cc +48 -0
- data/src/core/lib/experiments/experiments.h +24 -0
- data/src/core/lib/iomgr/buffer_list.cc +3 -3
- data/src/core/lib/iomgr/buffer_list.h +1 -1
- data/src/core/lib/iomgr/combiner.cc +0 -1
- data/src/core/lib/iomgr/ev_apple.cc +4 -4
- data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +2 -2
- data/src/core/lib/iomgr/tcp_client_posix.cc +3 -3
- data/src/core/lib/iomgr/tcp_posix.cc +7 -7
- data/src/core/lib/promise/activity.cc +1 -1
- data/src/core/lib/promise/activity.h +1 -1
- data/src/core/lib/promise/arena_promise.h +7 -7
- data/src/core/lib/promise/detail/promise_factory.h +8 -8
- data/src/core/lib/promise/detail/promise_like.h +4 -4
- data/src/core/lib/promise/inter_activity_latch.h +6 -6
- data/src/core/lib/promise/inter_activity_pipe.h +1 -1
- data/src/core/lib/promise/observable.h +3 -3
- data/src/core/lib/promise/party.cc +1 -1
- data/src/core/lib/promise/try_seq.h +2 -2
- data/src/core/lib/resource_quota/arena.h +3 -3
- data/src/core/lib/resource_quota/memory_quota.cc +16 -16
- data/src/core/lib/resource_quota/memory_quota.h +1 -1
- data/src/core/lib/resource_quota/thread_quota.cc +3 -3
- data/src/core/lib/security/authorization/audit_logging.cc +5 -5
- data/src/core/lib/security/authorization/authorization_engine.h +1 -1
- data/src/core/lib/security/authorization/grpc_authorization_engine.h +1 -1
- data/src/core/lib/security/authorization/grpc_server_authz_filter.cc +1 -1
- data/src/core/lib/security/authorization/grpc_server_authz_filter.h +1 -1
- data/src/core/lib/security/authorization/matchers.h +1 -1
- data/src/core/lib/surface/call.cc +8 -7
- data/src/core/lib/surface/call.h +3 -3
- data/src/core/lib/surface/call_utils.h +4 -0
- data/src/core/lib/surface/channel.cc +1 -1
- data/src/core/lib/surface/channel.h +1 -1
- data/src/core/lib/surface/channel_init.cc +1 -1
- data/src/core/lib/surface/init.cc +7 -7
- data/src/core/lib/surface/lame_client.cc +1 -1
- data/src/core/lib/surface/legacy_channel.cc +2 -2
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/transport_framing_endpoint_extension.h +3 -3
- data/src/core/load_balancing/autosharding/autosharding.cc +931 -0
- data/src/core/load_balancing/autosharding/autosharding.h +78 -0
- data/src/core/load_balancing/grpclb/grpclb_client_stats.cc +2 -2
- data/src/core/load_balancing/grpclb/load_balancer_api.cc +1 -1
- data/src/core/load_balancing/grpclb/load_balancer_api.h +3 -1
- data/src/core/load_balancing/health_check_client.cc +7 -7
- data/src/core/load_balancing/lb_policy.cc +1 -1
- data/src/core/load_balancing/oob_backend_metric.cc +5 -5
- data/src/core/load_balancing/outlier_detection/outlier_detection.cc +2 -2
- data/src/core/load_balancing/ring_hash/ring_hash.cc +109 -37
- data/src/core/load_balancing/rls/rls.cc +23 -17
- data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +10 -10
- data/src/core/load_balancing/xds/cds.cc +6 -5
- data/src/core/load_balancing/xds/xds_cluster_impl.cc +2 -2
- data/src/core/load_balancing/xds/xds_override_host.cc +10 -10
- data/src/core/mitigation_engine/mitigation_engine.h +28 -4
- data/src/core/plugin_registry/grpc_plugin_registry.cc +2 -0
- data/src/core/resolver/dns/dns_resolver.cc +7 -7
- data/src/core/resolver/fake/fake_resolver.cc +5 -5
- data/src/core/resolver/google_c2p/google_c2p_resolver.cc +38 -30
- data/src/core/server/server.cc +30 -30
- data/src/core/server/server.h +4 -3
- data/src/core/server/server_config_selector_filter.cc +3 -3
- data/src/core/server/xds_server_config_fetcher_legacy.cc +15 -15
- data/src/core/telemetry/default_tcp_tracer.cc +1 -1
- data/src/core/telemetry/instrument.cc +30 -16
- data/src/core/telemetry/instrument.h +3 -3
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +3 -3
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +4 -4
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +2 -2
- data/src/core/tsi/alts/handshaker/alts_tsi_utils.h +1 -1
- data/src/core/tsi/alts/handshaker/transport_security_common_api.h +1 -1
- data/src/core/tsi/ssl/key_logging/ssl_key_logging.cc +5 -5
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +3 -3
- data/src/core/tsi/ssl_transport_security.cc +46 -13
- data/src/core/tsi/ssl_transport_security.h +7 -0
- data/src/core/tsi/ssl_transport_security_utils.cc +16 -6
- data/src/core/util/event_log.cc +3 -3
- data/src/core/util/http_client/httpcli.cc +5 -5
- data/src/core/util/http_client/httpcli.h +1 -1
- data/src/core/util/json/json_object_loader.cc +7 -0
- data/src/core/util/json/json_object_loader.h +17 -2
- data/src/core/util/latent_see.cc +123 -36
- data/src/core/util/latent_see.h +14 -1
- data/src/core/util/mpscq.cc +1 -1
- data/src/core/util/notification.h +4 -4
- data/src/core/util/sync.h +20 -6
- data/src/core/util/table.h +20 -22
- data/src/core/util/work_serializer.cc +2 -2
- data/src/core/xds/grpc/blackboard.cc +4 -3
- data/src/core/xds/grpc/certificate_provider_store.cc +2 -2
- data/src/core/xds/grpc/streaming_call_promise_wrapper.cc +181 -0
- data/src/core/xds/grpc/streaming_call_promise_wrapper.h +213 -0
- data/src/core/xds/grpc/xds_bootstrap_grpc_builder.cc +2 -2
- data/src/core/xds/grpc/xds_client_grpc.cc +8 -8
- data/src/core/xds/grpc/xds_cluster_specifier_plugin.cc +2 -2
- data/src/core/xds/grpc/xds_endpoint.cc +1 -1
- data/src/core/xds/grpc/xds_endpoint_parser.cc +11 -0
- data/src/core/xds/grpc/xds_grpc_service_parser.cc +12 -10
- data/src/core/xds/grpc/xds_http_ext_proc_filter.cc +17 -14
- data/src/core/xds/grpc/xds_matcher.h +2 -2
- data/src/core/xds/grpc/xds_transport_grpc.cc +125 -85
- data/src/core/xds/grpc/xds_transport_grpc.h +19 -4
- data/src/core/xds/xds_client/lrs_client.cc +22 -19
- data/src/core/xds/xds_client/xds_client.cc +19 -16
- data/src/core/xds/xds_client/xds_transport.h +49 -3
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +3 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/README.md +1 -1
- data/src/ruby/pb/generate_proto_ruby.sh +1 -1
- data/third_party/abseil-cpp/absl/algorithm/algorithm.h +34 -2
- data/third_party/abseil-cpp/absl/algorithm/container.h +345 -147
- data/third_party/abseil-cpp/absl/base/attributes.h +67 -44
- data/third_party/abseil-cpp/absl/base/call_once.h +1 -0
- data/third_party/abseil-cpp/absl/base/casts.cc +61 -0
- data/third_party/abseil-cpp/absl/base/casts.h +135 -2
- data/third_party/abseil-cpp/absl/base/config.h +63 -41
- data/third_party/abseil-cpp/absl/base/fast_type_id.h +30 -2
- data/third_party/abseil-cpp/absl/base/internal/dynamic_annotations.h +1 -1
- data/third_party/abseil-cpp/absl/base/internal/hardening.h +136 -0
- data/third_party/abseil-cpp/absl/base/internal/iterator_traits.h +6 -2
- data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc +39 -4
- data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.h +6 -0
- data/third_party/abseil-cpp/absl/base/internal/low_level_scheduling.h +77 -15
- data/third_party/abseil-cpp/absl/base/internal/raw_logging.cc +3 -4
- data/third_party/abseil-cpp/absl/base/internal/spinlock.cc +26 -24
- data/third_party/abseil-cpp/absl/base/internal/spinlock.h +74 -29
- data/third_party/abseil-cpp/absl/base/internal/sysinfo.cc +1 -11
- data/third_party/abseil-cpp/absl/base/internal/thread_identity.h +52 -0
- data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc +5 -1
- data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h +5 -0
- data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h +1 -1
- data/third_party/abseil-cpp/absl/base/macros.h +76 -37
- data/third_party/abseil-cpp/absl/base/nullability.h +5 -5
- data/third_party/abseil-cpp/absl/base/optimization.h +4 -5
- data/third_party/abseil-cpp/absl/base/options.h +46 -18
- data/third_party/abseil-cpp/absl/base/policy_checks.h +5 -5
- data/third_party/abseil-cpp/absl/base/{internal/throw_delegate.cc → throw_delegate.cc} +9 -7
- data/third_party/abseil-cpp/absl/base/{internal/throw_delegate.h → throw_delegate.h} +4 -14
- data/third_party/abseil-cpp/absl/cleanup/cleanup.h +7 -2
- data/third_party/abseil-cpp/absl/cleanup/internal/cleanup.h +3 -2
- data/third_party/abseil-cpp/absl/container/btree_map.h +60 -10
- data/third_party/abseil-cpp/absl/container/btree_set.h +61 -15
- data/third_party/abseil-cpp/absl/container/fixed_array.h +19 -21
- data/third_party/abseil-cpp/absl/container/flat_hash_map.h +49 -27
- data/third_party/abseil-cpp/absl/container/flat_hash_set.h +50 -26
- data/third_party/abseil-cpp/absl/container/inlined_vector.h +42 -36
- data/third_party/abseil-cpp/absl/container/internal/btree.h +32 -24
- data/third_party/abseil-cpp/absl/container/internal/btree_container.h +30 -22
- data/third_party/abseil-cpp/absl/container/internal/common.h +57 -5
- data/third_party/abseil-cpp/absl/container/internal/common_policy_traits.h +1 -1
- data/third_party/abseil-cpp/absl/container/internal/compressed_tuple.h +40 -36
- data/third_party/abseil-cpp/absl/container/internal/container_memory.h +119 -39
- data/third_party/abseil-cpp/absl/container/internal/hash_function_defaults.h +14 -2
- data/third_party/abseil-cpp/absl/container/internal/hash_policy_traits.h +14 -22
- data/third_party/abseil-cpp/absl/container/internal/hashtable_control_bytes.h +52 -52
- data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +7 -7
- data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h +7 -7
- data/third_party/abseil-cpp/absl/container/internal/inlined_vector.h +32 -40
- data/third_party/abseil-cpp/absl/container/internal/layout.h +13 -13
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_map.h +95 -72
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc +633 -365
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h +1016 -749
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_set_resize_impl.h +0 -1
- data/third_party/abseil-cpp/absl/container/node_hash_map.h +58 -35
- data/third_party/abseil-cpp/absl/crc/internal/cpu_detect.cc +23 -6
- data/third_party/abseil-cpp/absl/crc/internal/cpu_detect.h +7 -1
- data/third_party/abseil-cpp/absl/crc/internal/crc.cc +4 -6
- data/third_party/abseil-cpp/absl/crc/internal/crc32_x86_arm_combined_simd.h +41 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc_internal.h +0 -16
- data/third_party/abseil-cpp/absl/crc/internal/crc_memcpy_x86_arm_combined.cc +5 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc_x86_arm_combined.cc +304 -188
- data/third_party/abseil-cpp/absl/crc/internal/non_temporal_arm_intrinsics.h +4 -2
- data/third_party/abseil-cpp/absl/debugging/internal/demangle.cc +2 -2
- data/third_party/abseil-cpp/absl/debugging/internal/demangle_rust.h +8 -0
- data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.h +4 -4
- data/third_party/abseil-cpp/absl/debugging/internal/examine_stack.cc +15 -1
- data/third_party/abseil-cpp/absl/debugging/internal/examine_stack.h +7 -1
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_aarch64-inl.inc +12 -1
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h +6 -5
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_emscripten-inl.inc +13 -11
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_generic-inl.inc +14 -7
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc +3 -2
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_riscv-inl.inc +6 -1
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc +14 -8
- data/third_party/abseil-cpp/absl/debugging/internal/symbolize.h +48 -38
- data/third_party/abseil-cpp/absl/debugging/internal/vdso_support.cc +4 -0
- data/third_party/abseil-cpp/absl/debugging/stacktrace.cc +63 -118
- data/third_party/abseil-cpp/absl/debugging/stacktrace.h +7 -47
- data/third_party/abseil-cpp/absl/debugging/symbolize.cc +20 -2
- data/third_party/abseil-cpp/absl/debugging/symbolize_elf.inc +83 -149
- data/third_party/abseil-cpp/absl/debugging/symbolize_emscripten.inc +4 -17
- data/third_party/abseil-cpp/absl/debugging/symbolize_unimplemented.inc +4 -4
- data/third_party/abseil-cpp/absl/debugging/symbolize_win32.inc +2 -4
- data/third_party/abseil-cpp/absl/flags/commandlineflag.h +8 -6
- data/third_party/abseil-cpp/absl/flags/declare.h +9 -0
- data/third_party/abseil-cpp/absl/flags/flag.h +2 -1
- data/third_party/abseil-cpp/absl/flags/internal/commandlineflag.h +1 -1
- data/third_party/abseil-cpp/absl/flags/internal/flag.cc +19 -18
- data/third_party/abseil-cpp/absl/flags/internal/flag.h +33 -34
- data/third_party/abseil-cpp/absl/flags/internal/program_name.cc +2 -2
- data/third_party/abseil-cpp/absl/flags/marshalling.cc +1 -16
- data/third_party/abseil-cpp/absl/flags/marshalling.h +2 -28
- data/third_party/abseil-cpp/absl/flags/reflection.cc +11 -7
- data/third_party/abseil-cpp/absl/flags/usage_config.cc +2 -2
- data/third_party/abseil-cpp/absl/functional/any_invocable.h +22 -19
- data/third_party/abseil-cpp/absl/functional/bind_front.h +7 -1
- data/third_party/abseil-cpp/absl/functional/function_ref.h +125 -20
- data/third_party/abseil-cpp/absl/functional/internal/any_invocable.h +43 -31
- data/third_party/abseil-cpp/absl/functional/internal/front_binder.h +4 -4
- data/third_party/abseil-cpp/absl/functional/internal/function_ref.h +44 -6
- data/third_party/abseil-cpp/absl/hash/hash.h +1 -1
- data/third_party/abseil-cpp/absl/hash/internal/city.cc +39 -51
- data/third_party/abseil-cpp/absl/hash/internal/hash.cc +379 -14
- data/third_party/abseil-cpp/absl/hash/internal/hash.h +457 -353
- data/third_party/abseil-cpp/absl/log/absl_vlog_is_on.h +0 -2
- data/third_party/abseil-cpp/absl/log/internal/check_impl.h +2 -1
- data/third_party/abseil-cpp/absl/log/internal/check_op.cc +4 -0
- data/third_party/abseil-cpp/absl/log/internal/check_op.h +128 -50
- data/third_party/abseil-cpp/absl/log/internal/conditions.h +38 -35
- data/third_party/abseil-cpp/absl/log/internal/log_impl.h +108 -110
- data/third_party/abseil-cpp/absl/log/internal/log_message.cc +10 -6
- data/third_party/abseil-cpp/absl/log/internal/log_message.h +19 -1
- data/third_party/abseil-cpp/absl/log/internal/log_sink_set.cc +4 -4
- data/third_party/abseil-cpp/absl/log/internal/nullstream.h +1 -1
- data/third_party/abseil-cpp/absl/log/internal/proto.cc +13 -0
- data/third_party/abseil-cpp/absl/log/internal/strip.h +30 -31
- data/third_party/abseil-cpp/absl/log/internal/structured_proto.cc +5 -5
- data/third_party/abseil-cpp/absl/log/internal/structured_proto.h +6 -5
- data/third_party/abseil-cpp/absl/log/internal/vlog_config.cc +30 -30
- data/third_party/abseil-cpp/absl/log/internal/vlog_config.h +0 -1
- data/third_party/abseil-cpp/absl/log/log.h +2 -2
- data/third_party/abseil-cpp/absl/log/log_entry.cc +263 -0
- data/third_party/abseil-cpp/absl/log/log_entry.h +2 -0
- data/third_party/abseil-cpp/absl/log/vlog_is_on.h +0 -2
- data/third_party/abseil-cpp/absl/memory/memory.h +55 -5
- data/third_party/abseil-cpp/absl/meta/type_traits.h +161 -56
- data/third_party/abseil-cpp/absl/numeric/int128.h +41 -21
- data/third_party/abseil-cpp/absl/numeric/int128_have_intrinsic.inc +16 -22
- data/third_party/abseil-cpp/absl/numeric/int128_no_intrinsic.inc +5 -7
- data/third_party/abseil-cpp/absl/numeric/internal/bits.h +32 -4
- data/third_party/abseil-cpp/absl/profiling/internal/sample_recorder.h +9 -9
- data/third_party/abseil-cpp/absl/random/beta_distribution.h +2 -2
- data/third_party/abseil-cpp/absl/random/bit_gen_ref.h +26 -53
- data/third_party/abseil-cpp/absl/random/discrete_distribution.h +1 -1
- data/third_party/abseil-cpp/absl/random/distributions.h +17 -17
- data/third_party/abseil-cpp/absl/random/exponential_distribution.h +1 -1
- data/third_party/abseil-cpp/absl/random/internal/distribution_caller.h +8 -21
- data/third_party/abseil-cpp/absl/random/internal/entropy_pool.cc +2 -2
- data/third_party/abseil-cpp/absl/random/internal/fast_uniform_bits.h +1 -1
- data/third_party/abseil-cpp/absl/random/internal/generate_real.h +1 -1
- data/third_party/abseil-cpp/absl/random/internal/iostream_state_saver.h +2 -2
- data/third_party/abseil-cpp/absl/random/internal/nonsecure_base.h +2 -2
- data/third_party/abseil-cpp/absl/random/internal/pcg_engine.h +6 -6
- data/third_party/abseil-cpp/absl/random/internal/platform.h +0 -13
- data/third_party/abseil-cpp/absl/random/internal/randen_detect.cc +6 -6
- data/third_party/abseil-cpp/absl/random/internal/randen_engine.h +2 -2
- data/third_party/abseil-cpp/absl/random/internal/salted_seed_seq.h +6 -5
- data/third_party/abseil-cpp/absl/random/internal/seed_material.cc +5 -31
- data/third_party/abseil-cpp/absl/random/internal/seed_material.h +2 -1
- data/third_party/abseil-cpp/absl/random/internal/traits.h +21 -0
- data/third_party/abseil-cpp/absl/random/internal/uniform_helper.h +23 -23
- data/third_party/abseil-cpp/absl/random/mocking_access.h +74 -0
- data/third_party/abseil-cpp/absl/random/uniform_real_distribution.h +1 -1
- data/third_party/abseil-cpp/absl/status/internal/status_internal.cc +63 -18
- data/third_party/abseil-cpp/absl/status/internal/status_internal.h +30 -4
- data/third_party/abseil-cpp/absl/status/internal/statusor_internal.h +225 -63
- data/third_party/abseil-cpp/absl/status/status.cc +66 -70
- data/third_party/abseil-cpp/absl/status/status.h +254 -23
- data/third_party/abseil-cpp/absl/status/status_payload_printer.h +3 -2
- data/third_party/abseil-cpp/absl/status/statusor.h +117 -137
- data/third_party/abseil-cpp/absl/strings/ascii.h +10 -6
- data/third_party/abseil-cpp/absl/strings/cord.cc +41 -17
- data/third_party/abseil-cpp/absl/strings/cord.h +26 -17
- data/third_party/abseil-cpp/absl/strings/cord_buffer.h +4 -2
- data/third_party/abseil-cpp/absl/strings/escaping.cc +305 -125
- data/third_party/abseil-cpp/absl/strings/escaping.h +12 -2
- data/third_party/abseil-cpp/absl/strings/internal/append_and_overwrite.h +93 -0
- data/third_party/abseil-cpp/absl/strings/internal/cord_internal.h +2 -2
- data/third_party/abseil-cpp/absl/strings/internal/cordz_handle.cc +6 -6
- data/third_party/abseil-cpp/absl/strings/internal/cordz_info.cc +27 -21
- data/third_party/abseil-cpp/absl/strings/internal/cordz_info.h +11 -19
- data/third_party/abseil-cpp/absl/strings/internal/damerau_levenshtein_distance.cc +6 -0
- data/third_party/abseil-cpp/absl/strings/internal/damerau_levenshtein_distance.h +1 -0
- data/third_party/abseil-cpp/absl/strings/internal/escaping.cc +0 -141
- data/third_party/abseil-cpp/absl/strings/internal/escaping.h +2 -24
- data/third_party/abseil-cpp/absl/strings/internal/resize_uninitialized.h +31 -36
- data/third_party/abseil-cpp/absl/strings/internal/stl_type_traits.h +39 -39
- data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h +14 -22
- data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.h +2 -2
- data/third_party/abseil-cpp/absl/strings/internal/str_format/checker.h +2 -4
- data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc +921 -231
- data/third_party/abseil-cpp/absl/strings/internal/str_join_internal.h +18 -16
- data/third_party/abseil-cpp/absl/strings/internal/str_split_internal.h +16 -12
- data/third_party/abseil-cpp/absl/strings/internal/stringify_sink.h +12 -0
- data/third_party/abseil-cpp/absl/strings/numbers.cc +477 -8
- data/third_party/abseil-cpp/absl/strings/numbers.h +29 -12
- data/third_party/abseil-cpp/absl/strings/resize_and_overwrite.h +198 -0
- data/third_party/abseil-cpp/absl/strings/str_cat.cc +96 -91
- data/third_party/abseil-cpp/absl/strings/str_cat.h +53 -13
- data/third_party/abseil-cpp/absl/strings/str_split.h +14 -9
- data/third_party/abseil-cpp/absl/strings/string_view.h +10 -716
- data/third_party/abseil-cpp/absl/strings/substitute.cc +24 -24
- data/third_party/abseil-cpp/absl/strings/substitute.h +2 -2
- data/third_party/abseil-cpp/absl/synchronization/barrier.cc +1 -1
- data/third_party/abseil-cpp/absl/synchronization/blocking_counter.cc +2 -2
- data/third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.cc +24 -3
- data/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc +30 -33
- data/third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h +2 -2
- data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.h +5 -0
- data/third_party/abseil-cpp/absl/synchronization/mutex.cc +41 -29
- data/third_party/abseil-cpp/absl/synchronization/mutex.h +199 -94
- data/third_party/abseil-cpp/absl/synchronization/notification.cc +5 -5
- data/third_party/abseil-cpp/absl/synchronization/notification.h +1 -1
- data/third_party/abseil-cpp/absl/time/clock.cc +29 -30
- data/third_party/abseil-cpp/absl/time/clock.h +3 -0
- data/third_party/abseil-cpp/absl/time/duration.cc +2 -2
- data/third_party/abseil-cpp/absl/time/format.cc +3 -10
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h +12 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc +131 -91
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc +6 -103
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_name_win.cc +185 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_name_win.h +37 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h +10 -15
- data/third_party/abseil-cpp/absl/time/time.cc +4 -4
- data/third_party/abseil-cpp/absl/time/time.h +14 -13
- data/third_party/abseil-cpp/absl/types/compare.h +64 -63
- data/third_party/abseil-cpp/absl/types/internal/span.h +6 -6
- data/third_party/abseil-cpp/absl/types/optional.h +31 -4
- data/third_party/abseil-cpp/absl/types/optional_ref.h +295 -0
- data/third_party/{boringssl-with-bazel/crypto/x509/x_val.cc → abseil-cpp/absl/types/source_location.cc} +4 -14
- data/third_party/abseil-cpp/absl/types/source_location.h +172 -0
- data/third_party/abseil-cpp/absl/types/span.h +67 -38
- data/third_party/abseil-cpp/absl/types/variant.h +75 -18
- data/third_party/abseil-cpp/absl/utility/utility.h +112 -16
- data/third_party/boringssl-with-bazel/crypto/aes/aes.cc +3 -0
- data/third_party/boringssl-with-bazel/crypto/armv8_feature_parsing.h +67 -0
- data/third_party/boringssl-with-bazel/crypto/asn1/a_bitstr.cc +143 -105
- data/third_party/boringssl-with-bazel/crypto/asn1/a_bool.cc +5 -8
- data/third_party/boringssl-with-bazel/crypto/asn1/a_d2i_fp.cc +3 -3
- data/third_party/boringssl-with-bazel/crypto/asn1/a_dup.cc +6 -6
- data/third_party/boringssl-with-bazel/crypto/asn1/a_gentm.cc +33 -12
- data/third_party/boringssl-with-bazel/crypto/asn1/a_i2d_fp.cc +7 -6
- data/third_party/boringssl-with-bazel/crypto/asn1/a_int.cc +80 -52
- data/third_party/boringssl-with-bazel/crypto/asn1/a_mbstr.cc +7 -4
- data/third_party/boringssl-with-bazel/crypto/asn1/a_object.cc +70 -72
- data/third_party/boringssl-with-bazel/crypto/asn1/a_strex.cc +38 -42
- data/third_party/boringssl-with-bazel/crypto/asn1/a_strnid.cc +41 -39
- data/third_party/boringssl-with-bazel/crypto/asn1/a_time.cc +59 -35
- data/third_party/boringssl-with-bazel/crypto/asn1/a_type.cc +275 -15
- data/third_party/boringssl-with-bazel/crypto/asn1/a_utctm.cc +32 -13
- data/third_party/boringssl-with-bazel/crypto/asn1/asn1_lib.cc +128 -30
- data/third_party/boringssl-with-bazel/crypto/asn1/asn_pack.cc +10 -10
- data/third_party/boringssl-with-bazel/crypto/asn1/f_int.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/asn1/f_string.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/asn1/internal.h +261 -115
- data/third_party/boringssl-with-bazel/crypto/asn1/posix_time.cc +8 -5
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_dec.cc +373 -725
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_enc.cc +211 -526
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_fre.cc +22 -19
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_new.cc +26 -24
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_typ.cc +19 -5
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_utl.cc +47 -51
- data/third_party/boringssl-with-bazel/crypto/base64/base64.cc +14 -15
- data/third_party/boringssl-with-bazel/crypto/bcm_support.h +7 -29
- data/third_party/boringssl-with-bazel/crypto/bio/bio.cc +234 -176
- data/third_party/boringssl-with-bazel/crypto/bio/bio_mem.cc +72 -86
- data/third_party/boringssl-with-bazel/crypto/bio/connect.cc +153 -199
- data/third_party/boringssl-with-bazel/crypto/bio/errno.cc +3 -1
- data/third_party/boringssl-with-bazel/crypto/bio/fd.cc +56 -55
- data/third_party/boringssl-with-bazel/crypto/bio/file.cc +70 -78
- data/third_party/boringssl-with-bazel/crypto/bio/hexdump.cc +6 -4
- data/third_party/boringssl-with-bazel/crypto/bio/internal.h +69 -17
- data/third_party/boringssl-with-bazel/crypto/bio/pair.cc +117 -136
- data/third_party/boringssl-with-bazel/crypto/bio/printf.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/bio/socket.cc +116 -50
- data/third_party/boringssl-with-bazel/crypto/bio/socket_helper.cc +53 -5
- data/third_party/boringssl-with-bazel/crypto/blake2/blake2.cc +9 -5
- data/third_party/boringssl-with-bazel/crypto/bn/bn_asn1.cc +2 -2
- data/third_party/boringssl-with-bazel/crypto/bn/convert.cc +56 -70
- data/third_party/boringssl-with-bazel/crypto/bn/div.cc +102 -0
- data/third_party/boringssl-with-bazel/crypto/bn/exponentiation.cc +26 -42
- data/third_party/boringssl-with-bazel/crypto/bn/sqrt.cc +93 -0
- data/third_party/boringssl-with-bazel/crypto/buf/buf.cc +6 -5
- data/third_party/boringssl-with-bazel/crypto/bytestring/asn1_compat.cc +6 -5
- data/third_party/boringssl-with-bazel/crypto/bytestring/ber.cc +22 -20
- data/third_party/boringssl-with-bazel/crypto/bytestring/cbb.cc +119 -59
- data/third_party/boringssl-with-bazel/crypto/bytestring/cbs.cc +115 -31
- data/third_party/boringssl-with-bazel/crypto/bytestring/internal.h +79 -24
- data/third_party/boringssl-with-bazel/crypto/bytestring/unicode.cc +2 -2
- data/third_party/boringssl-with-bazel/crypto/chacha/chacha.cc +5 -3
- data/third_party/boringssl-with-bazel/crypto/chacha/internal.h +23 -22
- data/third_party/boringssl-with-bazel/crypto/cipher/derive_key.cc +14 -18
- data/third_party/boringssl-with-bazel/crypto/cipher/e_aesctrhmac.cc +73 -58
- data/third_party/boringssl-with-bazel/crypto/cipher/e_aeseax.cc +132 -70
- data/third_party/boringssl-with-bazel/crypto/cipher/e_aesgcmsiv.cc +390 -249
- data/third_party/boringssl-with-bazel/crypto/cipher/e_chacha20poly1305.cc +200 -137
- data/third_party/boringssl-with-bazel/crypto/cipher/e_des.cc +45 -29
- data/third_party/boringssl-with-bazel/crypto/cipher/e_null.cc +9 -5
- data/third_party/boringssl-with-bazel/crypto/cipher/e_rc2.cc +43 -28
- data/third_party/boringssl-with-bazel/crypto/cipher/e_rc4.cc +7 -5
- data/third_party/boringssl-with-bazel/crypto/cipher/e_tls.cc +250 -237
- data/third_party/boringssl-with-bazel/crypto/cipher/get_cipher.cc +12 -12
- data/third_party/boringssl-with-bazel/crypto/cipher/internal.h +59 -59
- data/third_party/boringssl-with-bazel/crypto/cipher/tls_cbc.cc +111 -111
- data/third_party/boringssl-with-bazel/crypto/cms/cms.cc +48 -42
- data/third_party/boringssl-with-bazel/crypto/conf/conf.cc +69 -63
- data/third_party/boringssl-with-bazel/crypto/conf/internal.h +11 -12
- data/third_party/boringssl-with-bazel/crypto/cpu_aarch64_apple.cc +8 -5
- data/third_party/boringssl-with-bazel/crypto/cpu_aarch64_fuchsia.cc +6 -1
- data/third_party/boringssl-with-bazel/crypto/cpu_aarch64_linux.cc +7 -1
- data/third_party/boringssl-with-bazel/crypto/cpu_aarch64_openbsd.cc +7 -21
- data/third_party/boringssl-with-bazel/crypto/cpu_aarch64_sysreg.cc +15 -41
- data/third_party/boringssl-with-bazel/crypto/cpu_aarch64_win.cc +16 -3
- data/third_party/boringssl-with-bazel/crypto/cpu_arm_freebsd.cc +4 -2
- data/third_party/boringssl-with-bazel/crypto/cpu_arm_linux.cc +54 -31
- data/third_party/boringssl-with-bazel/crypto/cpu_arm_linux.h +79 -101
- data/third_party/boringssl-with-bazel/crypto/cpu_intel.cc +51 -45
- data/third_party/boringssl-with-bazel/crypto/crypto.cc +26 -55
- data/third_party/boringssl-with-bazel/crypto/curve25519/curve25519.cc +28 -25
- data/third_party/boringssl-with-bazel/crypto/curve25519/curve25519_tables.h +6 -6
- data/third_party/boringssl-with-bazel/crypto/curve25519/internal.h +14 -15
- data/third_party/boringssl-with-bazel/crypto/curve25519/spake25519.cc +23 -20
- data/third_party/boringssl-with-bazel/crypto/des/des.cc +27 -19
- data/third_party/boringssl-with-bazel/crypto/des/internal.h +4 -9
- data/third_party/boringssl-with-bazel/crypto/dh/dh_asn1.cc +34 -49
- data/third_party/boringssl-with-bazel/crypto/dh/params.cc +44 -41
- data/third_party/boringssl-with-bazel/crypto/digest/digest_extra.cc +87 -40
- data/third_party/boringssl-with-bazel/crypto/dsa/dsa.cc +237 -260
- data/third_party/boringssl-with-bazel/crypto/dsa/dsa_asn1.cc +100 -173
- data/third_party/boringssl-with-bazel/crypto/dsa/internal.h +23 -21
- data/third_party/boringssl-with-bazel/crypto/ec/ec_asn1.cc +181 -209
- data/third_party/boringssl-with-bazel/crypto/ec/ec_derive.cc +26 -28
- data/third_party/boringssl-with-bazel/crypto/ec/hash_to_curve.cc +265 -174
- data/third_party/boringssl-with-bazel/crypto/ec/internal.h +54 -18
- data/third_party/boringssl-with-bazel/crypto/ecdh/ecdh.cc +7 -5
- data/third_party/boringssl-with-bazel/crypto/ecdsa/ecdsa_asn1.cc +50 -70
- data/third_party/boringssl-with-bazel/crypto/ecdsa/ecdsa_p1363.cc +54 -0
- data/third_party/boringssl-with-bazel/crypto/engine/engine.cc +7 -7
- data/third_party/boringssl-with-bazel/crypto/err/err.cc +116 -105
- data/third_party/boringssl-with-bazel/crypto/err/internal.h +8 -21
- data/third_party/boringssl-with-bazel/crypto/evp/evp.cc +238 -166
- data/third_party/boringssl-with-bazel/crypto/evp/evp_asn1.cc +202 -234
- data/third_party/boringssl-with-bazel/crypto/evp/evp_ctx.cc +260 -159
- data/third_party/boringssl-with-bazel/crypto/evp/evp_kem.cc +82 -0
- data/third_party/boringssl-with-bazel/crypto/evp/internal.h +292 -137
- data/third_party/boringssl-with-bazel/crypto/evp/p_dh.cc +198 -25
- data/third_party/boringssl-with-bazel/crypto/evp/p_dsa.cc +333 -0
- data/third_party/boringssl-with-bazel/crypto/evp/p_ec.cc +427 -42
- data/third_party/boringssl-with-bazel/crypto/evp/p_ed25519.cc +270 -14
- data/third_party/boringssl-with-bazel/crypto/evp/p_hkdf.cc +70 -102
- data/third_party/boringssl-with-bazel/crypto/evp/p_mldsa.cc +549 -0
- data/third_party/boringssl-with-bazel/crypto/evp/p_mlkem.cc +485 -0
- data/third_party/boringssl-with-bazel/crypto/evp/p_rsa.cc +666 -158
- data/third_party/boringssl-with-bazel/crypto/evp/p_x25519.cc +290 -28
- data/third_party/boringssl-with-bazel/crypto/evp/p_xwing.cc +273 -0
- data/third_party/boringssl-with-bazel/crypto/evp/pbkdf.cc +14 -7
- data/third_party/boringssl-with-bazel/crypto/evp/print.cc +34 -89
- data/third_party/boringssl-with-bazel/crypto/evp/scrypt.cc +23 -21
- data/third_party/boringssl-with-bazel/crypto/evp/sign.cc +23 -42
- data/third_party/boringssl-with-bazel/crypto/ex_data.cc +40 -41
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/aes.cc.inc +34 -28
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/aes_nohw.cc.inc +119 -121
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/cbc.cc.inc +16 -14
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/cfb.cc.inc +12 -10
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/ctr.cc.inc +7 -5
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/gcm.cc.inc +39 -29
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/gcm_nohw.cc.inc +15 -13
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/internal.h +193 -177
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/key_wrap.cc.inc +5 -3
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/mode_wrappers.cc.inc +7 -3
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/ofb.cc.inc +7 -5
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bcm.cc +24 -19
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bcm_interface.h +512 -384
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/add.cc.inc +7 -5
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/asm/x86_64-gcc.cc.inc +63 -44
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/bn.cc.inc +40 -37
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/bytes.cc.inc +27 -22
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/cmp.cc.inc +9 -7
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/ctx.cc.inc +62 -126
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/div.cc.inc +92 -167
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/div_extra.cc.inc +15 -12
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/exponentiation.cc.inc +96 -93
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/gcd.cc.inc +73 -92
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/gcd_extra.cc.inc +59 -71
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/generic.cc.inc +54 -57
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/internal.h +333 -255
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/jacobi.cc.inc +12 -19
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/montgomery.cc.inc +80 -95
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/montgomery_inv.cc.inc +53 -96
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/mul.cc.inc +58 -419
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/prime.cc.inc +164 -213
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/random.cc.inc +27 -26
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/rsaz_exp.cc.inc +12 -10
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/rsaz_exp.h +47 -49
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/shift.cc.inc +14 -17
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/sqrt.cc.inc +19 -108
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/cipher/aead.cc.inc +427 -105
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/cipher/cipher.cc.inc +412 -212
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/cipher/e_aes.cc.inc +230 -225
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/cipher/e_aesccm.cc.inc +115 -84
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/cipher/internal.h +374 -27
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/cmac/cmac.cc.inc +28 -23
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/delocate.h +36 -40
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/dh/check.cc.inc +68 -78
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/dh/dh.cc.inc +154 -196
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/dh/internal.h +24 -24
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/digest/digest.cc.inc +40 -69
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/digest/digests.cc.inc +13 -7
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/digest/internal.h +13 -11
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/digest/md32_common.h +86 -81
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/digestsign/digestsign.cc.inc +38 -34
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/ec.cc.inc +187 -196
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/ec_key.cc.inc +196 -154
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/ec_montgomery.cc.inc +65 -125
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/felem.cc.inc +85 -22
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/internal.h +281 -287
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/oct.cc.inc +23 -22
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p256.cc.inc +514 -573
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p256_internal.h +193 -0
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/scalar.cc.inc +44 -39
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/simple.cc.inc +58 -90
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/simple_mul.cc.inc +39 -34
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/util.cc.inc +6 -3
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/wnaf.cc.inc +23 -20
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ecdh/ecdh.cc.inc +6 -3
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ecdsa/ecdsa.cc.inc +47 -37
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ecdsa/internal.h +5 -10
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/entropy/internal.h +38 -0
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/entropy/jitter.cc.inc +463 -0
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/entropy/sha512.cc.inc +329 -0
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/hkdf/hkdf.cc.inc +8 -6
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/hmac/hmac.cc.inc +19 -16
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/keccak/internal.h +41 -15
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/keccak/keccak.cc.inc +172 -44
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/mldsa/fips_known_values.inc +5 -5
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/mldsa/mldsa.cc.inc +1632 -766
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/mlkem/fips_known_values.inc +5 -5
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/mlkem/mlkem.cc.inc +740 -436
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/rand/android_entropy_client.cc.inc +82 -0
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/rand/ctrdrbg.cc.inc +240 -53
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/rand/internal.h +41 -26
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/rand/rand.cc.inc +221 -218
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/rsa/internal.h +64 -67
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/rsa/padding.cc.inc +49 -57
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/rsa/rsa.cc.inc +247 -234
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/rsa/rsa_impl.cc.inc +392 -692
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/self_check/fips.cc.inc +10 -10
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/self_check/self_check.cc.inc +479 -449
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/service_indicator/internal.h +34 -11
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/service_indicator/service_indicator.cc.inc +46 -43
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/sha/internal.h +61 -70
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/sha/sha1.cc.inc +27 -13
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/sha/sha256.cc.inc +46 -30
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/sha/sha512.cc.inc +47 -47
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/slhdsa/address.h +98 -73
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/slhdsa/fors.cc.inc +108 -98
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/slhdsa/fors.h +14 -24
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/slhdsa/merkle.cc.inc +94 -91
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/slhdsa/merkle.h +19 -31
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/slhdsa/params.h +156 -56
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/slhdsa/slhdsa.cc.inc +318 -132
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/slhdsa/thash.cc.inc +234 -81
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/slhdsa/thash.h +20 -34
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/slhdsa/wots.cc.inc +97 -96
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/slhdsa/wots.h +10 -20
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/tls/internal.h +2 -16
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/tls/kdf.cc.inc +26 -26
- data/third_party/boringssl-with-bazel/crypto/fuzzer_mode.cc +5 -5
- data/third_party/boringssl-with-bazel/crypto/hpke/hpke.cc +461 -97
- data/third_party/boringssl-with-bazel/crypto/hrss/hrss.cc +153 -149
- data/third_party/boringssl-with-bazel/crypto/hrss/internal.h +9 -13
- data/third_party/boringssl-with-bazel/crypto/internal.h +531 -394
- data/third_party/boringssl-with-bazel/crypto/kyber/internal.h +117 -12
- data/third_party/boringssl-with-bazel/crypto/kyber/kyber.cc +59 -58
- data/third_party/boringssl-with-bazel/crypto/lhash/internal.h +38 -37
- data/third_party/boringssl-with-bazel/crypto/lhash/lhash.cc +68 -65
- data/third_party/boringssl-with-bazel/crypto/md4/md4.cc +19 -6
- data/third_party/boringssl-with-bazel/crypto/md5/internal.h +6 -9
- data/third_party/boringssl-with-bazel/crypto/md5/md5.cc +18 -6
- data/third_party/boringssl-with-bazel/crypto/mem.cc +61 -65
- data/third_party/boringssl-with-bazel/crypto/mem_internal.h +671 -0
- data/third_party/boringssl-with-bazel/crypto/mldsa/mldsa.cc +238 -32
- data/third_party/boringssl-with-bazel/crypto/mlkem/mlkem.cc +21 -65
- data/third_party/boringssl-with-bazel/crypto/obj/obj.cc +132 -157
- data/third_party/boringssl-with-bazel/crypto/obj/obj_dat.h +79 -1
- data/third_party/boringssl-with-bazel/crypto/obj/obj_xref.cc +14 -11
- data/third_party/boringssl-with-bazel/crypto/params_internal.h +30 -0
- data/third_party/boringssl-with-bazel/crypto/pem/internal.h +20 -15
- data/third_party/boringssl-with-bazel/crypto/pem/pem_all.cc +20 -19
- data/third_party/boringssl-with-bazel/crypto/pem/pem_info.cc +72 -76
- data/third_party/boringssl-with-bazel/crypto/pem/pem_lib.cc +215 -217
- data/third_party/boringssl-with-bazel/crypto/pem/pem_oth.cc +6 -6
- data/third_party/boringssl-with-bazel/crypto/pem/pem_pk8.cc +13 -13
- data/third_party/boringssl-with-bazel/crypto/pem/pem_pkey.cc +11 -11
- data/third_party/boringssl-with-bazel/crypto/pkcs7/internal.h +12 -17
- data/third_party/boringssl-with-bazel/crypto/pkcs7/pkcs7.cc +29 -27
- data/third_party/boringssl-with-bazel/crypto/pkcs7/pkcs7_x509.cc +55 -49
- data/third_party/boringssl-with-bazel/crypto/pkcs8/internal.h +21 -26
- data/third_party/boringssl-with-bazel/crypto/pkcs8/p5_pbev2.cc +33 -31
- data/third_party/boringssl-with-bazel/crypto/pkcs8/pkcs8.cc +73 -81
- data/third_party/boringssl-with-bazel/crypto/pkcs8/pkcs8_x509.cc +139 -138
- data/third_party/boringssl-with-bazel/crypto/poly1305/internal.h +3 -7
- data/third_party/boringssl-with-bazel/crypto/poly1305/poly1305.cc +5 -4
- data/third_party/boringssl-with-bazel/crypto/poly1305/poly1305_arm.cc +43 -47
- data/third_party/boringssl-with-bazel/crypto/poly1305/poly1305_vec.cc +29 -26
- data/third_party/boringssl-with-bazel/crypto/pool/internal.h +64 -20
- data/third_party/boringssl-with-bazel/crypto/pool/pool.cc +177 -157
- data/third_party/boringssl-with-bazel/crypto/rand/deterministic.cc +9 -16
- data/third_party/boringssl-with-bazel/crypto/rand/fork_detect.cc +70 -42
- data/third_party/boringssl-with-bazel/crypto/rand/forkunsafe.cc +7 -7
- data/third_party/boringssl-with-bazel/crypto/rand/getentropy.cc +6 -13
- data/third_party/boringssl-with-bazel/crypto/rand/internal.h +16 -4
- data/third_party/boringssl-with-bazel/crypto/rand/ios.cc +4 -11
- data/third_party/boringssl-with-bazel/crypto/rand/rand.cc +11 -9
- data/third_party/boringssl-with-bazel/crypto/rand/trusty.cc +4 -11
- data/third_party/boringssl-with-bazel/crypto/rand/urandom.cc +16 -195
- data/third_party/boringssl-with-bazel/crypto/rand/windows.cc +12 -19
- data/third_party/boringssl-with-bazel/crypto/refcount.cc +7 -17
- data/third_party/boringssl-with-bazel/crypto/rsa/internal.h +22 -7
- data/third_party/boringssl-with-bazel/crypto/rsa/rsa_asn1.cc +199 -78
- data/third_party/boringssl-with-bazel/crypto/rsa/rsa_crypt.cc +49 -50
- data/third_party/boringssl-with-bazel/crypto/rsa/rsa_extra.cc +11 -0
- data/third_party/boringssl-with-bazel/crypto/rsa/rsa_print.cc +4 -6
- data/third_party/boringssl-with-bazel/crypto/sha/sha1.cc +3 -0
- data/third_party/boringssl-with-bazel/crypto/sha/sha256.cc +3 -1
- data/third_party/boringssl-with-bazel/crypto/sha/sha512.cc +6 -4
- data/third_party/boringssl-with-bazel/crypto/siphash/siphash.cc +2 -0
- data/third_party/boringssl-with-bazel/crypto/slhdsa/slhdsa.cc +43 -6
- data/third_party/boringssl-with-bazel/crypto/spake2plus/internal.h +31 -31
- data/third_party/boringssl-with-bazel/crypto/spake2plus/spake2plus.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/stack/stack.cc +89 -130
- data/third_party/boringssl-with-bazel/crypto/thread.cc +14 -14
- data/third_party/boringssl-with-bazel/crypto/thread_none.cc +10 -13
- data/third_party/boringssl-with-bazel/crypto/thread_pthread.cc +22 -35
- data/third_party/boringssl-with-bazel/crypto/thread_win.cc +29 -40
- data/third_party/boringssl-with-bazel/crypto/trust_token/internal.h +81 -88
- data/third_party/boringssl-with-bazel/crypto/trust_token/pmbtoken.cc +160 -144
- data/third_party/boringssl-with-bazel/crypto/trust_token/trust_token.cc +96 -80
- data/third_party/boringssl-with-bazel/crypto/trust_token/voprf.cc +90 -87
- data/third_party/boringssl-with-bazel/crypto/x509/a_digest.cc +5 -5
- data/third_party/boringssl-with-bazel/crypto/x509/a_sign.cc +51 -48
- data/third_party/boringssl-with-bazel/crypto/x509/a_verify.cc +30 -34
- data/third_party/boringssl-with-bazel/crypto/x509/algorithm.cc +47 -16
- data/third_party/boringssl-with-bazel/crypto/x509/asn1_gen.cc +41 -43
- data/third_party/boringssl-with-bazel/crypto/x509/by_dir.cc +183 -237
- data/third_party/boringssl-with-bazel/crypto/x509/by_file.cc +29 -30
- data/third_party/boringssl-with-bazel/crypto/x509/internal.h +276 -180
- data/third_party/boringssl-with-bazel/crypto/x509/name_print.cc +15 -13
- data/third_party/boringssl-with-bazel/crypto/x509/policy.cc +415 -525
- data/third_party/boringssl-with-bazel/crypto/x509/rsa_pss.cc +94 -271
- data/third_party/boringssl-with-bazel/crypto/x509/t_crl.cc +11 -8
- data/third_party/boringssl-with-bazel/crypto/x509/t_req.cc +26 -23
- data/third_party/boringssl-with-bazel/crypto/x509/t_x509.cc +26 -22
- data/third_party/boringssl-with-bazel/crypto/x509/t_x509a.cc +3 -1
- data/third_party/boringssl-with-bazel/crypto/x509/v3_akey.cc +69 -76
- data/third_party/boringssl-with-bazel/crypto/x509/v3_akeya.cc +2 -2
- data/third_party/boringssl-with-bazel/crypto/x509/v3_alt.cc +112 -69
- data/third_party/boringssl-with-bazel/crypto/x509/v3_bcons.cc +15 -14
- data/third_party/boringssl-with-bazel/crypto/x509/v3_bitst.cc +16 -18
- data/third_party/boringssl-with-bazel/crypto/x509/v3_conf.cc +62 -67
- data/third_party/boringssl-with-bazel/crypto/x509/v3_cpols.cc +143 -170
- data/third_party/boringssl-with-bazel/crypto/x509/v3_crld.cc +121 -165
- data/third_party/boringssl-with-bazel/crypto/x509/v3_enum.cc +13 -12
- data/third_party/boringssl-with-bazel/crypto/x509/v3_extku.cc +17 -34
- data/third_party/boringssl-with-bazel/crypto/x509/v3_genn.cc +20 -10
- data/third_party/boringssl-with-bazel/crypto/x509/v3_ia5.cc +22 -18
- data/third_party/boringssl-with-bazel/crypto/x509/v3_info.cc +45 -47
- data/third_party/boringssl-with-bazel/crypto/x509/v3_int.cc +35 -33
- data/third_party/boringssl-with-bazel/crypto/x509/v3_lib.cc +106 -61
- data/third_party/boringssl-with-bazel/crypto/x509/v3_ncons.cc +642 -358
- data/third_party/boringssl-with-bazel/crypto/x509/v3_ocsp.cc +25 -22
- data/third_party/boringssl-with-bazel/crypto/x509/v3_pcons.cc +15 -14
- data/third_party/boringssl-with-bazel/crypto/x509/v3_pmaps.cc +16 -15
- data/third_party/boringssl-with-bazel/crypto/x509/v3_prn.cc +6 -6
- data/third_party/boringssl-with-bazel/crypto/x509/v3_purp.cc +150 -137
- data/third_party/boringssl-with-bazel/crypto/x509/v3_skey.cc +23 -26
- data/third_party/boringssl-with-bazel/crypto/x509/v3_utl.cc +151 -178
- data/third_party/boringssl-with-bazel/crypto/x509/x509.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/x509/x509_att.cc +32 -30
- data/third_party/boringssl-with-bazel/crypto/x509/x509_cmp.cc +95 -88
- data/third_party/boringssl-with-bazel/crypto/x509/x509_d2.cc +9 -9
- data/third_party/boringssl-with-bazel/crypto/x509/x509_def.cc +6 -8
- data/third_party/boringssl-with-bazel/crypto/x509/x509_ext.cc +46 -24
- data/third_party/boringssl-with-bazel/crypto/x509/x509_lu.cc +211 -195
- data/third_party/boringssl-with-bazel/crypto/x509/x509_obj.cc +20 -16
- data/third_party/boringssl-with-bazel/crypto/x509/x509_req.cc +37 -46
- data/third_party/boringssl-with-bazel/crypto/x509/x509_set.cc +62 -90
- data/third_party/boringssl-with-bazel/crypto/x509/x509_trs.cc +18 -13
- data/third_party/boringssl-with-bazel/crypto/x509/x509_v3.cc +33 -33
- data/third_party/boringssl-with-bazel/crypto/x509/x509_vfy.cc +109 -110
- data/third_party/boringssl-with-bazel/crypto/x509/x509_vpm.cc +56 -47
- data/third_party/boringssl-with-bazel/crypto/x509/x509cset.cc +27 -40
- data/third_party/boringssl-with-bazel/crypto/x509/x509name.cc +77 -67
- data/third_party/boringssl-with-bazel/crypto/x509/x509rset.cc +5 -17
- data/third_party/boringssl-with-bazel/crypto/x509/x509spki.cc +13 -13
- data/third_party/boringssl-with-bazel/crypto/x509/x_algor.cc +131 -24
- data/third_party/boringssl-with-bazel/crypto/x509/x_all.cc +72 -39
- data/third_party/boringssl-with-bazel/crypto/x509/x_attrib.cc +10 -4
- data/third_party/boringssl-with-bazel/crypto/x509/x_crl.cc +77 -44
- data/third_party/boringssl-with-bazel/crypto/x509/x_exten.cc +6 -0
- data/third_party/boringssl-with-bazel/crypto/x509/x_name.cc +311 -383
- data/third_party/boringssl-with-bazel/crypto/x509/x_pubkey.cc +129 -82
- data/third_party/boringssl-with-bazel/crypto/x509/x_req.cc +11 -6
- data/third_party/boringssl-with-bazel/crypto/x509/x_sig.cc +4 -4
- data/third_party/boringssl-with-bazel/crypto/x509/x_spki.cc +11 -1
- data/third_party/boringssl-with-bazel/crypto/x509/x_x509.cc +285 -280
- data/third_party/boringssl-with-bazel/crypto/x509/x_x509a.cc +60 -60
- data/third_party/boringssl-with-bazel/crypto/xwing/xwing.cc +257 -0
- data/third_party/boringssl-with-bazel/gen/boringssl_prefix_symbols_internal_x86_64_win_asm.inc +301 -0
- data/third_party/boringssl-with-bazel/gen/boringssl_prefix_symbols_internal_x86_win_asm.inc +301 -0
- data/third_party/boringssl-with-bazel/gen/crypto/err_data.cc +526 -500
- data/third_party/boringssl-with-bazel/include/openssl/aead.h +286 -114
- data/third_party/boringssl-with-bazel/include/openssl/aes.h +43 -43
- data/third_party/boringssl-with-bazel/include/openssl/asm_base.h +29 -16
- data/third_party/boringssl-with-bazel/include/openssl/asn1.h +641 -631
- data/third_party/boringssl-with-bazel/include/openssl/asn1t.h +7 -9
- data/third_party/boringssl-with-bazel/include/openssl/base.h +34 -54
- data/third_party/boringssl-with-bazel/include/openssl/base64.h +30 -30
- data/third_party/boringssl-with-bazel/include/openssl/bio.h +373 -316
- data/third_party/boringssl-with-bazel/include/openssl/blake2.h +15 -11
- data/third_party/boringssl-with-bazel/include/openssl/blowfish.h +10 -3
- data/third_party/boringssl-with-bazel/include/openssl/bn.h +298 -306
- data/third_party/boringssl-with-bazel/include/openssl/buf.h +14 -14
- data/third_party/boringssl-with-bazel/include/openssl/bytestring.h +272 -207
- data/third_party/boringssl-with-bazel/include/openssl/cast.h +45 -8
- data/third_party/boringssl-with-bazel/include/openssl/chacha.h +3 -3
- data/third_party/boringssl-with-bazel/include/openssl/cipher.h +334 -152
- data/third_party/boringssl-with-bazel/include/openssl/cmac.h +13 -13
- data/third_party/boringssl-with-bazel/include/openssl/cms.h +35 -34
- data/third_party/boringssl-with-bazel/include/openssl/conf.h +15 -14
- data/third_party/boringssl-with-bazel/include/openssl/crypto.h +15 -13
- data/third_party/boringssl-with-bazel/include/openssl/ctrdrbg.h +49 -15
- data/third_party/boringssl-with-bazel/include/openssl/curve25519.h +24 -24
- data/third_party/boringssl-with-bazel/include/openssl/des.h +22 -16
- data/third_party/boringssl-with-bazel/include/openssl/dh.h +95 -95
- data/third_party/boringssl-with-bazel/include/openssl/digest.h +140 -71
- data/third_party/boringssl-with-bazel/include/openssl/dsa.h +101 -101
- data/third_party/boringssl-with-bazel/include/openssl/ec.h +143 -119
- data/third_party/boringssl-with-bazel/include/openssl/ec_key.h +97 -97
- data/third_party/boringssl-with-bazel/include/openssl/ecdh.h +9 -9
- data/third_party/boringssl-with-bazel/include/openssl/ecdsa.h +89 -46
- data/third_party/boringssl-with-bazel/include/openssl/engine.h +5 -5
- data/third_party/boringssl-with-bazel/include/openssl/err.h +73 -71
- data/third_party/boringssl-with-bazel/include/openssl/evp.h +824 -344
- data/third_party/boringssl-with-bazel/include/openssl/evp_errors.h +9 -2
- data/third_party/boringssl-with-bazel/include/openssl/ex_data.h +27 -32
- data/third_party/boringssl-with-bazel/include/openssl/hkdf.h +6 -6
- data/third_party/boringssl-with-bazel/include/openssl/hmac.h +31 -31
- data/third_party/boringssl-with-bazel/include/openssl/hpke.h +133 -117
- data/third_party/boringssl-with-bazel/include/openssl/hrss.h +14 -8
- data/third_party/boringssl-with-bazel/include/openssl/kdf.h +20 -19
- data/third_party/boringssl-with-bazel/include/openssl/lhash.h +4 -25
- data/third_party/boringssl-with-bazel/include/openssl/md4.h +14 -7
- data/third_party/boringssl-with-bazel/include/openssl/md5.h +7 -7
- data/third_party/boringssl-with-bazel/include/openssl/mem.h +38 -38
- data/third_party/boringssl-with-bazel/include/openssl/mldsa.h +380 -24
- data/third_party/boringssl-with-bazel/include/openssl/mlkem.h +43 -43
- data/third_party/boringssl-with-bazel/include/openssl/nid.h +1297 -2
- data/third_party/boringssl-with-bazel/include/openssl/obj.h +49 -49
- data/third_party/boringssl-with-bazel/include/openssl/opensslconf.h +30 -0
- data/third_party/boringssl-with-bazel/include/openssl/params.h +42 -0
- data/third_party/boringssl-with-bazel/include/openssl/pem.h +39 -30
- data/third_party/boringssl-with-bazel/include/openssl/pkcs7.h +40 -40
- data/third_party/boringssl-with-bazel/include/openssl/pkcs8.h +69 -63
- data/third_party/boringssl-with-bazel/include/openssl/poly1305.h +8 -5
- data/third_party/boringssl-with-bazel/include/openssl/pool.h +54 -25
- data/third_party/boringssl-with-bazel/include/openssl/posix_time.h +6 -6
- data/third_party/boringssl-with-bazel/include/openssl/prefix_symbols.h +7866 -0
- data/third_party/boringssl-with-bazel/include/openssl/prefix_symbols_internal_S.h +585 -0
- data/third_party/boringssl-with-bazel/include/openssl/prefix_symbols_internal_c.h +305 -0
- data/third_party/boringssl-with-bazel/include/openssl/rand.h +18 -18
- data/third_party/boringssl-with-bazel/include/openssl/rc4.h +4 -4
- data/third_party/boringssl-with-bazel/include/openssl/ripemd.h +15 -10
- data/third_party/boringssl-with-bazel/include/openssl/rsa.h +272 -235
- data/third_party/boringssl-with-bazel/include/openssl/service_indicator.h +4 -81
- data/third_party/boringssl-with-bazel/include/openssl/sha.h +43 -166
- data/third_party/boringssl-with-bazel/include/openssl/sha2.h +201 -0
- data/third_party/boringssl-with-bazel/include/openssl/slhdsa.h +100 -48
- data/third_party/boringssl-with-bazel/include/openssl/span.h +190 -75
- data/third_party/boringssl-with-bazel/include/openssl/ssl.h +2168 -1567
- data/third_party/boringssl-with-bazel/include/openssl/ssl3.h +11 -69
- data/third_party/boringssl-with-bazel/include/openssl/stack.h +135 -80
- data/third_party/boringssl-with-bazel/include/openssl/target.h +13 -1
- data/third_party/boringssl-with-bazel/include/openssl/thread.h +0 -10
- data/third_party/boringssl-with-bazel/include/openssl/tls1.h +31 -310
- data/third_party/boringssl-with-bazel/include/openssl/tls_prf.h +47 -0
- data/third_party/boringssl-with-bazel/include/openssl/trust_token.h +97 -92
- data/third_party/boringssl-with-bazel/include/openssl/type_check.h +1 -1
- data/third_party/boringssl-with-bazel/include/openssl/x509.h +1805 -1857
- data/third_party/boringssl-with-bazel/include/openssl/x509v3.h +1 -1
- data/third_party/boringssl-with-bazel/include/openssl/xwing.h +115 -0
- data/third_party/boringssl-with-bazel/ssl/bio_ssl.cc +24 -19
- data/third_party/boringssl-with-bazel/ssl/d1_both.cc +59 -57
- data/third_party/boringssl-with-bazel/ssl/d1_lib.cc +53 -42
- data/third_party/boringssl-with-bazel/ssl/d1_pkt.cc +4 -4
- data/third_party/boringssl-with-bazel/ssl/d1_srtp.cc +2 -2
- data/third_party/boringssl-with-bazel/ssl/dtls_method.cc +10 -10
- data/third_party/boringssl-with-bazel/ssl/dtls_record.cc +6 -6
- data/third_party/boringssl-with-bazel/ssl/encrypted_client_hello.cc +61 -71
- data/third_party/boringssl-with-bazel/ssl/extensions.cc +967 -366
- data/third_party/boringssl-with-bazel/ssl/handoff.cc +77 -38
- data/third_party/boringssl-with-bazel/ssl/handshake.cc +63 -30
- data/third_party/boringssl-with-bazel/ssl/handshake_client.cc +129 -85
- data/third_party/boringssl-with-bazel/ssl/handshake_server.cc +116 -68
- data/third_party/boringssl-with-bazel/ssl/internal.h +983 -1207
- data/third_party/boringssl-with-bazel/ssl/s3_both.cc +34 -29
- data/third_party/boringssl-with-bazel/ssl/s3_lib.cc +4 -3
- data/third_party/boringssl-with-bazel/ssl/s3_pkt.cc +12 -12
- data/third_party/boringssl-with-bazel/ssl/ssl_aead_ctx.cc +5 -5
- data/third_party/boringssl-with-bazel/ssl/ssl_asn1.cc +114 -59
- data/third_party/boringssl-with-bazel/ssl/ssl_buffer.cc +17 -18
- data/third_party/boringssl-with-bazel/ssl/ssl_cert.cc +99 -61
- data/third_party/boringssl-with-bazel/ssl/ssl_cipher.cc +143 -134
- data/third_party/boringssl-with-bazel/ssl/ssl_credential.cc +188 -90
- data/third_party/boringssl-with-bazel/ssl/ssl_file.cc +132 -225
- data/third_party/boringssl-with-bazel/ssl/ssl_key_share.cc +79 -7
- data/third_party/boringssl-with-bazel/ssl/ssl_lib.cc +698 -302
- data/third_party/boringssl-with-bazel/ssl/ssl_privkey.cc +102 -45
- data/third_party/boringssl-with-bazel/ssl/ssl_session.cc +117 -102
- data/third_party/boringssl-with-bazel/ssl/ssl_transcript.cc +3 -3
- data/third_party/boringssl-with-bazel/ssl/ssl_versions.cc +24 -24
- data/third_party/boringssl-with-bazel/ssl/ssl_x509.cc +184 -170
- data/third_party/boringssl-with-bazel/ssl/t1_enc.cc +12 -10
- data/third_party/boringssl-with-bazel/ssl/tls13_both.cc +86 -54
- data/third_party/boringssl-with-bazel/ssl/tls13_client.cc +176 -90
- data/third_party/boringssl-with-bazel/ssl/tls13_enc.cc +166 -112
- data/third_party/boringssl-with-bazel/ssl/tls13_server.cc +188 -97
- data/third_party/boringssl-with-bazel/ssl/tls_method.cc +23 -23
- data/third_party/boringssl-with-bazel/ssl/tls_record.cc +17 -14
- data/third_party/boringssl-with-bazel/third_party/fiat/bedrock_unverified_bareminimum.c.inc +47 -0
- data/third_party/boringssl-with-bazel/third_party/fiat/bedrock_unverified_platform.c.inc +137 -0
- data/third_party/boringssl-with-bazel/third_party/fiat/curve25519_64_adx.h +37 -33
- data/third_party/boringssl-with-bazel/third_party/fiat/p256_64.h +4 -93
- data/third_party/boringssl-with-bazel/third_party/fiat/p256_64_msvc.h +4 -69
- data/third_party/boringssl-with-bazel/third_party/fiat/p256_field_32.br.c.inc +71 -0
- data/third_party/boringssl-with-bazel/third_party/fiat/p256_field_64.br.c.inc +84 -0
- data/third_party/boringssl-with-bazel/third_party/fiat/p256_point.br.c.inc +166 -0
- metadata +77 -52
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +0 -240
- data/src/core/ext/transport/chttp2/transport/bin_decoder.h +0 -56
- data/src/core/ext/upb-gen/src/proto/grpc/health/v1/health.upb.h +0 -157
- data/src/core/ext/upb-gen/src/proto/grpc/health/v1/health.upb_minitable.c +0 -72
- data/src/core/ext/upbdefs-gen/src/proto/grpc/lookup/v1/rls_config.upbdefs.c +0 -181
- data/third_party/abseil-cpp/absl/base/internal/identity.h +0 -39
- data/third_party/abseil-cpp/absl/base/internal/nullability_deprecated.h +0 -106
- data/third_party/abseil-cpp/absl/hash/internal/low_level_hash.cc +0 -105
- data/third_party/abseil-cpp/absl/hash/internal/low_level_hash.h +0 -50
- data/third_party/abseil-cpp/absl/strings/string_view.cc +0 -257
- data/third_party/boringssl-with-bazel/crypto/evp/p_dh_asn1.cc +0 -142
- data/third_party/boringssl-with-bazel/crypto/evp/p_dsa_asn1.cc +0 -279
- data/third_party/boringssl-with-bazel/crypto/evp/p_ec_asn1.cc +0 -286
- data/third_party/boringssl-with-bazel/crypto/evp/p_ed25519_asn1.cc +0 -225
- data/third_party/boringssl-with-bazel/crypto/evp/p_rsa_asn1.cc +0 -198
- data/third_party/boringssl-with-bazel/crypto/evp/p_x25519_asn1.cc +0 -237
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p224-64.cc.inc +0 -1163
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p256-nistz.cc.inc +0 -741
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p256-nistz.h +0 -207
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/rsa/blinding.cc.inc +0 -147
- data/third_party/boringssl-with-bazel/crypto/rand/getrandom_fillin.h +0 -64
- data/third_party/boringssl-with-bazel/crypto/rand/passive.cc +0 -178
- data/third_party/boringssl-with-bazel/crypto/x509/ext_dat.h +0 -92
- data/third_party/boringssl-with-bazel/include/openssl/bcm_public.h +0 -82
- data/third_party/boringssl-with-bazel/include/openssl/experimental/kyber.h +0 -146
|
@@ -15,15 +15,18 @@
|
|
|
15
15
|
#ifndef OPENSSL_HEADER_CRYPTO_INTERNAL_H
|
|
16
16
|
#define OPENSSL_HEADER_CRYPTO_INTERNAL_H
|
|
17
17
|
|
|
18
|
+
#include <openssl/base.h>
|
|
18
19
|
#include <openssl/crypto.h>
|
|
19
20
|
#include <openssl/ex_data.h>
|
|
21
|
+
#include <openssl/span.h>
|
|
20
22
|
#include <openssl/stack.h>
|
|
21
|
-
#include <openssl/thread.h>
|
|
22
23
|
|
|
23
24
|
#include <assert.h>
|
|
24
25
|
#include <stdlib.h>
|
|
25
26
|
#include <string.h>
|
|
26
27
|
|
|
28
|
+
#include <type_traits>
|
|
29
|
+
|
|
27
30
|
#if defined(BORINGSSL_CONSTANT_TIME_VALIDATION)
|
|
28
31
|
#include <valgrind/memcheck.h>
|
|
29
32
|
#endif
|
|
@@ -45,41 +48,50 @@
|
|
|
45
48
|
|
|
46
49
|
#if defined(OPENSSL_THREADS)
|
|
47
50
|
#include <atomic>
|
|
51
|
+
#else
|
|
52
|
+
#include <utility>
|
|
48
53
|
#endif
|
|
49
54
|
|
|
50
55
|
#if defined(OPENSSL_WINDOWS_THREADS)
|
|
51
56
|
#include <windows.h>
|
|
52
57
|
#endif
|
|
53
58
|
|
|
54
|
-
#if defined(
|
|
55
|
-
|
|
59
|
+
#if defined(_M_X64) || defined(_M_IX86)
|
|
60
|
+
#include "intrin.h"
|
|
61
|
+
#endif
|
|
62
|
+
|
|
63
|
+
#if defined(BORINGSSL_PREFIX)
|
|
64
|
+
#include <openssl/prefix_symbols_internal_c.h> // IWYU pragma: export
|
|
56
65
|
#endif
|
|
57
66
|
|
|
58
67
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
68
|
+
BSSL_NAMESPACE_BEGIN
|
|
69
|
+
|
|
70
|
+
#if !defined(OPENSSL_NO_ASM) && \
|
|
71
|
+
(defined(OPENSSL_X86) || defined(OPENSSL_X86_64) || \
|
|
72
|
+
(!defined(OPENSSL_STATIC_ARMCAP) && \
|
|
73
|
+
(defined(OPENSSL_ARM) || defined(OPENSSL_AARCH64))))
|
|
62
74
|
// x86, x86_64, and the ARMs need to record the result of a cpuid/getauxval call
|
|
63
75
|
// for the asm to work correctly, unless compiled without asm code.
|
|
64
76
|
#define NEED_CPUID
|
|
65
77
|
|
|
66
78
|
// OPENSSL_cpuid_setup initializes the platform-specific feature cache. This
|
|
67
|
-
// function should not be called directly. Call
|
|
68
|
-
void OPENSSL_cpuid_setup(
|
|
79
|
+
// function should not be called directly. Call `OPENSSL_init_cpuid` instead.
|
|
80
|
+
void OPENSSL_cpuid_setup();
|
|
69
81
|
|
|
70
82
|
// OPENSSL_init_cpuid initializes the platform-specific feature cache, if
|
|
71
83
|
// needed. This function is idempotent and may be called concurrently.
|
|
72
|
-
void OPENSSL_init_cpuid(
|
|
84
|
+
void OPENSSL_init_cpuid();
|
|
73
85
|
#else
|
|
74
|
-
inline void OPENSSL_init_cpuid(
|
|
86
|
+
inline void OPENSSL_init_cpuid() {}
|
|
75
87
|
#endif
|
|
76
88
|
|
|
77
89
|
#if (defined(OPENSSL_ARM) || defined(OPENSSL_AARCH64)) && \
|
|
78
90
|
!defined(OPENSSL_STATIC_ARMCAP)
|
|
79
|
-
// OPENSSL_get_armcap_pointer_for_test returns a pointer to
|
|
80
|
-
// for unit tests. Any modifications to the value must be
|
|
81
|
-
// function call in BoringSSL.
|
|
82
|
-
OPENSSL_EXPORT uint32_t *OPENSSL_get_armcap_pointer_for_test(
|
|
91
|
+
// OPENSSL_get_armcap_pointer_for_test returns a pointer to
|
|
92
|
+
// `OPENSSL_armcap_P` for unit tests. Any modifications to the value must be
|
|
93
|
+
// made before any other function call in BoringSSL.
|
|
94
|
+
OPENSSL_EXPORT uint32_t *OPENSSL_get_armcap_pointer_for_test();
|
|
83
95
|
#endif
|
|
84
96
|
|
|
85
97
|
|
|
@@ -101,9 +113,7 @@ typedef __uint128_t uint128_t;
|
|
|
101
113
|
#endif
|
|
102
114
|
#endif
|
|
103
115
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
// GCC-like compilers indicate SSE2 with |__SSE2__|. MSVC leaves the caller to
|
|
116
|
+
// GCC-like compilers indicate SSE2 with `__SSE2__`. MSVC leaves the caller to
|
|
107
117
|
// know that x86_64 has SSE2, and uses _M_IX86_FP to indicate SSE2 on x86.
|
|
108
118
|
// https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-170
|
|
109
119
|
#if defined(__SSE2__) || defined(_M_AMD64) || defined(_M_X64) || \
|
|
@@ -117,7 +127,7 @@ typedef __uint128_t uint128_t;
|
|
|
117
127
|
#endif
|
|
118
128
|
|
|
119
129
|
// For convenience in testing the fallback code, we allow disabling SSE2
|
|
120
|
-
// intrinsics via
|
|
130
|
+
// intrinsics via `OPENSSL_NO_SSE2_FOR_TESTING`. We require SSE2 on x86 and
|
|
121
131
|
// x86_64, so we would otherwise need to test such code on a non-x86 platform.
|
|
122
132
|
//
|
|
123
133
|
// This does not remove the above requirement for SSE2 support with assembly
|
|
@@ -138,21 +148,21 @@ typedef __uint128_t uint128_t;
|
|
|
138
148
|
// resets the internal malloc counter, to simulate further malloc failures. This
|
|
139
149
|
// should be called in between independent tests, at a point where failure from
|
|
140
150
|
// a previous test will not impact subsequent ones.
|
|
141
|
-
OPENSSL_EXPORT void OPENSSL_reset_malloc_counter_for_testing(
|
|
151
|
+
OPENSSL_EXPORT void OPENSSL_reset_malloc_counter_for_testing();
|
|
142
152
|
|
|
143
153
|
// OPENSSL_disable_malloc_failures_for_testing, when malloc testing is enabled,
|
|
144
|
-
// disables simulated malloc failures. Calls to
|
|
154
|
+
// disables simulated malloc failures. Calls to `OPENSSL_malloc` will not
|
|
145
155
|
// increment the malloc counter or synthesize failures. This may be used to skip
|
|
146
156
|
// simulating malloc failures in some region of code.
|
|
147
|
-
OPENSSL_EXPORT void OPENSSL_disable_malloc_failures_for_testing(
|
|
157
|
+
OPENSSL_EXPORT void OPENSSL_disable_malloc_failures_for_testing();
|
|
148
158
|
|
|
149
159
|
// OPENSSL_enable_malloc_failures_for_testing, when malloc testing is enabled,
|
|
150
160
|
// re-enables simulated malloc failures.
|
|
151
|
-
OPENSSL_EXPORT void OPENSSL_enable_malloc_failures_for_testing(
|
|
161
|
+
OPENSSL_EXPORT void OPENSSL_enable_malloc_failures_for_testing();
|
|
152
162
|
#else
|
|
153
|
-
inline void OPENSSL_reset_malloc_counter_for_testing(
|
|
154
|
-
inline void OPENSSL_disable_malloc_failures_for_testing(
|
|
155
|
-
inline void OPENSSL_enable_malloc_failures_for_testing(
|
|
163
|
+
inline void OPENSSL_reset_malloc_counter_for_testing() {}
|
|
164
|
+
inline void OPENSSL_disable_malloc_failures_for_testing() {}
|
|
165
|
+
inline void OPENSSL_enable_malloc_failures_for_testing() {}
|
|
156
166
|
#endif
|
|
157
167
|
|
|
158
168
|
#if defined(__has_builtin)
|
|
@@ -164,10 +174,10 @@ inline void OPENSSL_enable_malloc_failures_for_testing(void) {}
|
|
|
164
174
|
|
|
165
175
|
// Pointer utility functions.
|
|
166
176
|
|
|
167
|
-
// buffers_alias returns one if
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
// Cast
|
|
177
|
+
// buffers_alias returns one if `a` and `b` alias and zero otherwise.
|
|
178
|
+
inline int buffers_alias(const void *a, size_t a_bytes, const void *b,
|
|
179
|
+
size_t b_bytes) {
|
|
180
|
+
// Cast `a` and `b` to integers. In C, pointer comparisons between unrelated
|
|
171
181
|
// objects are undefined whereas pointer to integer conversions are merely
|
|
172
182
|
// implementation-defined. We assume the implementation defined it in a sane
|
|
173
183
|
// way.
|
|
@@ -176,15 +186,22 @@ static inline int buffers_alias(const void *a, size_t a_bytes, const void *b,
|
|
|
176
186
|
return a_u + a_bytes > b_u && b_u + b_bytes > a_u;
|
|
177
187
|
}
|
|
178
188
|
|
|
179
|
-
//
|
|
180
|
-
|
|
189
|
+
// spans_alias returns one if `a` and `b` alias, and zero otherwise.
|
|
190
|
+
template <typename T>
|
|
191
|
+
inline int spans_alias(Span<const T> a, Span<const T> b) {
|
|
192
|
+
return buffers_alias(a.data(), a.size() * sizeof(T), b.data(),
|
|
193
|
+
b.size() * sizeof(T));
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// align_pointer returns `ptr`, advanced to `alignment`. `alignment` must be a
|
|
197
|
+
// power of two, and `ptr` must have at least `alignment - 1` bytes of scratch
|
|
181
198
|
// space.
|
|
182
|
-
|
|
183
|
-
//
|
|
199
|
+
inline void *align_pointer(void *ptr, size_t alignment) {
|
|
200
|
+
// `alignment` must be a power of two.
|
|
184
201
|
assert(alignment != 0 && (alignment & (alignment - 1)) == 0);
|
|
185
|
-
// Instead of aligning
|
|
202
|
+
// Instead of aligning `ptr` as a `uintptr_t` and casting back, compute the
|
|
186
203
|
// offset and advance in pointer space. C guarantees that casting from pointer
|
|
187
|
-
// to
|
|
204
|
+
// to `uintptr_t` and back gives the same pointer, but general
|
|
188
205
|
// integer-to-pointer conversions are implementation-defined. GCC does define
|
|
189
206
|
// it in the useful way, but this makes fewer assumptions.
|
|
190
207
|
uintptr_t offset = (0u - (uintptr_t)ptr) & (alignment - 1);
|
|
@@ -212,10 +229,10 @@ static inline void *align_pointer(void *ptr, size_t alignment) {
|
|
|
212
229
|
// c = constant_time_select_w(lt, a, b);
|
|
213
230
|
|
|
214
231
|
// crypto_word_t is the type that most constant-time functions use. Ideally we
|
|
215
|
-
// would like it to be
|
|
216
|
-
// pointers, which means that
|
|
232
|
+
// would like it to be `size_t`, but NaCl builds in 64-bit mode with 32-bit
|
|
233
|
+
// pointers, which means that `size_t` can be 32 bits when `BN_ULONG` is 64
|
|
217
234
|
// bits. Since we want to be able to do constant-time operations on a
|
|
218
|
-
//
|
|
235
|
+
// `BN_ULONG`, `crypto_word_t` is defined as an unsigned value with the native
|
|
219
236
|
// word length.
|
|
220
237
|
#if defined(OPENSSL_64_BIT)
|
|
221
238
|
typedef uint64_t crypto_word_t;
|
|
@@ -230,48 +247,47 @@ typedef uint32_t crypto_word_t;
|
|
|
230
247
|
#define CONSTTIME_TRUE_8 ((uint8_t)0xff)
|
|
231
248
|
#define CONSTTIME_FALSE_8 ((uint8_t)0)
|
|
232
249
|
|
|
233
|
-
// value_barrier_w returns
|
|
250
|
+
// value_barrier_w returns `a`, but prevents GCC and Clang from reasoning about
|
|
234
251
|
// the returned value. This is used to mitigate compilers undoing constant-time
|
|
235
252
|
// code, until we can express our requirements directly in the language.
|
|
236
253
|
//
|
|
237
|
-
// Note the compiler is aware that
|
|
254
|
+
// Note the compiler is aware that `value_barrier_w` has no side effects and
|
|
238
255
|
// always has the same output for a given input. This allows it to eliminate
|
|
239
256
|
// dead code, move computations across loops, and vectorize.
|
|
240
|
-
|
|
257
|
+
inline crypto_word_t value_barrier_w(crypto_word_t a) {
|
|
241
258
|
#if defined(__GNUC__) || defined(__clang__)
|
|
242
259
|
__asm__("" : "+r"(a) : /* no inputs */);
|
|
243
260
|
#endif
|
|
244
261
|
return a;
|
|
245
262
|
}
|
|
246
263
|
|
|
247
|
-
// value_barrier_u32 behaves like
|
|
248
|
-
|
|
264
|
+
// value_barrier_u32 behaves like `value_barrier_w` but takes a `uint32_t`.
|
|
265
|
+
inline uint32_t value_barrier_u32(uint32_t a) {
|
|
249
266
|
#if defined(__GNUC__) || defined(__clang__)
|
|
250
267
|
__asm__("" : "+r"(a) : /* no inputs */);
|
|
251
268
|
#endif
|
|
252
269
|
return a;
|
|
253
270
|
}
|
|
254
271
|
|
|
255
|
-
// value_barrier_u64 behaves like
|
|
256
|
-
|
|
272
|
+
// value_barrier_u64 behaves like `value_barrier_w` but takes a `uint64_t`.
|
|
273
|
+
inline uint64_t value_barrier_u64(uint64_t a) {
|
|
257
274
|
#if defined(__GNUC__) || defined(__clang__)
|
|
258
275
|
__asm__("" : "+r"(a) : /* no inputs */);
|
|
259
276
|
#endif
|
|
260
277
|
return a;
|
|
261
278
|
}
|
|
262
279
|
|
|
263
|
-
//
|
|
280
|
+
// `value_barrier_u8` could be defined as above, but compilers other than
|
|
264
281
|
// clang seem to still materialize 0x00..00MM instead of reusing 0x??..??MM.
|
|
265
282
|
|
|
266
283
|
// constant_time_msb_w returns the given value with the MSB copied to all the
|
|
267
284
|
// other bits.
|
|
268
|
-
|
|
285
|
+
inline crypto_word_t constant_time_msb_w(crypto_word_t a) {
|
|
269
286
|
return 0u - (a >> (sizeof(a) * 8 - 1));
|
|
270
287
|
}
|
|
271
288
|
|
|
272
289
|
// constant_time_lt_w returns 0xff..f if a < b and 0 otherwise.
|
|
273
|
-
|
|
274
|
-
crypto_word_t b) {
|
|
290
|
+
inline crypto_word_t constant_time_lt_w(crypto_word_t a, crypto_word_t b) {
|
|
275
291
|
// Consider the two cases of the problem:
|
|
276
292
|
// msb(a) == msb(b): a < b iff the MSB of a - b is set.
|
|
277
293
|
// msb(a) != msb(b): a < b iff the MSB of b is set.
|
|
@@ -305,26 +321,25 @@ static inline crypto_word_t constant_time_lt_w(crypto_word_t a,
|
|
|
305
321
|
return constant_time_msb_w(a ^ ((a ^ b) | ((a - b) ^ a)));
|
|
306
322
|
}
|
|
307
323
|
|
|
308
|
-
// constant_time_lt_8 acts like
|
|
324
|
+
// constant_time_lt_8 acts like `constant_time_lt_w` but returns an 8-bit
|
|
309
325
|
// mask.
|
|
310
|
-
|
|
326
|
+
inline uint8_t constant_time_lt_8(crypto_word_t a, crypto_word_t b) {
|
|
311
327
|
return (uint8_t)(constant_time_lt_w(a, b));
|
|
312
328
|
}
|
|
313
329
|
|
|
314
330
|
// constant_time_ge_w returns 0xff..f if a >= b and 0 otherwise.
|
|
315
|
-
|
|
316
|
-
crypto_word_t b) {
|
|
331
|
+
inline crypto_word_t constant_time_ge_w(crypto_word_t a, crypto_word_t b) {
|
|
317
332
|
return ~constant_time_lt_w(a, b);
|
|
318
333
|
}
|
|
319
334
|
|
|
320
|
-
// constant_time_ge_8 acts like
|
|
335
|
+
// constant_time_ge_8 acts like `constant_time_ge_w` but returns an 8-bit
|
|
321
336
|
// mask.
|
|
322
|
-
|
|
337
|
+
inline uint8_t constant_time_ge_8(crypto_word_t a, crypto_word_t b) {
|
|
323
338
|
return (uint8_t)(constant_time_ge_w(a, b));
|
|
324
339
|
}
|
|
325
340
|
|
|
326
341
|
// constant_time_is_zero returns 0xff..f if a == 0 and 0 otherwise.
|
|
327
|
-
|
|
342
|
+
inline crypto_word_t constant_time_is_zero_w(crypto_word_t a) {
|
|
328
343
|
// Here is an SMT-LIB verification of this formula:
|
|
329
344
|
//
|
|
330
345
|
// (define-fun is_zero ((a (_ BitVec 32))) (_ BitVec 32)
|
|
@@ -338,42 +353,40 @@ static inline crypto_word_t constant_time_is_zero_w(crypto_word_t a) {
|
|
|
338
353
|
return constant_time_msb_w(~a & (a - 1));
|
|
339
354
|
}
|
|
340
355
|
|
|
341
|
-
// constant_time_is_zero_8 acts like
|
|
356
|
+
// constant_time_is_zero_8 acts like `constant_time_is_zero_w` but returns an
|
|
342
357
|
// 8-bit mask.
|
|
343
|
-
|
|
358
|
+
inline uint8_t constant_time_is_zero_8(crypto_word_t a) {
|
|
344
359
|
return (uint8_t)(constant_time_is_zero_w(a));
|
|
345
360
|
}
|
|
346
361
|
|
|
347
362
|
// constant_time_eq_w returns 0xff..f if a == b and 0 otherwise.
|
|
348
|
-
|
|
349
|
-
crypto_word_t b) {
|
|
363
|
+
inline crypto_word_t constant_time_eq_w(crypto_word_t a, crypto_word_t b) {
|
|
350
364
|
return constant_time_is_zero_w(a ^ b);
|
|
351
365
|
}
|
|
352
366
|
|
|
353
|
-
// constant_time_eq_8 acts like
|
|
367
|
+
// constant_time_eq_8 acts like `constant_time_eq_w` but returns an 8-bit
|
|
354
368
|
// mask.
|
|
355
|
-
|
|
369
|
+
inline uint8_t constant_time_eq_8(crypto_word_t a, crypto_word_t b) {
|
|
356
370
|
return (uint8_t)(constant_time_eq_w(a, b));
|
|
357
371
|
}
|
|
358
372
|
|
|
359
|
-
// constant_time_eq_int acts like
|
|
373
|
+
// constant_time_eq_int acts like `constant_time_eq_w` but works on int
|
|
360
374
|
// values.
|
|
361
|
-
|
|
375
|
+
inline crypto_word_t constant_time_eq_int(int a, int b) {
|
|
362
376
|
return constant_time_eq_w((crypto_word_t)(a), (crypto_word_t)(b));
|
|
363
377
|
}
|
|
364
378
|
|
|
365
|
-
// constant_time_eq_int_8 acts like
|
|
379
|
+
// constant_time_eq_int_8 acts like `constant_time_eq_int` but returns an 8-bit
|
|
366
380
|
// mask.
|
|
367
|
-
|
|
381
|
+
inline uint8_t constant_time_eq_int_8(int a, int b) {
|
|
368
382
|
return constant_time_eq_8((crypto_word_t)(a), (crypto_word_t)(b));
|
|
369
383
|
}
|
|
370
384
|
|
|
371
|
-
// constant_time_select_w returns (mask & a) | (~mask & b). When
|
|
385
|
+
// constant_time_select_w returns (mask & a) | (~mask & b). When `mask` is all
|
|
372
386
|
// 1s or all 0s (as returned by the methods above), the select methods return
|
|
373
|
-
// either
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
crypto_word_t b) {
|
|
387
|
+
// either `a` (if `mask` is nonzero) or `b` (if `mask` is zero).
|
|
388
|
+
inline crypto_word_t constant_time_select_w(crypto_word_t mask, crypto_word_t a,
|
|
389
|
+
crypto_word_t b) {
|
|
377
390
|
// Clang recognizes this pattern as a select. While it usually transforms it
|
|
378
391
|
// to a cmov, it sometimes further transforms it into a branch, which we do
|
|
379
392
|
// not want.
|
|
@@ -383,33 +396,41 @@ static inline crypto_word_t constant_time_select_w(crypto_word_t mask,
|
|
|
383
396
|
return (mask & a) | (~mask & b);
|
|
384
397
|
}
|
|
385
398
|
|
|
386
|
-
// constant_time_select_8 acts like
|
|
399
|
+
// constant_time_select_8 acts like `constant_time_select` but operates on
|
|
387
400
|
// 8-bit values.
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
//
|
|
391
|
-
// Making both
|
|
401
|
+
inline uint8_t constant_time_select_8(crypto_word_t mask, uint8_t a,
|
|
402
|
+
uint8_t b) {
|
|
403
|
+
// `mask` is a word instead of `uint8_t` to avoid materializing 0x000..0MM
|
|
404
|
+
// Making both `mask` and its value barrier `uint8_t` would allow the compiler
|
|
392
405
|
// to materialize 0x????..?MM instead, but only clang is that clever.
|
|
393
406
|
// However, vectorization of bitwise operations seems to work better on
|
|
394
|
-
//
|
|
395
|
-
//
|
|
407
|
+
// `uint8_t` than a mix of `uint64_t` and `uint8_t`, so `m` is cast to
|
|
408
|
+
// `uint8_t` after the value barrier but before the bitwise operations.
|
|
396
409
|
uint8_t m = value_barrier_w(mask);
|
|
397
410
|
return (m & a) | (~m & b);
|
|
398
411
|
}
|
|
399
412
|
|
|
400
|
-
// constant_time_select_int acts like
|
|
413
|
+
// constant_time_select_int acts like `constant_time_select` but operates on
|
|
401
414
|
// ints.
|
|
402
|
-
|
|
403
|
-
return
|
|
404
|
-
|
|
415
|
+
inline int constant_time_select_int(crypto_word_t mask, int a, int b) {
|
|
416
|
+
return static_cast<int>(constant_time_select_w(
|
|
417
|
+
mask, static_cast<crypto_word_t>(a), static_cast<crypto_word_t>(b)));
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
// constant_time_select_32 acts like `constant_time_select` but operates on
|
|
421
|
+
// 32-bit values.
|
|
422
|
+
inline uint32_t constant_time_select_32(crypto_word_t mask, uint32_t a,
|
|
423
|
+
uint32_t b) {
|
|
424
|
+
return static_cast<uint32_t>(
|
|
425
|
+
constant_time_select_w(mask, crypto_word_t{a}, crypto_word_t{b}));
|
|
405
426
|
}
|
|
406
427
|
|
|
407
|
-
// constant_time_conditional_memcpy copies
|
|
408
|
-
//
|
|
409
|
-
// ranges at
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
428
|
+
// constant_time_conditional_memcpy copies `n` bytes from `src` to `dst` if
|
|
429
|
+
// `mask` is 0xff..ff and does nothing if `mask` is 0. The `n`-byte memory
|
|
430
|
+
// ranges at `dst` and `src` must not overlap, as when calling `memcpy`.
|
|
431
|
+
inline void constant_time_conditional_memcpy(void *dst, const void *src,
|
|
432
|
+
const size_t n,
|
|
433
|
+
const crypto_word_t mask) {
|
|
413
434
|
assert(!buffers_alias(dst, n, src, n));
|
|
414
435
|
uint8_t *out = (uint8_t *)dst;
|
|
415
436
|
const uint8_t *in = (const uint8_t *)src;
|
|
@@ -418,23 +439,26 @@ static inline void constant_time_conditional_memcpy(void *dst, const void *src,
|
|
|
418
439
|
}
|
|
419
440
|
}
|
|
420
441
|
|
|
421
|
-
// constant_time_conditional_memxor xors
|
|
422
|
-
//
|
|
423
|
-
// ranges at
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
442
|
+
// constant_time_conditional_memxor xors `n` bytes from `src` to `dst` if
|
|
443
|
+
// `mask` is 0xff..ff and does nothing if `mask` is 0. The `n`-byte memory
|
|
444
|
+
// ranges at `dst` and `src` must not overlap, as when calling `memcpy`.
|
|
445
|
+
inline void constant_time_conditional_memxor(void *dst, const void *src,
|
|
446
|
+
size_t n,
|
|
447
|
+
const crypto_word_t mask) {
|
|
427
448
|
assert(!buffers_alias(dst, n, src, n));
|
|
428
449
|
uint8_t *out = (uint8_t *)dst;
|
|
429
450
|
const uint8_t *in = (const uint8_t *)src;
|
|
430
|
-
#if defined(__GNUC__)
|
|
451
|
+
#if defined(__GNUC__) || defined(__clang__)
|
|
431
452
|
// gcc 13.2.0 doesn't automatically vectorize this loop regardless of barrier
|
|
453
|
+
// clang 16.0.6 vectorizes if alias analysis finds src and dst are disjoint,
|
|
454
|
+
// but does not conclude that from the !buffers_alias assert.
|
|
432
455
|
typedef uint8_t v32u8 __attribute__((vector_size(32), aligned(1), may_alias));
|
|
433
456
|
size_t n_vec = n & ~(size_t)31;
|
|
434
457
|
v32u8 masks = ((uint8_t)mask - (v32u8){}); // broadcast
|
|
435
458
|
for (size_t i = 0; i < n_vec; i += 32) {
|
|
436
459
|
*(v32u8 *)&out[i] ^= masks & *(v32u8 *)&in[i];
|
|
437
460
|
}
|
|
461
|
+
in += n_vec;
|
|
438
462
|
out += n_vec;
|
|
439
463
|
n -= n_vec;
|
|
440
464
|
#endif
|
|
@@ -458,15 +482,24 @@ static inline void constant_time_conditional_memxor(void *dst, const void *src,
|
|
|
458
482
|
|
|
459
483
|
#else
|
|
460
484
|
|
|
461
|
-
|
|
462
|
-
#define
|
|
485
|
+
// Just disable unused warnings for those.
|
|
486
|
+
#define CONSTTIME_SECRET(ptr, len) \
|
|
487
|
+
do { \
|
|
488
|
+
(void)(ptr); \
|
|
489
|
+
(void)(len); \
|
|
490
|
+
} while (false)
|
|
491
|
+
#define CONSTTIME_DECLASSIFY(ptr, len) \
|
|
492
|
+
do { \
|
|
493
|
+
(void)(ptr); \
|
|
494
|
+
(void)(len); \
|
|
495
|
+
} while (false)
|
|
463
496
|
|
|
464
497
|
#endif // BORINGSSL_CONSTANT_TIME_VALIDATION
|
|
465
498
|
|
|
466
|
-
|
|
467
|
-
// Return
|
|
499
|
+
inline crypto_word_t constant_time_declassify_w(crypto_word_t v) {
|
|
500
|
+
// Return `v` through a value barrier to be safe. Valgrind-based constant-time
|
|
468
501
|
// validation is partly to check the compiler has not undone any constant-time
|
|
469
|
-
// work. Any place
|
|
502
|
+
// work. Any place `BORINGSSL_CONSTANT_TIME_VALIDATION` influences
|
|
470
503
|
// optimizations, this validation is inaccurate.
|
|
471
504
|
//
|
|
472
505
|
// However, by sending pointers through valgrind, we likely inhibit escape
|
|
@@ -479,7 +512,7 @@ static inline crypto_word_t constant_time_declassify_w(crypto_word_t v) {
|
|
|
479
512
|
return value_barrier_w(v);
|
|
480
513
|
}
|
|
481
514
|
|
|
482
|
-
|
|
515
|
+
inline int constant_time_declassify_int(int v) {
|
|
483
516
|
static_assert(sizeof(uint32_t) == sizeof(int),
|
|
484
517
|
"int is not the same size as uint32_t");
|
|
485
518
|
// See comment above.
|
|
@@ -487,8 +520,8 @@ static inline int constant_time_declassify_int(int v) {
|
|
|
487
520
|
return value_barrier_u32(v);
|
|
488
521
|
}
|
|
489
522
|
|
|
490
|
-
// declassify_assert behaves like
|
|
491
|
-
// evaluating
|
|
523
|
+
// declassify_assert behaves like `assert` but declassifies the result of
|
|
524
|
+
// evaluating `expr`. This allows the assertion to branch on the (presumably
|
|
492
525
|
// public) result, but still ensures that values leading up to the computation
|
|
493
526
|
// were secret.
|
|
494
527
|
#define declassify_assert(expr) assert(constant_time_declassify_int(expr))
|
|
@@ -509,167 +542,159 @@ typedef pthread_once_t CRYPTO_once_t;
|
|
|
509
542
|
#error "Unknown threading library"
|
|
510
543
|
#endif
|
|
511
544
|
|
|
512
|
-
// CRYPTO_once calls
|
|
513
|
-
// concurrent threads call
|
|
514
|
-
// then they will block until
|
|
545
|
+
// CRYPTO_once calls `init` exactly once per process. This is thread-safe: if
|
|
546
|
+
// concurrent threads call `CRYPTO_once` with the same `CRYPTO_once_t` argument
|
|
547
|
+
// then they will block until `init` completes, but `init` will have only been
|
|
515
548
|
// called once.
|
|
516
549
|
//
|
|
517
|
-
// The
|
|
518
|
-
// the value
|
|
519
|
-
OPENSSL_EXPORT void CRYPTO_once(CRYPTO_once_t *once, void (*init)(
|
|
550
|
+
// The `once` argument must be a `CRYPTO_once_t` that has been initialised with
|
|
551
|
+
// the value `CRYPTO_ONCE_INIT`.
|
|
552
|
+
OPENSSL_EXPORT void CRYPTO_once(CRYPTO_once_t *once, void (*init)());
|
|
520
553
|
|
|
521
554
|
|
|
522
555
|
// Atomics.
|
|
523
556
|
//
|
|
524
|
-
//
|
|
525
|
-
//
|
|
557
|
+
// This is a thin wrapper over std::atomic because some embedded platforms do
|
|
558
|
+
// not support threads and don't provide a trivial std::atomic implementation.
|
|
559
|
+
// For now, this does not wrap std::memory_order. If we ever use non-default
|
|
560
|
+
// std::memory_order, we will need to wrap these too, or fix the embedded
|
|
561
|
+
// platforms to provide a no-op std::atomic. See https://crbug.com/442112336.
|
|
526
562
|
|
|
527
563
|
#if defined(OPENSSL_THREADS)
|
|
528
|
-
|
|
529
|
-
using
|
|
530
|
-
|
|
531
|
-
static_assert(sizeof(CRYPTO_atomic_u32) == sizeof(uint32_t), "");
|
|
532
|
-
|
|
533
|
-
inline uint32_t CRYPTO_atomic_load_u32(const CRYPTO_atomic_u32 *val) {
|
|
534
|
-
return val->load(std::memory_order_seq_cst);
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
inline bool CRYPTO_atomic_compare_exchange_weak_u32(CRYPTO_atomic_u32 *val,
|
|
538
|
-
uint32_t *expected,
|
|
539
|
-
uint32_t desired) {
|
|
540
|
-
return val->compare_exchange_weak(
|
|
541
|
-
*expected, desired, std::memory_order_seq_cst, std::memory_order_seq_cst);
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
inline void CRYPTO_atomic_store_u32(CRYPTO_atomic_u32 *val, uint32_t desired) {
|
|
545
|
-
val->store(desired, std::memory_order_seq_cst);
|
|
546
|
-
}
|
|
547
|
-
|
|
564
|
+
template <typename T>
|
|
565
|
+
using Atomic = std::atomic<T>;
|
|
548
566
|
#else
|
|
567
|
+
template <typename T>
|
|
568
|
+
class Atomic {
|
|
569
|
+
public:
|
|
570
|
+
static_assert(std::is_integral_v<T> || std::is_pointer_v<T>);
|
|
571
|
+
|
|
572
|
+
Atomic() = default;
|
|
573
|
+
constexpr Atomic(T value) : value_(value) {}
|
|
574
|
+
Atomic(const Atomic &) = delete;
|
|
575
|
+
Atomic &operator=(const Atomic &) = delete;
|
|
576
|
+
T operator=(T value) {
|
|
577
|
+
value_ = value;
|
|
578
|
+
return value_;
|
|
579
|
+
}
|
|
549
580
|
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
inline uint32_t CRYPTO_atomic_load_u32(CRYPTO_atomic_u32 *val) { return *val; }
|
|
581
|
+
T load() const { return value_; }
|
|
582
|
+
void store(T desired) { value_ = desired; }
|
|
553
583
|
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
584
|
+
bool compare_exchange_strong(T &expected, T desired) {
|
|
585
|
+
if (value_ != expected) {
|
|
586
|
+
expected = value_;
|
|
587
|
+
return false;
|
|
588
|
+
}
|
|
589
|
+
value_ = desired;
|
|
590
|
+
return true;
|
|
591
|
+
}
|
|
592
|
+
bool compare_exchange_weak(T &expected, T desired) {
|
|
593
|
+
return compare_exchange_strong(expected, desired);
|
|
560
594
|
}
|
|
561
|
-
*val = desired;
|
|
562
|
-
return 1;
|
|
563
|
-
}
|
|
564
595
|
|
|
565
|
-
|
|
566
|
-
*val = desired;
|
|
567
|
-
}
|
|
596
|
+
T exchange(T desired) { return std::exchange(value_, desired); }
|
|
568
597
|
|
|
598
|
+
private:
|
|
599
|
+
T value_;
|
|
600
|
+
};
|
|
569
601
|
#endif
|
|
570
602
|
|
|
571
|
-
// See the comment in the |__cplusplus| section above.
|
|
572
|
-
static_assert(sizeof(CRYPTO_atomic_u32) == sizeof(uint32_t),
|
|
573
|
-
"CRYPTO_atomic_u32 does not match uint32_t size");
|
|
574
|
-
static_assert(alignof(CRYPTO_atomic_u32) == alignof(uint32_t),
|
|
575
|
-
"CRYPTO_atomic_u32 does not match uint32_t alignment");
|
|
576
|
-
|
|
577
603
|
|
|
578
604
|
// Reference counting.
|
|
579
605
|
|
|
580
606
|
// CRYPTO_REFCOUNT_MAX is the value at which the reference count saturates.
|
|
581
607
|
#define CRYPTO_REFCOUNT_MAX 0xffffffff
|
|
582
608
|
|
|
583
|
-
|
|
609
|
+
using CRYPTO_refcount_t = Atomic<uint32_t>;
|
|
610
|
+
|
|
611
|
+
// CRYPTO_refcount_inc atomically increments the value at `*count` unless the
|
|
584
612
|
// value would overflow. It's safe for multiple threads to concurrently call
|
|
585
|
-
// this or
|
|
586
|
-
//
|
|
613
|
+
// this or `CRYPTO_refcount_dec_and_test_zero` on the same
|
|
614
|
+
// `CRYPTO_refcount_t`.
|
|
587
615
|
OPENSSL_EXPORT void CRYPTO_refcount_inc(CRYPTO_refcount_t *count);
|
|
588
616
|
|
|
589
|
-
// CRYPTO_refcount_dec_and_test_zero tests the value at
|
|
617
|
+
// CRYPTO_refcount_dec_and_test_zero tests the value at `*count`:
|
|
590
618
|
// if it's zero, it crashes the address space.
|
|
591
619
|
// if it's the maximum value, it returns zero.
|
|
592
620
|
// otherwise, it atomically decrements it and returns one iff the resulting
|
|
593
621
|
// value is zero.
|
|
594
622
|
//
|
|
595
623
|
// It's safe for multiple threads to concurrently call this or
|
|
596
|
-
//
|
|
624
|
+
// `CRYPTO_refcount_inc` on the same `CRYPTO_refcount_t`.
|
|
597
625
|
OPENSSL_EXPORT int CRYPTO_refcount_dec_and_test_zero(CRYPTO_refcount_t *count);
|
|
598
626
|
|
|
599
627
|
|
|
600
628
|
// Locks.
|
|
601
629
|
|
|
630
|
+
// A Mutex is a read/write lock. It can be constant-initialized, but has a
|
|
631
|
+
// destructor. To allocate a global one, use StaticMutex, which skips the
|
|
632
|
+
// destructor.
|
|
633
|
+
class OPENSSL_EXPORT StaticMutex {
|
|
634
|
+
public:
|
|
635
|
+
constexpr StaticMutex() = default;
|
|
636
|
+
StaticMutex(const StaticMutex &) = delete;
|
|
637
|
+
StaticMutex &operator=(const StaticMutex &) = delete;
|
|
638
|
+
|
|
639
|
+
// LockRead locks the mutex such that other threads may also have a read lock,
|
|
640
|
+
// but none may have a write lock.
|
|
641
|
+
void LockRead();
|
|
642
|
+
// UnlockRead releases a read lock.
|
|
643
|
+
void UnlockRead();
|
|
644
|
+
|
|
645
|
+
// LockWrite locks the mutex such that no other thread has any type of lock on
|
|
646
|
+
// it.
|
|
647
|
+
void LockWrite();
|
|
648
|
+
// UnlockWrite releases a write lock.
|
|
649
|
+
void UnlockWrite();
|
|
650
|
+
|
|
651
|
+
protected:
|
|
602
652
|
#if !defined(OPENSSL_THREADS)
|
|
603
|
-
|
|
604
|
-
char padding; // Empty structs have different sizes in C and C++.
|
|
605
|
-
} CRYPTO_MUTEX;
|
|
606
|
-
#define CRYPTO_MUTEX_INIT {0}
|
|
653
|
+
// Nothing.
|
|
607
654
|
#elif defined(OPENSSL_WINDOWS_THREADS)
|
|
608
|
-
|
|
609
|
-
#define CRYPTO_MUTEX_INIT SRWLOCK_INIT
|
|
655
|
+
SRWLOCK lock_ = SRWLOCK_INIT;
|
|
610
656
|
#elif defined(OPENSSL_PTHREADS)
|
|
611
|
-
|
|
612
|
-
#define CRYPTO_MUTEX_INIT PTHREAD_RWLOCK_INITIALIZER
|
|
657
|
+
pthread_rwlock_t lock_ = PTHREAD_RWLOCK_INITIALIZER;
|
|
613
658
|
#else
|
|
614
659
|
#error "Unknown threading library"
|
|
615
660
|
#endif
|
|
661
|
+
};
|
|
616
662
|
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
// read lock, but none may have a write lock.
|
|
623
|
-
OPENSSL_EXPORT void CRYPTO_MUTEX_lock_read(CRYPTO_MUTEX *lock);
|
|
624
|
-
|
|
625
|
-
// CRYPTO_MUTEX_lock_write locks |lock| such that no other thread has any type
|
|
626
|
-
// of lock on it.
|
|
627
|
-
OPENSSL_EXPORT void CRYPTO_MUTEX_lock_write(CRYPTO_MUTEX *lock);
|
|
628
|
-
|
|
629
|
-
// CRYPTO_MUTEX_unlock_read unlocks |lock| for reading.
|
|
630
|
-
OPENSSL_EXPORT void CRYPTO_MUTEX_unlock_read(CRYPTO_MUTEX *lock);
|
|
631
|
-
|
|
632
|
-
// CRYPTO_MUTEX_unlock_write unlocks |lock| for writing.
|
|
633
|
-
OPENSSL_EXPORT void CRYPTO_MUTEX_unlock_write(CRYPTO_MUTEX *lock);
|
|
634
|
-
|
|
635
|
-
// CRYPTO_MUTEX_cleanup releases all resources held by |lock|.
|
|
636
|
-
OPENSSL_EXPORT void CRYPTO_MUTEX_cleanup(CRYPTO_MUTEX *lock);
|
|
637
|
-
|
|
638
|
-
#if defined(__cplusplus)
|
|
639
|
-
extern "C++" {
|
|
640
|
-
|
|
641
|
-
BSSL_NAMESPACE_BEGIN
|
|
663
|
+
class OPENSSL_EXPORT Mutex : public StaticMutex {
|
|
664
|
+
public:
|
|
665
|
+
constexpr Mutex() = default;
|
|
666
|
+
~Mutex();
|
|
667
|
+
};
|
|
642
668
|
|
|
643
669
|
namespace internal {
|
|
644
670
|
|
|
645
|
-
// MutexLockBase is a RAII helper for
|
|
646
|
-
template <void (
|
|
671
|
+
// MutexLockBase is a RAII helper for Mutex locking.
|
|
672
|
+
template <void (StaticMutex::*LockMethod)(),
|
|
673
|
+
void (StaticMutex::*ReleaseMethod)()>
|
|
647
674
|
class MutexLockBase {
|
|
648
675
|
public:
|
|
649
|
-
explicit MutexLockBase(
|
|
676
|
+
explicit MutexLockBase(StaticMutex *mu) : mu_(mu) {
|
|
650
677
|
assert(mu_ != nullptr);
|
|
651
|
-
|
|
678
|
+
(mu_->*LockMethod)();
|
|
652
679
|
}
|
|
653
|
-
~MutexLockBase() {
|
|
654
|
-
MutexLockBase(const MutexLockBase
|
|
655
|
-
MutexLockBase &operator=(const MutexLockBase
|
|
656
|
-
delete;
|
|
680
|
+
~MutexLockBase() { (mu_->*ReleaseMethod)(); }
|
|
681
|
+
MutexLockBase(const MutexLockBase &) = delete;
|
|
682
|
+
MutexLockBase &operator=(const MutexLockBase &) = delete;
|
|
657
683
|
|
|
658
684
|
private:
|
|
659
|
-
|
|
685
|
+
StaticMutex *const mu_;
|
|
660
686
|
};
|
|
661
687
|
|
|
662
688
|
} // namespace internal
|
|
663
689
|
|
|
664
690
|
using MutexWriteLock =
|
|
665
|
-
internal::MutexLockBase
|
|
691
|
+
internal::MutexLockBase<&StaticMutex::LockWrite, &StaticMutex::UnlockWrite>;
|
|
666
692
|
using MutexReadLock =
|
|
667
|
-
internal::MutexLockBase
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
#endif // defined(__cplusplus)
|
|
693
|
+
internal::MutexLockBase<&StaticMutex::LockRead, &StaticMutex::UnlockRead>;
|
|
694
|
+
using MutexWriteUnlock =
|
|
695
|
+
internal::MutexLockBase<&StaticMutex::UnlockWrite, &StaticMutex::LockWrite>;
|
|
696
|
+
using MutexReadUnlock =
|
|
697
|
+
internal::MutexLockBase<&StaticMutex::UnlockRead, &StaticMutex::LockRead>;
|
|
673
698
|
|
|
674
699
|
|
|
675
700
|
// Thread local storage.
|
|
@@ -695,18 +720,18 @@ OPENSSL_EXPORT void *CRYPTO_get_thread_local(thread_local_data_t value);
|
|
|
695
720
|
|
|
696
721
|
// CRYPTO_set_thread_local sets a pointer value for the current thread at the
|
|
697
722
|
// given index. This function should only be called once per thread for a given
|
|
698
|
-
//
|
|
723
|
+
// `index`: rather than update the pointer value itself, update the data that
|
|
699
724
|
// is pointed to.
|
|
700
725
|
//
|
|
701
726
|
// The destructor function will be called when a thread exits to free this
|
|
702
|
-
// thread-local data. All calls to
|
|
703
|
-
//
|
|
727
|
+
// thread-local data. All calls to `CRYPTO_set_thread_local` with the same
|
|
728
|
+
// `index` should have the same `destructor` argument. The destructor may be
|
|
704
729
|
// called with a NULL argument if a thread that never set a thread-local
|
|
705
|
-
// pointer for
|
|
730
|
+
// pointer for `index`, exits. The destructor may be called concurrently with
|
|
706
731
|
// different arguments.
|
|
707
732
|
//
|
|
708
733
|
// This function returns one on success or zero on error. If it returns zero
|
|
709
|
-
// then
|
|
734
|
+
// then `destructor` has been called with `value` already.
|
|
710
735
|
OPENSSL_EXPORT int CRYPTO_set_thread_local(
|
|
711
736
|
thread_local_data_t index, void *value,
|
|
712
737
|
thread_local_destructor_t destructor);
|
|
@@ -714,33 +739,40 @@ OPENSSL_EXPORT int CRYPTO_set_thread_local(
|
|
|
714
739
|
|
|
715
740
|
// ex_data
|
|
716
741
|
|
|
717
|
-
|
|
742
|
+
BSSL_NAMESPACE_END
|
|
743
|
+
|
|
744
|
+
struct crypto_ex_data_st {
|
|
745
|
+
STACK_OF(void) *sk;
|
|
746
|
+
} /* CRYPTO_EX_DATA */;
|
|
747
|
+
|
|
748
|
+
BSSL_NAMESPACE_BEGIN
|
|
749
|
+
|
|
750
|
+
struct ExDataFuncs;
|
|
718
751
|
|
|
719
|
-
//
|
|
752
|
+
// ExDataClass tracks the ex_indices registered for a type which
|
|
720
753
|
// supports ex_data. It should defined as a static global within the module
|
|
721
754
|
// which defines that type.
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
//
|
|
729
|
-
|
|
755
|
+
struct ExDataClass {
|
|
756
|
+
explicit constexpr ExDataClass(bool with_app_data = false)
|
|
757
|
+
: num_reserved(with_app_data ? 1 : 0) {}
|
|
758
|
+
|
|
759
|
+
StaticMutex lock;
|
|
760
|
+
// funcs is a linked list of `ExDataFuncs` structures. It may be traversed
|
|
761
|
+
// without serialization only up to `num_funcs`. last points to the final
|
|
762
|
+
// entry of `funcs`, or nullptr if empty.
|
|
763
|
+
ExDataFuncs *funcs = nullptr, *last = nullptr;
|
|
764
|
+
// num_funcs is the number of entries in `funcs`.
|
|
765
|
+
Atomic<uint32_t> num_funcs = 0;
|
|
730
766
|
// num_reserved is one if the ex_data index zero is reserved for legacy
|
|
731
|
-
//
|
|
732
|
-
uint8_t num_reserved;
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
#define CRYPTO_EX_DATA_CLASS_INIT {CRYPTO_MUTEX_INIT, NULL, NULL, {}, 0}
|
|
736
|
-
#define CRYPTO_EX_DATA_CLASS_INIT_WITH_APP_DATA \
|
|
737
|
-
{CRYPTO_MUTEX_INIT, NULL, NULL, {}, 1}
|
|
767
|
+
// `TYPE_get_app_data` functions.
|
|
768
|
+
uint8_t num_reserved = 0;
|
|
769
|
+
};
|
|
738
770
|
|
|
739
|
-
// CRYPTO_get_ex_new_index_ex allocates a new index for
|
|
771
|
+
// CRYPTO_get_ex_new_index_ex allocates a new index for `ex_data_class`. Each
|
|
740
772
|
// class of object should provide a wrapper function that uses the correct
|
|
741
|
-
//
|
|
773
|
+
// `ExDataClass`. It returns the new index on success and -1 on error.
|
|
742
774
|
OPENSSL_EXPORT int CRYPTO_get_ex_new_index_ex(
|
|
743
|
-
|
|
775
|
+
ExDataClass *ex_data_class, long argl, void *argp,
|
|
744
776
|
CRYPTO_EX_free *free_func);
|
|
745
777
|
|
|
746
778
|
// CRYPTO_set_ex_data sets an extra data pointer on a given object. Each class
|
|
@@ -752,46 +784,39 @@ OPENSSL_EXPORT int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int index, void *val);
|
|
|
752
784
|
// function.
|
|
753
785
|
OPENSSL_EXPORT void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int index);
|
|
754
786
|
|
|
755
|
-
// CRYPTO_new_ex_data initialises a newly allocated
|
|
787
|
+
// CRYPTO_new_ex_data initialises a newly allocated `CRYPTO_EX_DATA`.
|
|
756
788
|
OPENSSL_EXPORT void CRYPTO_new_ex_data(CRYPTO_EX_DATA *ad);
|
|
757
789
|
|
|
758
|
-
// CRYPTO_free_ex_data frees
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
void *obj, CRYPTO_EX_DATA *ad);
|
|
790
|
+
// CRYPTO_free_ex_data frees `ad`, which is an object of the given class.
|
|
791
|
+
OPENSSL_EXPORT void CRYPTO_free_ex_data(ExDataClass *ex_data_class,
|
|
792
|
+
CRYPTO_EX_DATA *ad);
|
|
762
793
|
|
|
763
794
|
|
|
764
795
|
// Endianness conversions.
|
|
765
796
|
|
|
766
797
|
#if defined(__GNUC__) && __GNUC__ >= 2
|
|
767
|
-
|
|
768
|
-
return __builtin_bswap16(x);
|
|
769
|
-
}
|
|
798
|
+
inline uint16_t CRYPTO_bswap2(uint16_t x) { return __builtin_bswap16(x); }
|
|
770
799
|
|
|
771
|
-
|
|
772
|
-
return __builtin_bswap32(x);
|
|
773
|
-
}
|
|
800
|
+
inline uint32_t CRYPTO_bswap4(uint32_t x) { return __builtin_bswap32(x); }
|
|
774
801
|
|
|
775
|
-
|
|
776
|
-
return __builtin_bswap64(x);
|
|
777
|
-
}
|
|
802
|
+
inline uint64_t CRYPTO_bswap8(uint64_t x) { return __builtin_bswap64(x); }
|
|
778
803
|
#elif defined(_MSC_VER)
|
|
779
804
|
#pragma intrinsic(_byteswap_uint64, _byteswap_ulong, _byteswap_ushort)
|
|
780
|
-
|
|
805
|
+
inline uint16_t CRYPTO_bswap2(uint16_t x) { return _byteswap_ushort(x); }
|
|
781
806
|
|
|
782
|
-
|
|
807
|
+
inline uint32_t CRYPTO_bswap4(uint32_t x) { return _byteswap_ulong(x); }
|
|
783
808
|
|
|
784
|
-
|
|
809
|
+
inline uint64_t CRYPTO_bswap8(uint64_t x) { return _byteswap_uint64(x); }
|
|
785
810
|
#else
|
|
786
|
-
|
|
811
|
+
inline uint16_t CRYPTO_bswap2(uint16_t x) { return (x >> 8) | (x << 8); }
|
|
787
812
|
|
|
788
|
-
|
|
813
|
+
inline uint32_t CRYPTO_bswap4(uint32_t x) {
|
|
789
814
|
x = (x >> 16) | (x << 16);
|
|
790
815
|
x = ((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8);
|
|
791
816
|
return x;
|
|
792
817
|
}
|
|
793
818
|
|
|
794
|
-
|
|
819
|
+
inline uint64_t CRYPTO_bswap8(uint64_t x) {
|
|
795
820
|
return CRYPTO_bswap4(x >> 32) | (((uint64_t)CRYPTO_bswap4(x)) << 32);
|
|
796
821
|
}
|
|
797
822
|
#endif
|
|
@@ -808,42 +833,26 @@ static inline uint64_t CRYPTO_bswap8(uint64_t x) {
|
|
|
808
833
|
// These wrapper functions behave the same as the corresponding C standard
|
|
809
834
|
// functions, but behave as expected when passed NULL if the length is zero.
|
|
810
835
|
//
|
|
811
|
-
// Note
|
|
812
|
-
|
|
813
|
-
// C++ defines |memchr| as a const-correct overload.
|
|
814
|
-
#if defined(__cplusplus)
|
|
815
|
-
extern "C++" {
|
|
836
|
+
// Note `OPENSSL_memcmp` is a different function from `CRYPTO_memcmp`.
|
|
816
837
|
|
|
817
|
-
|
|
838
|
+
// C++ defines `memchr` as a const-correct overload.
|
|
839
|
+
inline const void *OPENSSL_memchr(const void *s, int c, size_t n) {
|
|
818
840
|
if (n == 0) {
|
|
819
|
-
return
|
|
841
|
+
return nullptr;
|
|
820
842
|
}
|
|
821
843
|
|
|
822
844
|
return memchr(s, c, n);
|
|
823
845
|
}
|
|
824
846
|
|
|
825
|
-
|
|
847
|
+
inline void *OPENSSL_memchr(void *s, int c, size_t n) {
|
|
826
848
|
if (n == 0) {
|
|
827
|
-
return
|
|
849
|
+
return nullptr;
|
|
828
850
|
}
|
|
829
851
|
|
|
830
852
|
return memchr(s, c, n);
|
|
831
853
|
}
|
|
832
854
|
|
|
833
|
-
|
|
834
|
-
#else // __cplusplus
|
|
835
|
-
|
|
836
|
-
static inline void *OPENSSL_memchr(const void *s, int c, size_t n) {
|
|
837
|
-
if (n == 0) {
|
|
838
|
-
return NULL;
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
return memchr(s, c, n);
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
#endif // __cplusplus
|
|
845
|
-
|
|
846
|
-
static inline int OPENSSL_memcmp(const void *s1, const void *s2, size_t n) {
|
|
855
|
+
inline int OPENSSL_memcmp(const void *s1, const void *s2, size_t n) {
|
|
847
856
|
if (n == 0) {
|
|
848
857
|
return 0;
|
|
849
858
|
}
|
|
@@ -851,7 +860,7 @@ static inline int OPENSSL_memcmp(const void *s1, const void *s2, size_t n) {
|
|
|
851
860
|
return memcmp(s1, s2, n);
|
|
852
861
|
}
|
|
853
862
|
|
|
854
|
-
|
|
863
|
+
inline void *OPENSSL_memcpy(void *dst, const void *src, size_t n) {
|
|
855
864
|
if (n == 0) {
|
|
856
865
|
return dst;
|
|
857
866
|
}
|
|
@@ -859,7 +868,7 @@ static inline void *OPENSSL_memcpy(void *dst, const void *src, size_t n) {
|
|
|
859
868
|
return memcpy(dst, src, n);
|
|
860
869
|
}
|
|
861
870
|
|
|
862
|
-
|
|
871
|
+
inline void *OPENSSL_memmove(void *dst, const void *src, size_t n) {
|
|
863
872
|
if (n == 0) {
|
|
864
873
|
return dst;
|
|
865
874
|
}
|
|
@@ -867,7 +876,7 @@ static inline void *OPENSSL_memmove(void *dst, const void *src, size_t n) {
|
|
|
867
876
|
return memmove(dst, src, n);
|
|
868
877
|
}
|
|
869
878
|
|
|
870
|
-
|
|
879
|
+
inline void *OPENSSL_memset(void *dst, int c, size_t n) {
|
|
871
880
|
if (n == 0) {
|
|
872
881
|
return dst;
|
|
873
882
|
}
|
|
@@ -879,73 +888,83 @@ static inline void *OPENSSL_memset(void *dst, int c, size_t n) {
|
|
|
879
888
|
// Loads and stores.
|
|
880
889
|
//
|
|
881
890
|
// The following functions load and store sized integers with the specified
|
|
882
|
-
// endianness. They use
|
|
891
|
+
// endianness. They use `memcpy`, and so avoid alignment or strict aliasing
|
|
883
892
|
// requirements on the input and output pointers.
|
|
884
893
|
|
|
885
|
-
|
|
894
|
+
inline uint16_t CRYPTO_load_u16_le(const void *in) {
|
|
895
|
+
uint16_t v;
|
|
896
|
+
OPENSSL_memcpy(&v, in, sizeof(v));
|
|
897
|
+
return v;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
inline void CRYPTO_store_u16_le(void *out, uint16_t v) {
|
|
901
|
+
OPENSSL_memcpy(out, &v, sizeof(v));
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
inline uint16_t CRYPTO_load_u16_be(const void *in) {
|
|
886
905
|
uint16_t v;
|
|
887
906
|
OPENSSL_memcpy(&v, in, sizeof(v));
|
|
888
907
|
return CRYPTO_bswap2(v);
|
|
889
908
|
}
|
|
890
909
|
|
|
891
|
-
|
|
910
|
+
inline void CRYPTO_store_u16_be(void *out, uint16_t v) {
|
|
892
911
|
v = CRYPTO_bswap2(v);
|
|
893
912
|
OPENSSL_memcpy(out, &v, sizeof(v));
|
|
894
913
|
}
|
|
895
914
|
|
|
896
|
-
|
|
915
|
+
inline uint32_t CRYPTO_load_u32_le(const void *in) {
|
|
897
916
|
uint32_t v;
|
|
898
917
|
OPENSSL_memcpy(&v, in, sizeof(v));
|
|
899
918
|
return v;
|
|
900
919
|
}
|
|
901
920
|
|
|
902
|
-
|
|
921
|
+
inline void CRYPTO_store_u32_le(void *out, uint32_t v) {
|
|
903
922
|
OPENSSL_memcpy(out, &v, sizeof(v));
|
|
904
923
|
}
|
|
905
924
|
|
|
906
|
-
|
|
925
|
+
inline uint32_t CRYPTO_load_u32_be(const void *in) {
|
|
907
926
|
uint32_t v;
|
|
908
927
|
OPENSSL_memcpy(&v, in, sizeof(v));
|
|
909
928
|
return CRYPTO_bswap4(v);
|
|
910
929
|
}
|
|
911
930
|
|
|
912
|
-
|
|
931
|
+
inline void CRYPTO_store_u32_be(void *out, uint32_t v) {
|
|
913
932
|
v = CRYPTO_bswap4(v);
|
|
914
933
|
OPENSSL_memcpy(out, &v, sizeof(v));
|
|
915
934
|
}
|
|
916
935
|
|
|
917
|
-
|
|
936
|
+
inline uint64_t CRYPTO_load_u64_le(const void *in) {
|
|
918
937
|
uint64_t v;
|
|
919
938
|
OPENSSL_memcpy(&v, in, sizeof(v));
|
|
920
939
|
return v;
|
|
921
940
|
}
|
|
922
941
|
|
|
923
|
-
|
|
942
|
+
inline void CRYPTO_store_u64_le(void *out, uint64_t v) {
|
|
924
943
|
OPENSSL_memcpy(out, &v, sizeof(v));
|
|
925
944
|
}
|
|
926
945
|
|
|
927
|
-
|
|
946
|
+
inline uint64_t CRYPTO_load_u64_be(const void *ptr) {
|
|
928
947
|
uint64_t ret;
|
|
929
948
|
OPENSSL_memcpy(&ret, ptr, sizeof(ret));
|
|
930
949
|
return CRYPTO_bswap8(ret);
|
|
931
950
|
}
|
|
932
951
|
|
|
933
|
-
|
|
952
|
+
inline void CRYPTO_store_u64_be(void *out, uint64_t v) {
|
|
934
953
|
v = CRYPTO_bswap8(v);
|
|
935
954
|
OPENSSL_memcpy(out, &v, sizeof(v));
|
|
936
955
|
}
|
|
937
956
|
|
|
938
|
-
|
|
957
|
+
inline crypto_word_t CRYPTO_load_word_le(const void *in) {
|
|
939
958
|
crypto_word_t v;
|
|
940
959
|
OPENSSL_memcpy(&v, in, sizeof(v));
|
|
941
960
|
return v;
|
|
942
961
|
}
|
|
943
962
|
|
|
944
|
-
|
|
963
|
+
inline void CRYPTO_store_word_le(void *out, crypto_word_t v) {
|
|
945
964
|
OPENSSL_memcpy(out, &v, sizeof(v));
|
|
946
965
|
}
|
|
947
966
|
|
|
948
|
-
|
|
967
|
+
inline crypto_word_t CRYPTO_load_word_be(const void *in) {
|
|
949
968
|
crypto_word_t v;
|
|
950
969
|
OPENSSL_memcpy(&v, in, sizeof(v));
|
|
951
970
|
#if defined(OPENSSL_64_BIT)
|
|
@@ -960,11 +979,11 @@ static inline crypto_word_t CRYPTO_load_word_be(const void *in) {
|
|
|
960
979
|
|
|
961
980
|
// Bit rotation functions.
|
|
962
981
|
//
|
|
963
|
-
// Note these functions use
|
|
982
|
+
// Note these functions use `(-shift) & 31`, etc., because shifting by the bit
|
|
964
983
|
// width is undefined. Both Clang and GCC recognize this pattern as a rotation,
|
|
965
984
|
// but MSVC does not. Instead, we call MSVC's built-in functions.
|
|
966
985
|
|
|
967
|
-
|
|
986
|
+
inline uint32_t CRYPTO_rotl_u32(uint32_t value, int shift) {
|
|
968
987
|
#if defined(_MSC_VER)
|
|
969
988
|
return _rotl(value, shift);
|
|
970
989
|
#else
|
|
@@ -972,7 +991,7 @@ static inline uint32_t CRYPTO_rotl_u32(uint32_t value, int shift) {
|
|
|
972
991
|
#endif
|
|
973
992
|
}
|
|
974
993
|
|
|
975
|
-
|
|
994
|
+
inline uint32_t CRYPTO_rotr_u32(uint32_t value, int shift) {
|
|
976
995
|
#if defined(_MSC_VER)
|
|
977
996
|
return _rotr(value, shift);
|
|
978
997
|
#else
|
|
@@ -980,7 +999,7 @@ static inline uint32_t CRYPTO_rotr_u32(uint32_t value, int shift) {
|
|
|
980
999
|
#endif
|
|
981
1000
|
}
|
|
982
1001
|
|
|
983
|
-
|
|
1002
|
+
inline uint64_t CRYPTO_rotl_u64(uint64_t value, int shift) {
|
|
984
1003
|
#if defined(_MSC_VER)
|
|
985
1004
|
return _rotl64(value, shift);
|
|
986
1005
|
#else
|
|
@@ -988,7 +1007,7 @@ static inline uint64_t CRYPTO_rotl_u64(uint64_t value, int shift) {
|
|
|
988
1007
|
#endif
|
|
989
1008
|
}
|
|
990
1009
|
|
|
991
|
-
|
|
1010
|
+
inline uint64_t CRYPTO_rotr_u64(uint64_t value, int shift) {
|
|
992
1011
|
#if defined(_MSC_VER)
|
|
993
1012
|
return _rotr64(value, shift);
|
|
994
1013
|
#else
|
|
@@ -1004,61 +1023,67 @@ static inline uint64_t CRYPTO_rotr_u64(uint64_t value, int shift) {
|
|
|
1004
1023
|
// BORINGSSL_FIPS_abort is called when a FIPS power-on or continuous test
|
|
1005
1024
|
// fails. It prevents any further cryptographic operations by the current
|
|
1006
1025
|
// process.
|
|
1007
|
-
void BORINGSSL_FIPS_abort(
|
|
1026
|
+
void BORINGSSL_FIPS_abort() __attribute__((noreturn));
|
|
1008
1027
|
|
|
1009
1028
|
// boringssl_self_test_startup runs all startup self tests and returns one on
|
|
1010
1029
|
// success or zero on error. Startup self tests do not include lazy tests.
|
|
1011
|
-
// Call
|
|
1012
|
-
int boringssl_self_test_startup(
|
|
1030
|
+
// Call `BORINGSSL_self_test` to run every self test.
|
|
1031
|
+
int boringssl_self_test_startup();
|
|
1032
|
+
|
|
1033
|
+
// boringssl_ensure_rsa_sign_self_test checks whether the RSA signing self-test
|
|
1034
|
+
// has been run in this address space. If not, it runs it and crashes the
|
|
1035
|
+
// address space if unsuccessful.
|
|
1036
|
+
void boringssl_ensure_rsa_sign_self_test();
|
|
1013
1037
|
|
|
1014
|
-
//
|
|
1015
|
-
// in this address space. If not, it runs it and crashes
|
|
1016
|
-
// unsuccessful.
|
|
1017
|
-
void
|
|
1038
|
+
// boringssl_ensure_rsa_verify_self_test checks whether the RSA verification
|
|
1039
|
+
// self-test has been run in this address space. If not, it runs it and crashes
|
|
1040
|
+
// the address space if unsuccessful.
|
|
1041
|
+
void boringssl_ensure_rsa_verify_self_test();
|
|
1018
1042
|
|
|
1019
1043
|
// boringssl_ensure_ecc_self_test checks whether the ECDSA and ECDH self-test
|
|
1020
1044
|
// has been run in this address space. If not, it runs it and crashes the
|
|
1021
1045
|
// address space if unsuccessful.
|
|
1022
|
-
void boringssl_ensure_ecc_self_test(
|
|
1046
|
+
void boringssl_ensure_ecc_self_test();
|
|
1023
1047
|
|
|
1024
1048
|
// boringssl_ensure_ffdh_self_test checks whether the FFDH self-test has been
|
|
1025
1049
|
// run in this address space. If not, it runs it and crashes the address space
|
|
1026
1050
|
// if unsuccessful.
|
|
1027
|
-
void boringssl_ensure_ffdh_self_test(
|
|
1051
|
+
void boringssl_ensure_ffdh_self_test();
|
|
1028
1052
|
|
|
1029
1053
|
#else
|
|
1030
1054
|
|
|
1031
1055
|
// Outside of FIPS mode, the lazy tests are no-ops.
|
|
1032
1056
|
|
|
1033
|
-
inline void
|
|
1034
|
-
inline void
|
|
1035
|
-
inline void
|
|
1057
|
+
inline void boringssl_ensure_rsa_sign_self_test() {}
|
|
1058
|
+
inline void boringssl_ensure_rsa_verify_self_test() {}
|
|
1059
|
+
inline void boringssl_ensure_ecc_self_test() {}
|
|
1060
|
+
inline void boringssl_ensure_ffdh_self_test() {}
|
|
1036
1061
|
|
|
1037
1062
|
#endif // FIPS
|
|
1038
1063
|
|
|
1039
|
-
// BORINGSSL_check_test
|
|
1040
|
-
// success and, on failure, it prints an error message that
|
|
1041
|
-
// hexdumps the two values and returns 0.
|
|
1042
|
-
int BORINGSSL_check_test(const
|
|
1043
|
-
|
|
1064
|
+
// BORINGSSL_check_test checks that `expected` and `actual` are equal. It
|
|
1065
|
+
// returns 1 on success and, on failure, it prints an error message that
|
|
1066
|
+
// includes the hexdumps the two values and returns 0.
|
|
1067
|
+
int BORINGSSL_check_test(Span<const uint8_t> expected,
|
|
1068
|
+
Span<const uint8_t> actual, const char *name);
|
|
1044
1069
|
|
|
1045
1070
|
// boringssl_self_test_sha256 performs a SHA-256 KAT.
|
|
1046
|
-
int boringssl_self_test_sha256(
|
|
1071
|
+
int boringssl_self_test_sha256();
|
|
1047
1072
|
|
|
1048
1073
|
// boringssl_self_test_sha512 performs a SHA-512 KAT.
|
|
1049
|
-
int boringssl_self_test_sha512(
|
|
1074
|
+
int boringssl_self_test_sha512();
|
|
1050
1075
|
|
|
1051
1076
|
// boringssl_self_test_hmac_sha256 performs an HMAC-SHA-256 KAT.
|
|
1052
|
-
int boringssl_self_test_hmac_sha256(
|
|
1077
|
+
int boringssl_self_test_hmac_sha256();
|
|
1053
1078
|
|
|
1054
1079
|
// boringssl_self_test_mlkem performs the ML-KEM KATs.
|
|
1055
|
-
OPENSSL_EXPORT int boringssl_self_test_mlkem(
|
|
1080
|
+
OPENSSL_EXPORT int boringssl_self_test_mlkem();
|
|
1056
1081
|
|
|
1057
1082
|
// boringssl_self_test_mldsa performs the ML-DSA KATs.
|
|
1058
|
-
OPENSSL_EXPORT int boringssl_self_test_mldsa(
|
|
1083
|
+
OPENSSL_EXPORT int boringssl_self_test_mldsa();
|
|
1059
1084
|
|
|
1060
1085
|
// boringssl_self_test_slhdsa performs the SLH-DSA KATs.
|
|
1061
|
-
OPENSSL_EXPORT int boringssl_self_test_slhdsa(
|
|
1086
|
+
OPENSSL_EXPORT int boringssl_self_test_slhdsa();
|
|
1062
1087
|
|
|
1063
1088
|
#if defined(BORINGSSL_FIPS_COUNTERS)
|
|
1064
1089
|
void boringssl_fips_inc_counter(enum fips_counter_t counter);
|
|
@@ -1069,7 +1094,7 @@ inline void boringssl_fips_inc_counter(enum fips_counter_t counter) {}
|
|
|
1069
1094
|
#if defined(BORINGSSL_FIPS_BREAK_TESTS)
|
|
1070
1095
|
inline int boringssl_fips_break_test(const char *test) {
|
|
1071
1096
|
const char *const value = getenv("BORINGSSL_FIPS_BREAK_TEST");
|
|
1072
|
-
return value !=
|
|
1097
|
+
return value != nullptr && strcmp(value, test) == 0;
|
|
1073
1098
|
}
|
|
1074
1099
|
#else
|
|
1075
1100
|
inline int boringssl_fips_break_test(const char *test) { return 0; }
|
|
@@ -1098,24 +1123,29 @@ inline int boringssl_fips_break_test(const char *test) { return 0; }
|
|
|
1098
1123
|
// and AVX512 bits in XCR0, so it is not necessary to check those. (WARNING: See
|
|
1099
1124
|
// caveats in cpu_intel.c.)
|
|
1100
1125
|
//
|
|
1101
|
-
// This symbol should only be accessed with
|
|
1126
|
+
// This symbol should only be accessed with `OPENSSL_get_ia32cap`.
|
|
1102
1127
|
extern uint32_t OPENSSL_ia32cap_P[4];
|
|
1103
1128
|
|
|
1104
|
-
// OPENSSL_get_ia32cap initializes the library if needed and returns the
|
|
1105
|
-
// entry of
|
|
1129
|
+
// OPENSSL_get_ia32cap initializes the library if needed and returns the `idx`th
|
|
1130
|
+
// entry of `OPENSSL_ia32cap_P`. It is marked as a const function so duplicate
|
|
1106
1131
|
// calls can be merged by the compiler, at least when indices match.
|
|
1107
1132
|
OPENSSL_ATTR_CONST uint32_t OPENSSL_get_ia32cap(int idx);
|
|
1108
1133
|
|
|
1134
|
+
// OPENSSL_adjust_ia32cap adjusts `cap`, which should contain
|
|
1135
|
+
// `OPENSSL_ia32cap_P`, based on the environment variable value in `env`. This
|
|
1136
|
+
// function is exposed for unit tests.
|
|
1137
|
+
void OPENSSL_adjust_ia32cap(uint32_t cap[4], const char *env);
|
|
1138
|
+
|
|
1109
1139
|
// See Intel manual, volume 2A, table 3-11.
|
|
1110
1140
|
|
|
1111
|
-
inline int CRYPTO_is_intel_cpu(
|
|
1141
|
+
inline int CRYPTO_is_intel_cpu() {
|
|
1112
1142
|
// The reserved bit 30 is used to indicate an Intel CPU.
|
|
1113
1143
|
return (OPENSSL_get_ia32cap(0) & (1u << 30)) != 0;
|
|
1114
1144
|
}
|
|
1115
1145
|
|
|
1116
1146
|
// See Intel manual, volume 2A, table 3-10.
|
|
1117
1147
|
|
|
1118
|
-
inline int CRYPTO_is_PCLMUL_capable(
|
|
1148
|
+
inline int CRYPTO_is_PCLMUL_capable() {
|
|
1119
1149
|
#if defined(__PCLMUL__)
|
|
1120
1150
|
return 1;
|
|
1121
1151
|
#else
|
|
@@ -1123,7 +1153,7 @@ inline int CRYPTO_is_PCLMUL_capable(void) {
|
|
|
1123
1153
|
#endif
|
|
1124
1154
|
}
|
|
1125
1155
|
|
|
1126
|
-
inline int CRYPTO_is_SSSE3_capable(
|
|
1156
|
+
inline int CRYPTO_is_SSSE3_capable() {
|
|
1127
1157
|
#if defined(__SSSE3__)
|
|
1128
1158
|
return 1;
|
|
1129
1159
|
#else
|
|
@@ -1131,7 +1161,7 @@ inline int CRYPTO_is_SSSE3_capable(void) {
|
|
|
1131
1161
|
#endif
|
|
1132
1162
|
}
|
|
1133
1163
|
|
|
1134
|
-
inline int CRYPTO_is_SSE4_1_capable(
|
|
1164
|
+
inline int CRYPTO_is_SSE4_1_capable() {
|
|
1135
1165
|
#if defined(__SSE4_1__)
|
|
1136
1166
|
return 1;
|
|
1137
1167
|
#else
|
|
@@ -1139,7 +1169,7 @@ inline int CRYPTO_is_SSE4_1_capable(void) {
|
|
|
1139
1169
|
#endif
|
|
1140
1170
|
}
|
|
1141
1171
|
|
|
1142
|
-
inline int CRYPTO_is_MOVBE_capable(
|
|
1172
|
+
inline int CRYPTO_is_MOVBE_capable() {
|
|
1143
1173
|
#if defined(__MOVBE__)
|
|
1144
1174
|
return 1;
|
|
1145
1175
|
#else
|
|
@@ -1147,7 +1177,7 @@ inline int CRYPTO_is_MOVBE_capable(void) {
|
|
|
1147
1177
|
#endif
|
|
1148
1178
|
}
|
|
1149
1179
|
|
|
1150
|
-
inline int CRYPTO_is_AESNI_capable(
|
|
1180
|
+
inline int CRYPTO_is_AESNI_capable() {
|
|
1151
1181
|
#if defined(__AES__)
|
|
1152
1182
|
return 1;
|
|
1153
1183
|
#else
|
|
@@ -1155,10 +1185,10 @@ inline int CRYPTO_is_AESNI_capable(void) {
|
|
|
1155
1185
|
#endif
|
|
1156
1186
|
}
|
|
1157
1187
|
|
|
1158
|
-
// We intentionally avoid defining a
|
|
1159
|
-
//
|
|
1188
|
+
// We intentionally avoid defining a `CRYPTO_is_XSAVE_capable` function. See
|
|
1189
|
+
// `CRYPTO_cpu_perf_is_like_silvermont`.
|
|
1160
1190
|
|
|
1161
|
-
inline int CRYPTO_is_AVX_capable(
|
|
1191
|
+
inline int CRYPTO_is_AVX_capable() {
|
|
1162
1192
|
#if defined(__AVX__)
|
|
1163
1193
|
return 1;
|
|
1164
1194
|
#else
|
|
@@ -1166,8 +1196,8 @@ inline int CRYPTO_is_AVX_capable(void) {
|
|
|
1166
1196
|
#endif
|
|
1167
1197
|
}
|
|
1168
1198
|
|
|
1169
|
-
inline int CRYPTO_is_RDRAND_capable(
|
|
1170
|
-
// We intentionally do not check
|
|
1199
|
+
inline int CRYPTO_is_RDRAND_capable() {
|
|
1200
|
+
// We intentionally do not check `__RDRND__` here. On some AMD processors, we
|
|
1171
1201
|
// will act as if the hardware is RDRAND-incapable, even it actually supports
|
|
1172
1202
|
// it. See cpu_intel.c.
|
|
1173
1203
|
return (OPENSSL_get_ia32cap(1) & (1u << 30)) != 0;
|
|
@@ -1175,7 +1205,7 @@ inline int CRYPTO_is_RDRAND_capable(void) {
|
|
|
1175
1205
|
|
|
1176
1206
|
// See Intel manual, volume 2A, table 3-8.
|
|
1177
1207
|
|
|
1178
|
-
inline int CRYPTO_is_BMI1_capable(
|
|
1208
|
+
inline int CRYPTO_is_BMI1_capable() {
|
|
1179
1209
|
#if defined(__BMI__)
|
|
1180
1210
|
return 1;
|
|
1181
1211
|
#else
|
|
@@ -1183,7 +1213,7 @@ inline int CRYPTO_is_BMI1_capable(void) {
|
|
|
1183
1213
|
#endif
|
|
1184
1214
|
}
|
|
1185
1215
|
|
|
1186
|
-
inline int CRYPTO_is_AVX2_capable(
|
|
1216
|
+
inline int CRYPTO_is_AVX2_capable() {
|
|
1187
1217
|
#if defined(__AVX2__)
|
|
1188
1218
|
return 1;
|
|
1189
1219
|
#else
|
|
@@ -1191,7 +1221,7 @@ inline int CRYPTO_is_AVX2_capable(void) {
|
|
|
1191
1221
|
#endif
|
|
1192
1222
|
}
|
|
1193
1223
|
|
|
1194
|
-
inline int CRYPTO_is_BMI2_capable(
|
|
1224
|
+
inline int CRYPTO_is_BMI2_capable() {
|
|
1195
1225
|
#if defined(__BMI2__)
|
|
1196
1226
|
return 1;
|
|
1197
1227
|
#else
|
|
@@ -1199,7 +1229,7 @@ inline int CRYPTO_is_BMI2_capable(void) {
|
|
|
1199
1229
|
#endif
|
|
1200
1230
|
}
|
|
1201
1231
|
|
|
1202
|
-
inline int CRYPTO_is_ADX_capable(
|
|
1232
|
+
inline int CRYPTO_is_ADX_capable() {
|
|
1203
1233
|
#if defined(__ADX__)
|
|
1204
1234
|
return 1;
|
|
1205
1235
|
#else
|
|
@@ -1208,7 +1238,7 @@ inline int CRYPTO_is_ADX_capable(void) {
|
|
|
1208
1238
|
}
|
|
1209
1239
|
|
|
1210
1240
|
// SHA-1 and SHA-256 are defined as a single extension.
|
|
1211
|
-
inline int CRYPTO_is_x86_SHA_capable(
|
|
1241
|
+
inline int CRYPTO_is_x86_SHA_capable() {
|
|
1212
1242
|
#if defined(__SHA__)
|
|
1213
1243
|
return 1;
|
|
1214
1244
|
#else
|
|
@@ -1226,7 +1256,7 @@ inline int CRYPTO_is_x86_SHA_capable(void) {
|
|
|
1226
1256
|
// isn't matched by this. Various sources indicate AMD first implemented MOVBE
|
|
1227
1257
|
// and XSAVE at the same time in Jaguar, so it seems like AMD chips will not be
|
|
1228
1258
|
// matched by this. That seems to be the case for other x86(-64) CPUs.
|
|
1229
|
-
inline int CRYPTO_cpu_perf_is_like_silvermont(
|
|
1259
|
+
inline int CRYPTO_cpu_perf_is_like_silvermont() {
|
|
1230
1260
|
// WARNING: This MUST NOT be used to guard the execution of the XSAVE
|
|
1231
1261
|
// instruction. This is the "hardware supports XSAVE" bit, not the OSXSAVE bit
|
|
1232
1262
|
// that indicates whether we can safely execute XSAVE. This bit may be set
|
|
@@ -1240,7 +1270,7 @@ inline int CRYPTO_cpu_perf_is_like_silvermont(void) {
|
|
|
1240
1270
|
return !hardware_supports_xsave && CRYPTO_is_MOVBE_capable();
|
|
1241
1271
|
}
|
|
1242
1272
|
|
|
1243
|
-
inline int CRYPTO_is_AVX512BW_capable(
|
|
1273
|
+
inline int CRYPTO_is_AVX512BW_capable() {
|
|
1244
1274
|
#if defined(__AVX512BW__)
|
|
1245
1275
|
return 1;
|
|
1246
1276
|
#else
|
|
@@ -1248,7 +1278,7 @@ inline int CRYPTO_is_AVX512BW_capable(void) {
|
|
|
1248
1278
|
#endif
|
|
1249
1279
|
}
|
|
1250
1280
|
|
|
1251
|
-
inline int CRYPTO_is_AVX512VL_capable(
|
|
1281
|
+
inline int CRYPTO_is_AVX512VL_capable() {
|
|
1252
1282
|
#if defined(__AVX512VL__)
|
|
1253
1283
|
return 1;
|
|
1254
1284
|
#else
|
|
@@ -1260,11 +1290,11 @@ inline int CRYPTO_is_AVX512VL_capable(void) {
|
|
|
1260
1290
|
// should not be used even if the CPU supports them.
|
|
1261
1291
|
//
|
|
1262
1292
|
// Note that this reuses the bit for the removed MPX feature.
|
|
1263
|
-
inline int CRYPTO_cpu_avoid_zmm_registers(
|
|
1293
|
+
inline int CRYPTO_cpu_avoid_zmm_registers() {
|
|
1264
1294
|
return (OPENSSL_get_ia32cap(2) & (1u << 14)) != 0;
|
|
1265
1295
|
}
|
|
1266
1296
|
|
|
1267
|
-
inline int CRYPTO_is_VAES_capable(
|
|
1297
|
+
inline int CRYPTO_is_VAES_capable() {
|
|
1268
1298
|
#if defined(__VAES__)
|
|
1269
1299
|
return 1;
|
|
1270
1300
|
#else
|
|
@@ -1272,7 +1302,7 @@ inline int CRYPTO_is_VAES_capable(void) {
|
|
|
1272
1302
|
#endif
|
|
1273
1303
|
}
|
|
1274
1304
|
|
|
1275
|
-
inline int CRYPTO_is_VPCLMULQDQ_capable(
|
|
1305
|
+
inline int CRYPTO_is_VPCLMULQDQ_capable() {
|
|
1276
1306
|
#if defined(__VPCLMULQDQ__)
|
|
1277
1307
|
return 1;
|
|
1278
1308
|
#else
|
|
@@ -1302,14 +1332,22 @@ inline int CRYPTO_is_VPCLMULQDQ_capable(void) {
|
|
|
1302
1332
|
// ARMV8_SHA512 indicates support for hardware SHA-512 instructions.
|
|
1303
1333
|
#define ARMV8_SHA512 (1 << 6)
|
|
1304
1334
|
|
|
1335
|
+
// ARMV8_SHA3 indicates support for eor3 instructions.
|
|
1336
|
+
#define ARMV8_SHA3 (1 << 7)
|
|
1337
|
+
|
|
1338
|
+
#if defined(OPENSSL_STATIC_ARMCAP)
|
|
1339
|
+
// We assume `CRYPTO_is_*_capable` already checked static capabilities.
|
|
1340
|
+
inline uint32_t OPENSSL_get_armcap() { return 0; }
|
|
1341
|
+
#else
|
|
1305
1342
|
// OPENSSL_armcap_P contains ARM CPU capabilities as a bitmask of the above
|
|
1306
|
-
// constants. This should only be accessed with
|
|
1343
|
+
// constants. This should only be accessed with `OPENSSL_get_armcap`.
|
|
1307
1344
|
extern uint32_t OPENSSL_armcap_P;
|
|
1308
1345
|
|
|
1309
1346
|
// OPENSSL_get_armcap initializes the library if needed and returns ARM CPU
|
|
1310
1347
|
// capabilities. It is marked as a const function so duplicate calls can be
|
|
1311
1348
|
// merged by the compiler.
|
|
1312
|
-
OPENSSL_ATTR_CONST uint32_t OPENSSL_get_armcap(
|
|
1349
|
+
OPENSSL_ATTR_CONST uint32_t OPENSSL_get_armcap();
|
|
1350
|
+
#endif // OPENSSL_STATIC_ARMCAP
|
|
1313
1351
|
|
|
1314
1352
|
// Normalize some older feature flags to their modern ACLE values.
|
|
1315
1353
|
// https://developer.arm.com/architectures/system-architectures/software-standards/acle
|
|
@@ -1327,71 +1365,69 @@ OPENSSL_ATTR_CONST uint32_t OPENSSL_get_armcap(void);
|
|
|
1327
1365
|
|
|
1328
1366
|
// CRYPTO_is_NEON_capable returns true if the current CPU has a NEON unit. If
|
|
1329
1367
|
// this is known statically, it is a constant inline function.
|
|
1330
|
-
inline int CRYPTO_is_NEON_capable(
|
|
1331
|
-
#if defined(OPENSSL_STATIC_ARMCAP_NEON) || defined(__ARM_NEON)
|
|
1368
|
+
inline int CRYPTO_is_NEON_capable() {
|
|
1369
|
+
#if (defined(OPENSSL_STATIC_ARMCAP_NEON) || defined(__ARM_NEON)) && \
|
|
1370
|
+
!defined(OPENSSL_NO_STATIC_NEON_FOR_TESTING)
|
|
1332
1371
|
return 1;
|
|
1333
|
-
#elif defined(OPENSSL_STATIC_ARMCAP)
|
|
1334
|
-
return 0;
|
|
1335
1372
|
#else
|
|
1336
1373
|
return (OPENSSL_get_armcap() & ARMV7_NEON) != 0;
|
|
1337
1374
|
#endif
|
|
1338
1375
|
}
|
|
1339
1376
|
|
|
1340
|
-
inline int CRYPTO_is_ARMv8_AES_capable(
|
|
1377
|
+
inline int CRYPTO_is_ARMv8_AES_capable() {
|
|
1341
1378
|
#if defined(OPENSSL_STATIC_ARMCAP_AES) || defined(__ARM_FEATURE_AES)
|
|
1342
1379
|
return 1;
|
|
1343
|
-
#elif defined(OPENSSL_STATIC_ARMCAP)
|
|
1344
|
-
return 0;
|
|
1345
1380
|
#else
|
|
1346
1381
|
return (OPENSSL_get_armcap() & ARMV8_AES) != 0;
|
|
1347
1382
|
#endif
|
|
1348
1383
|
}
|
|
1349
1384
|
|
|
1350
|
-
inline int CRYPTO_is_ARMv8_PMULL_capable(
|
|
1385
|
+
inline int CRYPTO_is_ARMv8_PMULL_capable() {
|
|
1351
1386
|
#if defined(OPENSSL_STATIC_ARMCAP_PMULL) || defined(__ARM_FEATURE_AES)
|
|
1352
1387
|
return 1;
|
|
1353
|
-
#elif defined(OPENSSL_STATIC_ARMCAP)
|
|
1354
|
-
return 0;
|
|
1355
1388
|
#else
|
|
1356
1389
|
return (OPENSSL_get_armcap() & ARMV8_PMULL) != 0;
|
|
1357
1390
|
#endif
|
|
1358
1391
|
}
|
|
1359
1392
|
|
|
1360
|
-
inline int CRYPTO_is_ARMv8_SHA1_capable(
|
|
1361
|
-
// SHA-1 and SHA-2 (only) share
|
|
1393
|
+
inline int CRYPTO_is_ARMv8_SHA1_capable() {
|
|
1394
|
+
// SHA-1 and SHA-2 (only) share `__ARM_FEATURE_SHA2` but otherwise
|
|
1362
1395
|
// are dealt with independently.
|
|
1363
1396
|
#if defined(OPENSSL_STATIC_ARMCAP_SHA1) || defined(__ARM_FEATURE_SHA2)
|
|
1364
1397
|
return 1;
|
|
1365
|
-
#elif defined(OPENSSL_STATIC_ARMCAP)
|
|
1366
|
-
return 0;
|
|
1367
1398
|
#else
|
|
1368
1399
|
return (OPENSSL_get_armcap() & ARMV8_SHA1) != 0;
|
|
1369
1400
|
#endif
|
|
1370
1401
|
}
|
|
1371
1402
|
|
|
1372
|
-
inline int CRYPTO_is_ARMv8_SHA256_capable(
|
|
1373
|
-
// SHA-1 and SHA-2 (only) share
|
|
1403
|
+
inline int CRYPTO_is_ARMv8_SHA256_capable() {
|
|
1404
|
+
// SHA-1 and SHA-2 (only) share `__ARM_FEATURE_SHA2` but otherwise
|
|
1374
1405
|
// are dealt with independently.
|
|
1375
1406
|
#if defined(OPENSSL_STATIC_ARMCAP_SHA256) || defined(__ARM_FEATURE_SHA2)
|
|
1376
1407
|
return 1;
|
|
1377
|
-
#elif defined(OPENSSL_STATIC_ARMCAP)
|
|
1378
|
-
return 0;
|
|
1379
1408
|
#else
|
|
1380
1409
|
return (OPENSSL_get_armcap() & ARMV8_SHA256) != 0;
|
|
1381
1410
|
#endif
|
|
1382
1411
|
}
|
|
1383
1412
|
|
|
1384
|
-
inline int CRYPTO_is_ARMv8_SHA512_capable(
|
|
1385
|
-
// There is no
|
|
1413
|
+
inline int CRYPTO_is_ARMv8_SHA512_capable() {
|
|
1414
|
+
// There is no `OPENSSL_STATIC_ARMCAP_SHA512`.
|
|
1386
1415
|
#if defined(__ARM_FEATURE_SHA512)
|
|
1387
1416
|
return 1;
|
|
1388
|
-
#elif defined(OPENSSL_STATIC_ARMCAP)
|
|
1389
|
-
return 0;
|
|
1390
1417
|
#else
|
|
1391
1418
|
return (OPENSSL_get_armcap() & ARMV8_SHA512) != 0;
|
|
1392
1419
|
#endif
|
|
1393
1420
|
}
|
|
1394
1421
|
|
|
1422
|
+
inline int CRYPTO_is_ARMv8_SHA3_capable() {
|
|
1423
|
+
// There is no `OPENSSL_STATIC_ARMCAP_SHA3`.
|
|
1424
|
+
#if defined(__ARM_FEATURE_SHA3)
|
|
1425
|
+
return 1;
|
|
1426
|
+
#else
|
|
1427
|
+
return (OPENSSL_get_armcap() & ARMV8_SHA3) != 0;
|
|
1428
|
+
#endif
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1395
1431
|
#endif // OPENSSL_ARM || OPENSSL_AARCH64
|
|
1396
1432
|
|
|
1397
1433
|
|
|
@@ -1408,14 +1444,14 @@ inline int CRYPTO_is_ARMv8_SHA512_capable(void) {
|
|
|
1408
1444
|
// 5: vpaes_set_encrypt_key
|
|
1409
1445
|
// 6: aes_gcm_enc_update_vaes_avx2
|
|
1410
1446
|
// 7: aes_gcm_enc_update_vaes_avx512
|
|
1411
|
-
extern uint8_t BORINGSSL_function_hit[8];
|
|
1447
|
+
extern "C" uint8_t BORINGSSL_function_hit[8];
|
|
1412
1448
|
#endif // BORINGSSL_DISPATCH_TEST
|
|
1413
1449
|
|
|
1414
1450
|
|
|
1415
|
-
// OPENSSL_vasprintf_internal is just like
|
|
1416
|
-
// 0, memory will be allocated with
|
|
1417
|
-
//
|
|
1418
|
-
// must be freed with the system
|
|
1451
|
+
// OPENSSL_vasprintf_internal is just like `vasprintf(3)`. If `system_malloc` is
|
|
1452
|
+
// 0, memory will be allocated with `OPENSSL_malloc` and must be freed with
|
|
1453
|
+
// `OPENSSL_free`. Otherwise the system `malloc` function is used and the memory
|
|
1454
|
+
// must be freed with the system `free` function.
|
|
1419
1455
|
OPENSSL_EXPORT int OPENSSL_vasprintf_internal(char **str, const char *format,
|
|
1420
1456
|
va_list args, int system_malloc)
|
|
1421
1457
|
OPENSSL_PRINTF_FORMAT_FUNC(2, 0);
|
|
@@ -1425,22 +1461,21 @@ OPENSSL_EXPORT int OPENSSL_vasprintf_internal(char **str, const char *format,
|
|
|
1425
1461
|
|
|
1426
1462
|
#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
|
|
1427
1463
|
// CRYPTO_fuzzer_mode_enabled returns whether fuzzer mode is enabled. See
|
|
1428
|
-
//
|
|
1464
|
+
// `CRYPTO_set_fuzzer_mode`. In non-fuzzer builds, this function statically
|
|
1429
1465
|
// returns zero so the codepaths will be deleted by the optimizer.
|
|
1430
|
-
int CRYPTO_fuzzer_mode_enabled(
|
|
1466
|
+
int CRYPTO_fuzzer_mode_enabled();
|
|
1431
1467
|
#else
|
|
1432
|
-
inline int CRYPTO_fuzzer_mode_enabled(
|
|
1468
|
+
inline int CRYPTO_fuzzer_mode_enabled() { return 0; }
|
|
1433
1469
|
#endif
|
|
1434
1470
|
|
|
1435
1471
|
|
|
1436
|
-
#if defined(__cplusplus)
|
|
1437
|
-
} // extern C
|
|
1438
|
-
#endif
|
|
1439
|
-
|
|
1440
1472
|
// Arithmetic functions.
|
|
1441
1473
|
|
|
1442
|
-
// CRYPTO_addc_* returns
|
|
1443
|
-
// bit.
|
|
1474
|
+
// CRYPTO_addc_* returns `x + y + carry`, and sets `*out_carry` to the carry
|
|
1475
|
+
// bit. `carry` must be zero or one.
|
|
1476
|
+
|
|
1477
|
+
// NOTE: Unoptimized GCC builds may compile these builtins to non-constant-time
|
|
1478
|
+
// code. For correct constant-time behavior, ensure builds are optimized.
|
|
1444
1479
|
#if OPENSSL_HAS_BUILTIN(__builtin_addc)
|
|
1445
1480
|
|
|
1446
1481
|
inline unsigned int CRYPTO_addc_impl(unsigned int x, unsigned int y,
|
|
@@ -1474,19 +1509,29 @@ inline uint64_t CRYPTO_addc_u64(uint64_t x, uint64_t y, uint64_t carry,
|
|
|
1474
1509
|
|
|
1475
1510
|
#else
|
|
1476
1511
|
|
|
1477
|
-
|
|
1478
|
-
|
|
1512
|
+
inline uint32_t CRYPTO_addc_u32(uint32_t x, uint32_t y, uint32_t carry,
|
|
1513
|
+
uint32_t *out_carry) {
|
|
1479
1514
|
declassify_assert(carry <= 1);
|
|
1515
|
+
#if defined(_M_IX86)
|
|
1516
|
+
uint32_t sum = 0;
|
|
1517
|
+
*out_carry = _addcarry_u32(carry, x, y, &sum);
|
|
1518
|
+
return sum;
|
|
1519
|
+
#else
|
|
1480
1520
|
uint64_t ret = carry;
|
|
1481
1521
|
ret += (uint64_t)x + y;
|
|
1482
1522
|
*out_carry = (uint32_t)(ret >> 32);
|
|
1483
1523
|
return (uint32_t)ret;
|
|
1524
|
+
#endif
|
|
1484
1525
|
}
|
|
1485
1526
|
|
|
1486
|
-
|
|
1487
|
-
|
|
1527
|
+
inline uint64_t CRYPTO_addc_u64(uint64_t x, uint64_t y, uint64_t carry,
|
|
1528
|
+
uint64_t *out_carry) {
|
|
1488
1529
|
declassify_assert(carry <= 1);
|
|
1489
|
-
#if defined(
|
|
1530
|
+
#if defined(_M_X64)
|
|
1531
|
+
uint64_t sum = 0;
|
|
1532
|
+
*out_carry = _addcarry_u64(carry, x, y, &sum);
|
|
1533
|
+
return sum;
|
|
1534
|
+
#elif defined(BORINGSSL_HAS_UINT128)
|
|
1490
1535
|
uint128_t ret = carry;
|
|
1491
1536
|
ret += (uint128_t)x + y;
|
|
1492
1537
|
*out_carry = (uint64_t)(ret >> 64);
|
|
@@ -1503,8 +1548,8 @@ static inline uint64_t CRYPTO_addc_u64(uint64_t x, uint64_t y, uint64_t carry,
|
|
|
1503
1548
|
#endif
|
|
1504
1549
|
|
|
1505
1550
|
|
|
1506
|
-
// CRYPTO_subc_* returns
|
|
1507
|
-
// bit.
|
|
1551
|
+
// CRYPTO_subc_* returns `x - y - borrow`, and sets `*out_borrow` to the borrow
|
|
1552
|
+
// bit. `borrow` must be zero or one.
|
|
1508
1553
|
#if OPENSSL_HAS_BUILTIN(__builtin_subc)
|
|
1509
1554
|
|
|
1510
1555
|
inline unsigned int CRYPTO_subc_impl(unsigned int x, unsigned int y,
|
|
@@ -1538,20 +1583,32 @@ inline uint64_t CRYPTO_subc_u64(uint64_t x, uint64_t y, uint64_t borrow,
|
|
|
1538
1583
|
|
|
1539
1584
|
#else
|
|
1540
1585
|
|
|
1541
|
-
|
|
1542
|
-
|
|
1586
|
+
inline uint32_t CRYPTO_subc_u32(uint32_t x, uint32_t y, uint32_t borrow,
|
|
1587
|
+
uint32_t *out_borrow) {
|
|
1543
1588
|
declassify_assert(borrow <= 1);
|
|
1589
|
+
#if defined(_M_IX86)
|
|
1590
|
+
uint32_t diff = 0;
|
|
1591
|
+
*out_borrow = _subborrow_u32(borrow, x, y, &diff);
|
|
1592
|
+
return diff;
|
|
1593
|
+
#else
|
|
1544
1594
|
uint32_t ret = x - y - borrow;
|
|
1545
1595
|
*out_borrow = (x < y) | ((x == y) & borrow);
|
|
1546
1596
|
return ret;
|
|
1597
|
+
#endif
|
|
1547
1598
|
}
|
|
1548
1599
|
|
|
1549
|
-
|
|
1550
|
-
|
|
1600
|
+
inline uint64_t CRYPTO_subc_u64(uint64_t x, uint64_t y, uint64_t borrow,
|
|
1601
|
+
uint64_t *out_borrow) {
|
|
1551
1602
|
declassify_assert(borrow <= 1);
|
|
1603
|
+
#if defined(_M_X64)
|
|
1604
|
+
uint64_t diff = 0;
|
|
1605
|
+
*out_borrow = _subborrow_u64(borrow, x, y, &diff);
|
|
1606
|
+
return diff;
|
|
1607
|
+
#else
|
|
1552
1608
|
uint64_t ret = x - y - borrow;
|
|
1553
1609
|
*out_borrow = (x < y) | ((x == y) & borrow);
|
|
1554
1610
|
return ret;
|
|
1611
|
+
#endif
|
|
1555
1612
|
}
|
|
1556
1613
|
#endif
|
|
1557
1614
|
|
|
@@ -1564,4 +1621,84 @@ static inline uint64_t CRYPTO_subc_u64(uint64_t x, uint64_t y, uint64_t borrow,
|
|
|
1564
1621
|
#endif
|
|
1565
1622
|
|
|
1566
1623
|
|
|
1624
|
+
// Cleanup implements a custom scope guard, when the cleanup logic does not fit
|
|
1625
|
+
// in a destructor. Usage:
|
|
1626
|
+
//
|
|
1627
|
+
// bssl::Cleanup cleanup = [&] { SomeCleanupWork(local_var); };
|
|
1628
|
+
template <typename F>
|
|
1629
|
+
class Cleanup {
|
|
1630
|
+
public:
|
|
1631
|
+
static_assert(std::is_invocable_v<F>);
|
|
1632
|
+
static_assert(std::is_same_v<std::invoke_result_t<F>, void>);
|
|
1633
|
+
|
|
1634
|
+
Cleanup(F func) : func_(func) {}
|
|
1635
|
+
Cleanup(const Cleanup &) = delete;
|
|
1636
|
+
Cleanup &operator=(const Cleanup &) = delete;
|
|
1637
|
+
~Cleanup() { func_(); }
|
|
1638
|
+
|
|
1639
|
+
private:
|
|
1640
|
+
F func_;
|
|
1641
|
+
};
|
|
1642
|
+
template <typename F>
|
|
1643
|
+
Cleanup(F func) -> Cleanup<F>;
|
|
1644
|
+
|
|
1645
|
+
// DECLARE_OPAQUE_STRUCT defines a public struct `public_name` with an
|
|
1646
|
+
// implementation struct `impl_name`.
|
|
1647
|
+
//
|
|
1648
|
+
// To prevent accidents, the `public_name` struct will be neither constructable,
|
|
1649
|
+
// nor copyable/movable, nor deletable.
|
|
1650
|
+
//
|
|
1651
|
+
// It must be used from inside the `bssl` namespace; however, `public_name` will
|
|
1652
|
+
// be defined outside.
|
|
1653
|
+
//
|
|
1654
|
+
// Usage:
|
|
1655
|
+
//
|
|
1656
|
+
// DECLARE_OPAQUE_STRUCT(public_st, PublicImpl)
|
|
1657
|
+
//
|
|
1658
|
+
// BSSL_NAMESPACE_BEGIN
|
|
1659
|
+
//
|
|
1660
|
+
// class PublicImpl : public public_st {
|
|
1661
|
+
// public:
|
|
1662
|
+
// PublicImpl();
|
|
1663
|
+
// ~PublicImpl();
|
|
1664
|
+
// void foo();
|
|
1665
|
+
// };
|
|
1666
|
+
//
|
|
1667
|
+
// BSSL_NAMESPACE_END
|
|
1668
|
+
//
|
|
1669
|
+
// The implementation struct can be converted to the public struct implicitly;
|
|
1670
|
+
// to convert the public struct to the implementation struct, call
|
|
1671
|
+
// `FromOpaque` on it. It is explicitly allowed to call `FromOpaque` on a
|
|
1672
|
+
// `nullptr`.
|
|
1673
|
+
#define DECLARE_OPAQUE_STRUCT(public_name, impl_name) \
|
|
1674
|
+
BSSL_NAMESPACE_BEGIN \
|
|
1675
|
+
class impl_name; \
|
|
1676
|
+
BSSL_NAMESPACE_END \
|
|
1677
|
+
\
|
|
1678
|
+
/* This is unnamespaced but assumed to not create linker symbols. */ \
|
|
1679
|
+
struct public_name { \
|
|
1680
|
+
using ImplType = bssl::impl_name; \
|
|
1681
|
+
\
|
|
1682
|
+
private: \
|
|
1683
|
+
public_name() = default; \
|
|
1684
|
+
~public_name() = default; \
|
|
1685
|
+
public_name(const public_name &) = delete; \
|
|
1686
|
+
public_name &operator=(const public_name &) = delete; \
|
|
1687
|
+
\
|
|
1688
|
+
friend class bssl::impl_name; \
|
|
1689
|
+
};
|
|
1690
|
+
|
|
1691
|
+
template <typename Public>
|
|
1692
|
+
inline typename Public::ImplType *FromOpaque(Public *p) {
|
|
1693
|
+
return static_cast<typename Public::ImplType *>(p);
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1696
|
+
template <typename Public>
|
|
1697
|
+
inline const typename Public::ImplType *FromOpaque(const Public *p) {
|
|
1698
|
+
return static_cast<const typename Public::ImplType *>(p);
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
BSSL_NAMESPACE_END
|
|
1702
|
+
|
|
1703
|
+
|
|
1567
1704
|
#endif // OPENSSL_HEADER_CRYPTO_INTERNAL_H
|