Branch Coverage

blib/lib/IO/Socket/SSL.pm
Criterion Covered Total %
branch 716 1228 58.3


line true false branch
28 0 80 unless do { local $SIG{'__DIE__'}; eval { do { require WeakRef; "WeakRef"->import("weaken"); 1 } } unless eval { do { require Scalar::Util; "Scalar::Util"->import("weaken"); 1 } } }
31 0 80 unless eval { do { require Scalar::Util; "Scalar::Util"->import("weaken"); 1 } }
94 80 0 defined &Net::SSLeay::CTX_set_tmp_ecdh && ($openssl_version != 268439631 || length pack('P', 0) == 4) ? :
0 80 defined &Net::SSLeay::CTX_set_ecdh_auto ? :
0 80 $openssl_version >= 269484047 ? :
103 0 80 defined &Net::SSLeay::CTX_set1_curves_list ? :
0 80 defined &Net::SSLeay::CTX_set1_groups_list ? :
119 0 80 if (defined &Net::SSLeay::SESSION_up_ref)
123 0 0 if ($session_upref and defined &Net::SSLeay::CTX_sess_set_new_cb and defined &Net::SSLeay::CTX_sess_set_remove_cb)
132 0 80 if (my $c = defined &Net::SSLeay::CTX_get0_param && eval { do { Net::SSLeay::X509_V_FLAG_PARTIAL_CHAIN() } })
141 80 0 unless (defined &Net::SSLeay::clear_mode)
149 0 80 if ($openssl_version >= 269488128)
157 0 0 if ($on) { }
164 80 0 if ($openssl_version >= 268435456)
231 79 80 unless &Net::SSLeay::library_init()
241 80 0 $can_ecdh eq 'tmp_ecdh' ? :
0 80 $can_ecdh eq 'can_auto' ? :
0 80 $can_ecdh eq 'auto' ? :
256 0 80 unless $dh
288 0 80 if not do { local $SIG{'__DIE__'}; local $SIG{'__WARN__'}; eval { do { &dualvar(0, ""); 1 } } }
377 80 0 if ($ip6)
380 79 1 if (eval { do { require IO::Socket::IP; 'IO::Socket::IP'->VERSION(0.31) } }) { }
0 1 elsif (eval { do { require IO::Socket::INET6; 'IO::Socket::INET6'->VERSION(2.62) } }) { }
402 1 79 unless ($ip6)
406 0 1 unless (defined $ip6)
421 0 0 unless $DEBUG
423 0 0 if ($sub =~ /^IO::Socket::SSL::(?:error|(_internal_error))$/) { }
424 0 0 if $1
429 0 0 if length $file > 20
430 0 0 if @_
493 3 164 if (@_)
495 0 3 if (@_ > 1) { }
3 0 elsif (my $path = shift()) { }
505 122 45 if defined $ca_detected
510 0 0 &Net::SSLeay::SSLeay_version(4) =~ /^OPENSSLDIR: "(.+)"$/ ? :
45 0 &Net::SSLeay::SSLeay_version(5) =~ /^OPENSSLDIR: "(.+)"$/ ? :
518 45 0 if (opendir my $dh, $dir)
520 0 45 unless open my $fh, "<", "$dir/$f"
522 0 45 unless $line =~ /^-+BEGIN (X509 |TRUSTED |)CERTIFICATE-/
530 0 45 if (open my $fh, "<", $file)
532 0 0 unless $line =~ /^-+BEGIN (X509 |TRUSTED |)CERTIFICATE-/
538 0 0 if not %default_ca and do { local $SIG{'__DIE__'}; eval { do { require Mozilla::CA; 1 } } }
557 0 1 if (/^inet4$/i) { }
0 1 elsif (/^inet6$/i) { }
1 0 elsif (/^:?debug(\d+)/) { }
563 0 0 unless (UNIVERSAL::isa($class, "IO::Socket::INET6") or UNIVERSAL::isa($class, "IO::Socket::IP"))
623 0 116 unless $self
635 2 114 if defined $blocking
637 4 112 unless $self->configure_SSL($arg_hash)
639 68 44 if ($arg_hash->{$family_key} ||= $arg_hash->{'Domain'} || $arg_hash->{'Family'})
645 68 0 if $IOCLASS eq "IO::Socket::IP" and not defined $arg_hash->{'GetAddrInfoFlags'}
647 6 106 unless $self->SUPER::configure($arg_hash)
650 2 104 if defined $blocking and not $blocking
659 196 81 unless (defined $is_server)
664 0 277 if $FILTER_SSL_ARGS
671 4 273 unless do { *$self }->{'_SSL_ctx'} = "IO::Socket::SSL::SSL_Context"->new($arg_hash)
681 71 39 if ($err == $Net_SSLeay_ERROR_WANT_READ) { }
2 37 elsif ($err == $Net_SSLeay_ERROR_WANT_WRITE) { }
689 73 0 if ref $self
698 0 74 if do { *$self }->{'_SSL_opened'}
700 74 0 unless (do { *$self }->{'_SSL_opening'})
705 0 74 if $DEBUG >= 2
706 0 74 unless $self->SUPER::connect(@_)
707 0 74 if $DEBUG >= 2
716 12 62 if defined $sh and not $sh
724 2 180 @_ > 1 ? :
725 0 182 if do { *$self }->{'_SSL_opened'}
728 178 4 unless (do { *$self }->{'_SSL_opening'})
730 0 178 if $DEBUG >= 2
735 0 178 unless defined $fileno
741 0 178 if $use_threads
745 12 166 if ($ctx->{'session_cache'})
750 6 0 $port ? :
754 0 178 unless &Net::SSLeay::set_fd($ssl, $fileno)
757 0 178 if $DEBUG >= 2 or do { *$self }->{'_SSL_msg_callback'}
759 178 0 if ($can_client_sni) { }
0 0 elsif ($arg_hash->{'SSL_hostname'}) { }
761 24 154 if (exists $arg_hash->{'SSL_hostname'}) { }
62 92 elsif ($host = $arg_hash->{'PeerAddr'} || $arg_hash->{'PeerHost'}) { }
769 62 0 if not $host =~ /[a-z_]/i or $host =~ /:/
773 24 154 if ($host) { }
774 0 24 if $DEBUG >= 2
777 0 154 if $DEBUG >= 2
783 0 0 if $DEBUG >= 2
786 101 75 unless $arg_hash->{'PeerAddr'} or $arg_hash->{'PeerHost'}
787 103 75 if ($ctx->{'verify_name_ref'})
791 47 56 unless (defined $host)
792 47 0 if ($host = $arg_hash->{'PeerAddr'} || $arg_hash->{'PeerHost'})
806 2 176 if ($ocsp & 1) { }
0 176 elsif (not $can_ocsp_staple) { }
99 77 elsif ($ocsp & 18) { }
809 0 0 if $ocsp & 2
815 0 99 if $DEBUG >= 2
818 8 170 if ($ctx->{'session_cache'} and my $session = $ctx->{'session_cache'}->get_session($arg_hash->{'SSL_session_key'}))
830 2 180 exists $args->{'Timeout'} ? :
831 23 159 if (defined $timeout and $timeout > 0 and $self->blocking(0)) { }
832 0 23 if $DEBUG >= 2
838 0 159 if $auto_retry
845 0 229 if $DEBUG >= 3
848 0 229 if $DEBUG >= 3
849 84 145 if ($rv < 0) { }
0 145 elsif ($rv == 0) { }
850 32 52 if (my $err = $self->_skip_rw_error($ssl, $rv))
854 0 32 if $DEBUG >= 1
858 0 52 if $DEBUG >= 2
861 4 48 unless defined $timeout
865 48 0 if ($timeout > 0) { }
868 0 48 if $DEBUG >= 2
869 0 0 $IO::Socket::SSL::SSL_ERROR == 42798824 ? :
48 0 $IO::Socket::SSL::SSL_ERROR == 42758544 ? :
874 0 0 if $DEBUG >= 2
877 1 47 unless ($rv)
878 0 1 if $DEBUG >= 2
888 0 47 if $DEBUG >= 2
896 0 0 if $DEBUG >= 2
903 0 145 if $DEBUG >= 2
907 15 130 if (defined $timeout)
914 2 143 if (my $ocsp_result = do { *$self }->{'_SSL_ocsp_verify'}) { }
0 143 elsif ($ctx->{'ocsp_mode'} & 2) { }
916 2 0 if ($ocsp_result->[0] > 0) { }
0 0 elsif ($ocsp_result->[0] < 0) { }
917 0 2 if $DEBUG >= 3
923 0 0 if $DEBUG >= 3
927 0 0 if $DEBUG >= 3
937 12 133 if (not %sess_cb and $ctx->{'session_cache'} and my $session = &Net::SSLeay::get1_session($ssl))
960 0 102 if ($af == 10) { }
980 58 0 unless ($socket)
982 0 58 if $DEBUG >= 2
984 0 58 if $DEBUG >= 2
988 16 42 if (defined $sh and not $sh)
994 0 16 if $DEBUG >= 2
995 0 16 wantarray ? :
999 3 39 unless $self->accept_SSL($socket)
1000 0 39 if $DEBUG >= 2
1002 2 37 wantarray ? :
1007 42 80 @_ && UNIVERSAL::isa($_[0], 'IO::Handle') ? :
1008 9 113 @_ > 1 ? :
1011 119 3 unless (do { *$self }->{'_SSL_opening'})
1012 0 119 if $DEBUG >= 2
1014 42 77 if ($socket != $self)
1023 0 119 unless defined $fileno
1029 0 119 if $use_threads
1033 0 119 unless &Net::SSLeay::set_fd($ssl, $fileno)
1036 0 119 if $DEBUG >= 2 or do { *$self }->{'_SSL_msg_callback'}
1046 9 113 exists $args->{'Timeout'} ? :
1047 14 108 if (defined $timeout and $timeout > 0 and $socket->blocking(0)) { }
1053 0 108 if $auto_retry
1062 0 136 if $DEBUG >= 3
1063 21 115 if ($rv < 0) { }
13 102 elsif ($rv == 0) { }
1064 3 18 if (my $err = $socket->_skip_rw_error($ssl, $rv))
1073 3 15 unless defined $timeout
1077 15 0 if ($timeout > 0) { }
1080 0 0 $IO::Socket::SSL::SSL_ERROR == 42798824 ? :
15 0 $IO::Socket::SSL::SSL_ERROR == 42758544 ? :
1087 1 14 unless ($rv)
1110 0 102 if $DEBUG >= 2
1114 12 90 if (defined $timeout)
1128 0 0 if $DEBUG >= 2
1130 0 0 if (my $cb = do { *$self }->{'_SSL_msg_callback'})
1141 0 0 if (@_)
1142 0 0 if ($_[0]) { }
1144 0 0 unless $ssleay_set_msg_callback
1154 0 0 if ($ssleay_set_msg_callback and my $ssl = do { *$self }->{'_SSL_object'})
1156 0 0 $DEBUG >= 2 || do { *$self }->{'_SSL_msg_callback'} ? :
1179 1 0 defined $rwerr ? :
0 1 if (my $err = $self->_skip_rw_error($ssl, defined $rwerr ? $rwerr : -1))
1182 0 0 if (not $! and $err == $Net_SSLeay_ERROR_SSL || $err == $Net_SSLeay_ERROR_SYSCALL)
1193 6088 28 unless defined $$buffer
1195 1 6115 if ($offset > length $$buffer)
1205 5 1 $self->blocking ? :
6 0 if do { *$self }->{'_SSL_object'}
1217 6110 0 if do { *$self }->{'_SSL_object'}
1227 1 5 if do { *$self }->{'_SSL_object'}
1232 0 5 unless defined CORE::recv($self, my $buf, $_[1], 2)
1233 0 5 $_[2] ? :
1247 0 7229 if $offset > $buf_len
1249 0 7229 if $offset == $buf_len
1253 59 7170 if ($write_all) { }
1254 0 59 $length < $buf_len - $offset ? :
1257 0 59 if not $written and $errs
1261 4 7166 if $written <= 0
1263 4 7225 unless (defined $written)
1264 2 2 if (my $err = $self->_skip_rw_error($ssl, -1))
1266 2 0 if $err == $Net_SSLeay_ERROR_SYSCALL
1279 60 0 if do { *$self }->{'_SSL_object'}
1290 7169 0 if do { *$self }->{'_SSL_object'}
1309 2 0 if $self->read($buffer, 1, 0)
1314 0 83 unless do { *$self }->{'_SSL_object'}
1316 7 76 if (not defined $/ or wantarray)
1322 0 14 if (not defined $rv) { }
7 7 elsif (not $rv) { }
1323 0 0 if $! == 4
1324 0 0 if $! == 11 or $! == 11
1331 2 5 if (not defined $/) { }
1 4 elsif (ref $/) { }
1 3 elsif ($/ eq '') { }
1335 0 1 unless $size > 0
1345 1 75 if (ref $/)
1348 0 1 unless $size > 0
1352 0 1 if (not defined $rv) { }
0 1 elsif (not $rv) { }
1353 0 0 if $! == 4
1354 0 0 if $! == 11 or $! == 11
1363 1 74 $/ eq '' ? :
1368 0 75 unless my $ssl = $self->_get_ssl_object
1373 21 58 if (not defined $poke or $poke eq "")
1374 1 20 if $! == 4
1381 58 20 if ($pending and (my $pb = &Net::SSLeay::peek($ssl, $pending)) ne '') { }
1385 19 1 $buf eq '' ? :
1387 58 0 unless ($eod)
1389 3 55 if ($pos < 0) { }
1396 55 3 if ($eod)
1397 1 54 if ($delim1 ne "")
1408 58 0 if ($self->sysread(my $p, $skip, 0))
1412 0 0 unless $! == 4
1415 55 0 if ($eod and $delim1 eq '' || $eod < length $buf)
1425 0 248 ref $_[0] eq 'HASH' ? :
1427 0 248 unless $self->stop_SSL("SSL_fast_shutdown", 1, %$close_args, "_SSL_ioclass_downgrade", 0)
1433 51 197 unless ($close_args->{'_SSL_in_DESTROY'})
1448 0 297 ref $_[0] eq 'HASH' ? :
1449 1 296 unless do { *$self }->{'_SSL_opened'}
1451 295 2 if (my $ssl = do { *$self }->{'_SSL_object'})
1452 0 295 if (delete do { *$self }->{'_SSL_opening'}) { }
97 198 elsif (not $stop_args->{'SSL_no_shutdown'}) { }
1460 0 85 exists $stop_args->{'Timeout'} ? :
12 85 !$self->blocking ? :
1461 3 94 if ($timeout)
1467 49 10 if ($status & 1 and $status & 2 || $stop_args->{'SSL_fast_shutdown'})
1474 48 59 if ((do { *$self }->{'_SSL_opened'} || 0) <= 0)
1484 0 59 if ($rv < 0)
1486 0 0 unless ($timeout)
1487 0 0 if (my $err = $self->_skip_rw_error($ssl, $rv))
1489 0 0 if $err == $Net_SSLeay_ERROR_SYSCALL
1499 0 0 if $wait <= 0
1502 0 0 if ($err == $Net_SSLeay_ERROR_WANT_READ) { }
0 0 elsif ($err == $Net_SSLeay_ERROR_WANT_READ) { }
1512 10 49 if $rv > 0
1514 3 94 if $timeout
1520 37 258 if (my $cert = delete do { *$self }->{'_SSL_certificate'})
1530 3 294 if ($stop_args->{'SSL_ctx_free'})
1532 3 0 if $ctx
1536 100 197 unless ($stop_args->{'_SSL_in_DESTROY'})
1539 49 51 if ($downgrade or not defined $downgrade)
1541 42 7 if (my $orig_class = delete do { *$self }->{'_SSL_ioclass_upgraded'})
1546 42 0 if @sslkeys
1557 7231 114 defined $fn ? :
1589 0 162 unless ref $socket
1590 1 161 @_ == 1 ? :
1591 11 151 exists $arg_hash->{'Timeout'} ? :
1593 0 162 unless ($original_class)
1594 0 0 unless $socket = ($original_class = $IO::Socket::SSL::ISA[0])->new_from_fd($socket, "<+")
1598 162 0 UNIVERSAL::can($socket, 'fileno') ? :
1600 1 161 unless defined $original_fileno
1604 0 161 unless $socket->configure_SSL($arg_hash)
1607 160 1 if $class ne $original_class
1611 157 4 if (not defined $start_handshake or $start_handshake) { }
1613 0 157 if $DEBUG >= 2
1616 57 100 do { *$socket }->{'_SSL_arguments'}{'SSL_server'} ? :
1618 116 41 if ($result) { }
1619 0 116 unless $was_blocking
1623 41 0 if ($original_class)
1625 0 41 if not $was_blocking and $socket->can("blocking")
1631 0 4 if $DEBUG >= 2
1640 1 0 if (length $_[0] < 4)
1642 1 0 unless length $mode
1665 0 6 if @chain and not $self->peer_certificate
1666 0 6 if (do { *$self }->{'_SSL_arguments'}{'SSL_server'})
1670 0 0 if (my $peer = &Net::SSLeay::get_peer_certificate($ssl))
1703 0 85 unless my $ssl = $self->_get_ssl_object
1706 0 0 if $reload and do { *$self }->{'_SSL_certificate'}
1708 0 85 unless my $cert = (do { *$self }->{'_SSL_certificate'} ||= &Net::SSLeay::get_peer_certificate($ssl))
1711 14 71 if ($field) { }
1712 0 14 unless my $sub = $dispatcher{$field}
1725 4 2 if ($field) { }
1726 0 4 unless my $sub = $dispatcher{$field}
1832 209 0 unless (ref $scheme)
1833 0 209 if $DEBUG >= 3
1837 0 209 unless %$scheme
1843 0 209 if $DEBUG >= 3
1845 0 209 if (my $sub = $scheme->{'callback'})
1853 12 197 if ($identity =~ /:/) { }
49 148 elsif (my(@ip) = $identity =~ /^(\d+)(?:\.(\d+)\.(\d+)\.(\d+)|[\d\.]*)$/) { }
1855 3 9 if $identity =~ /[^\da-fA-F:\.]/
1856 0 9 unless $ipn = inet_pton(10, $identity)
1859 190 6 if defined $_
3 46 if 4 != @ip or 4 != grep({$_ < 256 if defined $_;} @ip)
1863 5 143 if ($identity =~ /[^a-zA-Z0-9_.\-]/)
1864 0 5 if $identity =~ /\0/
1865 0 5 unless $identity = idn_to_ascii($identity)
1867 2 3 if $identity =~ /[^a-zA-Z0-9_.\-]/
1876 1 312 if $name eq ""
1888 116 196 if ($wtyp eq 'anywhere' and $name =~ /^([a-zA-Z0-9_\-]*)\*(.+)/) { }
26 170 elsif ($wtyp =~ /^(?:full_label|leftmost)$/ and $name =~ /^\*(\..+)$/) { }
1889 4 112 if $1 ne "" and substr($identity, 0, 4) eq "xn--"
1897 56 82 if ($identity =~ /$pattern/)
1898 56 0 unless defined $publicsuffix
1900 0 56 if $publicsuffix eq ""
1903 56 0 $tld ? :
41 15 if @labels > ($tld ? 0 + @$tld : 1)
1912 42 352 if ($ipn and $type == GEN_IPADD()) { }
225 207 elsif (not $ipn and $type == GEN_DNS()) { }
1915 35 7 if $ipn eq $name
1920 44 181 if &$check_name($name, $identity, $scheme->{'wildcards_in_alt'}, $publicsuffix)
1925 108 14 if ($scheme->{'check_cn'} eq "always" or $scheme->{'check_cn'} eq "when_only" and not $alt_dnsNames)
1927 88 20 if (not $ipn) { }
20 0 elsif ($scheme->{'ip_in_cn'}) { }
1928 44 44 if &$check_name($commonName, $identity, $scheme->{'wildcards_in_cn'}, $publicsuffix)
1931 5 15 if ($identity eq $commonName)
1934 0 0 $scheme->{'ip_in_cn'} == 6 ? :
5 0 $scheme->{'ip_in_cn'} == 4 ? :
3 2 if $scheme->{'ip_in_cn'} == 4 ? length $ipn == 4 : ($scheme->{'ip_in_cn'} == 6 ? length $ipn == 16 : 1)
1955 0 8 unless my $ssl = $self->_get_ssl_object
1963 8 14 $key_only ? :
1971 0 22 unless my $fp = get_fingerprint_bin($self, $algo, $cert, $key_only)
1972 8 14 $key_only ? :
1982 0 28 unless my $version = &Net::SSLeay::version($ssl)
1984 0 0 $version == 65279 ? :
0 0 $version == 2 ? :
0 0 $version == 768 ? :
6 0 $version == 769 ? :
6 6 $version == 770 ? :
16 12 $version == 771 ? :
0 28 $version == 772 ? :
2015 2 2 $ctx->{'ocsp_mode'} & 8 ? :
0 4 @_ ? :
2024 49 0 $oe ? :
2032 1 47 if (defined $error_trap and ref $error_trap eq 'CODE') { }
39 8 elsif (do { *$self }->{'_SSL_ioclass_upgraded'} or do { *$self }->{'_SSL_arguments'}{'SSL_keepSocketOnError'}) { }
2037 0 39 if $DEBUG >= 3
2043 48 0 if $saved_error
2069 22 61 if not ref $self and $CURRENT_SSL_OBJECT
2070 78 5 if (ref $self) { }
2072 50 28 if (not $oe or $oe->[1] <= $severity) { }
2075 0 50 if $DEBUG
2077 0 28 if $DEBUG
2081 0 5 if $DEBUG
2092 0 49 if $DEBUG >= 2
2094 49 3 if @err
2095 52 0 if $error
2121 0 289 unless my $self = shift()
2122 197 92 if (my $ssl = do { *$self }->{'_SSL_object'})
2124 197 0 if (not $use_threads or delete $CREATED_IN_THIS_THREAD{$ssl})
2142 0 2 ref $_[0] eq 'HASH' ? :
2194 0 0 if (ref $sub) { }
0 0 elsif ($sub eq 'use_defaults') { }
2200 0 0 $is_server ? :
2210 0 2 unless $can_npn
2217 0 2 unless $can_alpn
2239 1 0 if wantarray
2310 277 7 ref $_[0] eq 'HASH' ? :
2313 103 181 $is_server ? :
2316 6 278 if ($defaults{'SSL_reuse_ctx'})
2319 0 6 if grep {/^SSL_(?!verifycn_name|hostname)$/;} keys %$arg_hash
2321 284 0 if %defaults
2323 26 258 if (my $ctx = $arg_hash->{'SSL_reuse_ctx'})
2324 24 2 if ($ctx->isa('IO::Socket::SSL::SSL_Context') and $ctx->{'context'}) { }
2 0 elsif ($ctx = do { *$ctx }->{'_SSL_ctx'}) { }
2336 6 159 if (not $is_server || defined $arg_hash->{'SSL_use_cert'} and grep {$arg_hash->{$_};} "SSL_cert", "SSL_cert_file" and grep {$arg_hash->{$_};} "SSL_key", "SSL_key_file")
2344 32 226 if ($arg_hash->{'SSL_ca'}) { }
0 226 elsif ($arg_hash->{'SSL_ca_path'}) { }
61 165 elsif ($arg_hash->{'SSL_ca_file'}) { }
2354 248 10 unless defined $arg_hash->{'SSL_use_cert'}
2366 0 2064 if defined $arg_hash->{$_} and $arg_hash->{$_} eq ""
2369 380 136 unless defined(my $file = $arg_hash->{$_})
2370 12 124 ref $file eq 'HASH' ? :
2371 0 168 unless open my $fh, "<", $f
2376 93 165 if ($verify_mode != $Net_SSLeay_VERIFY_NONE) { }
0 165 elsif ($verify_mode ne '0') { }
2389 90 0 if (not $is_server and $verify_mode & 1 and !$vcn_scheme || $vcn_scheme ne 'none')
2399 4 197 if $vcb
2400 14 187 unless $ok
2402 97 90 if $depth != 0
2405 0 90 unless ($host)
2406 0 0 if ($vcn_scheme)
2421 22 68 unless ($rv)
2429 91 167 if ($is_server)
2430 0 91 if ($arg_hash->{'SSL_ticket_keycb'} and not $can_tckt_keycb)
2441 0 1180 unless m[^(!?)(?:(SSL(?:v2|v3|v23|v2/3))|(TLSv1(?:_?[123])?))$]i
2445 922 258 if ($not) { }
2448 0 258 if $ver and $v ne $ver
2456 4 248 $ver eq 'TLSv1_2' ? :
2 252 $ver eq 'TLSv1_1' ? :
2 254 $ver eq 'TLSv1' ? :
1 256 $ver eq 'SSLv3' ? :
0 257 $ver eq 'SSLv2' ? :
1 257 $ver eq 'TLSv1_3' ? :
2 256 unless my $ctx_new_sub = $ver eq "TLSv1_3" ? $CTX_tlsv1_3_new : UNIVERSAL::can("Net::SSLeay", $ver eq "SSLv2" ? "CTX_v2_new" : ($ver eq "SSLv3" ? "CTX_v3_new" : ($ver eq "TLSv1" ? "CTX_tlsv1_new" : ($ver eq "TLSv1_1" ? "CTX_tlsv1_1_new" : ($ver eq "TLSv1_2" ? "CTX_tlsv1_2_new" : "CTX_new")))))
2470 91 165 if ($is_server)
2473 187 177 unless my $val = $arg_hash->{$opt}
2474 12 165 if (ref $val eq "HASH")
2481 2 20 $host =~ /%/ ? :
2484 250 6 unless %ctx
2489 2 270 if ($host =~ /^([^%]*)%/)
2490 0 2 unless $ctx = $ctx{$1}
2492 0 2 if (my(@k) = grep({not /^SSL_(?:cert|key)(?:_file)?$/;} keys %$arg_hash))
2497 0 2 unless $can_multi_cert
2503 0 270 unless $ctx = &$ctx_new_sub()
2505 0 270 if $use_threads
2509 101 169 if $arg_hash->{'SSL_honor_cipher_order'}
2511 21 249 if ($ver eq "SSLv23" and not $ssl_op & $SSL_OP_NO{'SSLv3'})
2521 0 270 if $check_partial_chain
2527 9 261 if ($arg_hash->{'SSL_server'} and my $id = $arg_hash->{'SSL_session_id_context'} || $arg_hash->{'SSL_verify_mode'} & 1 && "$ctx")
2540 0 270 $arg_hash->{'SSL_mode_release_buffers'} ? :
2543 3 267 if (my $proto_list = $arg_hash->{'SSL_npn_protocols'})
2544 0 3 unless $can_npn
2546 2 1 if ($arg_hash->{'SSL_server'}) { }
2556 3 267 if (my $proto_list = $arg_hash->{'SSL_alpn_protocols'})
2557 0 3 unless $can_alpn
2559 2 1 if ($arg_hash->{'SSL_server'}) { }
2566 0 270 if ($arg_hash->{'SSL_ticket_keycb'})
2568 0 0 ref $cb eq 'CODE' ? :
2575 107 163 if ($arg_hash->{'SSL_ca'} or defined $arg_hash->{'SSL_ca_file'} or defined $arg_hash->{'SSL_ca_path'}) { }
163 0 elsif (my(%ca) = IO::Socket::SSL::default_ca()) { }
2579 0 107 if ref $file eq "SCALAR" and not $$file
2581 0 107 if ref $dir eq "SCALAR" and not $$dir
2582 32 75 if ($arg_hash->{'SSL_ca'})
2585 0 33 unless &Net::SSLeay::X509_STORE_add_cert($store, $_)
2590 0 107 if ref $dir
2591 0 107 if ($file || $dir and not &Net::SSLeay::CTX_load_verify_locations($ctx, scalar($file || ''), scalar($dir || '')))
2593 0 0 if $verify_mode != $Net_SSLeay_VERIFY_NONE
2600 0 163 if ref $dir
2601 0 163 if (not &Net::SSLeay::CTX_load_verify_locations($ctx, scalar($ca{'SSL_ca_file'} || ''), scalar($dir || '')) and $verify_mode != $Net_SSLeay_VERIFY_NONE)
2609 9 261 if ($is_server and $verify_mode & $Net_SSLeay_VERIFY_PEER)
2610 0 9 if ($arg_hash->{'SSL_client_ca'})
2612 0 0 unless &Net::SSLeay::CTX_add_client_CA($ctx, $_)
2617 0 9 if ($arg_hash->{'SSL_client_ca_file'})
2619 0 0 unless my $list = &Net::SSLeay::load_client_CA_file($arg_hash->{'SSL_client_ca_file'})
2627 0 270 if ($arg_hash->{'SSL_check_crl'})
2629 0 0 if ($arg_hash->{'SSL_crl_file'})
2633 0 0 if ($crl) { }
2643 270 0 if $X509_STORE_flags
2648 12 258 if $arg_hash->{'SSL_passwd_cb'}
2652 31 241 if (my $x509 = $arg_hash->{'SSL_cert'}) { }
82 159 elsif (my $f = $arg_hash->{'SSL_cert_file'}) { }
2656 1 30 ref $x509 eq 'ARRAY' ? :
2658 0 31 unless &Net::SSLeay::CTX_use_certificate($ctx, $cert)
2661 0 1 unless &Net::SSLeay::CTX_add_extra_chain_cert($ctx, $ca)
2668 79 3 if (&Net::SSLeay::CTX_use_certificate_chain_file($ctx, $f)) { }
1 2 elsif (do { push @err, ['PEM', _errstack()]; &Net::SSLeay::CTX_use_certificate_file($ctx, $f, 2) }) { }
2679 1 0 if (not $cert and $arg_hash->{'SSL_passwd_cb'} and defined(my $pw = $arg_hash->{'SSL_passwd_cb'}->(0)))
2684 0 2 unless &Net::SSLeay::CTX_use_certificate($ctx, $cert)
2692 0 0 unless &Net::SSLeay::CTX_add_extra_chain_cert($ctx, $ca)
2695 0 2 if $key and not &Net::SSLeay::CTX_use_PrivateKey($ctx, $key)
2699 2 0 if $key
2700 2 0 if $cert
2701 2 0 if $key
2705 0 82 unless ($havecert)
2710 0 0 if @e
2716 161 111 if (not $havecert or $havekey) { }
28 83 elsif (my $pkey = $arg_hash->{'SSL_key'}) { }
83 0 elsif (my $f = $arg_hash->{'SSL_key_file'} || ($havecert eq 'PEM' ? $arg_hash->{'SSL_cert_file'} : undef)) { }
2720 0 28 unless &Net::SSLeay::CTX_use_PrivateKey($ctx, $pkey)
2726 83 1 if (&Net::SSLeay::CTX_use_PrivateKey_file($ctx, $f, $ft))
2727 82 1 $ft == 1 ? :
2731 0 83 unless $havekey
2735 0 0 if not $is_server and $can_pha and $havecert and $havekey
2739 91 165 if ($arg_hash->{'SSL_server'})
2741 0 91 if (my $f = $arg_hash->{'SSL_dh_file'}) { }
91 0 elsif (my $dh = $arg_hash->{'SSL_dh'}) { }
2746 0 0 unless $dh
2749 0 0 unless $rv = &Net::SSLeay::CTX_set_tmp_dh($_, $dh)
2752 0 0 unless $rv
2757 0 105 unless &Net::SSLeay::CTX_set_tmp_dh($_, $dh)
2763 91 165 if (my $curve = $arg_hash->{'SSL_ecdh_curve'})
2764 0 91 unless $can_ecdh
2769 0 105 if ($arg_hash->{'SSL_server'} and $curve eq 'auto') { }
0 105 elsif ($set_groups_list) { }
0 105 elsif ($curve =~ /:/) { }
105 0 elsif ($arg_hash->{'SSL_server'}) { }
2770 0 0 if ($can_ecdh eq 'can_auto') { }
0 0 elsif ($can_ecdh eq 'auto') { }
2771 0 0 unless Net::SSLeay::CTX_set_ecdh_auto($_, 1)
2782 0 0 unless &$set_groups_list($_, $curve)
2785 0 0 if $can_ecdh eq "can_auto"
2791 91 14 unless ($curve =~ /^\d+$/)
2797 0 105 unless my $ecdh = &Net::SSLeay::EC_KEY_new_by_curve_name($curve)
2801 0 157 unless &Net::SSLeay::CTX_set_tmp_ecdh($_, $ecdh)
2812 9 247 if (my $fp = $arg_hash->{'SSL_fingerprint'})
2813 2 7 ref $fp ? :
2814 0 11 unless my($algo, $pubkey, $digest) = /^(?:([\w-]+)\$)?(pub\$)?([a-f\d:]+)$/i
2817 0 0 length $digest == 64 ? :
0 0 length $digest == 40 ? :
0 0 length $digest == 32 ? :
2836 2 10 $_->[1] ? :
2863 0 256 if ($^O eq "darwin")
2868 0 0 $vcb ? :
2869 0 0 if ($rv != 1)
2880 156 9 if (not $is_server and $can_ocsp_staple and not $verify_fingerprint)
2884 0 81 unless my $iossl = $SSL_OBJECT{$ssl}
2886 0 81 if ($iossl->[1])
2897 0 81 if ($staple_callback)
2903 79 2 unless ($resp)
2904 0 79 if $IO::Socket::SSL::DEBUG >= 3
2907 0 2 if $IO::Socket::SSL::DEBUG >= 3
2909 0 2 if ($status != Net::SSLeay::OCSP_RESPONSE_STATUS_SUCCESSFUL())
2910 0 0 if $IO::Socket::SSL::DEBUG >= 3
2914 0 2 unless (eval { do { &Net::SSLeay::OCSP_response_verify($ssl, $resp) } })
2915 0 0 if $IO::Socket::SSL::DEBUG >= 3
2922 1 5 unless ($certid)
2923 0 1 if $IO::Socket::SSL::DEBUG >= 3
2928 2 3 if ($status and $status->[2])
2930 2 0 if (not $status->[1]) { }
0 0 elsif ($status->[2]{'statusType'} == Net::SSLeay::V_OCSP_CERTSTATUS_GOOD()) { }
2932 0 2 if $cache
2937 0 0 if $cache
2944 0 0 if $cache
2953 0 2 if ($hard_error) { }
2 0 elsif (@results and $chain[0] == $iossl->peer_certificate) { }
2963 256 0 if (my $cl = $arg_hash->{'SSL_cipher_list'})
2967 0 270 ref $cl ? :
2 268 unless &Net::SSLeay::CTX_set_cipher_list($ctx{$_}, scalar(ref $cl ? $cl->{$_} || $cl->{''} || $DEFAULT_SSL_ARGS{'SSL_cipher_list'} || (next) : $cl))
2971 0 254 if (my $cl = $arg_hash->{'SSL_ciphersuites'})
2972 0 0 unless $can_ciphersuites
2977 0 0 ref $cl ? :
0 0 unless Net::SSLeay::CTX_set_ciphersuites($ctx{$_}, ref $cl ? $cl->{$_} || $cl->{''} || $DEFAULT_SSL_ARGS{'SSL_cipher_list'} || (next) : $cl)
2984 6 248 if (keys %ctx > 1 or not exists $ctx{''})
2985 0 6 unless $can_server_sni
2991 4 15 unless defined $host
2992 0 19 unless (my $snictx = $ctx{lc $host} || $ctx{''})
2993 0 0 if $IO::Socket::SSL::DEBUG > 1
2997 0 19 if $IO::Socket::SSL::DEBUG > 1
2998 9 10 if $snictx != $ctx
3003 0 254 if (my $cb = $arg_hash->{'SSL_create_ctx_callback'})
3011 89 161 $self->{'verify_mode'} ? :
4 250 defined $arg_hash->{'SSL_ocsp_mode'} ? :
3013 0 254 if $IO::Socket::SSL::DEBUG >= 3
3015 0 254 if (my $cache = $arg_hash->{'SSL_session_cache'}) { }
3 251 elsif (my $size = $arg_hash->{'SSL_session_cache_size'}) { }
3023 0 254 if ($self->{'session_cache'} and %sess_cb)
3034 0 0 unless (my $key = $args->{'SSL_session_key'})
3038 0 0 if $IO::Socket::SSL::DEBUG >= 3
3044 0 0 if $IO::Socket::SSL::DEBUG >= 3
3061 252 7 if (my $ctx = $self->{'context'})
3062 0 252 if $IO::Socket::SSL::DEBUG >= 3
3063 252 0 if (not $use_threads or delete $CTX_CREATED_IN_THIS_THREAD{$ctx})
3065 92 160 if ($self->{'verify_mode'})
3066 0 92 if $IO::Socket::SSL::DEBUG >= 3
3069 0 252 if ($self->{'ocsp_error_ref'})
3070 0 0 if $IO::Socket::SSL::DEBUG >= 3
3073 0 252 if $IO::Socket::SSL::DEBUG >= 3
3093 0 3 unless $size > 0
3108 0 16 if $IO::Socket::SSL::DEBUG >= 3
3121 1 0 $key ? :
3125 3 0 if (not $session) { }
0 0 elsif ($v->[0] == $session) { }
3132 1 2 if $v == $head
3134 0 0 $key ? :
0 0 $session ? :
0 1 if $IO::Socket::SSL::DEBUG >= 3
3140 0 3 if $_->[0]
3149 3 13 if ($session)
3152 0 3 if $IO::Socket::SSL::DEBUG >= 3
3153 3 0 if $v->[0] == $session
3155 0 0 if $v == $shead
3158 12 4 if ($v)
3162 0 0 $session ? :
0 0 $v ? :
0 16 if $IO::Socket::SSL::DEBUG >= 3
3175 38 18 if ($$rhead) { }
3189 1 27 if ($self->{'room'} < 0)
3192 0 1 if $l->[0]
3204 0 32 unless $$rhead
3207 8 24 if ($v != $$rhead) { }
12 12 elsif ($v->[$inext] == $v) { }
3211 10 2 if ($inext == 4) { }
3230 0 0 if exists $v2i{$v}
3233 0 0 if $v == $self->{'ghead'}
3243 0 0 if $v == $self->{'ghead'}
3255 0 0 if $v == $shead
3266 6 1 if $v->[0]
3285 5 0 unless my $e = $self->{$id}
3287 0 0 if ($e->{'expire'} and time < $e->{'expire'})
3291 0 0 if ($e->{'nextUpdate'} and time < $e->{'nextUpdate'})
3303 0 5 if ($del > 0)
3325 3 5 unless (my $uri = &Net::SSLeay::P_X509_get_ocsp_uri($cert))
3326 0 3 if $IO::Socket::SSL::DEBUG > 2
3330 0 5 unless (my $certid = eval { do { &Net::SSLeay::OCSP_cert2ids($ssl, $cert) } })
3331 0 0 if $IO::Socket::SSL::DEBUG > 2
3335 5 0 if (not $done = $cache->get($certid)) { }
0 0 elsif ($done->{'hard_error'}) { }
0 0 elsif ($done->{'soft_error'}) { }
3352 0 4 unless %todo
3353 2 2 @soft_error ? :
3378 0 5 if not $todo or $self->{'error'}
3383 0 5 if (not $resp) { }
0 5 elsif (not eval { do { $resp = &Net::SSLeay::d2i_OCSP_RESPONSE($resp) } }) { }
0 5 elsif ((my $status = &Net::SSLeay::OCSP_response_status($resp)) != Net::SSLeay::OCSP_RESPONSE_STATUS_SUCCESSFUL()) { }
0 5 elsif (not eval { do { $req = &Net::SSLeay::d2i_OCSP_REQUEST($todo->{'req'}); &Net::SSLeay::OCSP_response_verify($self->{'ssl'}, $resp, $req) } }) { }
5 0 elsif (my(@result) = &Net::SSLeay::OCSP_response_results($resp, @{$$todo{'ids'};})) { }
3415 0 0 if ($@) { }
3423 0 0 unless @soft_error
3436 5 0 if ($rv->[2]) { }
3438 5 0 if (not $rv->[1]) { }
0 0 elsif ($rv->[2]{'statusType'} == Net::SSLeay::V_OCSP_CERTSTATUS_GOOD()) { }
3461 0 5 if (@miss and @found)
3468 0 0 if $IO::Socket::SSL::DEBUG >= 2
3480 5 0 if $req
3481 0 5 if ($self->{'failhard'})
3485 0 5 if (@soft_error)
3486 0 0 if $self->{'soft_error'}
3489 0 5 if (@hard_error) { }
4 1 elsif (not %{$self->{'todo'};}) { }
3502 0 4 unless eval { do { require HTTP::Tiny } }
3506 0 5 if $IO::Socket::SSL::DEBUG
3511 0 5 if $IO::Socket::SSL::DEBUG
3513 4 1 if defined $self->add_response($uri, $resp->{'success'} && $resp->{'content'})
3517 0 4 if $IO::Socket::SSL::DEBUG >= 2
3652 0 0 unless $IO::Socket::SSL::DEBUG >= 2
3661 0 0 if ($ssl_ver and $content_type != $trace_constants{'SSL3_RT_HEADER'} and $content_type != $trace_constants{'SSL3_RT_INNER_CONTENT_TYPE'})
3674 0 0 $ssl_ver == $trace_constants{'SSL3_VERSION_MAJOR'} && $content_type ? :
3679 0 0 if ($content_type == $trace_constants{'SSL3_RT_CHANGE_CIPHER_SPEC'}) { }
0 0 elsif ($content_type == $trace_constants{'SSL3_RT_ALERT'}) { }
3690 0 0 $direction ? :