grpc 0.12.0 → 0.13.0.pre1.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +5707 -22222
- data/include/grpc/byte_buffer.h +2 -83
- data/include/grpc/census.h +191 -121
- data/include/grpc/compression.h +14 -38
- data/include/grpc/grpc.h +88 -434
- data/include/grpc/grpc_security.h +76 -46
- data/include/grpc/grpc_zookeeper.h +1 -1
- data/include/grpc/impl/codegen/alloc.h +74 -0
- data/include/grpc/impl/codegen/atm.h +92 -0
- data/include/grpc/impl/codegen/atm_gcc_atomic.h +72 -0
- data/include/grpc/impl/codegen/atm_gcc_sync.h +87 -0
- data/include/grpc/impl/codegen/atm_win32.h +125 -0
- data/include/grpc/impl/codegen/byte_buffer.h +121 -0
- data/include/grpc/impl/codegen/compression_types.h +73 -0
- data/include/grpc/impl/codegen/connectivity_state.h +59 -0
- data/include/grpc/impl/codegen/grpc_types.h +373 -0
- data/include/grpc/impl/codegen/log.h +110 -0
- data/include/grpc/impl/codegen/port_platform.h +362 -0
- data/include/grpc/impl/codegen/propagation_bits.h +67 -0
- data/include/grpc/impl/codegen/slice.h +182 -0
- data/include/grpc/impl/codegen/slice_buffer.h +105 -0
- data/include/grpc/impl/codegen/status.h +163 -0
- data/include/grpc/impl/codegen/sync.h +316 -0
- data/include/grpc/impl/codegen/sync_generic.h +55 -0
- data/{src/core/census/context.h → include/grpc/impl/codegen/sync_posix.h} +11 -11
- data/include/grpc/impl/codegen/sync_win32.h +49 -0
- data/include/grpc/impl/codegen/time.h +132 -0
- data/include/grpc/status.h +2 -126
- data/include/grpc/support/alloc.h +2 -35
- data/include/grpc/support/atm.h +2 -55
- data/include/grpc/support/atm_gcc_atomic.h +5 -38
- data/include/grpc/support/atm_gcc_sync.h +2 -50
- data/include/grpc/support/atm_win32.h +2 -88
- data/include/grpc/support/avl.h +7 -7
- data/include/grpc/support/cmdline.h +15 -13
- data/include/grpc/support/cpu.h +5 -3
- data/include/grpc/support/histogram.h +23 -20
- data/include/grpc/support/host_port.h +5 -3
- data/include/grpc/support/log.h +2 -71
- data/include/grpc/support/log_win32.h +2 -2
- data/include/grpc/support/port_platform.h +2 -319
- data/include/grpc/support/slice.h +2 -145
- data/include/grpc/support/slice_buffer.h +2 -65
- data/include/grpc/support/string_util.h +3 -3
- data/include/grpc/support/subprocess.h +8 -6
- data/include/grpc/support/sync.h +2 -278
- data/include/grpc/support/sync_generic.h +2 -18
- data/include/grpc/support/sync_posix.h +2 -10
- data/include/grpc/support/sync_win32.h +2 -12
- data/include/grpc/support/thd.h +11 -11
- data/include/grpc/support/time.h +2 -91
- data/include/grpc/support/tls.h +1 -1
- data/include/grpc/support/tls_gcc.h +1 -1
- data/include/grpc/support/tls_msvc.h +1 -1
- data/include/grpc/support/tls_pthread.h +2 -2
- data/src/boringssl/err_data.c +1252 -0
- data/src/core/census/context.c +492 -8
- data/src/core/census/grpc_filter.c +3 -3
- data/src/core/census/initialize.c +4 -7
- data/src/core/census/operation.c +2 -2
- data/src/core/census/placeholders.c +109 -0
- data/src/core/census/rpc_metric_id.h +6 -6
- data/src/core/census/tracing.c +1 -1
- data/src/core/channel/channel_args.c +4 -3
- data/src/core/channel/channel_stack.c +1 -1
- data/src/core/channel/client_channel.c +18 -14
- data/src/core/channel/client_uchannel.c +3 -3
- data/src/core/channel/compress_filter.c +8 -8
- data/src/core/channel/http_client_filter.c +2 -2
- data/src/core/channel/http_server_filter.c +9 -9
- data/src/core/channel/subchannel_call_holder.c +12 -10
- data/src/core/client_config/lb_policies/pick_first.c +49 -31
- data/src/core/client_config/lb_policies/round_robin.c +7 -7
- data/src/core/client_config/resolvers/dns_resolver.c +3 -3
- data/src/core/client_config/resolvers/sockaddr_resolver.c +5 -5
- data/src/core/client_config/subchannel.c +36 -25
- data/src/core/compression/algorithm.c +3 -3
- data/src/core/httpcli/format_request.c +1 -1
- data/src/core/httpcli/httpcli.c +5 -5
- data/src/core/httpcli/httpcli_security_connector.c +2 -3
- data/src/core/httpcli/parser.c +7 -7
- data/src/core/httpcli/parser.h +1 -1
- data/src/core/iomgr/closure.c +7 -7
- data/src/core/iomgr/closure.h +6 -5
- data/src/core/iomgr/exec_ctx.c +12 -8
- data/src/core/iomgr/exec_ctx.h +12 -5
- data/src/core/iomgr/executor.c +4 -4
- data/src/core/iomgr/executor.h +2 -2
- data/src/core/iomgr/fd_posix.c +28 -17
- data/src/core/iomgr/fd_posix.h +7 -4
- data/src/core/iomgr/iocp_windows.c +6 -8
- data/src/core/iomgr/pollset_multipoller_with_epoll.c +70 -5
- data/src/core/iomgr/pollset_multipoller_with_poll_posix.c +4 -2
- data/src/core/iomgr/pollset_posix.c +15 -15
- data/src/core/iomgr/pollset_posix.h +4 -2
- data/src/core/iomgr/pollset_windows.c +3 -12
- data/src/core/iomgr/resolve_address_posix.c +2 -2
- data/src/core/iomgr/resolve_address_windows.c +2 -2
- data/src/core/iomgr/sockaddr_utils.c +6 -6
- data/src/core/iomgr/sockaddr_win32.h +1 -6
- data/src/core/iomgr/tcp_client_posix.c +7 -7
- data/src/core/iomgr/tcp_client_windows.c +4 -4
- data/src/core/iomgr/tcp_posix.c +14 -8
- data/src/core/iomgr/tcp_posix.h +7 -1
- data/src/core/iomgr/tcp_server.h +40 -20
- data/src/core/iomgr/tcp_server_posix.c +106 -49
- data/src/core/iomgr/tcp_server_windows.c +98 -49
- data/src/core/iomgr/tcp_windows.c +11 -15
- data/src/core/iomgr/timer.c +8 -8
- data/src/core/iomgr/timer.h +1 -1
- data/src/core/iomgr/timer_heap.c +10 -10
- data/src/core/iomgr/timer_heap.h +2 -2
- data/src/core/iomgr/udp_server.c +2 -12
- data/src/core/iomgr/udp_server.h +1 -9
- data/src/core/iomgr/workqueue.h +2 -4
- data/src/core/iomgr/workqueue_posix.c +3 -3
- data/src/core/json/json_reader.c +11 -12
- data/src/core/json/json_reader.h +4 -4
- data/src/core/json/json_string.c +19 -19
- data/src/core/json/json_writer.c +7 -9
- data/src/core/profiling/basic_timers.c +1 -1
- data/src/core/security/base64.c +9 -9
- data/src/core/security/client_auth_filter.c +4 -4
- data/src/core/security/credentials.c +5 -5
- data/src/core/security/google_default_credentials.c +3 -3
- data/src/core/security/handshake.c +6 -5
- data/src/core/security/json_token.c +13 -7
- data/src/core/security/jwt_verifier.c +3 -2
- data/src/core/security/secure_endpoint.c +16 -16
- data/src/core/security/security_connector.c +47 -17
- data/src/core/security/security_connector.h +5 -5
- data/src/core/security/server_auth_filter.c +3 -3
- data/src/core/security/server_secure_chttp2.c +30 -31
- data/src/core/statistics/census_interface.h +2 -2
- data/src/core/statistics/census_rpc_stats.h +3 -3
- data/src/core/support/alloc.c +1 -1
- data/src/core/support/cpu_posix.c +2 -2
- data/src/core/support/env_linux.c +12 -2
- data/src/core/support/env_win32.c +15 -7
- data/src/core/support/histogram.c +5 -5
- data/src/core/support/log_posix.c +1 -1
- data/src/core/support/log_win32.c +4 -3
- data/src/core/support/murmur_hash.c +11 -11
- data/src/core/support/murmur_hash.h +1 -1
- data/src/core/support/slice.c +11 -11
- data/src/core/support/slice_buffer.c +6 -6
- data/src/core/support/stack_lockfree.c +20 -10
- data/src/core/support/string.c +15 -15
- data/src/core/support/string.h +5 -5
- data/src/core/support/string_win32.c +5 -5
- data/src/core/support/subprocess_windows.c +141 -0
- data/src/core/support/sync.c +4 -4
- data/src/core/support/sync_posix.c +2 -2
- data/src/core/support/sync_win32.c +10 -5
- data/src/core/support/time.c +29 -29
- data/src/core/support/time_posix.c +15 -6
- data/src/core/support/time_precise.c +2 -2
- data/src/core/support/time_win32.c +18 -9
- data/src/core/support/tls_pthread.c +1 -1
- data/src/core/support/wrap_memcpy.c +53 -0
- data/src/core/surface/alarm.c +83 -0
- data/src/core/surface/byte_buffer_reader.c +1 -1
- data/src/core/surface/call.c +78 -69
- data/src/core/surface/call.h +2 -2
- data/src/core/surface/call_test_only.h +2 -2
- data/src/core/surface/channel.c +9 -9
- data/src/core/surface/channel.h +1 -1
- data/src/core/surface/channel_connectivity.c +3 -3
- data/src/core/surface/channel_create.c +3 -3
- data/src/core/surface/channel_ping.c +2 -2
- data/src/core/surface/completion_queue.c +11 -12
- data/src/core/surface/completion_queue.h +1 -1
- data/src/core/surface/init.c +7 -5
- data/src/core/surface/lame_client.c +3 -3
- data/src/core/surface/secure_channel_create.c +3 -3
- data/src/core/surface/server.c +28 -28
- data/src/core/surface/server_chttp2.c +8 -8
- data/src/core/surface/server_create.c +1 -4
- data/src/core/surface/validate_metadata.c +3 -3
- data/src/core/surface/version.c +2 -2
- data/src/core/transport/byte_stream.c +8 -6
- data/src/core/transport/byte_stream.h +6 -5
- data/src/core/transport/chttp2/bin_encoder.c +29 -29
- data/src/core/transport/chttp2/frame_data.c +29 -26
- data/src/core/transport/chttp2/frame_data.h +6 -6
- data/src/core/transport/chttp2/frame_goaway.c +30 -30
- data/src/core/transport/chttp2/frame_goaway.h +6 -6
- data/src/core/transport/chttp2/frame_ping.c +6 -6
- data/src/core/transport/chttp2/frame_ping.h +5 -5
- data/src/core/transport/chttp2/frame_rst_stream.c +18 -19
- data/src/core/transport/chttp2/frame_rst_stream.h +4 -4
- data/src/core/transport/chttp2/frame_settings.c +30 -30
- data/src/core/transport/chttp2/frame_settings.h +13 -13
- data/src/core/transport/chttp2/frame_window_update.c +17 -18
- data/src/core/transport/chttp2/frame_window_update.h +5 -7
- data/src/core/transport/chttp2/hpack_encoder.c +69 -73
- data/src/core/transport/chttp2/hpack_encoder.h +16 -16
- data/src/core/transport/chttp2/hpack_parser.c +167 -167
- data/src/core/transport/chttp2/hpack_parser.h +16 -16
- data/src/core/transport/chttp2/hpack_table.c +13 -13
- data/src/core/transport/chttp2/hpack_table.h +11 -11
- data/src/core/transport/chttp2/internal.h +97 -86
- data/src/core/transport/chttp2/parsing.c +25 -25
- data/src/core/transport/chttp2/stream_lists.c +26 -3
- data/src/core/transport/chttp2/stream_map.c +13 -14
- data/src/core/transport/chttp2/stream_map.h +6 -7
- data/src/core/transport/chttp2/timeout_encoding.c +19 -16
- data/src/core/transport/chttp2/varint.c +8 -9
- data/src/core/transport/chttp2/varint.h +7 -8
- data/src/core/transport/chttp2/writing.c +26 -23
- data/src/core/transport/chttp2_transport.c +133 -92
- data/src/core/transport/connectivity_state.c +6 -6
- data/src/core/transport/metadata.c +18 -18
- data/src/core/transport/metadata.h +5 -5
- data/src/core/transport/static_metadata.c +15 -16
- data/src/core/transport/static_metadata.h +5 -5
- data/src/core/transport/transport.c +5 -5
- data/src/core/transport/transport.h +14 -1
- data/src/core/tsi/fake_transport_security.c +7 -7
- data/src/core/tsi/ssl_transport_security.c +6 -4
- data/src/core/tsi/ssl_types.h +55 -0
- data/src/ruby/ext/grpc/extconf.rb +51 -14
- data/src/ruby/ext/grpc/rb_byte_buffer.c +3 -1
- data/src/ruby/ext/grpc/rb_call.c +6 -3
- data/src/ruby/ext/grpc/rb_call_credentials.c +4 -0
- data/src/ruby/ext/grpc/rb_channel.c +4 -2
- data/src/ruby/ext/grpc/rb_channel_args.c +3 -1
- data/src/ruby/ext/grpc/rb_channel_credentials.c +3 -1
- data/src/ruby/ext/grpc/rb_completion_queue.c +3 -1
- data/src/ruby/ext/grpc/rb_event_thread.c +5 -0
- data/src/ruby/ext/grpc/rb_grpc.c +11 -3
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +560 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +843 -0
- data/src/ruby/ext/grpc/rb_loader.c +72 -0
- data/src/ruby/ext/grpc/rb_loader.h +40 -0
- data/src/ruby/ext/grpc/rb_server.c +3 -1
- data/src/ruby/ext/grpc/rb_server_credentials.c +4 -2
- data/src/ruby/lib/grpc/generic/bidi_call.rb +1 -1
- data/src/ruby/lib/grpc/generic/rpc_desc.rb +1 -1
- data/src/ruby/lib/grpc/generic/rpc_server.rb +1 -1
- data/src/ruby/lib/grpc/grpc.rb +34 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/pb/health/checker_spec.rb +1 -1
- data/third_party/boringssl/crypto/aes/aes.c +1142 -0
- data/third_party/boringssl/crypto/aes/internal.h +87 -0
- data/third_party/boringssl/crypto/aes/mode_wrappers.c +108 -0
- data/third_party/boringssl/crypto/asn1/a_bitstr.c +255 -0
- data/third_party/boringssl/crypto/asn1/a_bool.c +112 -0
- data/third_party/boringssl/crypto/asn1/a_bytes.c +317 -0
- data/third_party/boringssl/crypto/asn1/a_d2i_fp.c +286 -0
- data/third_party/boringssl/crypto/asn1/a_dup.c +103 -0
- data/third_party/boringssl/crypto/asn1/a_enum.c +183 -0
- data/third_party/boringssl/crypto/asn1/a_gentm.c +255 -0
- data/third_party/boringssl/crypto/asn1/a_i2d_fp.c +154 -0
- data/third_party/boringssl/crypto/asn1/a_int.c +456 -0
- data/third_party/boringssl/crypto/asn1/a_mbstr.c +390 -0
- data/third_party/boringssl/crypto/asn1/a_object.c +412 -0
- data/third_party/boringssl/crypto/asn1/a_octet.c +70 -0
- data/third_party/boringssl/crypto/asn1/a_print.c +119 -0
- data/third_party/boringssl/crypto/asn1/a_strnid.c +286 -0
- data/third_party/boringssl/crypto/asn1/a_time.c +221 -0
- data/third_party/boringssl/crypto/asn1/a_type.c +160 -0
- data/third_party/boringssl/crypto/asn1/a_utctm.c +342 -0
- data/third_party/boringssl/crypto/asn1/a_utf8.c +210 -0
- data/third_party/boringssl/crypto/asn1/asn1_lib.c +510 -0
- data/third_party/boringssl/crypto/asn1/asn1_locl.h +73 -0
- data/third_party/boringssl/crypto/asn1/asn1_par.c +444 -0
- data/third_party/boringssl/crypto/asn1/asn_pack.c +104 -0
- data/third_party/boringssl/crypto/asn1/bio_asn1.c +496 -0
- data/third_party/boringssl/crypto/asn1/bio_ndef.c +254 -0
- data/third_party/boringssl/crypto/asn1/f_enum.c +206 -0
- data/third_party/boringssl/crypto/asn1/f_int.c +210 -0
- data/third_party/boringssl/crypto/asn1/f_string.c +204 -0
- data/third_party/boringssl/crypto/asn1/t_bitst.c +102 -0
- data/third_party/boringssl/crypto/asn1/t_pkey.c +112 -0
- data/third_party/boringssl/crypto/asn1/tasn_dec.c +1342 -0
- data/third_party/boringssl/crypto/asn1/tasn_enc.c +695 -0
- data/third_party/boringssl/crypto/asn1/tasn_fre.c +264 -0
- data/third_party/boringssl/crypto/asn1/tasn_new.c +398 -0
- data/third_party/boringssl/crypto/asn1/tasn_prn.c +642 -0
- data/third_party/boringssl/crypto/asn1/tasn_typ.c +137 -0
- data/third_party/boringssl/crypto/asn1/tasn_utl.c +266 -0
- data/third_party/boringssl/crypto/asn1/x_bignum.c +143 -0
- data/third_party/boringssl/crypto/asn1/x_long.c +182 -0
- data/third_party/boringssl/crypto/base64/base64.c +478 -0
- data/third_party/boringssl/crypto/bio/bio.c +608 -0
- data/third_party/boringssl/crypto/bio/bio_mem.c +327 -0
- data/third_party/boringssl/crypto/bio/buffer.c +496 -0
- data/third_party/boringssl/crypto/bio/connect.c +544 -0
- data/third_party/boringssl/crypto/bio/fd.c +270 -0
- data/third_party/boringssl/crypto/bio/file.c +349 -0
- data/third_party/boringssl/crypto/bio/hexdump.c +192 -0
- data/third_party/boringssl/crypto/bio/internal.h +108 -0
- data/third_party/boringssl/crypto/bio/pair.c +803 -0
- data/third_party/boringssl/crypto/bio/printf.c +119 -0
- data/third_party/boringssl/crypto/bio/socket.c +195 -0
- data/third_party/boringssl/crypto/bio/socket_helper.c +113 -0
- data/third_party/boringssl/crypto/bn/add.c +377 -0
- data/third_party/boringssl/crypto/bn/asm/x86_64-gcc.c +599 -0
- data/third_party/boringssl/crypto/bn/bn.c +341 -0
- data/third_party/boringssl/crypto/bn/bn_asn1.c +93 -0
- data/third_party/boringssl/crypto/bn/cmp.c +200 -0
- data/third_party/boringssl/crypto/bn/convert.c +597 -0
- data/third_party/boringssl/crypto/bn/ctx.c +311 -0
- data/third_party/boringssl/crypto/bn/div.c +625 -0
- data/third_party/boringssl/crypto/bn/exponentiation.c +1544 -0
- data/third_party/boringssl/crypto/bn/gcd.c +711 -0
- data/third_party/boringssl/crypto/bn/generic.c +1019 -0
- data/third_party/boringssl/crypto/bn/internal.h +294 -0
- data/third_party/boringssl/crypto/bn/kronecker.c +175 -0
- data/third_party/boringssl/crypto/bn/montgomery.c +561 -0
- data/third_party/boringssl/crypto/bn/mul.c +888 -0
- data/third_party/boringssl/crypto/bn/prime.c +845 -0
- data/third_party/boringssl/crypto/bn/random.c +326 -0
- data/third_party/boringssl/crypto/bn/rsaz_exp.c +326 -0
- data/third_party/boringssl/crypto/bn/rsaz_exp.h +56 -0
- data/third_party/boringssl/crypto/bn/shift.c +299 -0
- data/third_party/boringssl/crypto/bn/sqrt.c +505 -0
- data/third_party/boringssl/crypto/buf/buf.c +235 -0
- data/third_party/boringssl/crypto/bytestring/ber.c +221 -0
- data/third_party/boringssl/crypto/bytestring/cbb.c +411 -0
- data/third_party/boringssl/crypto/bytestring/cbs.c +415 -0
- data/third_party/boringssl/crypto/bytestring/internal.h +46 -0
- data/third_party/boringssl/crypto/chacha/chacha_generic.c +140 -0
- data/third_party/boringssl/crypto/chacha/chacha_vec.c +323 -0
- data/third_party/boringssl/crypto/cipher/aead.c +167 -0
- data/third_party/boringssl/crypto/cipher/cipher.c +652 -0
- data/third_party/boringssl/crypto/cipher/derive_key.c +154 -0
- data/third_party/boringssl/crypto/cipher/e_aes.c +1767 -0
- data/third_party/boringssl/crypto/cipher/e_chacha20poly1305.c +311 -0
- data/third_party/boringssl/crypto/cipher/e_des.c +207 -0
- data/third_party/boringssl/crypto/cipher/e_null.c +85 -0
- data/third_party/boringssl/crypto/cipher/e_rc2.c +443 -0
- data/third_party/boringssl/crypto/cipher/e_rc4.c +87 -0
- data/third_party/boringssl/crypto/cipher/e_ssl3.c +463 -0
- data/third_party/boringssl/crypto/cipher/e_tls.c +673 -0
- data/third_party/boringssl/crypto/cipher/internal.h +164 -0
- data/third_party/boringssl/crypto/cipher/tls_cbc.c +495 -0
- data/third_party/boringssl/crypto/cmac/cmac.c +239 -0
- data/third_party/boringssl/crypto/conf/conf.c +778 -0
- data/third_party/boringssl/crypto/conf/conf_def.h +127 -0
- data/third_party/boringssl/crypto/conf/internal.h +31 -0
- data/third_party/boringssl/crypto/cpu-arm.c +199 -0
- data/third_party/boringssl/crypto/cpu-intel.c +261 -0
- data/third_party/boringssl/crypto/crypto.c +140 -0
- data/third_party/boringssl/crypto/curve25519/curve25519.c +4897 -0
- data/third_party/boringssl/crypto/des/des.c +771 -0
- data/third_party/boringssl/crypto/des/internal.h +212 -0
- data/third_party/boringssl/crypto/dh/check.c +180 -0
- data/third_party/boringssl/crypto/dh/dh.c +463 -0
- data/third_party/boringssl/crypto/dh/dh_asn1.c +84 -0
- data/third_party/boringssl/crypto/dh/internal.h +80 -0
- data/third_party/boringssl/crypto/dh/params.c +301 -0
- data/third_party/boringssl/crypto/digest/digest.c +248 -0
- data/third_party/boringssl/crypto/digest/digests.c +321 -0
- data/third_party/boringssl/crypto/digest/internal.h +112 -0
- data/third_party/boringssl/crypto/digest/md32_common.h +322 -0
- data/third_party/boringssl/crypto/directory.h +66 -0
- data/third_party/boringssl/crypto/directory_posix.c +108 -0
- data/third_party/boringssl/crypto/directory_win.c +144 -0
- data/third_party/boringssl/crypto/dsa/dsa.c +908 -0
- data/third_party/boringssl/crypto/dsa/dsa_asn1.c +150 -0
- data/third_party/boringssl/crypto/dsa/internal.h +78 -0
- data/third_party/boringssl/crypto/ec/ec.c +889 -0
- data/third_party/boringssl/crypto/ec/ec_asn1.c +586 -0
- data/third_party/boringssl/crypto/ec/ec_key.c +482 -0
- data/third_party/boringssl/crypto/ec/ec_montgomery.c +280 -0
- data/third_party/boringssl/crypto/ec/internal.h +318 -0
- data/third_party/boringssl/crypto/ec/oct.c +416 -0
- data/third_party/boringssl/crypto/ec/p224-64.c +1305 -0
- data/third_party/boringssl/crypto/ec/p256-64.c +1878 -0
- data/third_party/boringssl/crypto/ec/p256-x86_64-table.h +9548 -0
- data/third_party/boringssl/crypto/ec/p256-x86_64.c +596 -0
- data/third_party/boringssl/crypto/ec/simple.c +1313 -0
- data/third_party/boringssl/crypto/ec/util-64.c +183 -0
- data/third_party/boringssl/crypto/ec/wnaf.c +449 -0
- data/third_party/boringssl/crypto/ecdh/ecdh.c +153 -0
- data/third_party/boringssl/crypto/ecdsa/ecdsa.c +496 -0
- data/third_party/boringssl/crypto/ecdsa/ecdsa_asn1.c +240 -0
- data/third_party/boringssl/crypto/engine/engine.c +96 -0
- data/third_party/boringssl/crypto/err/err.c +756 -0
- data/third_party/boringssl/crypto/evp/algorithm.c +153 -0
- data/third_party/boringssl/crypto/evp/digestsign.c +159 -0
- data/third_party/boringssl/crypto/evp/evp.c +411 -0
- data/third_party/boringssl/crypto/evp/evp_asn1.c +179 -0
- data/third_party/boringssl/crypto/evp/evp_ctx.c +477 -0
- data/third_party/boringssl/crypto/evp/internal.h +278 -0
- data/third_party/boringssl/crypto/evp/p_dsa_asn1.c +588 -0
- data/third_party/boringssl/crypto/evp/p_ec.c +283 -0
- data/third_party/boringssl/crypto/evp/p_ec_asn1.c +562 -0
- data/third_party/boringssl/crypto/evp/p_rsa.c +596 -0
- data/third_party/boringssl/crypto/evp/p_rsa_asn1.c +737 -0
- data/third_party/boringssl/crypto/evp/pbkdf.c +151 -0
- data/third_party/boringssl/crypto/evp/sign.c +151 -0
- data/third_party/boringssl/crypto/ex_data.c +294 -0
- data/third_party/boringssl/crypto/hkdf/hkdf.c +89 -0
- data/third_party/boringssl/crypto/hmac/hmac.c +213 -0
- data/third_party/boringssl/crypto/internal.h +532 -0
- data/third_party/boringssl/crypto/lhash/lhash.c +346 -0
- data/third_party/boringssl/crypto/md4/md4.c +225 -0
- data/third_party/boringssl/crypto/md5/md5.c +275 -0
- data/third_party/boringssl/crypto/mem.c +200 -0
- data/third_party/boringssl/crypto/modes/cbc.c +216 -0
- data/third_party/boringssl/crypto/modes/cfb.c +231 -0
- data/third_party/boringssl/crypto/modes/ctr.c +226 -0
- data/third_party/boringssl/crypto/modes/gcm.c +1252 -0
- data/third_party/boringssl/crypto/modes/internal.h +370 -0
- data/third_party/boringssl/crypto/modes/ofb.c +108 -0
- data/third_party/boringssl/crypto/obj/obj.c +664 -0
- data/third_party/boringssl/crypto/obj/obj_dat.h +5257 -0
- data/third_party/boringssl/crypto/obj/obj_xref.c +124 -0
- data/third_party/boringssl/crypto/obj/obj_xref.h +96 -0
- data/third_party/boringssl/crypto/pem/pem_all.c +281 -0
- data/third_party/boringssl/crypto/pem/pem_info.c +404 -0
- data/third_party/boringssl/crypto/pem/pem_lib.c +835 -0
- data/third_party/boringssl/crypto/pem/pem_oth.c +89 -0
- data/third_party/boringssl/crypto/pem/pem_pk8.c +244 -0
- data/third_party/boringssl/crypto/pem/pem_pkey.c +312 -0
- data/third_party/boringssl/crypto/pem/pem_x509.c +65 -0
- data/third_party/boringssl/crypto/pem/pem_xaux.c +66 -0
- data/third_party/boringssl/crypto/pkcs8/internal.h +83 -0
- data/third_party/boringssl/crypto/pkcs8/p5_pbe.c +150 -0
- data/third_party/boringssl/crypto/pkcs8/p5_pbev2.c +440 -0
- data/third_party/boringssl/crypto/pkcs8/p8_pkey.c +85 -0
- data/third_party/boringssl/crypto/pkcs8/pkcs8.c +1217 -0
- data/third_party/boringssl/crypto/poly1305/poly1305.c +331 -0
- data/third_party/boringssl/crypto/poly1305/poly1305_arm.c +301 -0
- data/third_party/boringssl/crypto/poly1305/poly1305_vec.c +892 -0
- data/third_party/boringssl/crypto/rand/internal.h +32 -0
- data/third_party/boringssl/crypto/rand/rand.c +239 -0
- data/third_party/boringssl/crypto/rand/urandom.c +223 -0
- data/third_party/boringssl/crypto/rand/windows.c +56 -0
- data/third_party/boringssl/crypto/rc4/rc4.c +283 -0
- data/third_party/boringssl/crypto/refcount_c11.c +67 -0
- data/third_party/boringssl/crypto/refcount_lock.c +53 -0
- data/third_party/boringssl/crypto/rsa/blinding.c +462 -0
- data/third_party/boringssl/crypto/rsa/internal.h +164 -0
- data/third_party/boringssl/crypto/rsa/padding.c +711 -0
- data/third_party/boringssl/crypto/rsa/rsa.c +808 -0
- data/third_party/boringssl/crypto/rsa/rsa_asn1.c +473 -0
- data/third_party/boringssl/crypto/rsa/rsa_impl.c +1138 -0
- data/third_party/boringssl/crypto/sha/sha1.c +337 -0
- data/third_party/boringssl/crypto/sha/sha256.c +327 -0
- data/third_party/boringssl/crypto/sha/sha512.c +607 -0
- data/third_party/boringssl/crypto/stack/stack.c +386 -0
- data/third_party/boringssl/crypto/test/scoped_types.h +137 -0
- data/third_party/boringssl/crypto/test/test_util.h +35 -0
- data/third_party/boringssl/crypto/thread.c +101 -0
- data/third_party/boringssl/crypto/thread_none.c +55 -0
- data/third_party/boringssl/crypto/thread_pthread.c +167 -0
- data/third_party/boringssl/crypto/thread_win.c +282 -0
- data/third_party/boringssl/crypto/time_support.c +212 -0
- data/third_party/boringssl/crypto/x509/a_digest.c +97 -0
- data/third_party/boringssl/crypto/x509/a_sign.c +136 -0
- data/third_party/boringssl/crypto/x509/a_strex.c +564 -0
- data/third_party/boringssl/crypto/x509/a_verify.c +133 -0
- data/third_party/boringssl/crypto/x509/asn1_gen.c +873 -0
- data/third_party/boringssl/crypto/x509/by_dir.c +491 -0
- data/third_party/boringssl/crypto/x509/by_file.c +295 -0
- data/third_party/boringssl/crypto/x509/charmap.h +15 -0
- data/third_party/boringssl/crypto/x509/i2d_pr.c +84 -0
- data/third_party/boringssl/crypto/x509/pkcs7.c +353 -0
- data/third_party/boringssl/crypto/x509/t_crl.c +129 -0
- data/third_party/boringssl/crypto/x509/t_req.c +246 -0
- data/third_party/boringssl/crypto/x509/t_x509.c +500 -0
- data/third_party/boringssl/crypto/x509/t_x509a.c +109 -0
- data/third_party/boringssl/crypto/x509/vpm_int.h +70 -0
- data/third_party/boringssl/crypto/x509/x509.c +152 -0
- data/third_party/boringssl/crypto/x509/x509_att.c +353 -0
- data/third_party/boringssl/crypto/x509/x509_cmp.c +490 -0
- data/third_party/boringssl/crypto/x509/x509_d2.c +105 -0
- data/third_party/boringssl/crypto/x509/x509_def.c +88 -0
- data/third_party/boringssl/crypto/x509/x509_ext.c +206 -0
- data/third_party/boringssl/crypto/x509/x509_lu.c +738 -0
- data/third_party/boringssl/crypto/x509/x509_obj.c +191 -0
- data/third_party/boringssl/crypto/x509/x509_r2x.c +113 -0
- data/third_party/boringssl/crypto/x509/x509_req.c +315 -0
- data/third_party/boringssl/crypto/x509/x509_set.c +154 -0
- data/third_party/boringssl/crypto/x509/x509_trs.c +304 -0
- data/third_party/boringssl/crypto/x509/x509_txt.c +209 -0
- data/third_party/boringssl/crypto/x509/x509_v3.c +271 -0
- data/third_party/boringssl/crypto/x509/x509_vfy.c +2456 -0
- data/third_party/boringssl/crypto/x509/x509_vpm.c +672 -0
- data/third_party/boringssl/crypto/x509/x509cset.c +172 -0
- data/third_party/boringssl/crypto/x509/x509name.c +381 -0
- data/third_party/boringssl/crypto/x509/x509rset.c +80 -0
- data/third_party/boringssl/crypto/x509/x509spki.c +135 -0
- data/third_party/boringssl/crypto/x509/x509type.c +128 -0
- data/third_party/boringssl/crypto/x509/x_algor.c +154 -0
- data/third_party/boringssl/crypto/x509/x_all.c +547 -0
- data/third_party/boringssl/crypto/x509/x_attrib.c +117 -0
- data/third_party/boringssl/crypto/x509/x_crl.c +560 -0
- data/third_party/boringssl/crypto/x509/x_exten.c +75 -0
- data/third_party/boringssl/crypto/x509/x_info.c +95 -0
- data/third_party/boringssl/crypto/x509/x_name.c +538 -0
- data/third_party/boringssl/crypto/x509/x_pkey.c +100 -0
- data/third_party/boringssl/crypto/x509/x_pubkey.c +384 -0
- data/third_party/boringssl/crypto/x509/x_req.c +112 -0
- data/third_party/boringssl/crypto/x509/x_sig.c +69 -0
- data/third_party/boringssl/crypto/x509/x_spki.c +78 -0
- data/third_party/boringssl/crypto/x509/x_val.c +69 -0
- data/third_party/boringssl/crypto/x509/x_x509.c +227 -0
- data/third_party/boringssl/crypto/x509/x_x509a.c +197 -0
- data/third_party/boringssl/crypto/x509v3/ext_dat.h +129 -0
- data/third_party/boringssl/crypto/x509v3/pcy_cache.c +299 -0
- data/third_party/boringssl/crypto/x509v3/pcy_data.c +137 -0
- data/third_party/boringssl/crypto/x509v3/pcy_int.h +212 -0
- data/third_party/boringssl/crypto/x509v3/pcy_lib.c +165 -0
- data/third_party/boringssl/crypto/x509v3/pcy_map.c +133 -0
- data/third_party/boringssl/crypto/x509v3/pcy_node.c +197 -0
- data/third_party/boringssl/crypto/x509v3/pcy_tree.c +876 -0
- data/third_party/boringssl/crypto/x509v3/v3_akey.c +212 -0
- data/third_party/boringssl/crypto/x509v3/v3_akeya.c +71 -0
- data/third_party/boringssl/crypto/x509v3/v3_alt.c +622 -0
- data/third_party/boringssl/crypto/x509v3/v3_bcons.c +126 -0
- data/third_party/boringssl/crypto/x509v3/v3_bitst.c +141 -0
- data/third_party/boringssl/crypto/x509v3/v3_conf.c +459 -0
- data/third_party/boringssl/crypto/x509v3/v3_cpols.c +475 -0
- data/third_party/boringssl/crypto/x509v3/v3_crld.c +616 -0
- data/third_party/boringssl/crypto/x509v3/v3_enum.c +98 -0
- data/third_party/boringssl/crypto/x509v3/v3_extku.c +145 -0
- data/third_party/boringssl/crypto/x509v3/v3_genn.c +252 -0
- data/third_party/boringssl/crypto/x509v3/v3_ia5.c +117 -0
- data/third_party/boringssl/crypto/x509v3/v3_info.c +200 -0
- data/third_party/boringssl/crypto/x509v3/v3_int.c +87 -0
- data/third_party/boringssl/crypto/x509v3/v3_lib.c +335 -0
- data/third_party/boringssl/crypto/x509v3/v3_ncons.c +510 -0
- data/third_party/boringssl/crypto/x509v3/v3_pci.c +335 -0
- data/third_party/boringssl/crypto/x509v3/v3_pcia.c +56 -0
- data/third_party/boringssl/crypto/x509v3/v3_pcons.c +142 -0
- data/third_party/boringssl/crypto/x509v3/v3_pku.c +109 -0
- data/third_party/boringssl/crypto/x509v3/v3_pmaps.c +156 -0
- data/third_party/boringssl/crypto/x509v3/v3_prn.c +207 -0
- data/third_party/boringssl/crypto/x509v3/v3_purp.c +805 -0
- data/third_party/boringssl/crypto/x509v3/v3_skey.c +148 -0
- data/third_party/boringssl/crypto/x509v3/v3_sxnet.c +266 -0
- data/third_party/boringssl/crypto/x509v3/v3_utl.c +1322 -0
- data/third_party/boringssl/include/openssl/aead.h +346 -0
- data/third_party/boringssl/include/openssl/aes.h +158 -0
- data/third_party/boringssl/include/openssl/arm_arch.h +127 -0
- data/third_party/boringssl/include/openssl/asn1.h +1168 -0
- data/third_party/boringssl/include/openssl/asn1_mac.h +75 -0
- data/third_party/boringssl/include/openssl/asn1t.h +906 -0
- data/third_party/boringssl/include/openssl/base.h +261 -0
- data/third_party/boringssl/include/openssl/base64.h +184 -0
- data/third_party/boringssl/include/openssl/bio.h +902 -0
- data/third_party/boringssl/include/openssl/blowfish.h +93 -0
- data/third_party/boringssl/include/openssl/bn.h +885 -0
- data/third_party/boringssl/include/openssl/buf.h +118 -0
- data/third_party/boringssl/include/openssl/buffer.h +18 -0
- data/third_party/boringssl/include/openssl/bytestring.h +360 -0
- data/third_party/boringssl/include/openssl/cast.h +96 -0
- data/third_party/boringssl/include/openssl/chacha.h +37 -0
- data/third_party/boringssl/include/openssl/cipher.h +571 -0
- data/third_party/boringssl/include/openssl/cmac.h +76 -0
- data/third_party/boringssl/include/openssl/conf.h +145 -0
- data/third_party/boringssl/include/openssl/cpu.h +184 -0
- data/third_party/boringssl/include/openssl/crypto.h +68 -0
- data/third_party/boringssl/include/openssl/curve25519.h +88 -0
- data/third_party/boringssl/include/openssl/des.h +177 -0
- data/third_party/boringssl/include/openssl/dh.h +238 -0
- data/third_party/boringssl/include/openssl/digest.h +258 -0
- data/third_party/boringssl/include/openssl/dsa.h +343 -0
- data/third_party/boringssl/include/openssl/dtls1.h +16 -0
- data/third_party/boringssl/include/openssl/ec.h +355 -0
- data/third_party/boringssl/include/openssl/ec_key.h +280 -0
- data/third_party/boringssl/include/openssl/ecdh.h +102 -0
- data/third_party/boringssl/include/openssl/ecdsa.h +206 -0
- data/third_party/boringssl/include/openssl/engine.h +98 -0
- data/third_party/boringssl/include/openssl/err.h +487 -0
- data/third_party/boringssl/include/openssl/evp.h +750 -0
- data/third_party/boringssl/include/openssl/ex_data.h +213 -0
- data/third_party/boringssl/include/openssl/hkdf.h +44 -0
- data/third_party/boringssl/include/openssl/hmac.h +160 -0
- data/third_party/boringssl/include/openssl/lhash.h +192 -0
- data/third_party/boringssl/include/openssl/lhash_macros.h +132 -0
- data/third_party/boringssl/include/openssl/md4.h +102 -0
- data/third_party/boringssl/include/openssl/md5.h +107 -0
- data/third_party/boringssl/include/openssl/mem.h +140 -0
- data/third_party/boringssl/include/openssl/obj.h +198 -0
- data/third_party/boringssl/include/openssl/obj_mac.h +4140 -0
- data/third_party/boringssl/include/openssl/objects.h +18 -0
- data/third_party/boringssl/include/openssl/opensslfeatures.h +60 -0
- data/third_party/boringssl/include/openssl/opensslv.h +18 -0
- data/third_party/boringssl/include/openssl/ossl_typ.h +18 -0
- data/third_party/boringssl/include/openssl/pem.h +521 -0
- data/third_party/boringssl/include/openssl/pkcs12.h +18 -0
- data/third_party/boringssl/include/openssl/pkcs7.h +16 -0
- data/third_party/boringssl/include/openssl/pkcs8.h +220 -0
- data/third_party/boringssl/include/openssl/poly1305.h +51 -0
- data/third_party/boringssl/include/openssl/pqueue.h +146 -0
- data/third_party/boringssl/include/openssl/rand.h +113 -0
- data/third_party/boringssl/include/openssl/rc4.h +90 -0
- data/third_party/boringssl/include/openssl/rsa.h +637 -0
- data/third_party/boringssl/include/openssl/safestack.h +16 -0
- data/third_party/boringssl/include/openssl/sha.h +256 -0
- data/third_party/boringssl/include/openssl/srtp.h +18 -0
- data/third_party/boringssl/include/openssl/ssl.h +4466 -0
- data/third_party/boringssl/include/openssl/ssl3.h +441 -0
- data/third_party/boringssl/include/openssl/stack.h +298 -0
- data/third_party/boringssl/include/openssl/stack_macros.h +4190 -0
- data/third_party/boringssl/include/openssl/thread.h +173 -0
- data/third_party/boringssl/include/openssl/time_support.h +90 -0
- data/third_party/boringssl/include/openssl/tls1.h +653 -0
- data/third_party/boringssl/include/openssl/type_check.h +91 -0
- data/third_party/boringssl/include/openssl/x509.h +1258 -0
- data/third_party/boringssl/include/openssl/x509_vfy.h +611 -0
- data/third_party/boringssl/include/openssl/x509v3.h +798 -0
- data/third_party/boringssl/ssl/custom_extensions.c +257 -0
- data/third_party/boringssl/ssl/d1_both.c +880 -0
- data/third_party/boringssl/ssl/d1_clnt.c +566 -0
- data/third_party/boringssl/ssl/d1_lib.c +340 -0
- data/third_party/boringssl/ssl/d1_meth.c +130 -0
- data/third_party/boringssl/ssl/d1_pkt.c +578 -0
- data/third_party/boringssl/ssl/d1_srtp.c +234 -0
- data/third_party/boringssl/ssl/d1_srvr.c +485 -0
- data/third_party/boringssl/ssl/dtls_record.c +308 -0
- data/third_party/boringssl/ssl/internal.h +1276 -0
- data/third_party/boringssl/ssl/pqueue/pqueue.c +197 -0
- data/third_party/boringssl/ssl/s3_both.c +571 -0
- data/third_party/boringssl/ssl/s3_clnt.c +2241 -0
- data/third_party/boringssl/ssl/s3_enc.c +494 -0
- data/third_party/boringssl/ssl/s3_lib.c +587 -0
- data/third_party/boringssl/ssl/s3_meth.c +166 -0
- data/third_party/boringssl/ssl/s3_pkt.c +732 -0
- data/third_party/boringssl/ssl/s3_srvr.c +2536 -0
- data/third_party/boringssl/ssl/ssl_aead_ctx.c +300 -0
- data/third_party/boringssl/ssl/ssl_asn1.c +718 -0
- data/third_party/boringssl/ssl/ssl_buffer.c +319 -0
- data/third_party/boringssl/ssl/ssl_cert.c +539 -0
- data/third_party/boringssl/ssl/ssl_cipher.c +2003 -0
- data/third_party/boringssl/ssl/ssl_file.c +633 -0
- data/third_party/boringssl/ssl/ssl_lib.c +2653 -0
- data/third_party/boringssl/ssl/ssl_rsa.c +423 -0
- data/third_party/boringssl/ssl/ssl_session.c +764 -0
- data/third_party/boringssl/ssl/ssl_stat.c +591 -0
- data/third_party/boringssl/ssl/t1_enc.c +708 -0
- data/third_party/boringssl/ssl/t1_lib.c +2905 -0
- data/third_party/boringssl/ssl/test/async_bio.h +45 -0
- data/third_party/boringssl/ssl/test/packeted_bio.h +44 -0
- data/third_party/boringssl/ssl/test/scoped_types.h +28 -0
- data/third_party/boringssl/ssl/test/test_config.h +108 -0
- data/third_party/boringssl/ssl/tls_record.c +342 -0
- data/third_party/zlib/adler32.c +179 -0
- data/third_party/zlib/compress.c +80 -0
- data/third_party/zlib/crc32.c +425 -0
- data/third_party/zlib/crc32.h +441 -0
- data/third_party/zlib/deflate.c +1967 -0
- data/third_party/zlib/deflate.h +346 -0
- data/third_party/zlib/gzclose.c +25 -0
- data/third_party/zlib/gzguts.h +209 -0
- data/third_party/zlib/gzlib.c +634 -0
- data/third_party/zlib/gzread.c +594 -0
- data/third_party/zlib/gzwrite.c +577 -0
- data/third_party/zlib/infback.c +640 -0
- data/third_party/zlib/inffast.c +340 -0
- data/third_party/zlib/inffast.h +11 -0
- data/third_party/zlib/inffixed.h +94 -0
- data/third_party/zlib/inflate.c +1512 -0
- data/third_party/zlib/inflate.h +122 -0
- data/third_party/zlib/inftrees.c +306 -0
- data/third_party/zlib/inftrees.h +62 -0
- data/third_party/zlib/trees.c +1226 -0
- data/third_party/zlib/trees.h +128 -0
- data/third_party/zlib/uncompr.c +59 -0
- data/third_party/zlib/zconf.h +511 -0
- data/third_party/zlib/zlib.h +1768 -0
- data/third_party/zlib/zutil.c +324 -0
- data/third_party/zlib/zutil.h +253 -0
- metadata +492 -25
- data/Rakefile +0 -63
- data/src/ruby/lib/grpc/grpc.so +0 -0
@@ -0,0 +1,308 @@
|
|
1
|
+
/* DTLS implementation written by Nagendra Modadugu
|
2
|
+
* (nagendra@cs.stanford.edu) for the OpenSSL project 2005. */
|
3
|
+
/* ====================================================================
|
4
|
+
* Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved.
|
5
|
+
*
|
6
|
+
* Redistribution and use in source and binary forms, with or without
|
7
|
+
* modification, are permitted provided that the following conditions
|
8
|
+
* are met:
|
9
|
+
*
|
10
|
+
* 1. Redistributions of source code must retain the above copyright
|
11
|
+
* notice, this list of conditions and the following disclaimer.
|
12
|
+
*
|
13
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
14
|
+
* notice, this list of conditions and the following disclaimer in
|
15
|
+
* the documentation and/or other materials provided with the
|
16
|
+
* distribution.
|
17
|
+
*
|
18
|
+
* 3. All advertising materials mentioning features or use of this
|
19
|
+
* software must display the following acknowledgment:
|
20
|
+
* "This product includes software developed by the OpenSSL Project
|
21
|
+
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
22
|
+
*
|
23
|
+
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
24
|
+
* endorse or promote products derived from this software without
|
25
|
+
* prior written permission. For written permission, please contact
|
26
|
+
* openssl-core@openssl.org.
|
27
|
+
*
|
28
|
+
* 5. Products derived from this software may not be called "OpenSSL"
|
29
|
+
* nor may "OpenSSL" appear in their names without prior written
|
30
|
+
* permission of the OpenSSL Project.
|
31
|
+
*
|
32
|
+
* 6. Redistributions of any form whatsoever must retain the following
|
33
|
+
* acknowledgment:
|
34
|
+
* "This product includes software developed by the OpenSSL Project
|
35
|
+
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
36
|
+
*
|
37
|
+
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
38
|
+
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
39
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
40
|
+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
41
|
+
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
42
|
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
43
|
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
44
|
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
45
|
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
46
|
+
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
47
|
+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
48
|
+
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
49
|
+
* ====================================================================
|
50
|
+
*
|
51
|
+
* This product includes cryptographic software written by Eric Young
|
52
|
+
* (eay@cryptsoft.com). This product includes software written by Tim
|
53
|
+
* Hudson (tjh@cryptsoft.com).
|
54
|
+
*
|
55
|
+
*/
|
56
|
+
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
57
|
+
* All rights reserved.
|
58
|
+
*
|
59
|
+
* This package is an SSL implementation written
|
60
|
+
* by Eric Young (eay@cryptsoft.com).
|
61
|
+
* The implementation was written so as to conform with Netscapes SSL.
|
62
|
+
*
|
63
|
+
* This library is free for commercial and non-commercial use as long as
|
64
|
+
* the following conditions are aheared to. The following conditions
|
65
|
+
* apply to all code found in this distribution, be it the RC4, RSA,
|
66
|
+
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
67
|
+
* included with this distribution is covered by the same copyright terms
|
68
|
+
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
69
|
+
*
|
70
|
+
* Copyright remains Eric Young's, and as such any Copyright notices in
|
71
|
+
* the code are not to be removed.
|
72
|
+
* If this package is used in a product, Eric Young should be given attribution
|
73
|
+
* as the author of the parts of the library used.
|
74
|
+
* This can be in the form of a textual message at program startup or
|
75
|
+
* in documentation (online or textual) provided with the package.
|
76
|
+
*
|
77
|
+
* Redistribution and use in source and binary forms, with or without
|
78
|
+
* modification, are permitted provided that the following conditions
|
79
|
+
* are met:
|
80
|
+
* 1. Redistributions of source code must retain the copyright
|
81
|
+
* notice, this list of conditions and the following disclaimer.
|
82
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
83
|
+
* notice, this list of conditions and the following disclaimer in the
|
84
|
+
* documentation and/or other materials provided with the distribution.
|
85
|
+
* 3. All advertising materials mentioning features or use of this software
|
86
|
+
* must display the following acknowledgement:
|
87
|
+
* "This product includes cryptographic software written by
|
88
|
+
* Eric Young (eay@cryptsoft.com)"
|
89
|
+
* The word 'cryptographic' can be left out if the rouines from the library
|
90
|
+
* being used are not cryptographic related :-).
|
91
|
+
* 4. If you include any Windows specific code (or a derivative thereof) from
|
92
|
+
* the apps directory (application code) you must include an acknowledgement:
|
93
|
+
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
94
|
+
*
|
95
|
+
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
96
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
97
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
98
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
99
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
100
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
101
|
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
102
|
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
103
|
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
104
|
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
105
|
+
* SUCH DAMAGE.
|
106
|
+
*
|
107
|
+
* The licence and distribution terms for any publically available version or
|
108
|
+
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
109
|
+
* copied and put under another distribution licence
|
110
|
+
* [including the GNU Public Licence.] */
|
111
|
+
|
112
|
+
#include <openssl/ssl.h>
|
113
|
+
|
114
|
+
#include <assert.h>
|
115
|
+
#include <string.h>
|
116
|
+
|
117
|
+
#include <openssl/bytestring.h>
|
118
|
+
#include <openssl/err.h>
|
119
|
+
|
120
|
+
#include "internal.h"
|
121
|
+
|
122
|
+
|
123
|
+
/* to_u64_be treats |in| as a 8-byte big-endian integer and returns the value as
|
124
|
+
* a |uint64_t|. */
|
125
|
+
static uint64_t to_u64_be(const uint8_t in[8]) {
|
126
|
+
uint64_t ret = 0;
|
127
|
+
unsigned i;
|
128
|
+
for (i = 0; i < 8; i++) {
|
129
|
+
ret <<= 8;
|
130
|
+
ret |= in[i];
|
131
|
+
}
|
132
|
+
return ret;
|
133
|
+
}
|
134
|
+
|
135
|
+
/* dtls1_bitmap_should_discard returns one if |seq_num| has been seen in |bitmap|
|
136
|
+
* or is stale. Otherwise it returns zero. */
|
137
|
+
static int dtls1_bitmap_should_discard(DTLS1_BITMAP *bitmap,
|
138
|
+
const uint8_t seq_num[8]) {
|
139
|
+
const unsigned kWindowSize = sizeof(bitmap->map) * 8;
|
140
|
+
|
141
|
+
uint64_t seq_num_u = to_u64_be(seq_num);
|
142
|
+
if (seq_num_u > bitmap->max_seq_num) {
|
143
|
+
return 0;
|
144
|
+
}
|
145
|
+
uint64_t idx = bitmap->max_seq_num - seq_num_u;
|
146
|
+
return idx >= kWindowSize || (bitmap->map & (((uint64_t)1) << idx));
|
147
|
+
}
|
148
|
+
|
149
|
+
/* dtls1_bitmap_record updates |bitmap| to record receipt of sequence number
|
150
|
+
* |seq_num|. It slides the window forward if needed. It is an error to call
|
151
|
+
* this function on a stale sequence number. */
|
152
|
+
static void dtls1_bitmap_record(DTLS1_BITMAP *bitmap,
|
153
|
+
const uint8_t seq_num[8]) {
|
154
|
+
const unsigned kWindowSize = sizeof(bitmap->map) * 8;
|
155
|
+
|
156
|
+
uint64_t seq_num_u = to_u64_be(seq_num);
|
157
|
+
/* Shift the window if necessary. */
|
158
|
+
if (seq_num_u > bitmap->max_seq_num) {
|
159
|
+
uint64_t shift = seq_num_u - bitmap->max_seq_num;
|
160
|
+
if (shift >= kWindowSize) {
|
161
|
+
bitmap->map = 0;
|
162
|
+
} else {
|
163
|
+
bitmap->map <<= shift;
|
164
|
+
}
|
165
|
+
bitmap->max_seq_num = seq_num_u;
|
166
|
+
}
|
167
|
+
|
168
|
+
uint64_t idx = bitmap->max_seq_num - seq_num_u;
|
169
|
+
if (idx < kWindowSize) {
|
170
|
+
bitmap->map |= ((uint64_t)1) << idx;
|
171
|
+
}
|
172
|
+
}
|
173
|
+
|
174
|
+
enum ssl_open_record_t dtls_open_record(
|
175
|
+
SSL *ssl, uint8_t *out_type, uint8_t *out, size_t *out_len,
|
176
|
+
size_t *out_consumed, uint8_t *out_alert, size_t max_out, const uint8_t *in,
|
177
|
+
size_t in_len) {
|
178
|
+
CBS cbs;
|
179
|
+
CBS_init(&cbs, in, in_len);
|
180
|
+
|
181
|
+
/* Decode the record. */
|
182
|
+
uint8_t type;
|
183
|
+
uint16_t version;
|
184
|
+
uint8_t sequence[8];
|
185
|
+
CBS body;
|
186
|
+
if (!CBS_get_u8(&cbs, &type) ||
|
187
|
+
!CBS_get_u16(&cbs, &version) ||
|
188
|
+
!CBS_copy_bytes(&cbs, sequence, 8) ||
|
189
|
+
!CBS_get_u16_length_prefixed(&cbs, &body) ||
|
190
|
+
(ssl->s3->have_version && version != ssl->version) ||
|
191
|
+
(version >> 8) != DTLS1_VERSION_MAJOR ||
|
192
|
+
CBS_len(&body) > SSL3_RT_MAX_ENCRYPTED_LENGTH) {
|
193
|
+
/* The record header was incomplete or malformed. Drop the entire packet. */
|
194
|
+
*out_consumed = in_len;
|
195
|
+
return ssl_open_record_discard;
|
196
|
+
}
|
197
|
+
|
198
|
+
if (ssl->msg_callback != NULL) {
|
199
|
+
ssl->msg_callback(0 /* read */, 0, SSL3_RT_HEADER, in,
|
200
|
+
DTLS1_RT_HEADER_LENGTH, ssl, ssl->msg_callback_arg);
|
201
|
+
}
|
202
|
+
|
203
|
+
uint16_t epoch = (((uint16_t)sequence[0]) << 8) | sequence[1];
|
204
|
+
if (epoch != ssl->d1->r_epoch ||
|
205
|
+
dtls1_bitmap_should_discard(&ssl->d1->bitmap, sequence)) {
|
206
|
+
/* Drop this record. It's from the wrong epoch or is a replay. Note that if
|
207
|
+
* |epoch| is the next epoch, the record could be buffered for later. For
|
208
|
+
* simplicity, drop it and expect retransmit to handle it later; DTLS must
|
209
|
+
* handle packet loss anyway. */
|
210
|
+
*out_consumed = in_len - CBS_len(&cbs);
|
211
|
+
return ssl_open_record_discard;
|
212
|
+
}
|
213
|
+
|
214
|
+
/* Decrypt the body. */
|
215
|
+
size_t plaintext_len;
|
216
|
+
if (!SSL_AEAD_CTX_open(ssl->aead_read_ctx, out, &plaintext_len, max_out,
|
217
|
+
type, version, sequence, CBS_data(&body),
|
218
|
+
CBS_len(&body))) {
|
219
|
+
/* Bad packets are silently dropped in DTLS. See section 4.2.1 of RFC 6347.
|
220
|
+
* Clear the error queue of any errors decryption may have added. Drop the
|
221
|
+
* entire packet as it must not have come from the peer.
|
222
|
+
*
|
223
|
+
* TODO(davidben): This doesn't distinguish malloc failures from encryption
|
224
|
+
* failures. */
|
225
|
+
ERR_clear_error();
|
226
|
+
*out_consumed = in_len - CBS_len(&cbs);
|
227
|
+
return ssl_open_record_discard;
|
228
|
+
}
|
229
|
+
|
230
|
+
/* Check the plaintext length. */
|
231
|
+
if (plaintext_len > SSL3_RT_MAX_PLAIN_LENGTH) {
|
232
|
+
OPENSSL_PUT_ERROR(SSL, SSL_R_DATA_LENGTH_TOO_LONG);
|
233
|
+
*out_alert = SSL_AD_RECORD_OVERFLOW;
|
234
|
+
return ssl_open_record_error;
|
235
|
+
}
|
236
|
+
|
237
|
+
dtls1_bitmap_record(&ssl->d1->bitmap, sequence);
|
238
|
+
|
239
|
+
/* TODO(davidben): Limit the number of empty records as in TLS? This is only
|
240
|
+
* useful if we also limit discarded packets. */
|
241
|
+
|
242
|
+
*out_type = type;
|
243
|
+
*out_len = plaintext_len;
|
244
|
+
*out_consumed = in_len - CBS_len(&cbs);
|
245
|
+
return ssl_open_record_success;
|
246
|
+
}
|
247
|
+
|
248
|
+
int dtls_seal_record(SSL *ssl, uint8_t *out, size_t *out_len, size_t max_out,
|
249
|
+
uint8_t type, const uint8_t *in, size_t in_len,
|
250
|
+
enum dtls1_use_epoch_t use_epoch) {
|
251
|
+
/* Determine the parameters for the current epoch. */
|
252
|
+
uint16_t epoch = ssl->d1->w_epoch;
|
253
|
+
SSL_AEAD_CTX *aead = ssl->aead_write_ctx;
|
254
|
+
uint8_t *seq = ssl->s3->write_sequence;
|
255
|
+
if (use_epoch == dtls1_use_previous_epoch) {
|
256
|
+
/* DTLS renegotiation is unsupported, so only epochs 0 (NULL cipher) and 1
|
257
|
+
* (negotiated cipher) exist. */
|
258
|
+
assert(ssl->d1->w_epoch == 1);
|
259
|
+
epoch = ssl->d1->w_epoch - 1;
|
260
|
+
aead = NULL;
|
261
|
+
seq = ssl->d1->last_write_sequence;
|
262
|
+
}
|
263
|
+
|
264
|
+
if (max_out < DTLS1_RT_HEADER_LENGTH) {
|
265
|
+
OPENSSL_PUT_ERROR(SSL, SSL_R_BUFFER_TOO_SMALL);
|
266
|
+
return 0;
|
267
|
+
}
|
268
|
+
/* Check the record header does not alias any part of the input.
|
269
|
+
* |SSL_AEAD_CTX_seal| will internally enforce other aliasing requirements. */
|
270
|
+
if (in < out + DTLS1_RT_HEADER_LENGTH && out < in + in_len) {
|
271
|
+
OPENSSL_PUT_ERROR(SSL, SSL_R_OUTPUT_ALIASES_INPUT);
|
272
|
+
return 0;
|
273
|
+
}
|
274
|
+
|
275
|
+
out[0] = type;
|
276
|
+
|
277
|
+
uint16_t wire_version = ssl->s3->have_version ? ssl->version : DTLS1_VERSION;
|
278
|
+
out[1] = wire_version >> 8;
|
279
|
+
out[2] = wire_version & 0xff;
|
280
|
+
|
281
|
+
out[3] = epoch >> 8;
|
282
|
+
out[4] = epoch & 0xff;
|
283
|
+
memcpy(&out[5], &seq[2], 6);
|
284
|
+
|
285
|
+
size_t ciphertext_len;
|
286
|
+
if (!SSL_AEAD_CTX_seal(aead, out + DTLS1_RT_HEADER_LENGTH, &ciphertext_len,
|
287
|
+
max_out - DTLS1_RT_HEADER_LENGTH, type, wire_version,
|
288
|
+
&out[3] /* seq */, in, in_len) ||
|
289
|
+
!ssl3_record_sequence_update(&seq[2], 6)) {
|
290
|
+
return 0;
|
291
|
+
}
|
292
|
+
|
293
|
+
if (ciphertext_len >= 1 << 16) {
|
294
|
+
OPENSSL_PUT_ERROR(SSL, ERR_R_OVERFLOW);
|
295
|
+
return 0;
|
296
|
+
}
|
297
|
+
out[11] = ciphertext_len >> 8;
|
298
|
+
out[12] = ciphertext_len & 0xff;
|
299
|
+
|
300
|
+
*out_len = DTLS1_RT_HEADER_LENGTH + ciphertext_len;
|
301
|
+
|
302
|
+
if (ssl->msg_callback) {
|
303
|
+
ssl->msg_callback(1 /* write */, 0, SSL3_RT_HEADER, out,
|
304
|
+
DTLS1_RT_HEADER_LENGTH, ssl, ssl->msg_callback_arg);
|
305
|
+
}
|
306
|
+
|
307
|
+
return 1;
|
308
|
+
}
|
@@ -0,0 +1,1276 @@
|
|
1
|
+
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
2
|
+
* All rights reserved.
|
3
|
+
*
|
4
|
+
* This package is an SSL implementation written
|
5
|
+
* by Eric Young (eay@cryptsoft.com).
|
6
|
+
* The implementation was written so as to conform with Netscapes SSL.
|
7
|
+
*
|
8
|
+
* This library is free for commercial and non-commercial use as long as
|
9
|
+
* the following conditions are aheared to. The following conditions
|
10
|
+
* apply to all code found in this distribution, be it the RC4, RSA,
|
11
|
+
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
12
|
+
* included with this distribution is covered by the same copyright terms
|
13
|
+
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
14
|
+
*
|
15
|
+
* Copyright remains Eric Young's, and as such any Copyright notices in
|
16
|
+
* the code are not to be removed.
|
17
|
+
* If this package is used in a product, Eric Young should be given attribution
|
18
|
+
* as the author of the parts of the library used.
|
19
|
+
* This can be in the form of a textual message at program startup or
|
20
|
+
* in documentation (online or textual) provided with the package.
|
21
|
+
*
|
22
|
+
* Redistribution and use in source and binary forms, with or without
|
23
|
+
* modification, are permitted provided that the following conditions
|
24
|
+
* are met:
|
25
|
+
* 1. Redistributions of source code must retain the copyright
|
26
|
+
* notice, this list of conditions and the following disclaimer.
|
27
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
28
|
+
* notice, this list of conditions and the following disclaimer in the
|
29
|
+
* documentation and/or other materials provided with the distribution.
|
30
|
+
* 3. All advertising materials mentioning features or use of this software
|
31
|
+
* must display the following acknowledgement:
|
32
|
+
* "This product includes cryptographic software written by
|
33
|
+
* Eric Young (eay@cryptsoft.com)"
|
34
|
+
* The word 'cryptographic' can be left out if the rouines from the library
|
35
|
+
* being used are not cryptographic related :-).
|
36
|
+
* 4. If you include any Windows specific code (or a derivative thereof) from
|
37
|
+
* the apps directory (application code) you must include an acknowledgement:
|
38
|
+
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
39
|
+
*
|
40
|
+
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
41
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
42
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
43
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
44
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
45
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
46
|
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
47
|
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
48
|
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
49
|
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
50
|
+
* SUCH DAMAGE.
|
51
|
+
*
|
52
|
+
* The licence and distribution terms for any publically available version or
|
53
|
+
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
54
|
+
* copied and put under another distribution licence
|
55
|
+
* [including the GNU Public Licence.]
|
56
|
+
*/
|
57
|
+
/* ====================================================================
|
58
|
+
* Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
|
59
|
+
*
|
60
|
+
* Redistribution and use in source and binary forms, with or without
|
61
|
+
* modification, are permitted provided that the following conditions
|
62
|
+
* are met:
|
63
|
+
*
|
64
|
+
* 1. Redistributions of source code must retain the above copyright
|
65
|
+
* notice, this list of conditions and the following disclaimer.
|
66
|
+
*
|
67
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
68
|
+
* notice, this list of conditions and the following disclaimer in
|
69
|
+
* the documentation and/or other materials provided with the
|
70
|
+
* distribution.
|
71
|
+
*
|
72
|
+
* 3. All advertising materials mentioning features or use of this
|
73
|
+
* software must display the following acknowledgment:
|
74
|
+
* "This product includes software developed by the OpenSSL Project
|
75
|
+
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
76
|
+
*
|
77
|
+
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
78
|
+
* endorse or promote products derived from this software without
|
79
|
+
* prior written permission. For written permission, please contact
|
80
|
+
* openssl-core@openssl.org.
|
81
|
+
*
|
82
|
+
* 5. Products derived from this software may not be called "OpenSSL"
|
83
|
+
* nor may "OpenSSL" appear in their names without prior written
|
84
|
+
* permission of the OpenSSL Project.
|
85
|
+
*
|
86
|
+
* 6. Redistributions of any form whatsoever must retain the following
|
87
|
+
* acknowledgment:
|
88
|
+
* "This product includes software developed by the OpenSSL Project
|
89
|
+
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
90
|
+
*
|
91
|
+
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
92
|
+
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
93
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
94
|
+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
95
|
+
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
96
|
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
97
|
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
98
|
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
99
|
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
100
|
+
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
101
|
+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
102
|
+
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
103
|
+
* ====================================================================
|
104
|
+
*
|
105
|
+
* This product includes cryptographic software written by Eric Young
|
106
|
+
* (eay@cryptsoft.com). This product includes software written by Tim
|
107
|
+
* Hudson (tjh@cryptsoft.com).
|
108
|
+
*
|
109
|
+
*/
|
110
|
+
/* ====================================================================
|
111
|
+
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
|
112
|
+
* ECC cipher suite support in OpenSSL originally developed by
|
113
|
+
* SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
|
114
|
+
*/
|
115
|
+
/* ====================================================================
|
116
|
+
* Copyright 2005 Nokia. All rights reserved.
|
117
|
+
*
|
118
|
+
* The portions of the attached software ("Contribution") is developed by
|
119
|
+
* Nokia Corporation and is licensed pursuant to the OpenSSL open source
|
120
|
+
* license.
|
121
|
+
*
|
122
|
+
* The Contribution, originally written by Mika Kousa and Pasi Eronen of
|
123
|
+
* Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
|
124
|
+
* support (see RFC 4279) to OpenSSL.
|
125
|
+
*
|
126
|
+
* No patent licenses or other rights except those expressly stated in
|
127
|
+
* the OpenSSL open source license shall be deemed granted or received
|
128
|
+
* expressly, by implication, estoppel, or otherwise.
|
129
|
+
*
|
130
|
+
* No assurances are provided by Nokia that the Contribution does not
|
131
|
+
* infringe the patent or other intellectual property rights of any third
|
132
|
+
* party or that the license provides you with all the necessary rights
|
133
|
+
* to make use of the Contribution.
|
134
|
+
*
|
135
|
+
* THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
|
136
|
+
* ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
|
137
|
+
* SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
|
138
|
+
* OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
|
139
|
+
* OTHERWISE.
|
140
|
+
*/
|
141
|
+
|
142
|
+
#ifndef OPENSSL_HEADER_SSL_INTERNAL_H
|
143
|
+
#define OPENSSL_HEADER_SSL_INTERNAL_H
|
144
|
+
|
145
|
+
#include <openssl/base.h>
|
146
|
+
|
147
|
+
#include <openssl/aead.h>
|
148
|
+
#include <openssl/pqueue.h>
|
149
|
+
#include <openssl/ssl.h>
|
150
|
+
#include <openssl/stack.h>
|
151
|
+
|
152
|
+
#if defined(OPENSSL_WINDOWS)
|
153
|
+
/* Windows defines struct timeval in winsock2.h. */
|
154
|
+
#pragma warning(push, 3)
|
155
|
+
#include <winsock2.h>
|
156
|
+
#pragma warning(pop)
|
157
|
+
#else
|
158
|
+
#include <sys/time.h>
|
159
|
+
#endif
|
160
|
+
|
161
|
+
|
162
|
+
/* Cipher suites. */
|
163
|
+
|
164
|
+
/* Bits for |algorithm_mkey| (key exchange algorithm). */
|
165
|
+
#define SSL_kRSA 0x00000001L
|
166
|
+
#define SSL_kDHE 0x00000002L
|
167
|
+
#define SSL_kECDHE 0x00000004L
|
168
|
+
/* SSL_kPSK is only set for plain PSK, not ECDHE_PSK. */
|
169
|
+
#define SSL_kPSK 0x00000008L
|
170
|
+
|
171
|
+
/* Bits for |algorithm_auth| (server authentication). */
|
172
|
+
#define SSL_aRSA 0x00000001L
|
173
|
+
#define SSL_aECDSA 0x00000002L
|
174
|
+
/* SSL_aPSK is set for both PSK and ECDHE_PSK. */
|
175
|
+
#define SSL_aPSK 0x00000004L
|
176
|
+
|
177
|
+
/* Bits for |algorithm_enc| (symmetric encryption). */
|
178
|
+
#define SSL_3DES 0x00000001L
|
179
|
+
#define SSL_RC4 0x00000002L
|
180
|
+
#define SSL_AES128 0x00000004L
|
181
|
+
#define SSL_AES256 0x00000008L
|
182
|
+
#define SSL_AES128GCM 0x00000010L
|
183
|
+
#define SSL_AES256GCM 0x00000020L
|
184
|
+
#define SSL_CHACHA20POLY1305_OLD 0x00000040L
|
185
|
+
#define SSL_eNULL 0x00000080L
|
186
|
+
#define SSL_CHACHA20POLY1305 0x00000100L
|
187
|
+
|
188
|
+
#define SSL_AES (SSL_AES128 | SSL_AES256 | SSL_AES128GCM | SSL_AES256GCM)
|
189
|
+
|
190
|
+
/* Bits for |algorithm_mac| (symmetric authentication). */
|
191
|
+
#define SSL_MD5 0x00000001L
|
192
|
+
#define SSL_SHA1 0x00000002L
|
193
|
+
#define SSL_SHA256 0x00000004L
|
194
|
+
#define SSL_SHA384 0x00000008L
|
195
|
+
/* SSL_AEAD is set for all AEADs. */
|
196
|
+
#define SSL_AEAD 0x00000010L
|
197
|
+
|
198
|
+
/* Bits for |algorithm_prf| (handshake digest). */
|
199
|
+
#define SSL_HANDSHAKE_MAC_DEFAULT 0x1
|
200
|
+
#define SSL_HANDSHAKE_MAC_SHA256 0x2
|
201
|
+
#define SSL_HANDSHAKE_MAC_SHA384 0x4
|
202
|
+
|
203
|
+
/* SSL_MAX_DIGEST is the number of digest types which exist. When adding a new
|
204
|
+
* one, update the table in ssl_cipher.c. */
|
205
|
+
#define SSL_MAX_DIGEST 4
|
206
|
+
|
207
|
+
/* ssl_cipher_get_evp_aead sets |*out_aead| to point to the correct EVP_AEAD
|
208
|
+
* object for |cipher| protocol version |version|. It sets |*out_mac_secret_len|
|
209
|
+
* and |*out_fixed_iv_len| to the MAC key length and fixed IV length,
|
210
|
+
* respectively. The MAC key length is zero except for legacy block and stream
|
211
|
+
* ciphers. It returns 1 on success and 0 on error. */
|
212
|
+
int ssl_cipher_get_evp_aead(const EVP_AEAD **out_aead,
|
213
|
+
size_t *out_mac_secret_len,
|
214
|
+
size_t *out_fixed_iv_len,
|
215
|
+
const SSL_CIPHER *cipher, uint16_t version);
|
216
|
+
|
217
|
+
/* ssl_get_handshake_digest returns the |EVP_MD| corresponding to
|
218
|
+
* |algorithm_prf|. It returns SHA-1 for |SSL_HANDSHAKE_DEFAULT|. The caller is
|
219
|
+
* responsible for maintaining the additional MD5 digest and switching to
|
220
|
+
* SHA-256 in TLS 1.2. */
|
221
|
+
const EVP_MD *ssl_get_handshake_digest(uint32_t algorithm_prf);
|
222
|
+
|
223
|
+
/* ssl_create_cipher_list evaluates |rule_str| according to the ciphers in
|
224
|
+
* |ssl_method|. It sets |*out_cipher_list| to a newly-allocated
|
225
|
+
* |ssl_cipher_preference_list_st| containing the result.
|
226
|
+
* |*out_cipher_list_by_id| is set to a list of selected ciphers sorted by
|
227
|
+
* id. It returns |(*out_cipher_list)->ciphers| on success and NULL on
|
228
|
+
* failure. */
|
229
|
+
STACK_OF(SSL_CIPHER) *
|
230
|
+
ssl_create_cipher_list(const SSL_PROTOCOL_METHOD *ssl_method,
|
231
|
+
struct ssl_cipher_preference_list_st **out_cipher_list,
|
232
|
+
STACK_OF(SSL_CIPHER) **out_cipher_list_by_id,
|
233
|
+
const char *rule_str);
|
234
|
+
|
235
|
+
/* ssl_cipher_get_value returns the cipher suite id of |cipher|. */
|
236
|
+
uint16_t ssl_cipher_get_value(const SSL_CIPHER *cipher);
|
237
|
+
|
238
|
+
/* ssl_cipher_get_key_type returns the |EVP_PKEY_*| value corresponding to the
|
239
|
+
* server key used in |cipher| or |EVP_PKEY_NONE| if there is none. */
|
240
|
+
int ssl_cipher_get_key_type(const SSL_CIPHER *cipher);
|
241
|
+
|
242
|
+
/* ssl_cipher_has_server_public_key returns 1 if |cipher| involves a server
|
243
|
+
* public key in the key exchange, sent in a server Certificate message.
|
244
|
+
* Otherwise it returns 0. */
|
245
|
+
int ssl_cipher_has_server_public_key(const SSL_CIPHER *cipher);
|
246
|
+
|
247
|
+
/* ssl_cipher_requires_server_key_exchange returns 1 if |cipher| requires a
|
248
|
+
* ServerKeyExchange message. Otherwise it returns 0.
|
249
|
+
*
|
250
|
+
* Unlike |ssl_cipher_has_server_public_key|, this function may return zero
|
251
|
+
* while still allowing |cipher| an optional ServerKeyExchange. This is the
|
252
|
+
* case for plain PSK ciphers. */
|
253
|
+
int ssl_cipher_requires_server_key_exchange(const SSL_CIPHER *cipher);
|
254
|
+
|
255
|
+
/* ssl_cipher_get_record_split_len, for TLS 1.0 CBC mode ciphers, returns the
|
256
|
+
* length of an encrypted 1-byte record, for use in record-splitting. Otherwise
|
257
|
+
* it returns zero. */
|
258
|
+
size_t ssl_cipher_get_record_split_len(const SSL_CIPHER *cipher);
|
259
|
+
|
260
|
+
|
261
|
+
/* Encryption layer. */
|
262
|
+
|
263
|
+
/* SSL_AEAD_CTX contains information about an AEAD that is being used to encrypt
|
264
|
+
* an SSL connection. */
|
265
|
+
struct ssl_aead_ctx_st {
|
266
|
+
const SSL_CIPHER *cipher;
|
267
|
+
EVP_AEAD_CTX ctx;
|
268
|
+
/* fixed_nonce contains any bytes of the nonce that are fixed for all
|
269
|
+
* records. */
|
270
|
+
uint8_t fixed_nonce[12];
|
271
|
+
uint8_t fixed_nonce_len, variable_nonce_len;
|
272
|
+
/* variable_nonce_included_in_record is non-zero if the variable nonce
|
273
|
+
* for a record is included as a prefix before the ciphertext. */
|
274
|
+
char variable_nonce_included_in_record;
|
275
|
+
/* random_variable_nonce is non-zero if the variable nonce is
|
276
|
+
* randomly generated, rather than derived from the sequence
|
277
|
+
* number. */
|
278
|
+
char random_variable_nonce;
|
279
|
+
/* omit_length_in_ad is non-zero if the length should be omitted in the
|
280
|
+
* AEAD's ad parameter. */
|
281
|
+
char omit_length_in_ad;
|
282
|
+
/* omit_version_in_ad is non-zero if the version should be omitted
|
283
|
+
* in the AEAD's ad parameter. */
|
284
|
+
char omit_version_in_ad;
|
285
|
+
/* xor_fixed_nonce is non-zero if the fixed nonce should be XOR'd into the
|
286
|
+
* variable nonce rather than prepended. */
|
287
|
+
char xor_fixed_nonce;
|
288
|
+
} /* SSL_AEAD_CTX */;
|
289
|
+
|
290
|
+
/* SSL_AEAD_CTX_new creates a newly-allocated |SSL_AEAD_CTX| using the supplied
|
291
|
+
* key material. It returns NULL on error. Only one of |SSL_AEAD_CTX_open| or
|
292
|
+
* |SSL_AEAD_CTX_seal| may be used with the resulting object, depending on
|
293
|
+
* |direction|. |version| is the normalized protocol version, so DTLS 1.0 is
|
294
|
+
* represented as 0x0301, not 0xffef. */
|
295
|
+
SSL_AEAD_CTX *SSL_AEAD_CTX_new(enum evp_aead_direction_t direction,
|
296
|
+
uint16_t version, const SSL_CIPHER *cipher,
|
297
|
+
const uint8_t *enc_key, size_t enc_key_len,
|
298
|
+
const uint8_t *mac_key, size_t mac_key_len,
|
299
|
+
const uint8_t *fixed_iv, size_t fixed_iv_len);
|
300
|
+
|
301
|
+
/* SSL_AEAD_CTX_free frees |ctx|. */
|
302
|
+
void SSL_AEAD_CTX_free(SSL_AEAD_CTX *ctx);
|
303
|
+
|
304
|
+
/* SSL_AEAD_CTX_explicit_nonce_len returns the length of the explicit nonce for
|
305
|
+
* |ctx|, if any. |ctx| may be NULL to denote the null cipher. */
|
306
|
+
size_t SSL_AEAD_CTX_explicit_nonce_len(SSL_AEAD_CTX *ctx);
|
307
|
+
|
308
|
+
/* SSL_AEAD_CTX_max_overhead returns the maximum overhead of calling
|
309
|
+
* |SSL_AEAD_CTX_seal|. |ctx| may be NULL to denote the null cipher. */
|
310
|
+
size_t SSL_AEAD_CTX_max_overhead(SSL_AEAD_CTX *ctx);
|
311
|
+
|
312
|
+
/* SSL_AEAD_CTX_open authenticates and decrypts |in_len| bytes from |in| and
|
313
|
+
* writes the result to |out|. It returns one on success and zero on
|
314
|
+
* error. |ctx| may be NULL to denote the null cipher.
|
315
|
+
*
|
316
|
+
* If |in| and |out| alias then |out| must be <= |in| + |explicit_nonce_len|. */
|
317
|
+
int SSL_AEAD_CTX_open(SSL_AEAD_CTX *ctx, uint8_t *out, size_t *out_len,
|
318
|
+
size_t max_out, uint8_t type, uint16_t wire_version,
|
319
|
+
const uint8_t seqnum[8], const uint8_t *in,
|
320
|
+
size_t in_len);
|
321
|
+
|
322
|
+
/* SSL_AEAD_CTX_seal encrypts and authenticates |in_len| bytes from |in| and
|
323
|
+
* writes the result to |out|. It returns one on success and zero on
|
324
|
+
* error. |ctx| may be NULL to denote the null cipher.
|
325
|
+
*
|
326
|
+
* If |in| and |out| alias then |out| + |explicit_nonce_len| must be <= |in| */
|
327
|
+
int SSL_AEAD_CTX_seal(SSL_AEAD_CTX *ctx, uint8_t *out, size_t *out_len,
|
328
|
+
size_t max_out, uint8_t type, uint16_t wire_version,
|
329
|
+
const uint8_t seqnum[8], const uint8_t *in,
|
330
|
+
size_t in_len);
|
331
|
+
|
332
|
+
|
333
|
+
/* DTLS replay bitmap. */
|
334
|
+
|
335
|
+
/* DTLS1_BITMAP maintains a sliding window of 64 sequence numbers to detect
|
336
|
+
* replayed packets. It should be initialized by zeroing every field. */
|
337
|
+
typedef struct dtls1_bitmap_st {
|
338
|
+
/* map is a bit mask of the last 64 sequence numbers. Bit
|
339
|
+
* |1<<i| corresponds to |max_seq_num - i|. */
|
340
|
+
uint64_t map;
|
341
|
+
/* max_seq_num is the largest sequence number seen so far as a 64-bit
|
342
|
+
* integer. */
|
343
|
+
uint64_t max_seq_num;
|
344
|
+
} DTLS1_BITMAP;
|
345
|
+
|
346
|
+
|
347
|
+
/* Record layer. */
|
348
|
+
|
349
|
+
/* ssl_record_prefix_len returns the length of the prefix before the ciphertext
|
350
|
+
* of a record for |ssl|.
|
351
|
+
*
|
352
|
+
* TODO(davidben): Expose this as part of public API once the high-level
|
353
|
+
* buffer-free APIs are available. */
|
354
|
+
size_t ssl_record_prefix_len(const SSL *ssl);
|
355
|
+
|
356
|
+
enum ssl_open_record_t {
|
357
|
+
ssl_open_record_success,
|
358
|
+
ssl_open_record_discard,
|
359
|
+
ssl_open_record_partial,
|
360
|
+
ssl_open_record_error,
|
361
|
+
};
|
362
|
+
|
363
|
+
/* tls_open_record decrypts a record from |in|.
|
364
|
+
*
|
365
|
+
* On success, it returns |ssl_open_record_success|. It sets |*out_type| to the
|
366
|
+
* record type, |*out_len| to the plaintext length, and writes the record body
|
367
|
+
* to |out|. It sets |*out_consumed| to the number of bytes of |in| consumed.
|
368
|
+
* Note that |*out_len| may be zero.
|
369
|
+
*
|
370
|
+
* If a record was successfully processed but should be discarded, it returns
|
371
|
+
* |ssl_open_record_discard| and sets |*out_consumed| to the number of bytes
|
372
|
+
* consumed.
|
373
|
+
*
|
374
|
+
* If the input did not contain a complete record, it returns
|
375
|
+
* |ssl_open_record_partial|. It sets |*out_consumed| to the total number of
|
376
|
+
* bytes necessary. It is guaranteed that a successful call to |tls_open_record|
|
377
|
+
* will consume at least that many bytes.
|
378
|
+
*
|
379
|
+
* On failure, it returns |ssl_open_record_error| and sets |*out_alert| to an
|
380
|
+
* alert to emit.
|
381
|
+
*
|
382
|
+
* If |in| and |out| alias, |out| must be <= |in| + |ssl_record_prefix_len|. */
|
383
|
+
enum ssl_open_record_t tls_open_record(
|
384
|
+
SSL *ssl, uint8_t *out_type, uint8_t *out, size_t *out_len,
|
385
|
+
size_t *out_consumed, uint8_t *out_alert, size_t max_out, const uint8_t *in,
|
386
|
+
size_t in_len);
|
387
|
+
|
388
|
+
/* dtls_open_record implements |tls_open_record| for DTLS. It never returns
|
389
|
+
* |ssl_open_record_partial| but otherwise behaves analogously. */
|
390
|
+
enum ssl_open_record_t dtls_open_record(
|
391
|
+
SSL *ssl, uint8_t *out_type, uint8_t *out, size_t *out_len,
|
392
|
+
size_t *out_consumed, uint8_t *out_alert, size_t max_out, const uint8_t *in,
|
393
|
+
size_t in_len);
|
394
|
+
|
395
|
+
/* ssl_seal_prefix_len returns the length of the prefix before the ciphertext
|
396
|
+
* when sealing a record with |ssl|. Note that this value may differ from
|
397
|
+
* |ssl_record_prefix_len| when TLS 1.0 CBC record-splitting is enabled. Sealing
|
398
|
+
* a small record may also result in a smaller output than this value.
|
399
|
+
*
|
400
|
+
* TODO(davidben): Expose this as part of public API once the high-level
|
401
|
+
* buffer-free APIs are available. */
|
402
|
+
size_t ssl_seal_prefix_len(const SSL *ssl);
|
403
|
+
|
404
|
+
/* ssl_max_seal_overhead returns the maximum overhead of sealing a record with
|
405
|
+
* |ssl|. This includes |ssl_seal_prefix_len|.
|
406
|
+
*
|
407
|
+
* TODO(davidben): Expose this as part of public API once the high-level
|
408
|
+
* buffer-free APIs are available. */
|
409
|
+
size_t ssl_max_seal_overhead(const SSL *ssl);
|
410
|
+
|
411
|
+
/* tls_seal_record seals a new record of type |type| and body |in| and writes it
|
412
|
+
* to |out|. At most |max_out| bytes will be written. It returns one on success
|
413
|
+
* and zero on error. If enabled, |tls_seal_record| implements TLS 1.0 CBC 1/n-1
|
414
|
+
* record splitting and may write two records concatenated.
|
415
|
+
*
|
416
|
+
* For a large record, the ciphertext will begin |ssl_seal_prefix_len| bytes
|
417
|
+
* into out. Aligning |out| appropriately may improve performance. It writes at
|
418
|
+
* most |in_len| + |ssl_max_seal_overhead| bytes to |out|.
|
419
|
+
*
|
420
|
+
* If |in| and |out| alias, |out| + |ssl_seal_prefix_len| must be <= |in|. */
|
421
|
+
int tls_seal_record(SSL *ssl, uint8_t *out, size_t *out_len, size_t max_out,
|
422
|
+
uint8_t type, const uint8_t *in, size_t in_len);
|
423
|
+
|
424
|
+
enum dtls1_use_epoch_t {
|
425
|
+
dtls1_use_previous_epoch,
|
426
|
+
dtls1_use_current_epoch,
|
427
|
+
};
|
428
|
+
|
429
|
+
/* dtls_seal_record implements |tls_seal_record| for DTLS. |use_epoch| selects
|
430
|
+
* which epoch's cipher state to use. */
|
431
|
+
int dtls_seal_record(SSL *ssl, uint8_t *out, size_t *out_len, size_t max_out,
|
432
|
+
uint8_t type, const uint8_t *in, size_t in_len,
|
433
|
+
enum dtls1_use_epoch_t use_epoch);
|
434
|
+
|
435
|
+
|
436
|
+
/* Private key operations. */
|
437
|
+
|
438
|
+
/* ssl_has_private_key returns one if |ssl| has a private key
|
439
|
+
* configured and zero otherwise. */
|
440
|
+
int ssl_has_private_key(SSL *ssl);
|
441
|
+
|
442
|
+
/* ssl_private_key_* call the corresponding function on the
|
443
|
+
* |SSL_PRIVATE_KEY_METHOD| for |ssl|, if configured. Otherwise, they implement
|
444
|
+
* the operation with |EVP_PKEY|. */
|
445
|
+
|
446
|
+
int ssl_private_key_type(SSL *ssl);
|
447
|
+
|
448
|
+
size_t ssl_private_key_max_signature_len(SSL *ssl);
|
449
|
+
|
450
|
+
enum ssl_private_key_result_t ssl_private_key_sign(
|
451
|
+
SSL *ssl, uint8_t *out, size_t *out_len, size_t max_out, const EVP_MD *md,
|
452
|
+
const uint8_t *in, size_t in_len);
|
453
|
+
|
454
|
+
enum ssl_private_key_result_t ssl_private_key_sign_complete(
|
455
|
+
SSL *ssl, uint8_t *out, size_t *out_len, size_t max_out);
|
456
|
+
|
457
|
+
enum ssl_private_key_result_t ssl_private_key_decrypt(
|
458
|
+
SSL *ssl, uint8_t *out, size_t *out_len, size_t max_out,
|
459
|
+
const uint8_t *in, size_t in_len);
|
460
|
+
|
461
|
+
enum ssl_private_key_result_t ssl_private_key_decrypt_complete(
|
462
|
+
SSL *ssl, uint8_t *out, size_t *out_len, size_t max_out);
|
463
|
+
|
464
|
+
|
465
|
+
/* Custom extensions */
|
466
|
+
|
467
|
+
/* ssl_custom_extension (a.k.a. SSL_CUSTOM_EXTENSION) is a structure that
|
468
|
+
* contains information about custom-extension callbacks. */
|
469
|
+
struct ssl_custom_extension {
|
470
|
+
SSL_custom_ext_add_cb add_callback;
|
471
|
+
void *add_arg;
|
472
|
+
SSL_custom_ext_free_cb free_callback;
|
473
|
+
SSL_custom_ext_parse_cb parse_callback;
|
474
|
+
void *parse_arg;
|
475
|
+
uint16_t value;
|
476
|
+
};
|
477
|
+
|
478
|
+
void SSL_CUSTOM_EXTENSION_free(SSL_CUSTOM_EXTENSION *custom_extension);
|
479
|
+
|
480
|
+
int custom_ext_add_clienthello(SSL *ssl, CBB *extensions);
|
481
|
+
int custom_ext_parse_serverhello(SSL *ssl, int *out_alert, uint16_t value,
|
482
|
+
const CBS *extension);
|
483
|
+
int custom_ext_parse_clienthello(SSL *ssl, int *out_alert, uint16_t value,
|
484
|
+
const CBS *extension);
|
485
|
+
int custom_ext_add_serverhello(SSL *ssl, CBB *extensions);
|
486
|
+
|
487
|
+
|
488
|
+
/* Handshake hash.
|
489
|
+
*
|
490
|
+
* The TLS handshake maintains a transcript of all handshake messages. At
|
491
|
+
* various points in the protocol, this is either a handshake buffer, a rolling
|
492
|
+
* hash (selected by cipher suite) or both. */
|
493
|
+
|
494
|
+
/* ssl3_init_handshake_buffer initializes the handshake buffer and resets the
|
495
|
+
* handshake hash. It returns one success and zero on failure. */
|
496
|
+
int ssl3_init_handshake_buffer(SSL *ssl);
|
497
|
+
|
498
|
+
/* ssl3_init_handshake_hash initializes the handshake hash based on the pending
|
499
|
+
* cipher and the contents of the handshake buffer. Subsequent calls to
|
500
|
+
* |ssl3_update_handshake_hash| will update the rolling hash. It returns one on
|
501
|
+
* success and zero on failure. It is an error to call this function after the
|
502
|
+
* handshake buffer is released. */
|
503
|
+
int ssl3_init_handshake_hash(SSL *ssl);
|
504
|
+
|
505
|
+
/* ssl3_free_handshake_buffer releases the handshake buffer. Subsequent calls
|
506
|
+
* to |ssl3_update_handshake_hash| will not update the handshake buffer. */
|
507
|
+
void ssl3_free_handshake_buffer(SSL *ssl);
|
508
|
+
|
509
|
+
/* ssl3_free_handshake_hash releases the handshake hash. */
|
510
|
+
void ssl3_free_handshake_hash(SSL *s);
|
511
|
+
|
512
|
+
/* ssl3_update_handshake_hash adds |in| to the handshake buffer and handshake
|
513
|
+
* hash, whichever is enabled. It returns one on success and zero on failure. */
|
514
|
+
int ssl3_update_handshake_hash(SSL *ssl, const uint8_t *in, size_t in_len);
|
515
|
+
|
516
|
+
|
517
|
+
/* Transport buffers. */
|
518
|
+
|
519
|
+
/* ssl_read_buffer returns a pointer to contents of the read buffer. */
|
520
|
+
uint8_t *ssl_read_buffer(SSL *ssl);
|
521
|
+
|
522
|
+
/* ssl_read_buffer_len returns the length of the read buffer. */
|
523
|
+
size_t ssl_read_buffer_len(const SSL *ssl);
|
524
|
+
|
525
|
+
/* ssl_read_buffer_extend_to extends the read buffer to the desired length. For
|
526
|
+
* TLS, it reads to the end of the buffer until the buffer is |len| bytes
|
527
|
+
* long. For DTLS, it reads a new packet and ignores |len|. It returns one on
|
528
|
+
* success, zero on EOF, and a negative number on error.
|
529
|
+
*
|
530
|
+
* It is an error to call |ssl_read_buffer_extend_to| in DTLS when the buffer is
|
531
|
+
* non-empty. */
|
532
|
+
int ssl_read_buffer_extend_to(SSL *ssl, size_t len);
|
533
|
+
|
534
|
+
/* ssl_read_buffer_consume consumes |len| bytes from the read buffer. It
|
535
|
+
* advances the data pointer and decrements the length. The memory consumed will
|
536
|
+
* remain valid until the next call to |ssl_read_buffer_extend| or it is
|
537
|
+
* discarded with |ssl_read_buffer_discard|. */
|
538
|
+
void ssl_read_buffer_consume(SSL *ssl, size_t len);
|
539
|
+
|
540
|
+
/* ssl_read_buffer_discard discards the consumed bytes from the read buffer. If
|
541
|
+
* the buffer is now empty, it releases memory used by it. */
|
542
|
+
void ssl_read_buffer_discard(SSL *ssl);
|
543
|
+
|
544
|
+
/* ssl_read_buffer_clear releases all memory associated with the read buffer and
|
545
|
+
* zero-initializes it. */
|
546
|
+
void ssl_read_buffer_clear(SSL *ssl);
|
547
|
+
|
548
|
+
/* ssl_write_buffer_is_pending returns one if the write buffer has pending data
|
549
|
+
* and zero if is empty. */
|
550
|
+
int ssl_write_buffer_is_pending(const SSL *ssl);
|
551
|
+
|
552
|
+
/* ssl_write_buffer_init initializes the write buffer. On success, it sets
|
553
|
+
* |*out_ptr| to the start of the write buffer with space for up to |max_len|
|
554
|
+
* bytes. It returns one on success and zero on failure. Call
|
555
|
+
* |ssl_write_buffer_set_len| to complete initialization. */
|
556
|
+
int ssl_write_buffer_init(SSL *ssl, uint8_t **out_ptr, size_t max_len);
|
557
|
+
|
558
|
+
/* ssl_write_buffer_set_len is called after |ssl_write_buffer_init| to complete
|
559
|
+
* initialization after |len| bytes are written to the buffer. */
|
560
|
+
void ssl_write_buffer_set_len(SSL *ssl, size_t len);
|
561
|
+
|
562
|
+
/* ssl_write_buffer_flush flushes the write buffer to the transport. It returns
|
563
|
+
* one on success and <= 0 on error. For DTLS, whether or not the write
|
564
|
+
* succeeds, the write buffer will be cleared. */
|
565
|
+
int ssl_write_buffer_flush(SSL *ssl);
|
566
|
+
|
567
|
+
/* ssl_write_buffer_clear releases all memory associated with the write buffer
|
568
|
+
* and zero-initializes it. */
|
569
|
+
void ssl_write_buffer_clear(SSL *ssl);
|
570
|
+
|
571
|
+
|
572
|
+
/* Underdocumented functions.
|
573
|
+
*
|
574
|
+
* Functions below here haven't been touched up and may be underdocumented. */
|
575
|
+
|
576
|
+
#define c2l(c, l) \
|
577
|
+
(l = ((unsigned long)(*((c)++))), l |= (((unsigned long)(*((c)++))) << 8), \
|
578
|
+
l |= (((unsigned long)(*((c)++))) << 16), \
|
579
|
+
l |= (((unsigned long)(*((c)++))) << 24))
|
580
|
+
|
581
|
+
/* NOTE - c is not incremented as per c2l */
|
582
|
+
#define c2ln(c, l1, l2, n) \
|
583
|
+
{ \
|
584
|
+
c += n; \
|
585
|
+
l1 = l2 = 0; \
|
586
|
+
switch (n) { \
|
587
|
+
case 8: \
|
588
|
+
l2 = ((unsigned long)(*(--(c)))) << 24; \
|
589
|
+
case 7: \
|
590
|
+
l2 |= ((unsigned long)(*(--(c)))) << 16; \
|
591
|
+
case 6: \
|
592
|
+
l2 |= ((unsigned long)(*(--(c)))) << 8; \
|
593
|
+
case 5: \
|
594
|
+
l2 |= ((unsigned long)(*(--(c)))); \
|
595
|
+
case 4: \
|
596
|
+
l1 = ((unsigned long)(*(--(c)))) << 24; \
|
597
|
+
case 3: \
|
598
|
+
l1 |= ((unsigned long)(*(--(c)))) << 16; \
|
599
|
+
case 2: \
|
600
|
+
l1 |= ((unsigned long)(*(--(c)))) << 8; \
|
601
|
+
case 1: \
|
602
|
+
l1 |= ((unsigned long)(*(--(c)))); \
|
603
|
+
} \
|
604
|
+
}
|
605
|
+
|
606
|
+
#define l2c(l, c) \
|
607
|
+
(*((c)++) = (uint8_t)(((l)) & 0xff), \
|
608
|
+
*((c)++) = (uint8_t)(((l) >> 8) & 0xff), \
|
609
|
+
*((c)++) = (uint8_t)(((l) >> 16) & 0xff), \
|
610
|
+
*((c)++) = (uint8_t)(((l) >> 24) & 0xff))
|
611
|
+
|
612
|
+
#define n2l(c, l) \
|
613
|
+
(l = ((unsigned long)(*((c)++))) << 24, \
|
614
|
+
l |= ((unsigned long)(*((c)++))) << 16, \
|
615
|
+
l |= ((unsigned long)(*((c)++))) << 8, l |= ((unsigned long)(*((c)++))))
|
616
|
+
|
617
|
+
#define l2n(l, c) \
|
618
|
+
(*((c)++) = (uint8_t)(((l) >> 24) & 0xff), \
|
619
|
+
*((c)++) = (uint8_t)(((l) >> 16) & 0xff), \
|
620
|
+
*((c)++) = (uint8_t)(((l) >> 8) & 0xff), \
|
621
|
+
*((c)++) = (uint8_t)(((l)) & 0xff))
|
622
|
+
|
623
|
+
#define l2n8(l, c) \
|
624
|
+
(*((c)++) = (uint8_t)(((l) >> 56) & 0xff), \
|
625
|
+
*((c)++) = (uint8_t)(((l) >> 48) & 0xff), \
|
626
|
+
*((c)++) = (uint8_t)(((l) >> 40) & 0xff), \
|
627
|
+
*((c)++) = (uint8_t)(((l) >> 32) & 0xff), \
|
628
|
+
*((c)++) = (uint8_t)(((l) >> 24) & 0xff), \
|
629
|
+
*((c)++) = (uint8_t)(((l) >> 16) & 0xff), \
|
630
|
+
*((c)++) = (uint8_t)(((l) >> 8) & 0xff), \
|
631
|
+
*((c)++) = (uint8_t)(((l)) & 0xff))
|
632
|
+
|
633
|
+
/* NOTE - c is not incremented as per l2c */
|
634
|
+
#define l2cn(l1, l2, c, n) \
|
635
|
+
{ \
|
636
|
+
c += n; \
|
637
|
+
switch (n) { \
|
638
|
+
case 8: \
|
639
|
+
*(--(c)) = (uint8_t)(((l2) >> 24) & 0xff); \
|
640
|
+
case 7: \
|
641
|
+
*(--(c)) = (uint8_t)(((l2) >> 16) & 0xff); \
|
642
|
+
case 6: \
|
643
|
+
*(--(c)) = (uint8_t)(((l2) >> 8) & 0xff); \
|
644
|
+
case 5: \
|
645
|
+
*(--(c)) = (uint8_t)(((l2)) & 0xff); \
|
646
|
+
case 4: \
|
647
|
+
*(--(c)) = (uint8_t)(((l1) >> 24) & 0xff); \
|
648
|
+
case 3: \
|
649
|
+
*(--(c)) = (uint8_t)(((l1) >> 16) & 0xff); \
|
650
|
+
case 2: \
|
651
|
+
*(--(c)) = (uint8_t)(((l1) >> 8) & 0xff); \
|
652
|
+
case 1: \
|
653
|
+
*(--(c)) = (uint8_t)(((l1)) & 0xff); \
|
654
|
+
} \
|
655
|
+
}
|
656
|
+
|
657
|
+
#define n2s(c, s) \
|
658
|
+
((s = (((unsigned int)(c[0])) << 8) | (((unsigned int)(c[1])))), c += 2)
|
659
|
+
|
660
|
+
#define s2n(s, c) \
|
661
|
+
((c[0] = (uint8_t)(((s) >> 8) & 0xff), \
|
662
|
+
c[1] = (uint8_t)(((s)) & 0xff)), \
|
663
|
+
c += 2)
|
664
|
+
|
665
|
+
#define n2l3(c, l) \
|
666
|
+
((l = (((unsigned long)(c[0])) << 16) | (((unsigned long)(c[1])) << 8) | \
|
667
|
+
(((unsigned long)(c[2])))), \
|
668
|
+
c += 3)
|
669
|
+
|
670
|
+
#define l2n3(l, c) \
|
671
|
+
((c[0] = (uint8_t)(((l) >> 16) & 0xff), \
|
672
|
+
c[1] = (uint8_t)(((l) >> 8) & 0xff), \
|
673
|
+
c[2] = (uint8_t)(((l)) & 0xff)), \
|
674
|
+
c += 3)
|
675
|
+
|
676
|
+
/* LOCAL STUFF */
|
677
|
+
|
678
|
+
#define TLSEXT_CHANNEL_ID_SIZE 128
|
679
|
+
|
680
|
+
/* Check if an SSL structure is using DTLS */
|
681
|
+
#define SSL_IS_DTLS(s) (s->method->is_dtls)
|
682
|
+
/* See if we need explicit IV */
|
683
|
+
#define SSL_USE_EXPLICIT_IV(s) \
|
684
|
+
(s->enc_method->enc_flags & SSL_ENC_FLAG_EXPLICIT_IV)
|
685
|
+
/* See if we use signature algorithms extension and signature algorithm before
|
686
|
+
* signatures. */
|
687
|
+
#define SSL_USE_SIGALGS(s) (s->enc_method->enc_flags & SSL_ENC_FLAG_SIGALGS)
|
688
|
+
|
689
|
+
/* SSL_kRSA <- RSA_ENC | (RSA_TMP & RSA_SIGN) |
|
690
|
+
* <- (EXPORT & (RSA_ENC | RSA_TMP) & RSA_SIGN)
|
691
|
+
* SSL_kDH <- DH_ENC & (RSA_ENC | RSA_SIGN | DSA_SIGN)
|
692
|
+
* SSL_kDHE <- RSA_ENC | RSA_SIGN | DSA_SIGN
|
693
|
+
* SSL_aRSA <- RSA_ENC | RSA_SIGN
|
694
|
+
* SSL_aDSS <- DSA_SIGN */
|
695
|
+
|
696
|
+
/* From RFC4492, used in encoding the curve type in ECParameters */
|
697
|
+
#define EXPLICIT_PRIME_CURVE_TYPE 1
|
698
|
+
#define EXPLICIT_CHAR2_CURVE_TYPE 2
|
699
|
+
#define NAMED_CURVE_TYPE 3
|
700
|
+
|
701
|
+
enum ssl_hash_message_t {
|
702
|
+
ssl_dont_hash_message,
|
703
|
+
ssl_hash_message,
|
704
|
+
};
|
705
|
+
|
706
|
+
/* Structure containing decoded values of signature algorithms extension */
|
707
|
+
typedef struct tls_sigalgs_st {
|
708
|
+
uint8_t rsign;
|
709
|
+
uint8_t rhash;
|
710
|
+
} TLS_SIGALGS;
|
711
|
+
|
712
|
+
typedef struct cert_st {
|
713
|
+
X509 *x509;
|
714
|
+
EVP_PKEY *privatekey;
|
715
|
+
/* Chain for this certificate */
|
716
|
+
STACK_OF(X509) *chain;
|
717
|
+
|
718
|
+
/* key_method, if non-NULL, is a set of callbacks to call for private key
|
719
|
+
* operations. */
|
720
|
+
const SSL_PRIVATE_KEY_METHOD *key_method;
|
721
|
+
|
722
|
+
/* For clients the following masks are of *disabled* key and auth algorithms
|
723
|
+
* based on the current configuration.
|
724
|
+
*
|
725
|
+
* TODO(davidben): Remove these. They get checked twice: when sending the
|
726
|
+
* ClientHello and when processing the ServerHello. */
|
727
|
+
uint32_t mask_k;
|
728
|
+
uint32_t mask_a;
|
729
|
+
|
730
|
+
DH *dh_tmp;
|
731
|
+
DH *(*dh_tmp_cb)(SSL *ssl, int is_export, int keysize);
|
732
|
+
|
733
|
+
/* peer_sigalgs are the algorithm/hash pairs that the peer supports. These
|
734
|
+
* are taken from the contents of signature algorithms extension for a server
|
735
|
+
* or from the CertificateRequest for a client. */
|
736
|
+
TLS_SIGALGS *peer_sigalgs;
|
737
|
+
/* peer_sigalgslen is the number of entries in |peer_sigalgs|. */
|
738
|
+
size_t peer_sigalgslen;
|
739
|
+
|
740
|
+
/* digest_nids, if non-NULL, is the set of digests supported by |privatekey|
|
741
|
+
* in decreasing order of preference. */
|
742
|
+
int *digest_nids;
|
743
|
+
size_t num_digest_nids;
|
744
|
+
|
745
|
+
/* Certificate setup callback: if set is called whenever a
|
746
|
+
* certificate may be required (client or server). the callback
|
747
|
+
* can then examine any appropriate parameters and setup any
|
748
|
+
* certificates required. This allows advanced applications
|
749
|
+
* to select certificates on the fly: for example based on
|
750
|
+
* supported signature algorithms or curves. */
|
751
|
+
int (*cert_cb)(SSL *ssl, void *arg);
|
752
|
+
void *cert_cb_arg;
|
753
|
+
} CERT;
|
754
|
+
|
755
|
+
/* SSL_METHOD is a compatibility structure to support the legacy version-locked
|
756
|
+
* methods. */
|
757
|
+
struct ssl_method_st {
|
758
|
+
/* version, if non-zero, is the only protocol version acceptable to an
|
759
|
+
* SSL_CTX initialized from this method. */
|
760
|
+
uint16_t version;
|
761
|
+
/* method is the underlying SSL_PROTOCOL_METHOD that initializes the
|
762
|
+
* SSL_CTX. */
|
763
|
+
const SSL_PROTOCOL_METHOD *method;
|
764
|
+
};
|
765
|
+
|
766
|
+
/* Used to hold functions for SSLv2 or SSLv3/TLSv1 functions */
|
767
|
+
struct ssl_protocol_method_st {
|
768
|
+
/* is_dtls is one if the protocol is DTLS and zero otherwise. */
|
769
|
+
char is_dtls;
|
770
|
+
int (*ssl_new)(SSL *ssl);
|
771
|
+
void (*ssl_free)(SSL *ssl);
|
772
|
+
int (*ssl_accept)(SSL *ssl);
|
773
|
+
int (*ssl_connect)(SSL *ssl);
|
774
|
+
long (*ssl_get_message)(SSL *ssl, int header_state, int body_state,
|
775
|
+
int msg_type, long max,
|
776
|
+
enum ssl_hash_message_t hash_message, int *ok);
|
777
|
+
int (*ssl_read_app_data)(SSL *ssl, uint8_t *buf, int len, int peek);
|
778
|
+
int (*ssl_read_change_cipher_spec)(SSL *ssl);
|
779
|
+
void (*ssl_read_close_notify)(SSL *ssl);
|
780
|
+
int (*ssl_write_app_data)(SSL *ssl, const void *buf_, int len);
|
781
|
+
int (*ssl_dispatch_alert)(SSL *ssl);
|
782
|
+
/* supports_cipher returns one if |cipher| is supported by this protocol and
|
783
|
+
* zero otherwise. */
|
784
|
+
int (*supports_cipher)(const SSL_CIPHER *cipher);
|
785
|
+
/* Handshake header length */
|
786
|
+
unsigned int hhlen;
|
787
|
+
/* Set the handshake header */
|
788
|
+
int (*set_handshake_header)(SSL *ssl, int type, unsigned long len);
|
789
|
+
/* Write out handshake message */
|
790
|
+
int (*do_write)(SSL *ssl);
|
791
|
+
};
|
792
|
+
|
793
|
+
/* This is for the SSLv3/TLSv1.0 differences in crypto/hash stuff It is a bit
|
794
|
+
* of a mess of functions, but hell, think of it as an opaque structure. */
|
795
|
+
struct ssl3_enc_method {
|
796
|
+
int (*prf)(SSL *, uint8_t *, size_t, const uint8_t *, size_t, const char *,
|
797
|
+
size_t, const uint8_t *, size_t, const uint8_t *, size_t);
|
798
|
+
int (*setup_key_block)(SSL *);
|
799
|
+
int (*generate_master_secret)(SSL *, uint8_t *, const uint8_t *, size_t);
|
800
|
+
int (*change_cipher_state)(SSL *, int);
|
801
|
+
int (*final_finish_mac)(SSL *, const char *, int, uint8_t *);
|
802
|
+
int (*cert_verify_mac)(SSL *, int, uint8_t *);
|
803
|
+
const char *client_finished_label;
|
804
|
+
int client_finished_label_len;
|
805
|
+
const char *server_finished_label;
|
806
|
+
int server_finished_label_len;
|
807
|
+
int (*alert_value)(int);
|
808
|
+
int (*export_keying_material)(SSL *, uint8_t *, size_t, const char *, size_t,
|
809
|
+
const uint8_t *, size_t, int use_context);
|
810
|
+
/* Various flags indicating protocol version requirements */
|
811
|
+
unsigned int enc_flags;
|
812
|
+
};
|
813
|
+
|
814
|
+
#define SSL_HM_HEADER_LENGTH(s) s->method->hhlen
|
815
|
+
#define ssl_handshake_start(s) \
|
816
|
+
(((uint8_t *)s->init_buf->data) + s->method->hhlen)
|
817
|
+
#define ssl_set_handshake_header(s, htype, len) \
|
818
|
+
s->method->set_handshake_header(s, htype, len)
|
819
|
+
#define ssl_do_write(s) s->method->do_write(s)
|
820
|
+
|
821
|
+
/* Values for enc_flags */
|
822
|
+
|
823
|
+
/* Uses explicit IV for CBC mode */
|
824
|
+
#define SSL_ENC_FLAG_EXPLICIT_IV 0x1
|
825
|
+
/* Uses signature algorithms extension */
|
826
|
+
#define SSL_ENC_FLAG_SIGALGS 0x2
|
827
|
+
/* Uses SHA256 default PRF */
|
828
|
+
#define SSL_ENC_FLAG_SHA256_PRF 0x4
|
829
|
+
|
830
|
+
/* lengths of messages */
|
831
|
+
#define DTLS1_COOKIE_LENGTH 256
|
832
|
+
|
833
|
+
#define DTLS1_RT_HEADER_LENGTH 13
|
834
|
+
|
835
|
+
#define DTLS1_HM_HEADER_LENGTH 12
|
836
|
+
|
837
|
+
#define DTLS1_CCS_HEADER_LENGTH 1
|
838
|
+
|
839
|
+
#define DTLS1_AL_HEADER_LENGTH 2
|
840
|
+
|
841
|
+
/* TODO(davidben): This structure is used for both incoming messages and
|
842
|
+
* outgoing messages. |is_ccs| and |epoch| are only used in the latter and
|
843
|
+
* should be moved elsewhere. */
|
844
|
+
struct hm_header_st {
|
845
|
+
uint8_t type;
|
846
|
+
uint32_t msg_len;
|
847
|
+
uint16_t seq;
|
848
|
+
uint32_t frag_off;
|
849
|
+
uint32_t frag_len;
|
850
|
+
int is_ccs;
|
851
|
+
/* epoch, for buffered outgoing messages, is the epoch the message was
|
852
|
+
* originally sent in. */
|
853
|
+
uint16_t epoch;
|
854
|
+
};
|
855
|
+
|
856
|
+
/* TODO(davidben): This structure is used for both incoming messages and
|
857
|
+
* outgoing messages. |fragment| and |reassembly| are only used in the former
|
858
|
+
* and should be moved elsewhere. */
|
859
|
+
typedef struct hm_fragment_st {
|
860
|
+
struct hm_header_st msg_header;
|
861
|
+
uint8_t *fragment;
|
862
|
+
uint8_t *reassembly;
|
863
|
+
} hm_fragment;
|
864
|
+
|
865
|
+
typedef struct dtls1_state_st {
|
866
|
+
/* send_cookie is true if we are resending the ClientHello
|
867
|
+
* with a cookie from a HelloVerifyRequest. */
|
868
|
+
unsigned int send_cookie;
|
869
|
+
|
870
|
+
uint8_t cookie[DTLS1_COOKIE_LENGTH];
|
871
|
+
size_t cookie_len;
|
872
|
+
|
873
|
+
/* The current data and handshake epoch. This is initially undefined, and
|
874
|
+
* starts at zero once the initial handshake is completed. */
|
875
|
+
uint16_t r_epoch;
|
876
|
+
uint16_t w_epoch;
|
877
|
+
|
878
|
+
/* records being received in the current epoch */
|
879
|
+
DTLS1_BITMAP bitmap;
|
880
|
+
|
881
|
+
/* handshake message numbers.
|
882
|
+
* TODO(davidben): It doesn't make much sense to store both of these. Only
|
883
|
+
* store one. */
|
884
|
+
uint16_t handshake_write_seq;
|
885
|
+
uint16_t next_handshake_write_seq;
|
886
|
+
|
887
|
+
uint16_t handshake_read_seq;
|
888
|
+
|
889
|
+
/* save last sequence number for retransmissions */
|
890
|
+
uint8_t last_write_sequence[8];
|
891
|
+
|
892
|
+
/* buffered_messages is a priority queue of incoming handshake messages that
|
893
|
+
* have yet to be processed.
|
894
|
+
*
|
895
|
+
* TODO(davidben): This data structure may as well be a ring buffer of fixed
|
896
|
+
* size. */
|
897
|
+
pqueue buffered_messages;
|
898
|
+
|
899
|
+
/* send_messages is a priority queue of outgoing handshake messages sent in
|
900
|
+
* the most recent handshake flight.
|
901
|
+
*
|
902
|
+
* TODO(davidben): This data structure may as well be a STACK_OF(T). */
|
903
|
+
pqueue sent_messages;
|
904
|
+
|
905
|
+
unsigned int mtu; /* max DTLS packet size */
|
906
|
+
|
907
|
+
struct hm_header_st w_msg_hdr;
|
908
|
+
|
909
|
+
/* num_timeouts is the number of times the retransmit timer has fired since
|
910
|
+
* the last time it was reset. */
|
911
|
+
unsigned int num_timeouts;
|
912
|
+
|
913
|
+
/* Indicates when the last handshake msg or heartbeat sent will
|
914
|
+
* timeout. */
|
915
|
+
struct timeval next_timeout;
|
916
|
+
|
917
|
+
/* Timeout duration */
|
918
|
+
unsigned short timeout_duration;
|
919
|
+
} DTLS1_STATE;
|
920
|
+
|
921
|
+
extern const SSL3_ENC_METHOD TLSv1_enc_data;
|
922
|
+
extern const SSL3_ENC_METHOD TLSv1_1_enc_data;
|
923
|
+
extern const SSL3_ENC_METHOD TLSv1_2_enc_data;
|
924
|
+
extern const SSL3_ENC_METHOD SSLv3_enc_data;
|
925
|
+
extern const SRTP_PROTECTION_PROFILE kSRTPProfiles[];
|
926
|
+
|
927
|
+
void ssl_clear_cipher_ctx(SSL *s);
|
928
|
+
int ssl_clear_bad_session(SSL *s);
|
929
|
+
CERT *ssl_cert_new(void);
|
930
|
+
CERT *ssl_cert_dup(CERT *cert);
|
931
|
+
void ssl_cert_clear_certs(CERT *c);
|
932
|
+
void ssl_cert_free(CERT *c);
|
933
|
+
int ssl_get_new_session(SSL *ssl, int is_server);
|
934
|
+
|
935
|
+
enum ssl_session_result_t {
|
936
|
+
ssl_session_success,
|
937
|
+
ssl_session_error,
|
938
|
+
ssl_session_retry,
|
939
|
+
};
|
940
|
+
|
941
|
+
/* ssl_get_prev_session looks up the previous session based on |ctx|. On
|
942
|
+
* success, it sets |*out_session| to the session or NULL if none was found. It
|
943
|
+
* sets |*out_send_ticket| to whether a ticket should be sent at the end of the
|
944
|
+
* handshake. If the session could not be looked up synchronously, it returns
|
945
|
+
* |ssl_session_retry| and should be called again. Otherwise, it returns
|
946
|
+
* |ssl_session_error|. */
|
947
|
+
enum ssl_session_result_t ssl_get_prev_session(
|
948
|
+
SSL *ssl, SSL_SESSION **out_session, int *out_send_ticket,
|
949
|
+
const struct ssl_early_callback_ctx *ctx);
|
950
|
+
|
951
|
+
STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s, const CBS *cbs);
|
952
|
+
void ssl_cipher_preference_list_free(
|
953
|
+
struct ssl_cipher_preference_list_st *cipher_list);
|
954
|
+
struct ssl_cipher_preference_list_st *ssl_get_cipher_preferences(SSL *s);
|
955
|
+
|
956
|
+
int ssl_cert_set0_chain(CERT *cert, STACK_OF(X509) *chain);
|
957
|
+
int ssl_cert_set1_chain(CERT *cert, STACK_OF(X509) *chain);
|
958
|
+
int ssl_cert_add0_chain_cert(CERT *cert, X509 *x509);
|
959
|
+
int ssl_cert_add1_chain_cert(CERT *cert, X509 *x509);
|
960
|
+
void ssl_cert_set_cert_cb(CERT *cert,
|
961
|
+
int (*cb)(SSL *ssl, void *arg), void *arg);
|
962
|
+
|
963
|
+
int ssl_verify_cert_chain(SSL *ssl, STACK_OF(X509) *cert_chain);
|
964
|
+
int ssl_add_cert_chain(SSL *s, unsigned long *l);
|
965
|
+
void ssl_update_cache(SSL *ssl, int mode);
|
966
|
+
|
967
|
+
/* ssl_get_compatible_server_ciphers determines the key exchange and
|
968
|
+
* authentication cipher suite masks compatible with the server configuration
|
969
|
+
* and current ClientHello parameters of |s|. It sets |*out_mask_k| to the key
|
970
|
+
* exchange mask and |*out_mask_a| to the authentication mask. */
|
971
|
+
void ssl_get_compatible_server_ciphers(SSL *s, uint32_t *out_mask_k,
|
972
|
+
uint32_t *out_mask_a);
|
973
|
+
|
974
|
+
STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *s);
|
975
|
+
int ssl_verify_alarm_type(long type);
|
976
|
+
|
977
|
+
/* ssl_fill_hello_random fills a client_random or server_random field of length
|
978
|
+
* |len|. It returns one on success and zero on failure. */
|
979
|
+
int ssl_fill_hello_random(uint8_t *out, size_t len, int is_server);
|
980
|
+
|
981
|
+
int ssl3_send_server_certificate(SSL *s);
|
982
|
+
int ssl3_send_new_session_ticket(SSL *s);
|
983
|
+
int ssl3_send_certificate_status(SSL *s);
|
984
|
+
int ssl3_get_finished(SSL *s, int state_a, int state_b);
|
985
|
+
int ssl3_send_change_cipher_spec(SSL *s, int state_a, int state_b);
|
986
|
+
int ssl3_prf(SSL *s, uint8_t *out, size_t out_len, const uint8_t *secret,
|
987
|
+
size_t secret_len, const char *label, size_t label_len,
|
988
|
+
const uint8_t *seed1, size_t seed1_len,
|
989
|
+
const uint8_t *seed2, size_t seed2_len);
|
990
|
+
void ssl3_cleanup_key_block(SSL *s);
|
991
|
+
int ssl3_do_write(SSL *s, int type);
|
992
|
+
int ssl3_send_alert(SSL *s, int level, int desc);
|
993
|
+
int ssl3_get_req_cert_type(SSL *s, uint8_t *p);
|
994
|
+
long ssl3_get_message(SSL *s, int header_state, int body_state, int msg_type,
|
995
|
+
long max, enum ssl_hash_message_t hash_message, int *ok);
|
996
|
+
|
997
|
+
/* ssl3_hash_current_message incorporates the current handshake message into the
|
998
|
+
* handshake hash. It returns one on success and zero on allocation failure. */
|
999
|
+
int ssl3_hash_current_message(SSL *s);
|
1000
|
+
|
1001
|
+
/* ssl3_cert_verify_hash writes the CertificateVerify hash into the bytes
|
1002
|
+
* pointed to by |out| and writes the number of bytes to |*out_len|. |out| must
|
1003
|
+
* have room for EVP_MAX_MD_SIZE bytes. For TLS 1.2 and up, |*out_md| is used
|
1004
|
+
* for the hash function, otherwise the hash function depends on |pkey_type|
|
1005
|
+
* and is written to |*out_md|. It returns one on success and zero on
|
1006
|
+
* failure. */
|
1007
|
+
int ssl3_cert_verify_hash(SSL *s, uint8_t *out, size_t *out_len,
|
1008
|
+
const EVP_MD **out_md, int pkey_type);
|
1009
|
+
|
1010
|
+
int ssl3_send_finished(SSL *s, int a, int b, const char *sender, int slen);
|
1011
|
+
int ssl3_supports_cipher(const SSL_CIPHER *cipher);
|
1012
|
+
int ssl3_dispatch_alert(SSL *s);
|
1013
|
+
int ssl3_read_app_data(SSL *ssl, uint8_t *buf, int len, int peek);
|
1014
|
+
int ssl3_read_change_cipher_spec(SSL *ssl);
|
1015
|
+
void ssl3_read_close_notify(SSL *ssl);
|
1016
|
+
int ssl3_read_bytes(SSL *s, int type, uint8_t *buf, int len, int peek);
|
1017
|
+
int ssl3_write_app_data(SSL *ssl, const void *buf, int len);
|
1018
|
+
int ssl3_write_bytes(SSL *s, int type, const void *buf, int len);
|
1019
|
+
int ssl3_final_finish_mac(SSL *s, const char *sender, int slen, uint8_t *p);
|
1020
|
+
int ssl3_cert_verify_mac(SSL *s, int md_nid, uint8_t *p);
|
1021
|
+
int ssl3_output_cert_chain(SSL *s);
|
1022
|
+
const SSL_CIPHER *ssl3_choose_cipher(
|
1023
|
+
SSL *ssl, STACK_OF(SSL_CIPHER) *clnt,
|
1024
|
+
struct ssl_cipher_preference_list_st *srvr);
|
1025
|
+
|
1026
|
+
int ssl3_new(SSL *s);
|
1027
|
+
void ssl3_free(SSL *s);
|
1028
|
+
int ssl3_accept(SSL *s);
|
1029
|
+
int ssl3_connect(SSL *s);
|
1030
|
+
|
1031
|
+
/* ssl3_record_sequence_update increments the sequence number in |seq|. It
|
1032
|
+
* returns one on success and zero on wraparound. */
|
1033
|
+
int ssl3_record_sequence_update(uint8_t *seq, size_t seq_len);
|
1034
|
+
|
1035
|
+
int ssl3_do_change_cipher_spec(SSL *ssl);
|
1036
|
+
|
1037
|
+
int ssl3_set_handshake_header(SSL *s, int htype, unsigned long len);
|
1038
|
+
int ssl3_handshake_write(SSL *s);
|
1039
|
+
|
1040
|
+
int dtls1_do_handshake_write(SSL *s, enum dtls1_use_epoch_t use_epoch);
|
1041
|
+
int dtls1_read_app_data(SSL *ssl, uint8_t *buf, int len, int peek);
|
1042
|
+
int dtls1_read_change_cipher_spec(SSL *ssl);
|
1043
|
+
void dtls1_read_close_notify(SSL *ssl);
|
1044
|
+
int dtls1_read_bytes(SSL *s, int type, uint8_t *buf, int len, int peek);
|
1045
|
+
void dtls1_set_message_header(SSL *s, uint8_t mt, unsigned long len,
|
1046
|
+
unsigned short seq_num, unsigned long frag_off,
|
1047
|
+
unsigned long frag_len);
|
1048
|
+
|
1049
|
+
int dtls1_write_app_data(SSL *s, const void *buf, int len);
|
1050
|
+
int dtls1_write_bytes(SSL *s, int type, const void *buf, int len,
|
1051
|
+
enum dtls1_use_epoch_t use_epoch);
|
1052
|
+
|
1053
|
+
int dtls1_send_change_cipher_spec(SSL *s, int a, int b);
|
1054
|
+
int dtls1_send_finished(SSL *s, int a, int b, const char *sender, int slen);
|
1055
|
+
int dtls1_read_failed(SSL *s, int code);
|
1056
|
+
int dtls1_buffer_message(SSL *s);
|
1057
|
+
int dtls1_retransmit_buffered_messages(SSL *s);
|
1058
|
+
void dtls1_clear_record_buffer(SSL *s);
|
1059
|
+
void dtls1_get_message_header(uint8_t *data, struct hm_header_st *msg_hdr);
|
1060
|
+
int dtls1_check_timeout_num(SSL *s);
|
1061
|
+
int dtls1_set_handshake_header(SSL *s, int type, unsigned long len);
|
1062
|
+
int dtls1_handshake_write(SSL *s);
|
1063
|
+
|
1064
|
+
int dtls1_supports_cipher(const SSL_CIPHER *cipher);
|
1065
|
+
void dtls1_start_timer(SSL *s);
|
1066
|
+
void dtls1_stop_timer(SSL *s);
|
1067
|
+
int dtls1_is_timer_expired(SSL *s);
|
1068
|
+
void dtls1_double_timeout(SSL *s);
|
1069
|
+
unsigned int dtls1_min_mtu(void);
|
1070
|
+
void dtls1_hm_fragment_free(hm_fragment *frag);
|
1071
|
+
|
1072
|
+
/* some client-only functions */
|
1073
|
+
int ssl3_send_client_hello(SSL *ssl);
|
1074
|
+
int ssl3_get_server_hello(SSL *s);
|
1075
|
+
int ssl3_get_certificate_request(SSL *s);
|
1076
|
+
int ssl3_get_new_session_ticket(SSL *s);
|
1077
|
+
int ssl3_get_cert_status(SSL *s);
|
1078
|
+
int ssl3_get_server_done(SSL *s);
|
1079
|
+
int ssl3_send_cert_verify(SSL *s);
|
1080
|
+
int ssl3_send_client_certificate(SSL *s);
|
1081
|
+
int ssl_do_client_cert_cb(SSL *s, X509 **px509, EVP_PKEY **ppkey);
|
1082
|
+
int ssl3_send_client_key_exchange(SSL *s);
|
1083
|
+
int ssl3_get_server_key_exchange(SSL *s);
|
1084
|
+
int ssl3_get_server_certificate(SSL *s);
|
1085
|
+
int ssl3_send_next_proto(SSL *ssl);
|
1086
|
+
int ssl3_send_channel_id(SSL *ssl);
|
1087
|
+
int ssl3_verify_server_cert(SSL *s);
|
1088
|
+
|
1089
|
+
/* some server-only functions */
|
1090
|
+
int ssl3_get_initial_bytes(SSL *s);
|
1091
|
+
int ssl3_get_v2_client_hello(SSL *s);
|
1092
|
+
int ssl3_get_client_hello(SSL *s);
|
1093
|
+
int ssl3_send_server_hello(SSL *ssl);
|
1094
|
+
int ssl3_send_server_key_exchange(SSL *s);
|
1095
|
+
int ssl3_send_certificate_request(SSL *s);
|
1096
|
+
int ssl3_send_server_done(SSL *s);
|
1097
|
+
int ssl3_get_client_certificate(SSL *s);
|
1098
|
+
int ssl3_get_client_key_exchange(SSL *s);
|
1099
|
+
int ssl3_get_cert_verify(SSL *s);
|
1100
|
+
int ssl3_get_next_proto(SSL *s);
|
1101
|
+
int ssl3_get_channel_id(SSL *s);
|
1102
|
+
|
1103
|
+
int dtls1_new(SSL *s);
|
1104
|
+
int dtls1_accept(SSL *s);
|
1105
|
+
int dtls1_connect(SSL *s);
|
1106
|
+
void dtls1_free(SSL *s);
|
1107
|
+
|
1108
|
+
long dtls1_get_message(SSL *s, int st1, int stn, int mt, long max,
|
1109
|
+
enum ssl_hash_message_t hash_message, int *ok);
|
1110
|
+
int dtls1_dispatch_alert(SSL *s);
|
1111
|
+
|
1112
|
+
int ssl_init_wbio_buffer(SSL *s, int push);
|
1113
|
+
void ssl_free_wbio_buffer(SSL *s);
|
1114
|
+
|
1115
|
+
/* tls1_prf computes the TLS PRF function for |s| as described in RFC 5246,
|
1116
|
+
* section 5 and RFC 2246 section 5. It writes |out_len| bytes to |out|, using
|
1117
|
+
* |secret| as the secret and |label| as the label. |seed1| and |seed2| are
|
1118
|
+
* concatenated to form the seed parameter. It returns one on success and zero
|
1119
|
+
* on failure. */
|
1120
|
+
int tls1_prf(SSL *s, uint8_t *out, size_t out_len, const uint8_t *secret,
|
1121
|
+
size_t secret_len, const char *label, size_t label_len,
|
1122
|
+
const uint8_t *seed1, size_t seed1_len,
|
1123
|
+
const uint8_t *seed2, size_t seed2_len);
|
1124
|
+
|
1125
|
+
int tls1_change_cipher_state(SSL *s, int which);
|
1126
|
+
int tls1_setup_key_block(SSL *s);
|
1127
|
+
int tls1_handshake_digest(SSL *s, uint8_t *out, size_t out_len);
|
1128
|
+
int tls1_final_finish_mac(SSL *s, const char *str, int slen, uint8_t *p);
|
1129
|
+
int tls1_cert_verify_mac(SSL *s, int md_nid, uint8_t *p);
|
1130
|
+
int tls1_generate_master_secret(SSL *s, uint8_t *out, const uint8_t *premaster,
|
1131
|
+
size_t premaster_len);
|
1132
|
+
int tls1_export_keying_material(SSL *s, uint8_t *out, size_t out_len,
|
1133
|
+
const char *label, size_t label_len,
|
1134
|
+
const uint8_t *context, size_t context_len,
|
1135
|
+
int use_context);
|
1136
|
+
int tls1_alert_code(int code);
|
1137
|
+
int ssl3_alert_code(int code);
|
1138
|
+
|
1139
|
+
char ssl_early_callback_init(struct ssl_early_callback_ctx *ctx);
|
1140
|
+
int tls1_ec_curve_id2nid(uint16_t curve_id);
|
1141
|
+
int tls1_ec_nid2curve_id(uint16_t *out_curve_id, int nid);
|
1142
|
+
|
1143
|
+
/* tls1_ec_curve_id2name returns a human-readable name for the
|
1144
|
+
* curve specified by the TLS curve id in |curve_id|. If the
|
1145
|
+
* curve is unknown, it returns NULL. */
|
1146
|
+
const char* tls1_ec_curve_id2name(uint16_t curve_id);
|
1147
|
+
|
1148
|
+
/* tls1_check_curve parses ECParameters out of |cbs|, modifying it. It
|
1149
|
+
* checks the curve is one of our preferences and writes the
|
1150
|
+
* NamedCurve value to |*out_curve_id|. It returns one on success and
|
1151
|
+
* zero on error. */
|
1152
|
+
int tls1_check_curve(SSL *s, CBS *cbs, uint16_t *out_curve_id);
|
1153
|
+
|
1154
|
+
/* tls1_get_shared_curve returns the NID of the first preferred shared curve
|
1155
|
+
* between client and server preferences. If none can be found, it returns
|
1156
|
+
* NID_undef. */
|
1157
|
+
int tls1_get_shared_curve(SSL *s);
|
1158
|
+
|
1159
|
+
/* tls1_set_curves converts the array of |ncurves| NIDs pointed to by |curves|
|
1160
|
+
* into a newly allocated array of TLS curve IDs. On success, the function
|
1161
|
+
* returns one and writes the array to |*out_curve_ids| and its size to
|
1162
|
+
* |*out_curve_ids_len|. Otherwise, it returns zero. */
|
1163
|
+
int tls1_set_curves(uint16_t **out_curve_ids, size_t *out_curve_ids_len,
|
1164
|
+
const int *curves, size_t ncurves);
|
1165
|
+
|
1166
|
+
/* tls1_check_ec_cert returns one if |x| is an ECC certificate with curve and
|
1167
|
+
* point format compatible with the client's preferences. Otherwise it returns
|
1168
|
+
* zero. */
|
1169
|
+
int tls1_check_ec_cert(SSL *s, X509 *x);
|
1170
|
+
|
1171
|
+
/* ssl_add_clienthello_tlsext writes ClientHello extensions to |out|. It
|
1172
|
+
* returns one on success and zero on failure. The |header_len| argument is the
|
1173
|
+
* length of the ClientHello written so far and is used to compute the padding
|
1174
|
+
* length. (It does not include the record header.) */
|
1175
|
+
int ssl_add_clienthello_tlsext(SSL *ssl, CBB *out, size_t header_len);
|
1176
|
+
|
1177
|
+
int ssl_add_serverhello_tlsext(SSL *ssl, CBB *out);
|
1178
|
+
int ssl_parse_clienthello_tlsext(SSL *s, CBS *cbs);
|
1179
|
+
int ssl_parse_serverhello_tlsext(SSL *s, CBS *cbs);
|
1180
|
+
|
1181
|
+
#define tlsext_tick_md EVP_sha256
|
1182
|
+
|
1183
|
+
/* tls_process_ticket processes the session ticket extension. On success, it
|
1184
|
+
* sets |*out_session| to the decrypted session or NULL if the ticket was
|
1185
|
+
* rejected. It sets |*out_send_ticket| to whether a new ticket should be sent
|
1186
|
+
* at the end of the handshake. It returns one on success and zero on fatal
|
1187
|
+
* error. */
|
1188
|
+
int tls_process_ticket(SSL *ssl, SSL_SESSION **out_session,
|
1189
|
+
int *out_send_ticket, const uint8_t *ticket,
|
1190
|
+
size_t ticket_len, const uint8_t *session_id,
|
1191
|
+
size_t session_id_len);
|
1192
|
+
|
1193
|
+
/* tls12_get_sigandhash assembles the SignatureAndHashAlgorithm corresponding to
|
1194
|
+
* |ssl|'s private key and |md|. The two-byte value is written to |p|. It
|
1195
|
+
* returns one on success and zero on failure. */
|
1196
|
+
int tls12_get_sigandhash(SSL *ssl, uint8_t *p, const EVP_MD *md);
|
1197
|
+
int tls12_get_sigid(int pkey_type);
|
1198
|
+
const EVP_MD *tls12_get_hash(uint8_t hash_alg);
|
1199
|
+
|
1200
|
+
/* tls1_channel_id_hash computes the hash to be signed by Channel ID and writes
|
1201
|
+
* it to |out|, which must contain at least |EVP_MAX_MD_SIZE| bytes. It returns
|
1202
|
+
* one on success and zero on failure. */
|
1203
|
+
int tls1_channel_id_hash(SSL *ssl, uint8_t *out, size_t *out_len);
|
1204
|
+
|
1205
|
+
int tls1_record_handshake_hashes_for_channel_id(SSL *s);
|
1206
|
+
|
1207
|
+
/* ssl_log_rsa_client_key_exchange logs |premaster|, if logging is enabled for
|
1208
|
+
* |ssl|. It returns one on success and zero on failure. The entry is identified
|
1209
|
+
* by the first 8 bytes of |encrypted_premaster|. */
|
1210
|
+
int ssl_log_rsa_client_key_exchange(const SSL *ssl,
|
1211
|
+
const uint8_t *encrypted_premaster,
|
1212
|
+
size_t encrypted_premaster_len,
|
1213
|
+
const uint8_t *premaster,
|
1214
|
+
size_t premaster_len);
|
1215
|
+
|
1216
|
+
/* ssl_log_master_secret logs |master|, if logging is enabled for |ssl|. It
|
1217
|
+
* returns one on success and zero on failure. The entry is identified by
|
1218
|
+
* |client_random|. */
|
1219
|
+
int ssl_log_master_secret(const SSL *ssl, const uint8_t *client_random,
|
1220
|
+
size_t client_random_len, const uint8_t *master,
|
1221
|
+
size_t master_len);
|
1222
|
+
|
1223
|
+
/* ssl3_can_false_start returns one if |s| is allowed to False Start and zero
|
1224
|
+
* otherwise. */
|
1225
|
+
int ssl3_can_false_start(const SSL *s);
|
1226
|
+
|
1227
|
+
/* ssl3_get_enc_method returns the SSL3_ENC_METHOD corresponding to
|
1228
|
+
* |version|. */
|
1229
|
+
const SSL3_ENC_METHOD *ssl3_get_enc_method(uint16_t version);
|
1230
|
+
|
1231
|
+
/* ssl3_get_max_server_version returns the maximum SSL/TLS version number
|
1232
|
+
* supported by |s| as a server, or zero if all versions are disabled. */
|
1233
|
+
uint16_t ssl3_get_max_server_version(const SSL *s);
|
1234
|
+
|
1235
|
+
/* ssl3_get_mutual_version selects the protocol version on |s| for a client
|
1236
|
+
* which advertises |client_version|. If no suitable version exists, it returns
|
1237
|
+
* zero. */
|
1238
|
+
uint16_t ssl3_get_mutual_version(SSL *s, uint16_t client_version);
|
1239
|
+
|
1240
|
+
/* ssl3_get_max_client_version returns the maximum protocol version configured
|
1241
|
+
* for the client. It is guaranteed that the set of allowed versions at or below
|
1242
|
+
* this maximum version is contiguous. If all versions are disabled, it returns
|
1243
|
+
* zero. */
|
1244
|
+
uint16_t ssl3_get_max_client_version(SSL *s);
|
1245
|
+
|
1246
|
+
/* ssl3_is_version_enabled returns one if |version| is an enabled protocol
|
1247
|
+
* version for |s| and zero otherwise. */
|
1248
|
+
int ssl3_is_version_enabled(SSL *s, uint16_t version);
|
1249
|
+
|
1250
|
+
/* ssl3_version_from_wire maps |wire_version| to a protocol version. For
|
1251
|
+
* SSLv3/TLS, the version is returned as-is. For DTLS, the corresponding TLS
|
1252
|
+
* version is used. Note that this mapping is not injective but preserves
|
1253
|
+
* comparisons.
|
1254
|
+
*
|
1255
|
+
* TODO(davidben): To normalize some DTLS-specific code, move away from using
|
1256
|
+
* the wire version except at API boundaries. */
|
1257
|
+
uint16_t ssl3_version_from_wire(SSL *s, uint16_t wire_version);
|
1258
|
+
|
1259
|
+
uint32_t ssl_get_algorithm_prf(SSL *s);
|
1260
|
+
int tls1_parse_peer_sigalgs(SSL *s, const CBS *sigalgs);
|
1261
|
+
|
1262
|
+
/* tls1_choose_signing_digest returns a digest for use with |ssl|'s private key
|
1263
|
+
* based on the peer's preferences the digests supported. */
|
1264
|
+
const EVP_MD *tls1_choose_signing_digest(SSL *ssl);
|
1265
|
+
|
1266
|
+
size_t tls12_get_psigalgs(SSL *s, const uint8_t **psigs);
|
1267
|
+
|
1268
|
+
/* tls12_check_peer_sigalg checks that |hash| and |signature| are consistent
|
1269
|
+
* with |pkey| and |ssl|'s sent, supported signature algorithms and, if so,
|
1270
|
+
* writes the relevant digest into |*out_md| and returns 1. Otherwise it
|
1271
|
+
* returns 0 and writes an alert into |*out_alert|. */
|
1272
|
+
int tls12_check_peer_sigalg(SSL *ssl, const EVP_MD **out_md, int *out_alert,
|
1273
|
+
uint8_t hash, uint8_t signature, EVP_PKEY *pkey);
|
1274
|
+
void ssl_set_client_disabled(SSL *s);
|
1275
|
+
|
1276
|
+
#endif /* OPENSSL_HEADER_SSL_INTERNAL_H */
|