grpc 1.24.0 → 1.25.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +306 -243
- data/etc/roots.pem +0 -100
- data/include/grpc/grpc_security.h +44 -18
- data/include/grpc/impl/codegen/grpc_types.h +15 -0
- data/include/grpc/impl/codegen/port_platform.h +27 -11
- data/include/grpc/impl/codegen/sync_generic.h +1 -1
- data/src/boringssl/err_data.c +695 -650
- data/src/core/ext/filters/client_channel/client_channel.cc +257 -179
- data/src/core/ext/filters/client_channel/client_channel.h +24 -0
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +2 -3
- data/src/core/ext/filters/client_channel/client_channel_factory.h +1 -5
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +18 -45
- data/src/core/ext/filters/client_channel/health/health_check_client.h +5 -13
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy.cc +2 -3
- data/src/core/ext/filters/client_channel/lb_policy.h +65 -55
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +14 -14
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +113 -36
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +14 -19
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +36 -13
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +3 -10
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +814 -1589
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +2 -5
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +3 -6
- data/src/core/ext/filters/client_channel/resolver.cc +1 -2
- data/src/core/ext/filters/client_channel/resolver.h +8 -16
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +25 -8
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +46 -12
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +10 -17
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +7 -8
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +4 -4
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +111 -44
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +22 -14
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +29 -10
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +27 -36
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +7 -10
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +60 -16
- data/src/core/ext/filters/client_channel/resolver_factory.h +4 -8
- data/src/core/ext/filters/client_channel/resolver_registry.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver_registry.h +1 -1
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +7 -10
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +7 -8
- data/src/core/ext/filters/client_channel/resolving_lb_policy.h +1 -1
- data/src/core/ext/filters/client_channel/retry_throttle.cc +5 -5
- data/src/core/ext/filters/client_channel/retry_throttle.h +1 -4
- data/src/core/ext/filters/client_channel/service_config.h +8 -8
- data/src/core/ext/filters/client_channel/subchannel.cc +53 -86
- data/src/core/ext/filters/client_channel/subchannel.h +7 -9
- data/src/core/ext/filters/client_channel/subchannel_interface.h +9 -13
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +3 -6
- data/src/core/ext/filters/client_channel/{lb_policy/xds/xds_load_balancer_api.cc → xds/xds_api.cc} +169 -52
- data/src/core/ext/filters/client_channel/xds/xds_api.h +171 -0
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc +450 -0
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.h +99 -0
- data/src/core/ext/filters/client_channel/{lb_policy/xds → xds}/xds_channel.h +8 -6
- data/src/core/ext/filters/client_channel/xds/xds_channel_args.h +26 -0
- data/src/core/ext/filters/client_channel/{lb_policy/xds → xds}/xds_channel_secure.cc +28 -11
- data/src/core/ext/filters/client_channel/xds/xds_client.cc +1413 -0
- data/src/core/ext/filters/client_channel/xds/xds_client.h +221 -0
- data/src/core/ext/filters/client_channel/{lb_policy/xds → xds}/xds_client_stats.cc +1 -5
- data/src/core/ext/filters/client_channel/{lb_policy/xds → xds}/xds_client_stats.h +3 -4
- data/src/core/ext/filters/deadline/deadline_filter.cc +20 -20
- data/src/core/ext/filters/http/client/http_client_filter.cc +15 -15
- data/src/core/ext/filters/http/client_authority_filter.cc +14 -14
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +12 -12
- data/src/core/ext/filters/max_age/max_age_filter.cc +59 -50
- data/src/core/ext/filters/message_size/message_size_filter.cc +18 -18
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +15 -14
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +233 -175
- data/src/core/ext/transport/chttp2/transport/flow_control.h +21 -24
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +253 -163
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +24 -12
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +2 -3
- data/src/core/ext/transport/chttp2/transport/internal.h +13 -15
- data/src/core/ext/transport/chttp2/transport/writing.cc +3 -0
- data/src/core/ext/transport/inproc/inproc_transport.cc +20 -13
- data/src/core/lib/channel/channel_args.cc +16 -0
- data/src/core/lib/channel/channel_args.h +22 -0
- data/src/core/lib/channel/channelz.cc +5 -6
- data/src/core/lib/channel/channelz.h +1 -1
- data/src/core/lib/channel/connected_channel.cc +20 -20
- data/src/core/lib/channel/handshaker.h +3 -4
- data/src/core/lib/channel/handshaker_factory.h +1 -3
- data/src/core/lib/debug/trace.h +3 -2
- data/src/core/lib/gprpp/arena.cc +3 -3
- data/src/core/lib/gprpp/arena.h +2 -3
- data/src/core/lib/gprpp/inlined_vector.h +9 -0
- data/src/core/lib/gprpp/map.h +3 -501
- data/src/core/lib/gprpp/memory.h +45 -41
- data/src/core/lib/gprpp/mpscq.cc +108 -0
- data/src/core/lib/gprpp/mpscq.h +98 -0
- data/src/core/lib/gprpp/orphanable.h +6 -11
- data/src/core/lib/gprpp/ref_counted.h +25 -19
- data/src/core/lib/gprpp/set.h +33 -0
- data/src/core/lib/gprpp/thd.h +2 -4
- data/src/core/lib/http/httpcli.cc +1 -1
- data/src/core/lib/http/httpcli_security_connector.cc +15 -11
- data/src/core/lib/http/parser.cc +1 -1
- data/src/core/lib/iomgr/buffer_list.cc +4 -5
- data/src/core/lib/iomgr/buffer_list.h +5 -6
- data/src/core/lib/iomgr/call_combiner.cc +4 -5
- data/src/core/lib/iomgr/call_combiner.h +2 -2
- data/src/core/lib/iomgr/cfstream_handle.h +3 -5
- data/src/core/lib/iomgr/closure.h +8 -3
- data/src/core/lib/iomgr/combiner.cc +45 -82
- data/src/core/lib/iomgr/combiner.h +32 -8
- data/src/core/lib/iomgr/endpoint_cfstream.cc +5 -3
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +19 -15
- data/src/core/lib/iomgr/ev_poll_posix.cc +3 -1
- data/src/core/lib/iomgr/exec_ctx.h +4 -3
- data/src/core/lib/iomgr/executor.cc +4 -2
- data/src/core/lib/iomgr/executor.h +3 -0
- data/src/core/lib/iomgr/executor/mpmcqueue.h +3 -6
- data/src/core/lib/iomgr/executor/threadpool.cc +1 -2
- data/src/core/lib/iomgr/executor/threadpool.h +7 -11
- data/src/core/lib/iomgr/resource_quota.cc +55 -51
- data/src/core/lib/iomgr/resource_quota.h +13 -9
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +13 -0
- data/src/core/lib/iomgr/socket_utils_posix.h +4 -0
- data/src/core/lib/iomgr/tcp_client_posix.cc +4 -11
- data/src/core/lib/iomgr/tcp_custom.cc +9 -7
- data/src/core/lib/iomgr/tcp_posix.cc +20 -16
- data/src/core/lib/iomgr/tcp_server.h +1 -4
- data/src/core/lib/iomgr/tcp_server_custom.cc +5 -5
- data/src/core/lib/iomgr/tcp_server_posix.cc +1 -1
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +2 -11
- data/src/core/lib/iomgr/timer_custom.cc +2 -2
- data/src/core/lib/iomgr/udp_server.cc +3 -2
- data/src/core/lib/iomgr/udp_server.h +6 -12
- data/src/core/lib/json/json.h +1 -1
- data/src/core/lib/json/json_string.cc +2 -2
- data/src/core/lib/profiling/basic_timers.cc +2 -2
- data/src/core/lib/security/credentials/alts/alts_credentials.cc +2 -2
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc +1 -1
- data/src/core/lib/security/credentials/credentials.h +4 -20
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +4 -4
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +1 -3
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +64 -0
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +4 -4
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +9 -7
- data/src/core/lib/security/security_connector/load_system_roots_linux.cc +2 -0
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +4 -4
- data/src/core/lib/security/security_connector/security_connector.cc +1 -0
- data/src/core/lib/security/security_connector/security_connector.h +19 -17
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +8 -5
- data/src/core/lib/security/security_connector/ssl_utils.cc +2 -2
- data/src/core/lib/security/security_connector/ssl_utils.h +1 -1
- data/src/core/lib/security/security_connector/tls/spiffe_security_connector.cc +14 -6
- data/src/core/lib/security/security_connector/tls/spiffe_security_connector.h +4 -2
- data/src/core/lib/security/transport/client_auth_filter.cc +17 -17
- data/src/core/lib/security/transport/security_handshaker.cc +29 -13
- data/src/core/lib/security/transport/security_handshaker.h +4 -2
- data/src/core/lib/security/transport/server_auth_filter.cc +14 -14
- data/src/core/lib/slice/slice.cc +2 -10
- data/src/core/lib/slice/slice_hash_table.h +4 -6
- data/src/core/lib/slice/slice_intern.cc +42 -39
- data/src/core/lib/slice/slice_internal.h +3 -3
- data/src/core/lib/slice/slice_utils.h +21 -4
- data/src/core/lib/slice/slice_weak_hash_table.h +4 -6
- data/src/core/lib/surface/call.cc +3 -3
- data/src/core/lib/surface/channel.cc +7 -0
- data/src/core/lib/surface/completion_queue.cc +12 -11
- data/src/core/lib/surface/completion_queue.h +4 -2
- data/src/core/lib/surface/init.cc +1 -0
- data/src/core/lib/surface/lame_client.cc +33 -18
- data/src/core/lib/surface/server.cc +77 -76
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/byte_stream.h +3 -7
- data/src/core/lib/transport/connectivity_state.cc +112 -98
- data/src/core/lib/transport/connectivity_state.h +100 -50
- data/src/core/lib/transport/static_metadata.cc +276 -288
- data/src/core/lib/transport/static_metadata.h +73 -76
- data/src/core/lib/transport/status_conversion.cc +1 -1
- data/src/core/lib/transport/status_metadata.cc +1 -1
- data/src/core/lib/transport/transport.cc +2 -2
- data/src/core/lib/transport/transport.h +12 -4
- data/src/core/lib/transport/transport_op_string.cc +14 -11
- data/src/core/tsi/alts/frame_protector/alts_unseal_privacy_integrity_crypter.cc +1 -1
- data/src/core/tsi/alts/handshaker/alts_shared_resource.cc +1 -1
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +5 -5
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +12 -2
- data/src/core/tsi/fake_transport_security.cc +7 -5
- data/src/core/tsi/grpc_shadow_boringssl.h +2918 -2627
- data/src/core/tsi/local_transport_security.cc +8 -6
- data/src/core/tsi/ssl/session_cache/ssl_session.h +1 -3
- data/src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc +1 -2
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +7 -5
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +4 -6
- data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +1 -2
- data/src/core/tsi/ssl_transport_security.cc +12 -12
- data/src/core/tsi/ssl_transport_security.h +2 -2
- data/src/core/tsi/transport_security_grpc.cc +7 -0
- data/src/core/tsi/transport_security_grpc.h +6 -0
- data/src/ruby/ext/grpc/extconf.rb +1 -0
- data/src/ruby/ext/grpc/rb_call.c +1 -1
- data/src/ruby/ext/grpc/rb_channel.c +1 -1
- data/src/ruby/lib/grpc/generic/bidi_call.rb +1 -1
- data/src/ruby/lib/grpc/generic/rpc_server.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/google_rpc_status_utils_spec.rb +2 -2
- data/third_party/boringssl/crypto/asn1/a_bool.c +18 -5
- data/third_party/boringssl/crypto/asn1/a_d2i_fp.c +17 -221
- data/third_party/boringssl/crypto/asn1/a_dup.c +0 -24
- data/third_party/boringssl/crypto/asn1/a_enum.c +2 -2
- data/third_party/boringssl/crypto/asn1/a_i2d_fp.c +10 -72
- data/third_party/boringssl/crypto/asn1/a_int.c +12 -71
- data/third_party/boringssl/crypto/asn1/a_mbstr.c +110 -216
- data/third_party/boringssl/crypto/asn1/a_object.c +16 -5
- data/third_party/boringssl/crypto/asn1/a_strnid.c +1 -0
- data/third_party/boringssl/crypto/asn1/asn1_lib.c +5 -1
- data/third_party/boringssl/crypto/asn1/tasn_enc.c +3 -1
- data/third_party/boringssl/crypto/base64/base64.c +2 -2
- data/third_party/boringssl/crypto/bio/bio.c +73 -9
- data/third_party/boringssl/crypto/bio/connect.c +4 -0
- data/third_party/boringssl/crypto/bio/fd.c +4 -0
- data/third_party/boringssl/crypto/bio/file.c +5 -2
- data/third_party/boringssl/crypto/bio/socket.c +4 -0
- data/third_party/boringssl/crypto/bio/socket_helper.c +4 -0
- data/third_party/boringssl/crypto/bn_extra/convert.c +11 -7
- data/third_party/boringssl/crypto/bytestring/ber.c +8 -4
- data/third_party/boringssl/crypto/bytestring/cbb.c +19 -7
- data/third_party/boringssl/crypto/bytestring/cbs.c +28 -15
- data/third_party/boringssl/crypto/bytestring/internal.h +28 -7
- data/third_party/boringssl/crypto/bytestring/unicode.c +155 -0
- data/third_party/boringssl/crypto/chacha/chacha.c +36 -19
- data/third_party/boringssl/crypto/chacha/internal.h +45 -0
- data/third_party/boringssl/crypto/cipher_extra/cipher_extra.c +29 -0
- data/third_party/boringssl/crypto/cipher_extra/e_aesccm.c +269 -25
- data/third_party/boringssl/crypto/cipher_extra/e_aesctrhmac.c +16 -14
- data/third_party/boringssl/crypto/cipher_extra/e_aesgcmsiv.c +54 -38
- data/third_party/boringssl/crypto/cipher_extra/e_chacha20poly1305.c +133 -41
- data/third_party/boringssl/crypto/cipher_extra/e_tls.c +23 -15
- data/third_party/boringssl/crypto/cipher_extra/tls_cbc.c +24 -15
- data/third_party/boringssl/crypto/cmac/cmac.c +62 -25
- data/third_party/boringssl/crypto/conf/conf.c +7 -0
- data/third_party/boringssl/crypto/cpu-arm-linux.c +4 -148
- data/third_party/boringssl/crypto/cpu-arm-linux.h +201 -0
- data/third_party/boringssl/crypto/cpu-intel.c +45 -51
- data/third_party/boringssl/crypto/crypto.c +39 -22
- data/third_party/boringssl/crypto/curve25519/spake25519.c +1 -1
- data/third_party/boringssl/crypto/dsa/dsa.c +77 -53
- data/third_party/boringssl/crypto/ec_extra/ec_asn1.c +20 -8
- data/third_party/boringssl/crypto/ec_extra/ec_derive.c +96 -0
- data/third_party/boringssl/crypto/{ecdh/ecdh.c → ecdh_extra/ecdh_extra.c} +20 -58
- data/third_party/boringssl/crypto/ecdsa_extra/ecdsa_asn1.c +1 -9
- data/third_party/boringssl/crypto/engine/engine.c +2 -1
- data/third_party/boringssl/crypto/err/err.c +2 -0
- data/third_party/boringssl/crypto/err/internal.h +2 -2
- data/third_party/boringssl/crypto/evp/evp.c +89 -8
- data/third_party/boringssl/crypto/evp/evp_asn1.c +56 -5
- data/third_party/boringssl/crypto/evp/evp_ctx.c +52 -14
- data/third_party/boringssl/crypto/evp/internal.h +18 -1
- data/third_party/boringssl/crypto/evp/p_dsa_asn1.c +5 -0
- data/third_party/boringssl/crypto/evp/p_ec.c +51 -3
- data/third_party/boringssl/crypto/evp/p_ec_asn1.c +6 -7
- data/third_party/boringssl/crypto/evp/p_ed25519.c +36 -3
- data/third_party/boringssl/crypto/evp/p_ed25519_asn1.c +76 -45
- data/third_party/boringssl/crypto/evp/p_rsa.c +3 -1
- data/third_party/boringssl/crypto/evp/p_rsa_asn1.c +5 -0
- data/third_party/boringssl/crypto/evp/p_x25519.c +110 -0
- data/third_party/boringssl/crypto/evp/p_x25519_asn1.c +249 -0
- data/third_party/boringssl/crypto/evp/scrypt.c +6 -2
- data/third_party/boringssl/crypto/fipsmodule/aes/aes.c +34 -274
- data/third_party/boringssl/crypto/fipsmodule/aes/internal.h +161 -21
- data/third_party/boringssl/crypto/fipsmodule/aes/key_wrap.c +111 -13
- data/third_party/boringssl/crypto/fipsmodule/aes/mode_wrappers.c +17 -21
- data/third_party/boringssl/crypto/fipsmodule/bcm.c +119 -7
- data/third_party/boringssl/crypto/fipsmodule/bn/bn.c +19 -2
- data/third_party/boringssl/crypto/fipsmodule/bn/cmp.c +2 -2
- data/third_party/boringssl/crypto/fipsmodule/bn/ctx.c +93 -160
- data/third_party/boringssl/crypto/fipsmodule/bn/div.c +48 -57
- data/third_party/boringssl/crypto/fipsmodule/bn/div_extra.c +87 -0
- data/third_party/boringssl/crypto/fipsmodule/bn/exponentiation.c +143 -211
- data/third_party/boringssl/crypto/fipsmodule/bn/gcd.c +0 -305
- data/third_party/boringssl/crypto/fipsmodule/bn/gcd_extra.c +325 -0
- data/third_party/boringssl/crypto/fipsmodule/bn/internal.h +168 -50
- data/third_party/boringssl/crypto/fipsmodule/bn/montgomery.c +68 -92
- data/third_party/boringssl/crypto/fipsmodule/bn/montgomery_inv.c +7 -6
- data/third_party/boringssl/crypto/fipsmodule/bn/mul.c +11 -14
- data/third_party/boringssl/crypto/fipsmodule/bn/prime.c +358 -443
- data/third_party/boringssl/crypto/fipsmodule/bn/random.c +25 -35
- data/third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.c +20 -25
- data/third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.h +76 -5
- data/third_party/boringssl/crypto/fipsmodule/bn/shift.c +14 -14
- data/third_party/boringssl/crypto/fipsmodule/cipher/cipher.c +7 -2
- data/third_party/boringssl/crypto/fipsmodule/cipher/e_aes.c +383 -516
- data/third_party/boringssl/crypto/fipsmodule/cipher/e_des.c +4 -0
- data/third_party/boringssl/crypto/fipsmodule/cipher/internal.h +3 -4
- data/third_party/boringssl/crypto/fipsmodule/delocate.h +3 -2
- data/third_party/boringssl/crypto/fipsmodule/digest/digest.c +32 -17
- data/third_party/boringssl/crypto/fipsmodule/digest/md32_common.h +3 -3
- data/third_party/boringssl/crypto/fipsmodule/ec/ec.c +228 -122
- data/third_party/boringssl/crypto/fipsmodule/ec/ec_key.c +34 -8
- data/third_party/boringssl/crypto/fipsmodule/ec/ec_montgomery.c +311 -98
- data/third_party/boringssl/crypto/fipsmodule/ec/felem.c +82 -0
- data/third_party/boringssl/crypto/fipsmodule/ec/internal.h +263 -97
- data/third_party/boringssl/crypto/fipsmodule/ec/oct.c +22 -59
- data/third_party/boringssl/crypto/fipsmodule/ec/p224-64.c +317 -234
- data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64-table.h +9473 -9475
- data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64.c +313 -109
- data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64.h +36 -0
- data/third_party/boringssl/crypto/fipsmodule/ec/scalar.c +96 -0
- data/third_party/boringssl/crypto/fipsmodule/ec/simple.c +126 -792
- data/third_party/boringssl/crypto/fipsmodule/ec/simple_mul.c +84 -0
- data/third_party/boringssl/crypto/fipsmodule/ec/util.c +163 -12
- data/third_party/boringssl/crypto/fipsmodule/ec/wnaf.c +84 -211
- data/third_party/boringssl/crypto/fipsmodule/ecdh/ecdh.c +122 -0
- data/third_party/boringssl/crypto/fipsmodule/ecdsa/ecdsa.c +60 -205
- data/third_party/boringssl/crypto/fipsmodule/fips_shared_support.c +32 -0
- data/third_party/boringssl/crypto/fipsmodule/is_fips.c +2 -0
- data/third_party/boringssl/crypto/fipsmodule/md4/md4.c +3 -1
- data/third_party/boringssl/crypto/fipsmodule/md5/internal.h +37 -0
- data/third_party/boringssl/crypto/fipsmodule/md5/md5.c +11 -8
- data/third_party/boringssl/crypto/fipsmodule/modes/cbc.c +35 -79
- data/third_party/boringssl/crypto/fipsmodule/modes/cfb.c +7 -39
- data/third_party/boringssl/crypto/fipsmodule/modes/ctr.c +7 -27
- data/third_party/boringssl/crypto/fipsmodule/modes/gcm.c +123 -309
- data/third_party/boringssl/crypto/fipsmodule/modes/internal.h +189 -126
- data/third_party/boringssl/crypto/fipsmodule/modes/ofb.c +3 -2
- data/third_party/boringssl/crypto/fipsmodule/rand/ctrdrbg.c +2 -2
- data/third_party/boringssl/crypto/fipsmodule/rand/internal.h +35 -0
- data/third_party/boringssl/crypto/fipsmodule/rand/rand.c +24 -19
- data/third_party/boringssl/crypto/fipsmodule/rand/urandom.c +256 -77
- data/third_party/boringssl/crypto/fipsmodule/rsa/padding.c +10 -7
- data/third_party/boringssl/crypto/fipsmodule/rsa/rsa.c +5 -1
- data/third_party/boringssl/crypto/fipsmodule/rsa/rsa_impl.c +131 -14
- data/third_party/boringssl/crypto/fipsmodule/self_check/self_check.c +83 -10
- data/third_party/boringssl/crypto/fipsmodule/sha/internal.h +53 -0
- data/third_party/boringssl/crypto/fipsmodule/sha/sha1.c +9 -13
- data/third_party/boringssl/crypto/fipsmodule/sha/sha256.c +18 -12
- data/third_party/boringssl/crypto/fipsmodule/sha/sha512.c +95 -168
- data/third_party/boringssl/crypto/hrss/hrss.c +2201 -0
- data/third_party/boringssl/crypto/hrss/internal.h +62 -0
- data/third_party/boringssl/crypto/internal.h +95 -20
- data/third_party/boringssl/crypto/lhash/lhash.c +45 -33
- data/third_party/boringssl/crypto/mem.c +39 -2
- data/third_party/boringssl/crypto/obj/obj.c +4 -4
- data/third_party/boringssl/crypto/obj/obj_dat.h +6181 -875
- data/third_party/boringssl/crypto/pem/pem_all.c +2 -3
- data/third_party/boringssl/crypto/pem/pem_info.c +144 -162
- data/third_party/boringssl/crypto/pem/pem_lib.c +53 -52
- data/third_party/boringssl/crypto/pem/pem_pkey.c +13 -21
- data/third_party/boringssl/crypto/pkcs7/pkcs7.c +15 -22
- data/third_party/boringssl/crypto/pkcs7/pkcs7_x509.c +168 -16
- data/third_party/boringssl/crypto/pkcs8/internal.h +11 -0
- data/third_party/boringssl/crypto/pkcs8/p5_pbev2.c +24 -15
- data/third_party/boringssl/crypto/pkcs8/pkcs8.c +42 -25
- data/third_party/boringssl/crypto/pkcs8/pkcs8_x509.c +559 -43
- data/third_party/boringssl/crypto/pool/internal.h +1 -1
- data/third_party/boringssl/crypto/pool/pool.c +21 -0
- data/third_party/boringssl/crypto/rand_extra/deterministic.c +8 -0
- data/third_party/boringssl/crypto/rand_extra/fuchsia.c +1 -14
- data/third_party/boringssl/crypto/refcount_lock.c +2 -2
- data/third_party/boringssl/crypto/rsa_extra/rsa_print.c +22 -0
- data/third_party/boringssl/crypto/siphash/siphash.c +80 -0
- data/third_party/boringssl/crypto/stack/stack.c +83 -32
- data/third_party/boringssl/crypto/thread_none.c +2 -2
- data/third_party/boringssl/crypto/thread_pthread.c +2 -2
- data/third_party/boringssl/crypto/thread_win.c +38 -19
- data/third_party/boringssl/crypto/x509/a_strex.c +22 -2
- data/third_party/boringssl/crypto/x509/asn1_gen.c +2 -1
- data/third_party/boringssl/crypto/x509/by_dir.c +7 -0
- data/third_party/boringssl/crypto/x509/by_file.c +12 -10
- data/third_party/boringssl/crypto/x509/t_crl.c +5 -8
- data/third_party/boringssl/crypto/x509/t_req.c +1 -3
- data/third_party/boringssl/crypto/x509/t_x509.c +5 -8
- data/third_party/boringssl/crypto/x509/x509_cmp.c +1 -1
- data/third_party/boringssl/crypto/x509/x509_def.c +1 -1
- data/third_party/boringssl/crypto/x509/x509_lu.c +114 -5
- data/third_party/boringssl/crypto/x509/x509_req.c +20 -0
- data/third_party/boringssl/crypto/x509/x509_set.c +5 -0
- data/third_party/boringssl/crypto/x509/x509_trs.c +1 -0
- data/third_party/boringssl/crypto/x509/x509_txt.c +4 -5
- data/third_party/boringssl/crypto/x509/x509_vfy.c +145 -138
- data/third_party/boringssl/crypto/x509/x509_vpm.c +2 -0
- data/third_party/boringssl/crypto/x509/x509cset.c +40 -0
- data/third_party/boringssl/crypto/x509/x509name.c +2 -3
- data/third_party/boringssl/crypto/x509/x_all.c +109 -210
- data/third_party/boringssl/crypto/x509/x_x509.c +6 -0
- data/third_party/boringssl/crypto/x509v3/ext_dat.h +1 -3
- data/third_party/boringssl/crypto/x509v3/internal.h +56 -0
- data/third_party/boringssl/crypto/x509v3/pcy_cache.c +2 -0
- data/third_party/boringssl/crypto/x509v3/pcy_node.c +1 -0
- data/third_party/boringssl/crypto/x509v3/pcy_tree.c +4 -2
- data/third_party/boringssl/crypto/x509v3/v3_akey.c +5 -2
- data/third_party/boringssl/crypto/x509v3/v3_alt.c +19 -13
- data/third_party/boringssl/crypto/x509v3/v3_conf.c +2 -1
- data/third_party/boringssl/crypto/x509v3/v3_cpols.c +3 -2
- data/third_party/boringssl/crypto/x509v3/v3_genn.c +1 -6
- data/third_party/boringssl/crypto/x509v3/v3_lib.c +1 -0
- data/third_party/boringssl/crypto/x509v3/v3_ocsp.c +68 -0
- data/third_party/boringssl/crypto/x509v3/v3_pci.c +2 -1
- data/third_party/boringssl/crypto/x509v3/v3_purp.c +47 -69
- data/third_party/boringssl/crypto/x509v3/v3_skey.c +5 -2
- data/third_party/boringssl/crypto/x509v3/v3_utl.c +69 -25
- data/third_party/boringssl/include/openssl/aead.h +45 -19
- data/third_party/boringssl/include/openssl/aes.h +32 -7
- data/third_party/boringssl/include/openssl/asn1.h +7 -77
- data/third_party/boringssl/include/openssl/base.h +120 -6
- data/third_party/boringssl/include/openssl/base64.h +4 -1
- data/third_party/boringssl/include/openssl/bio.h +112 -81
- data/third_party/boringssl/include/openssl/blowfish.h +3 -3
- data/third_party/boringssl/include/openssl/bn.h +55 -29
- data/third_party/boringssl/include/openssl/buf.h +2 -2
- data/third_party/boringssl/include/openssl/bytestring.h +54 -32
- data/third_party/boringssl/include/openssl/cast.h +2 -2
- data/third_party/boringssl/include/openssl/cipher.h +46 -16
- data/third_party/boringssl/include/openssl/cmac.h +6 -2
- data/third_party/boringssl/include/openssl/conf.h +3 -6
- data/third_party/boringssl/include/openssl/cpu.h +25 -9
- data/third_party/boringssl/include/openssl/crypto.h +32 -10
- data/third_party/boringssl/include/openssl/curve25519.h +4 -4
- data/third_party/boringssl/include/openssl/dh.h +3 -2
- data/third_party/boringssl/include/openssl/digest.h +21 -7
- data/third_party/boringssl/include/openssl/dsa.h +8 -2
- data/third_party/boringssl/include/openssl/e_os2.h +18 -0
- data/third_party/boringssl/include/openssl/ec.h +25 -21
- data/third_party/boringssl/include/openssl/ec_key.h +36 -8
- data/third_party/boringssl/include/openssl/ecdh.h +17 -0
- data/third_party/boringssl/include/openssl/ecdsa.h +3 -3
- data/third_party/boringssl/include/openssl/engine.h +4 -4
- data/third_party/boringssl/include/openssl/err.h +3 -0
- data/third_party/boringssl/include/openssl/evp.h +199 -42
- data/third_party/boringssl/include/openssl/hmac.h +4 -4
- data/third_party/boringssl/include/openssl/hrss.h +100 -0
- data/third_party/boringssl/include/openssl/lhash.h +131 -23
- data/third_party/boringssl/include/openssl/md4.h +6 -4
- data/third_party/boringssl/include/openssl/md5.h +6 -4
- data/third_party/boringssl/include/openssl/mem.h +6 -2
- data/third_party/boringssl/include/openssl/nid.h +3 -0
- data/third_party/boringssl/include/openssl/obj.h +3 -0
- data/third_party/boringssl/include/openssl/pem.h +102 -64
- data/third_party/boringssl/include/openssl/pkcs7.h +136 -3
- data/third_party/boringssl/include/openssl/pkcs8.h +42 -3
- data/third_party/boringssl/include/openssl/pool.h +13 -2
- data/third_party/boringssl/include/openssl/ripemd.h +5 -4
- data/third_party/boringssl/include/openssl/rsa.h +46 -15
- data/third_party/boringssl/include/openssl/sha.h +40 -28
- data/third_party/boringssl/include/openssl/siphash.h +37 -0
- data/third_party/boringssl/include/openssl/span.h +17 -9
- data/third_party/boringssl/include/openssl/ssl.h +766 -393
- data/third_party/boringssl/include/openssl/ssl3.h +4 -3
- data/third_party/boringssl/include/openssl/stack.h +134 -77
- data/third_party/boringssl/include/openssl/thread.h +1 -1
- data/third_party/boringssl/include/openssl/tls1.h +25 -9
- data/third_party/boringssl/include/openssl/type_check.h +14 -15
- data/third_party/boringssl/include/openssl/x509.h +28 -3
- data/third_party/boringssl/include/openssl/x509_vfy.h +98 -32
- data/third_party/boringssl/include/openssl/x509v3.h +17 -13
- data/third_party/boringssl/ssl/d1_both.cc +9 -18
- data/third_party/boringssl/ssl/d1_lib.cc +4 -3
- data/third_party/boringssl/ssl/d1_pkt.cc +4 -4
- data/third_party/boringssl/ssl/d1_srtp.cc +15 -15
- data/third_party/boringssl/ssl/dtls_method.cc +0 -1
- data/third_party/boringssl/ssl/dtls_record.cc +28 -28
- data/third_party/boringssl/ssl/handoff.cc +295 -91
- data/third_party/boringssl/ssl/handshake.cc +133 -72
- data/third_party/boringssl/ssl/handshake_client.cc +218 -189
- data/third_party/boringssl/ssl/handshake_server.cc +399 -272
- data/third_party/boringssl/ssl/internal.h +1413 -928
- data/third_party/boringssl/ssl/s3_both.cc +175 -36
- data/third_party/boringssl/ssl/s3_lib.cc +9 -13
- data/third_party/boringssl/ssl/s3_pkt.cc +63 -29
- data/third_party/boringssl/ssl/ssl_aead_ctx.cc +55 -35
- data/third_party/boringssl/ssl/ssl_asn1.cc +57 -73
- data/third_party/boringssl/ssl/ssl_buffer.cc +13 -12
- data/third_party/boringssl/ssl/ssl_cert.cc +313 -210
- data/third_party/boringssl/ssl/ssl_cipher.cc +159 -221
- data/third_party/boringssl/ssl/ssl_file.cc +2 -0
- data/third_party/boringssl/ssl/ssl_key_share.cc +164 -19
- data/third_party/boringssl/ssl/ssl_lib.cc +847 -555
- data/third_party/boringssl/ssl/ssl_privkey.cc +441 -111
- data/third_party/boringssl/ssl/ssl_session.cc +230 -178
- data/third_party/boringssl/ssl/ssl_transcript.cc +21 -142
- data/third_party/boringssl/ssl/ssl_versions.cc +88 -93
- data/third_party/boringssl/ssl/ssl_x509.cc +279 -218
- data/third_party/boringssl/ssl/t1_enc.cc +5 -96
- data/third_party/boringssl/ssl/t1_lib.cc +931 -678
- data/third_party/boringssl/ssl/tls13_both.cc +251 -121
- data/third_party/boringssl/ssl/tls13_client.cc +129 -73
- data/third_party/boringssl/ssl/tls13_enc.cc +350 -282
- data/third_party/boringssl/ssl/tls13_server.cc +259 -192
- data/third_party/boringssl/ssl/tls_method.cc +26 -21
- data/third_party/boringssl/ssl/tls_record.cc +42 -47
- data/third_party/boringssl/third_party/fiat/curve25519.c +261 -1324
- data/third_party/boringssl/third_party/fiat/curve25519_32.h +911 -0
- data/third_party/boringssl/third_party/fiat/curve25519_64.h +559 -0
- data/third_party/boringssl/third_party/fiat/p256.c +238 -999
- data/third_party/boringssl/third_party/fiat/p256_32.h +3226 -0
- data/third_party/boringssl/third_party/fiat/p256_64.h +1217 -0
- data/third_party/upb/upb/port_def.inc +1 -1
- data/third_party/upb/upb/table.c +2 -1
- metadata +72 -44
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h +0 -127
- data/src/core/lib/gpr/mpscq.cc +0 -117
- data/src/core/lib/gpr/mpscq.h +0 -88
- data/src/core/lib/gprpp/abstract.h +0 -47
- data/src/core/lib/gprpp/pair.h +0 -38
- data/third_party/boringssl/crypto/cipher_extra/e_ssl3.c +0 -460
- data/third_party/boringssl/crypto/fipsmodule/modes/ccm.c +0 -256
- data/third_party/boringssl/include/openssl/lhash_macros.h +0 -174
- data/third_party/boringssl/ssl/custom_extensions.cc +0 -265
data/src/core/lib/gpr/mpscq.cc
DELETED
@@ -1,117 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
*
|
3
|
-
* Copyright 2016 gRPC authors.
|
4
|
-
*
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
* you may not use this file except in compliance with the License.
|
7
|
-
* You may obtain a copy of the License at
|
8
|
-
*
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
*
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
* See the License for the specific language governing permissions and
|
15
|
-
* limitations under the License.
|
16
|
-
*
|
17
|
-
*/
|
18
|
-
|
19
|
-
#include <grpc/support/port_platform.h>
|
20
|
-
|
21
|
-
#include "src/core/lib/gpr/mpscq.h"
|
22
|
-
|
23
|
-
#include <grpc/support/log.h>
|
24
|
-
|
25
|
-
void gpr_mpscq_init(gpr_mpscq* q) {
|
26
|
-
gpr_atm_no_barrier_store(&q->head, (gpr_atm)&q->stub);
|
27
|
-
q->tail = &q->stub;
|
28
|
-
gpr_atm_no_barrier_store(&q->stub.next, (gpr_atm)NULL);
|
29
|
-
}
|
30
|
-
|
31
|
-
void gpr_mpscq_destroy(gpr_mpscq* q) {
|
32
|
-
GPR_ASSERT(gpr_atm_no_barrier_load(&q->head) == (gpr_atm)&q->stub);
|
33
|
-
GPR_ASSERT(q->tail == &q->stub);
|
34
|
-
}
|
35
|
-
|
36
|
-
bool gpr_mpscq_push(gpr_mpscq* q, gpr_mpscq_node* n) {
|
37
|
-
gpr_atm_no_barrier_store(&n->next, (gpr_atm)NULL);
|
38
|
-
gpr_mpscq_node* prev =
|
39
|
-
(gpr_mpscq_node*)gpr_atm_full_xchg(&q->head, (gpr_atm)n);
|
40
|
-
gpr_atm_rel_store(&prev->next, (gpr_atm)n);
|
41
|
-
return prev == &q->stub;
|
42
|
-
}
|
43
|
-
|
44
|
-
gpr_mpscq_node* gpr_mpscq_pop(gpr_mpscq* q) {
|
45
|
-
bool empty;
|
46
|
-
return gpr_mpscq_pop_and_check_end(q, &empty);
|
47
|
-
}
|
48
|
-
|
49
|
-
gpr_mpscq_node* gpr_mpscq_pop_and_check_end(gpr_mpscq* q, bool* empty) {
|
50
|
-
gpr_mpscq_node* tail = q->tail;
|
51
|
-
gpr_mpscq_node* next = (gpr_mpscq_node*)gpr_atm_acq_load(&tail->next);
|
52
|
-
if (tail == &q->stub) {
|
53
|
-
// indicates the list is actually (ephemerally) empty
|
54
|
-
if (next == nullptr) {
|
55
|
-
*empty = true;
|
56
|
-
return nullptr;
|
57
|
-
}
|
58
|
-
q->tail = next;
|
59
|
-
tail = next;
|
60
|
-
next = (gpr_mpscq_node*)gpr_atm_acq_load(&tail->next);
|
61
|
-
}
|
62
|
-
if (next != nullptr) {
|
63
|
-
*empty = false;
|
64
|
-
q->tail = next;
|
65
|
-
return tail;
|
66
|
-
}
|
67
|
-
gpr_mpscq_node* head = (gpr_mpscq_node*)gpr_atm_acq_load(&q->head);
|
68
|
-
if (tail != head) {
|
69
|
-
*empty = false;
|
70
|
-
// indicates a retry is in order: we're still adding
|
71
|
-
return nullptr;
|
72
|
-
}
|
73
|
-
gpr_mpscq_push(q, &q->stub);
|
74
|
-
next = (gpr_mpscq_node*)gpr_atm_acq_load(&tail->next);
|
75
|
-
if (next != nullptr) {
|
76
|
-
*empty = false;
|
77
|
-
q->tail = next;
|
78
|
-
return tail;
|
79
|
-
}
|
80
|
-
// indicates a retry is in order: we're still adding
|
81
|
-
*empty = false;
|
82
|
-
return nullptr;
|
83
|
-
}
|
84
|
-
|
85
|
-
void gpr_locked_mpscq_init(gpr_locked_mpscq* q) {
|
86
|
-
gpr_mpscq_init(&q->queue);
|
87
|
-
gpr_mu_init(&q->mu);
|
88
|
-
}
|
89
|
-
|
90
|
-
void gpr_locked_mpscq_destroy(gpr_locked_mpscq* q) {
|
91
|
-
gpr_mpscq_destroy(&q->queue);
|
92
|
-
gpr_mu_destroy(&q->mu);
|
93
|
-
}
|
94
|
-
|
95
|
-
bool gpr_locked_mpscq_push(gpr_locked_mpscq* q, gpr_mpscq_node* n) {
|
96
|
-
return gpr_mpscq_push(&q->queue, n);
|
97
|
-
}
|
98
|
-
|
99
|
-
gpr_mpscq_node* gpr_locked_mpscq_try_pop(gpr_locked_mpscq* q) {
|
100
|
-
if (gpr_mu_trylock(&q->mu)) {
|
101
|
-
gpr_mpscq_node* n = gpr_mpscq_pop(&q->queue);
|
102
|
-
gpr_mu_unlock(&q->mu);
|
103
|
-
return n;
|
104
|
-
}
|
105
|
-
return nullptr;
|
106
|
-
}
|
107
|
-
|
108
|
-
gpr_mpscq_node* gpr_locked_mpscq_pop(gpr_locked_mpscq* q) {
|
109
|
-
gpr_mu_lock(&q->mu);
|
110
|
-
bool empty = false;
|
111
|
-
gpr_mpscq_node* n;
|
112
|
-
do {
|
113
|
-
n = gpr_mpscq_pop_and_check_end(&q->queue, &empty);
|
114
|
-
} while (n == nullptr && !empty);
|
115
|
-
gpr_mu_unlock(&q->mu);
|
116
|
-
return n;
|
117
|
-
}
|
data/src/core/lib/gpr/mpscq.h
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
*
|
3
|
-
* Copyright 2016 gRPC authors.
|
4
|
-
*
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
* you may not use this file except in compliance with the License.
|
7
|
-
* You may obtain a copy of the License at
|
8
|
-
*
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
*
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
* See the License for the specific language governing permissions and
|
15
|
-
* limitations under the License.
|
16
|
-
*
|
17
|
-
*/
|
18
|
-
|
19
|
-
#ifndef GRPC_CORE_LIB_GPR_MPSCQ_H
|
20
|
-
#define GRPC_CORE_LIB_GPR_MPSCQ_H
|
21
|
-
|
22
|
-
#include <grpc/support/port_platform.h>
|
23
|
-
|
24
|
-
#include <grpc/support/atm.h>
|
25
|
-
#include <grpc/support/sync.h>
|
26
|
-
#include <stdbool.h>
|
27
|
-
#include <stddef.h>
|
28
|
-
|
29
|
-
// Multiple-producer single-consumer lock free queue, based upon the
|
30
|
-
// implementation from Dmitry Vyukov here:
|
31
|
-
// http://www.1024cores.net/home/lock-free-algorithms/queues/intrusive-mpsc-node-based-queue
|
32
|
-
|
33
|
-
// List node (include this in a data structure at the top, and add application
|
34
|
-
// fields after it - to simulate inheritance)
|
35
|
-
typedef struct gpr_mpscq_node {
|
36
|
-
gpr_atm next;
|
37
|
-
} gpr_mpscq_node;
|
38
|
-
|
39
|
-
// Actual queue type
|
40
|
-
typedef struct gpr_mpscq {
|
41
|
-
// make sure head & tail don't share a cacheline
|
42
|
-
union {
|
43
|
-
char padding[GPR_CACHELINE_SIZE];
|
44
|
-
gpr_atm head;
|
45
|
-
};
|
46
|
-
gpr_mpscq_node* tail;
|
47
|
-
gpr_mpscq_node stub;
|
48
|
-
} gpr_mpscq;
|
49
|
-
|
50
|
-
void gpr_mpscq_init(gpr_mpscq* q);
|
51
|
-
void gpr_mpscq_destroy(gpr_mpscq* q);
|
52
|
-
// Push a node
|
53
|
-
// Thread safe - can be called from multiple threads concurrently
|
54
|
-
// Returns true if this was possibly the first node (may return true
|
55
|
-
// sporadically, will not return false sporadically)
|
56
|
-
bool gpr_mpscq_push(gpr_mpscq* q, gpr_mpscq_node* n);
|
57
|
-
// Pop a node (returns NULL if no node is ready - which doesn't indicate that
|
58
|
-
// the queue is empty!!)
|
59
|
-
// Thread compatible - can only be called from one thread at a time
|
60
|
-
gpr_mpscq_node* gpr_mpscq_pop(gpr_mpscq* q);
|
61
|
-
// Pop a node; sets *empty to true if the queue is empty, or false if it is not
|
62
|
-
gpr_mpscq_node* gpr_mpscq_pop_and_check_end(gpr_mpscq* q, bool* empty);
|
63
|
-
|
64
|
-
// An mpscq with a lock: it's safe to pop from multiple threads, but doing
|
65
|
-
// only one thread will succeed concurrently
|
66
|
-
typedef struct gpr_locked_mpscq {
|
67
|
-
gpr_mpscq queue;
|
68
|
-
gpr_mu mu;
|
69
|
-
} gpr_locked_mpscq;
|
70
|
-
|
71
|
-
void gpr_locked_mpscq_init(gpr_locked_mpscq* q);
|
72
|
-
void gpr_locked_mpscq_destroy(gpr_locked_mpscq* q);
|
73
|
-
// Push a node
|
74
|
-
// Thread safe - can be called from multiple threads concurrently
|
75
|
-
// Returns true if this was possibly the first node (may return true
|
76
|
-
// sporadically, will not return false sporadically)
|
77
|
-
bool gpr_locked_mpscq_push(gpr_locked_mpscq* q, gpr_mpscq_node* n);
|
78
|
-
|
79
|
-
// Pop a node (returns NULL if no node is ready - which doesn't indicate that
|
80
|
-
// the queue is empty!!)
|
81
|
-
// Thread safe - can be called from multiple threads concurrently
|
82
|
-
gpr_mpscq_node* gpr_locked_mpscq_try_pop(gpr_locked_mpscq* q);
|
83
|
-
|
84
|
-
// Pop a node. Returns NULL only if the queue was empty at some point after
|
85
|
-
// calling this function
|
86
|
-
gpr_mpscq_node* gpr_locked_mpscq_pop(gpr_locked_mpscq* q);
|
87
|
-
|
88
|
-
#endif /* GRPC_CORE_LIB_GPR_MPSCQ_H */
|
@@ -1,47 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
*
|
3
|
-
* Copyright 2017 gRPC authors.
|
4
|
-
*
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
* you may not use this file except in compliance with the License.
|
7
|
-
* You may obtain a copy of the License at
|
8
|
-
*
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
*
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
* See the License for the specific language governing permissions and
|
15
|
-
* limitations under the License.
|
16
|
-
*
|
17
|
-
*/
|
18
|
-
|
19
|
-
#ifndef GRPC_CORE_LIB_GPRPP_ABSTRACT_H
|
20
|
-
#define GRPC_CORE_LIB_GPRPP_ABSTRACT_H
|
21
|
-
|
22
|
-
#if GRPC_USE_CPP_STD_LIB
|
23
|
-
|
24
|
-
#define GRPC_ABSTRACT_BASE_CLASS
|
25
|
-
|
26
|
-
#define GRPC_ABSTRACT = 0
|
27
|
-
|
28
|
-
#else
|
29
|
-
|
30
|
-
// This is needed to support abstract base classes in the c core. Since gRPC
|
31
|
-
// doesn't have a c++ runtime, it will hit a linker error on delete unless
|
32
|
-
// we define a virtual operator delete. See this blog for more info:
|
33
|
-
// https://eli.thegreenplace.net/2015/c-deleting-destructors-and-virtual-operator-delete/
|
34
|
-
#define GRPC_ABSTRACT_BASE_CLASS \
|
35
|
-
static void operator delete(void* p) { abort(); }
|
36
|
-
|
37
|
-
// gRPC currently can't depend on libstdc++, so we can't use "= 0" for
|
38
|
-
// pure virtual methods. Instead, we use this macro.
|
39
|
-
#define GRPC_ABSTRACT \
|
40
|
-
{ \
|
41
|
-
gpr_log(GPR_ERROR, "Function marked GRPC_ABSTRACT was not implemented"); \
|
42
|
-
GPR_ASSERT(false); \
|
43
|
-
}
|
44
|
-
|
45
|
-
#endif // GRPC_USE_CPP_STD_LIB
|
46
|
-
|
47
|
-
#endif /* GRPC_CORE_LIB_GPRPP_ABSTRACT_H */
|
data/src/core/lib/gprpp/pair.h
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
*
|
3
|
-
* Copyright 2017 gRPC authors.
|
4
|
-
*
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
* you may not use this file except in compliance with the License.
|
7
|
-
* You may obtain a copy of the License at
|
8
|
-
*
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
*
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
* See the License for the specific language governing permissions and
|
15
|
-
* limitations under the License.
|
16
|
-
*
|
17
|
-
*/
|
18
|
-
|
19
|
-
#ifndef GRPC_CORE_LIB_GPRPP_PAIR_H
|
20
|
-
#define GRPC_CORE_LIB_GPRPP_PAIR_H
|
21
|
-
|
22
|
-
#include <grpc/support/port_platform.h>
|
23
|
-
|
24
|
-
#include <utility>
|
25
|
-
|
26
|
-
namespace grpc_core {
|
27
|
-
template <class T1, class T2>
|
28
|
-
using Pair = std::pair<T1, T2>;
|
29
|
-
|
30
|
-
template <class T1, class T2>
|
31
|
-
inline Pair<typename std::decay<T1>::type, typename std::decay<T2>::type>
|
32
|
-
MakePair(T1&& u, T2&& v) {
|
33
|
-
typedef typename std::decay<T1>::type V1;
|
34
|
-
typedef typename std::decay<T2>::type V2;
|
35
|
-
return Pair<V1, V2>(std::forward<T1>(u), std::forward<T2>(v));
|
36
|
-
}
|
37
|
-
} // namespace grpc_core
|
38
|
-
#endif /* GRPC_CORE_LIB_GPRPP_PAIR_H */
|
@@ -1,460 +0,0 @@
|
|
1
|
-
/* Copyright (c) 2014, Google Inc.
|
2
|
-
*
|
3
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
4
|
-
* purpose with or without fee is hereby granted, provided that the above
|
5
|
-
* copyright notice and this permission notice appear in all copies.
|
6
|
-
*
|
7
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
8
|
-
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
9
|
-
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
10
|
-
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
11
|
-
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
12
|
-
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
13
|
-
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
14
|
-
|
15
|
-
#include <assert.h>
|
16
|
-
#include <limits.h>
|
17
|
-
#include <string.h>
|
18
|
-
|
19
|
-
#include <openssl/aead.h>
|
20
|
-
#include <openssl/cipher.h>
|
21
|
-
#include <openssl/err.h>
|
22
|
-
#include <openssl/hmac.h>
|
23
|
-
#include <openssl/md5.h>
|
24
|
-
#include <openssl/mem.h>
|
25
|
-
#include <openssl/sha.h>
|
26
|
-
|
27
|
-
#include "internal.h"
|
28
|
-
#include "../internal.h"
|
29
|
-
#include "../fipsmodule/cipher/internal.h"
|
30
|
-
|
31
|
-
|
32
|
-
typedef struct {
|
33
|
-
EVP_CIPHER_CTX cipher_ctx;
|
34
|
-
EVP_MD_CTX md_ctx;
|
35
|
-
} AEAD_SSL3_CTX;
|
36
|
-
|
37
|
-
static int ssl3_mac(AEAD_SSL3_CTX *ssl3_ctx, uint8_t *out, unsigned *out_len,
|
38
|
-
const uint8_t *ad, size_t ad_len, const uint8_t *in,
|
39
|
-
size_t in_len) {
|
40
|
-
size_t md_size = EVP_MD_CTX_size(&ssl3_ctx->md_ctx);
|
41
|
-
size_t pad_len = (md_size == 20) ? 40 : 48;
|
42
|
-
|
43
|
-
// To allow for CBC mode which changes cipher length, |ad| doesn't include the
|
44
|
-
// length for legacy ciphers.
|
45
|
-
uint8_t ad_extra[2];
|
46
|
-
ad_extra[0] = (uint8_t)(in_len >> 8);
|
47
|
-
ad_extra[1] = (uint8_t)(in_len & 0xff);
|
48
|
-
|
49
|
-
EVP_MD_CTX md_ctx;
|
50
|
-
EVP_MD_CTX_init(&md_ctx);
|
51
|
-
|
52
|
-
uint8_t pad[48];
|
53
|
-
uint8_t tmp[EVP_MAX_MD_SIZE];
|
54
|
-
OPENSSL_memset(pad, 0x36, pad_len);
|
55
|
-
if (!EVP_MD_CTX_copy_ex(&md_ctx, &ssl3_ctx->md_ctx) ||
|
56
|
-
!EVP_DigestUpdate(&md_ctx, pad, pad_len) ||
|
57
|
-
!EVP_DigestUpdate(&md_ctx, ad, ad_len) ||
|
58
|
-
!EVP_DigestUpdate(&md_ctx, ad_extra, sizeof(ad_extra)) ||
|
59
|
-
!EVP_DigestUpdate(&md_ctx, in, in_len) ||
|
60
|
-
!EVP_DigestFinal_ex(&md_ctx, tmp, NULL)) {
|
61
|
-
EVP_MD_CTX_cleanup(&md_ctx);
|
62
|
-
return 0;
|
63
|
-
}
|
64
|
-
|
65
|
-
OPENSSL_memset(pad, 0x5c, pad_len);
|
66
|
-
if (!EVP_MD_CTX_copy_ex(&md_ctx, &ssl3_ctx->md_ctx) ||
|
67
|
-
!EVP_DigestUpdate(&md_ctx, pad, pad_len) ||
|
68
|
-
!EVP_DigestUpdate(&md_ctx, tmp, md_size) ||
|
69
|
-
!EVP_DigestFinal_ex(&md_ctx, out, out_len)) {
|
70
|
-
EVP_MD_CTX_cleanup(&md_ctx);
|
71
|
-
return 0;
|
72
|
-
}
|
73
|
-
EVP_MD_CTX_cleanup(&md_ctx);
|
74
|
-
return 1;
|
75
|
-
}
|
76
|
-
|
77
|
-
static void aead_ssl3_cleanup(EVP_AEAD_CTX *ctx) {
|
78
|
-
AEAD_SSL3_CTX *ssl3_ctx = (AEAD_SSL3_CTX *)ctx->aead_state;
|
79
|
-
EVP_CIPHER_CTX_cleanup(&ssl3_ctx->cipher_ctx);
|
80
|
-
EVP_MD_CTX_cleanup(&ssl3_ctx->md_ctx);
|
81
|
-
OPENSSL_free(ssl3_ctx);
|
82
|
-
ctx->aead_state = NULL;
|
83
|
-
}
|
84
|
-
|
85
|
-
static int aead_ssl3_init(EVP_AEAD_CTX *ctx, const uint8_t *key, size_t key_len,
|
86
|
-
size_t tag_len, enum evp_aead_direction_t dir,
|
87
|
-
const EVP_CIPHER *cipher, const EVP_MD *md) {
|
88
|
-
if (tag_len != EVP_AEAD_DEFAULT_TAG_LENGTH &&
|
89
|
-
tag_len != EVP_MD_size(md)) {
|
90
|
-
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_UNSUPPORTED_TAG_SIZE);
|
91
|
-
return 0;
|
92
|
-
}
|
93
|
-
|
94
|
-
if (key_len != EVP_AEAD_key_length(ctx->aead)) {
|
95
|
-
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_BAD_KEY_LENGTH);
|
96
|
-
return 0;
|
97
|
-
}
|
98
|
-
|
99
|
-
size_t mac_key_len = EVP_MD_size(md);
|
100
|
-
size_t enc_key_len = EVP_CIPHER_key_length(cipher);
|
101
|
-
assert(mac_key_len + enc_key_len + EVP_CIPHER_iv_length(cipher) == key_len);
|
102
|
-
|
103
|
-
AEAD_SSL3_CTX *ssl3_ctx = OPENSSL_malloc(sizeof(AEAD_SSL3_CTX));
|
104
|
-
if (ssl3_ctx == NULL) {
|
105
|
-
OPENSSL_PUT_ERROR(CIPHER, ERR_R_MALLOC_FAILURE);
|
106
|
-
return 0;
|
107
|
-
}
|
108
|
-
EVP_CIPHER_CTX_init(&ssl3_ctx->cipher_ctx);
|
109
|
-
EVP_MD_CTX_init(&ssl3_ctx->md_ctx);
|
110
|
-
|
111
|
-
ctx->aead_state = ssl3_ctx;
|
112
|
-
if (!EVP_CipherInit_ex(&ssl3_ctx->cipher_ctx, cipher, NULL, &key[mac_key_len],
|
113
|
-
&key[mac_key_len + enc_key_len],
|
114
|
-
dir == evp_aead_seal) ||
|
115
|
-
!EVP_DigestInit_ex(&ssl3_ctx->md_ctx, md, NULL) ||
|
116
|
-
!EVP_DigestUpdate(&ssl3_ctx->md_ctx, key, mac_key_len)) {
|
117
|
-
aead_ssl3_cleanup(ctx);
|
118
|
-
ctx->aead_state = NULL;
|
119
|
-
return 0;
|
120
|
-
}
|
121
|
-
EVP_CIPHER_CTX_set_padding(&ssl3_ctx->cipher_ctx, 0);
|
122
|
-
|
123
|
-
return 1;
|
124
|
-
}
|
125
|
-
|
126
|
-
static size_t aead_ssl3_tag_len(const EVP_AEAD_CTX *ctx, const size_t in_len,
|
127
|
-
const size_t extra_in_len) {
|
128
|
-
assert(extra_in_len == 0);
|
129
|
-
const AEAD_SSL3_CTX *ssl3_ctx = (AEAD_SSL3_CTX*)ctx->aead_state;
|
130
|
-
|
131
|
-
const size_t digest_len = EVP_MD_CTX_size(&ssl3_ctx->md_ctx);
|
132
|
-
if (EVP_CIPHER_CTX_mode(&ssl3_ctx->cipher_ctx) != EVP_CIPH_CBC_MODE) {
|
133
|
-
// The NULL cipher.
|
134
|
-
return digest_len;
|
135
|
-
}
|
136
|
-
|
137
|
-
const size_t block_size = EVP_CIPHER_CTX_block_size(&ssl3_ctx->cipher_ctx);
|
138
|
-
// An overflow of |in_len + digest_len| doesn't affect the result mod
|
139
|
-
// |block_size|, provided that |block_size| is a smaller power of two.
|
140
|
-
assert(block_size != 0 && (block_size & (block_size - 1)) == 0);
|
141
|
-
const size_t pad_len = block_size - ((in_len + digest_len) % block_size);
|
142
|
-
return digest_len + pad_len;
|
143
|
-
}
|
144
|
-
|
145
|
-
static int aead_ssl3_seal_scatter(const EVP_AEAD_CTX *ctx, uint8_t *out,
|
146
|
-
uint8_t *out_tag, size_t *out_tag_len,
|
147
|
-
const size_t max_out_tag_len,
|
148
|
-
const uint8_t *nonce, const size_t nonce_len,
|
149
|
-
const uint8_t *in, const size_t in_len,
|
150
|
-
const uint8_t *extra_in,
|
151
|
-
const size_t extra_in_len, const uint8_t *ad,
|
152
|
-
const size_t ad_len) {
|
153
|
-
AEAD_SSL3_CTX *ssl3_ctx = (AEAD_SSL3_CTX *)ctx->aead_state;
|
154
|
-
|
155
|
-
if (!ssl3_ctx->cipher_ctx.encrypt) {
|
156
|
-
// Unlike a normal AEAD, an SSL3 AEAD may only be used in one direction.
|
157
|
-
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_INVALID_OPERATION);
|
158
|
-
return 0;
|
159
|
-
}
|
160
|
-
|
161
|
-
if (in_len > INT_MAX) {
|
162
|
-
// EVP_CIPHER takes int as input.
|
163
|
-
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_TOO_LARGE);
|
164
|
-
return 0;
|
165
|
-
}
|
166
|
-
|
167
|
-
if (max_out_tag_len < aead_ssl3_tag_len(ctx, in_len, extra_in_len)) {
|
168
|
-
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_BUFFER_TOO_SMALL);
|
169
|
-
return 0;
|
170
|
-
}
|
171
|
-
|
172
|
-
if (nonce_len != 0) {
|
173
|
-
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_IV_TOO_LARGE);
|
174
|
-
return 0;
|
175
|
-
}
|
176
|
-
|
177
|
-
if (ad_len != 11 - 2 /* length bytes */) {
|
178
|
-
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_INVALID_AD_SIZE);
|
179
|
-
return 0;
|
180
|
-
}
|
181
|
-
|
182
|
-
// Compute the MAC. This must be first in case the operation is being done
|
183
|
-
// in-place.
|
184
|
-
uint8_t mac[EVP_MAX_MD_SIZE];
|
185
|
-
unsigned mac_len;
|
186
|
-
if (!ssl3_mac(ssl3_ctx, mac, &mac_len, ad, ad_len, in, in_len)) {
|
187
|
-
return 0;
|
188
|
-
}
|
189
|
-
|
190
|
-
// Encrypt the input.
|
191
|
-
int len;
|
192
|
-
if (!EVP_EncryptUpdate(&ssl3_ctx->cipher_ctx, out, &len, in,
|
193
|
-
(int)in_len)) {
|
194
|
-
return 0;
|
195
|
-
}
|
196
|
-
|
197
|
-
const size_t block_size = EVP_CIPHER_CTX_block_size(&ssl3_ctx->cipher_ctx);
|
198
|
-
|
199
|
-
// Feed the MAC into the cipher in two steps. First complete the final partial
|
200
|
-
// block from encrypting the input and split the result between |out| and
|
201
|
-
// |out_tag|. Then encrypt the remainder.
|
202
|
-
|
203
|
-
size_t early_mac_len = (block_size - (in_len % block_size)) % block_size;
|
204
|
-
if (early_mac_len != 0) {
|
205
|
-
assert(len + block_size - early_mac_len == in_len);
|
206
|
-
uint8_t buf[EVP_MAX_BLOCK_LENGTH];
|
207
|
-
int buf_len;
|
208
|
-
if (!EVP_EncryptUpdate(&ssl3_ctx->cipher_ctx, buf, &buf_len, mac,
|
209
|
-
(int)early_mac_len)) {
|
210
|
-
return 0;
|
211
|
-
}
|
212
|
-
assert(buf_len == (int)block_size);
|
213
|
-
OPENSSL_memcpy(out + len, buf, block_size - early_mac_len);
|
214
|
-
OPENSSL_memcpy(out_tag, buf + block_size - early_mac_len, early_mac_len);
|
215
|
-
}
|
216
|
-
size_t tag_len = early_mac_len;
|
217
|
-
|
218
|
-
if (!EVP_EncryptUpdate(&ssl3_ctx->cipher_ctx, out_tag + tag_len, &len,
|
219
|
-
mac + tag_len, mac_len - tag_len)) {
|
220
|
-
return 0;
|
221
|
-
}
|
222
|
-
tag_len += len;
|
223
|
-
|
224
|
-
if (block_size > 1) {
|
225
|
-
assert(block_size <= 256);
|
226
|
-
assert(EVP_CIPHER_CTX_mode(&ssl3_ctx->cipher_ctx) == EVP_CIPH_CBC_MODE);
|
227
|
-
|
228
|
-
// Compute padding and feed that into the cipher.
|
229
|
-
uint8_t padding[256];
|
230
|
-
size_t padding_len = block_size - ((in_len + mac_len) % block_size);
|
231
|
-
OPENSSL_memset(padding, 0, padding_len - 1);
|
232
|
-
padding[padding_len - 1] = padding_len - 1;
|
233
|
-
if (!EVP_EncryptUpdate(&ssl3_ctx->cipher_ctx, out_tag + tag_len, &len, padding,
|
234
|
-
(int)padding_len)) {
|
235
|
-
return 0;
|
236
|
-
}
|
237
|
-
tag_len += len;
|
238
|
-
}
|
239
|
-
|
240
|
-
if (!EVP_EncryptFinal_ex(&ssl3_ctx->cipher_ctx, out_tag + tag_len, &len)) {
|
241
|
-
return 0;
|
242
|
-
}
|
243
|
-
tag_len += len;
|
244
|
-
assert(tag_len == aead_ssl3_tag_len(ctx, in_len, extra_in_len));
|
245
|
-
|
246
|
-
*out_tag_len = tag_len;
|
247
|
-
return 1;
|
248
|
-
}
|
249
|
-
|
250
|
-
static int aead_ssl3_open(const EVP_AEAD_CTX *ctx, uint8_t *out,
|
251
|
-
size_t *out_len, size_t max_out_len,
|
252
|
-
const uint8_t *nonce, size_t nonce_len,
|
253
|
-
const uint8_t *in, size_t in_len,
|
254
|
-
const uint8_t *ad, size_t ad_len) {
|
255
|
-
AEAD_SSL3_CTX *ssl3_ctx = (AEAD_SSL3_CTX *)ctx->aead_state;
|
256
|
-
|
257
|
-
if (ssl3_ctx->cipher_ctx.encrypt) {
|
258
|
-
// Unlike a normal AEAD, an SSL3 AEAD may only be used in one direction.
|
259
|
-
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_INVALID_OPERATION);
|
260
|
-
return 0;
|
261
|
-
}
|
262
|
-
|
263
|
-
size_t mac_len = EVP_MD_CTX_size(&ssl3_ctx->md_ctx);
|
264
|
-
if (in_len < mac_len) {
|
265
|
-
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_BAD_DECRYPT);
|
266
|
-
return 0;
|
267
|
-
}
|
268
|
-
|
269
|
-
if (max_out_len < in_len) {
|
270
|
-
// This requires that the caller provide space for the MAC, even though it
|
271
|
-
// will always be removed on return.
|
272
|
-
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_BUFFER_TOO_SMALL);
|
273
|
-
return 0;
|
274
|
-
}
|
275
|
-
|
276
|
-
if (nonce_len != 0) {
|
277
|
-
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_TOO_LARGE);
|
278
|
-
return 0;
|
279
|
-
}
|
280
|
-
|
281
|
-
if (ad_len != 11 - 2 /* length bytes */) {
|
282
|
-
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_INVALID_AD_SIZE);
|
283
|
-
return 0;
|
284
|
-
}
|
285
|
-
|
286
|
-
if (in_len > INT_MAX) {
|
287
|
-
// EVP_CIPHER takes int as input.
|
288
|
-
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_TOO_LARGE);
|
289
|
-
return 0;
|
290
|
-
}
|
291
|
-
|
292
|
-
// Decrypt to get the plaintext + MAC + padding.
|
293
|
-
size_t total = 0;
|
294
|
-
int len;
|
295
|
-
if (!EVP_DecryptUpdate(&ssl3_ctx->cipher_ctx, out, &len, in, (int)in_len)) {
|
296
|
-
return 0;
|
297
|
-
}
|
298
|
-
total += len;
|
299
|
-
if (!EVP_DecryptFinal_ex(&ssl3_ctx->cipher_ctx, out + total, &len)) {
|
300
|
-
return 0;
|
301
|
-
}
|
302
|
-
total += len;
|
303
|
-
assert(total == in_len);
|
304
|
-
|
305
|
-
// Remove CBC padding and MAC. This would normally be timing-sensitive, but
|
306
|
-
// SSLv3 CBC ciphers are already broken. Support will be removed eventually.
|
307
|
-
// https://www.openssl.org/~bodo/ssl-poodle.pdf
|
308
|
-
size_t data_len;
|
309
|
-
if (EVP_CIPHER_CTX_mode(&ssl3_ctx->cipher_ctx) == EVP_CIPH_CBC_MODE) {
|
310
|
-
unsigned padding_length = out[total - 1];
|
311
|
-
if (total < padding_length + 1 + mac_len) {
|
312
|
-
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_BAD_DECRYPT);
|
313
|
-
return 0;
|
314
|
-
}
|
315
|
-
// The padding must be minimal.
|
316
|
-
if (padding_length + 1 > EVP_CIPHER_CTX_block_size(&ssl3_ctx->cipher_ctx)) {
|
317
|
-
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_BAD_DECRYPT);
|
318
|
-
return 0;
|
319
|
-
}
|
320
|
-
data_len = total - padding_length - 1 - mac_len;
|
321
|
-
} else {
|
322
|
-
data_len = total - mac_len;
|
323
|
-
}
|
324
|
-
|
325
|
-
// Compute the MAC and compare against the one in the record.
|
326
|
-
uint8_t mac[EVP_MAX_MD_SIZE];
|
327
|
-
if (!ssl3_mac(ssl3_ctx, mac, NULL, ad, ad_len, out, data_len)) {
|
328
|
-
return 0;
|
329
|
-
}
|
330
|
-
if (CRYPTO_memcmp(&out[data_len], mac, mac_len) != 0) {
|
331
|
-
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_BAD_DECRYPT);
|
332
|
-
return 0;
|
333
|
-
}
|
334
|
-
|
335
|
-
*out_len = data_len;
|
336
|
-
return 1;
|
337
|
-
}
|
338
|
-
|
339
|
-
static int aead_ssl3_get_iv(const EVP_AEAD_CTX *ctx, const uint8_t **out_iv,
|
340
|
-
size_t *out_iv_len) {
|
341
|
-
AEAD_SSL3_CTX *ssl3_ctx = (AEAD_SSL3_CTX *)ctx->aead_state;
|
342
|
-
const size_t iv_len = EVP_CIPHER_CTX_iv_length(&ssl3_ctx->cipher_ctx);
|
343
|
-
if (iv_len <= 1) {
|
344
|
-
return 0;
|
345
|
-
}
|
346
|
-
|
347
|
-
*out_iv = ssl3_ctx->cipher_ctx.iv;
|
348
|
-
*out_iv_len = iv_len;
|
349
|
-
return 1;
|
350
|
-
}
|
351
|
-
|
352
|
-
static int aead_aes_128_cbc_sha1_ssl3_init(EVP_AEAD_CTX *ctx, const uint8_t *key,
|
353
|
-
size_t key_len, size_t tag_len,
|
354
|
-
enum evp_aead_direction_t dir) {
|
355
|
-
return aead_ssl3_init(ctx, key, key_len, tag_len, dir, EVP_aes_128_cbc(),
|
356
|
-
EVP_sha1());
|
357
|
-
}
|
358
|
-
|
359
|
-
static int aead_aes_256_cbc_sha1_ssl3_init(EVP_AEAD_CTX *ctx, const uint8_t *key,
|
360
|
-
size_t key_len, size_t tag_len,
|
361
|
-
enum evp_aead_direction_t dir) {
|
362
|
-
return aead_ssl3_init(ctx, key, key_len, tag_len, dir, EVP_aes_256_cbc(),
|
363
|
-
EVP_sha1());
|
364
|
-
}
|
365
|
-
static int aead_des_ede3_cbc_sha1_ssl3_init(EVP_AEAD_CTX *ctx,
|
366
|
-
const uint8_t *key, size_t key_len,
|
367
|
-
size_t tag_len,
|
368
|
-
enum evp_aead_direction_t dir) {
|
369
|
-
return aead_ssl3_init(ctx, key, key_len, tag_len, dir, EVP_des_ede3_cbc(),
|
370
|
-
EVP_sha1());
|
371
|
-
}
|
372
|
-
|
373
|
-
static int aead_null_sha1_ssl3_init(EVP_AEAD_CTX *ctx, const uint8_t *key,
|
374
|
-
size_t key_len, size_t tag_len,
|
375
|
-
enum evp_aead_direction_t dir) {
|
376
|
-
return aead_ssl3_init(ctx, key, key_len, tag_len, dir, EVP_enc_null(),
|
377
|
-
EVP_sha1());
|
378
|
-
}
|
379
|
-
|
380
|
-
static const EVP_AEAD aead_aes_128_cbc_sha1_ssl3 = {
|
381
|
-
SHA_DIGEST_LENGTH + 16 + 16, // key len (SHA1 + AES128 + IV)
|
382
|
-
0, // nonce len
|
383
|
-
16 + SHA_DIGEST_LENGTH, // overhead (padding + SHA1)
|
384
|
-
SHA_DIGEST_LENGTH, // max tag length
|
385
|
-
0, // seal_scatter_supports_extra_in
|
386
|
-
|
387
|
-
NULL, // init
|
388
|
-
aead_aes_128_cbc_sha1_ssl3_init,
|
389
|
-
aead_ssl3_cleanup,
|
390
|
-
aead_ssl3_open,
|
391
|
-
aead_ssl3_seal_scatter,
|
392
|
-
NULL, // open_gather
|
393
|
-
aead_ssl3_get_iv,
|
394
|
-
aead_ssl3_tag_len,
|
395
|
-
};
|
396
|
-
|
397
|
-
static const EVP_AEAD aead_aes_256_cbc_sha1_ssl3 = {
|
398
|
-
SHA_DIGEST_LENGTH + 32 + 16, // key len (SHA1 + AES256 + IV)
|
399
|
-
0, // nonce len
|
400
|
-
16 + SHA_DIGEST_LENGTH, // overhead (padding + SHA1)
|
401
|
-
SHA_DIGEST_LENGTH, // max tag length
|
402
|
-
0, // seal_scatter_supports_extra_in
|
403
|
-
|
404
|
-
NULL, // init
|
405
|
-
aead_aes_256_cbc_sha1_ssl3_init,
|
406
|
-
aead_ssl3_cleanup,
|
407
|
-
aead_ssl3_open,
|
408
|
-
aead_ssl3_seal_scatter,
|
409
|
-
NULL, // open_gather
|
410
|
-
aead_ssl3_get_iv,
|
411
|
-
aead_ssl3_tag_len,
|
412
|
-
};
|
413
|
-
|
414
|
-
static const EVP_AEAD aead_des_ede3_cbc_sha1_ssl3 = {
|
415
|
-
SHA_DIGEST_LENGTH + 24 + 8, // key len (SHA1 + 3DES + IV)
|
416
|
-
0, // nonce len
|
417
|
-
8 + SHA_DIGEST_LENGTH, // overhead (padding + SHA1)
|
418
|
-
SHA_DIGEST_LENGTH, // max tag length
|
419
|
-
0, // seal_scatter_supports_extra_in
|
420
|
-
|
421
|
-
NULL, // init
|
422
|
-
aead_des_ede3_cbc_sha1_ssl3_init,
|
423
|
-
aead_ssl3_cleanup,
|
424
|
-
aead_ssl3_open,
|
425
|
-
aead_ssl3_seal_scatter,
|
426
|
-
NULL, // open_gather
|
427
|
-
aead_ssl3_get_iv,
|
428
|
-
aead_ssl3_tag_len,
|
429
|
-
};
|
430
|
-
|
431
|
-
static const EVP_AEAD aead_null_sha1_ssl3 = {
|
432
|
-
SHA_DIGEST_LENGTH, // key len
|
433
|
-
0, // nonce len
|
434
|
-
SHA_DIGEST_LENGTH, // overhead (SHA1)
|
435
|
-
SHA_DIGEST_LENGTH, // max tag length
|
436
|
-
0, // seal_scatter_supports_extra_in
|
437
|
-
|
438
|
-
NULL, // init
|
439
|
-
aead_null_sha1_ssl3_init,
|
440
|
-
aead_ssl3_cleanup,
|
441
|
-
aead_ssl3_open,
|
442
|
-
aead_ssl3_seal_scatter,
|
443
|
-
NULL, // open_gather
|
444
|
-
NULL, // get_iv
|
445
|
-
aead_ssl3_tag_len,
|
446
|
-
};
|
447
|
-
|
448
|
-
const EVP_AEAD *EVP_aead_aes_128_cbc_sha1_ssl3(void) {
|
449
|
-
return &aead_aes_128_cbc_sha1_ssl3;
|
450
|
-
}
|
451
|
-
|
452
|
-
const EVP_AEAD *EVP_aead_aes_256_cbc_sha1_ssl3(void) {
|
453
|
-
return &aead_aes_256_cbc_sha1_ssl3;
|
454
|
-
}
|
455
|
-
|
456
|
-
const EVP_AEAD *EVP_aead_des_ede3_cbc_sha1_ssl3(void) {
|
457
|
-
return &aead_des_ede3_cbc_sha1_ssl3;
|
458
|
-
}
|
459
|
-
|
460
|
-
const EVP_AEAD *EVP_aead_null_sha1_ssl3(void) { return &aead_null_sha1_ssl3; }
|