Branch Coverage

blib/lib/IO/Socket/SSL.pm
Criterion Covered Total %
branch 710 1212 58.5


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)
233 79 80 unless &Net::SSLeay::library_init()
243 80 0 $can_ecdh eq 'tmp_ecdh' ? :
0 80 $can_ecdh eq 'can_auto' ? :
0 80 $can_ecdh eq 'auto' ? :
258 0 80 unless $dh
290 0 80 if not do { local $SIG{'__DIE__'}; local $SIG{'__WARN__'}; eval { do { &dualvar(0, ""); 1 } } }
379 80 0 if ($ip6)
382 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) } }) { }
404 1 79 unless ($ip6)
408 0 1 unless (defined $ip6)
423 0 0 unless $DEBUG
425 0 0 if ($sub =~ /^IO::Socket::SSL::(?:error|(_internal_error))$/) { }
426 0 0 if $1
431 0 0 if length $file > 20
432 0 0 if @_
495 3 156 if (@_)
497 0 3 if (@_ > 1) { }
3 0 elsif (my $path = shift()) { }
507 114 45 if defined $ca_detected
512 0 0 &Net::SSLeay::SSLeay_version(4) =~ /^OPENSSLDIR: "(.+)"$/ ? :
45 0 &Net::SSLeay::SSLeay_version(5) =~ /^OPENSSLDIR: "(.+)"$/ ? :
520 45 0 if (opendir my $dh, $dir)
522 0 45 unless open my $fh, "<", "$dir/$f"
524 0 45 unless $line =~ /^-+BEGIN (X509 |TRUSTED |)CERTIFICATE-/
532 0 45 if (open my $fh, "<", $file)
534 0 0 unless $line =~ /^-+BEGIN (X509 |TRUSTED |)CERTIFICATE-/
540 0 0 if not %default_ca and do { local $SIG{'__DIE__'}; eval { do { require Mozilla::CA; 1 } } }
559 0 1 if (/^inet4$/i) { }
0 1 elsif (/^inet6$/i) { }
1 0 elsif (/^:?debug(\d+)/) { }
565 0 0 unless (UNIVERSAL::isa($class, "IO::Socket::INET6") or UNIVERSAL::isa($class, "IO::Socket::IP"))
624 0 114 unless $self
636 2 112 if defined $blocking
638 2 112 unless $self->configure_SSL($arg_hash)
640 68 44 if ($arg_hash->{$family_key} ||= $arg_hash->{'Domain'} || $arg_hash->{'Family'})
646 68 0 if $IOCLASS eq "IO::Socket::IP" and not defined $arg_hash->{'GetAddrInfoFlags'}
648 6 106 unless $self->SUPER::configure($arg_hash)
651 2 104 if defined $blocking and not $blocking
660 190 79 unless (defined $is_server)
665 0 269 if $FILTER_SSL_ARGS
672 2 267 unless do { *$self }->{'_SSL_ctx'} = "IO::Socket::SSL::SSL_Context"->new($arg_hash)
682 60 36 if ($err == $Net_SSLeay_ERROR_WANT_READ) { }
2 34 elsif ($err == $Net_SSLeay_ERROR_WANT_WRITE) { }
690 62 0 if ref $self
699 0 74 if do { *$self }->{'_SSL_opened'}
701 74 0 unless (do { *$self }->{'_SSL_opening'})
706 0 74 if $DEBUG >= 2
707 0 74 unless $self->SUPER::connect(@_)
708 0 74 if $DEBUG >= 2
717 12 62 if defined $sh and not $sh
725 2 174 @_ > 1 ? :
726 0 176 if do { *$self }->{'_SSL_opened'}
729 172 4 unless (do { *$self }->{'_SSL_opening'})
731 0 172 if $DEBUG >= 2
736 0 172 unless defined $fileno
742 0 172 if $use_threads
746 12 160 if ($ctx->{'session_cache'})
751 6 0 $port ? :
755 0 172 unless &Net::SSLeay::set_fd($ssl, $fileno)
758 172 0 if ($can_client_sni) { }
0 0 elsif ($arg_hash->{'SSL_hostname'}) { }
760 21 151 if (exists $arg_hash->{'SSL_hostname'}) { }
62 89 elsif ($host = $arg_hash->{'PeerAddr'} || $arg_hash->{'PeerHost'}) { }
768 62 0 if not $host =~ /[a-z_]/i or $host =~ /:/
772 21 151 if ($host) { }
773 0 21 if $DEBUG >= 2
776 0 151 if $DEBUG >= 2
782 0 0 if $DEBUG >= 2
785 95 75 unless $arg_hash->{'PeerAddr'} or $arg_hash->{'PeerHost'}
786 97 75 if ($ctx->{'verify_name_ref'})
790 44 53 unless (defined $host)
791 44 0 if ($host = $arg_hash->{'PeerAddr'} || $arg_hash->{'PeerHost'})
805 1 171 if ($ocsp & 1) { }
0 171 elsif (not $can_ocsp_staple) { }
95 76 elsif ($ocsp & 18) { }
808 0 0 if $ocsp & 2
814 0 95 if $DEBUG >= 2
817 8 164 if ($ctx->{'session_cache'} and my $session = $ctx->{'session_cache'}->get_session($arg_hash->{'SSL_session_key'}))
829 2 174 exists $args->{'Timeout'} ? :
830 17 159 if (defined $timeout and $timeout > 0 and $self->blocking(0)) { }
831 0 17 if $DEBUG >= 2
837 0 159 if $auto_retry
844 0 212 if $DEBUG >= 3
847 0 212 if $DEBUG >= 3
848 70 142 if ($rv < 0) { }
0 142 elsif ($rv == 0) { }
849 29 41 if (my $err = $self->_skip_rw_error($ssl, $rv))
853 0 29 if $DEBUG >= 1
857 0 41 if $DEBUG >= 2
860 4 37 unless defined $timeout
864 37 0 if ($timeout > 0) { }
867 0 37 if $DEBUG >= 2
868 0 0 $IO::Socket::SSL::SSL_ERROR == 50929960 ? :
37 0 $IO::Socket::SSL::SSL_ERROR == 50903888 ? :
873 0 0 if $DEBUG >= 2
876 1 36 unless ($rv)
877 0 1 if $DEBUG >= 2
887 0 36 if $DEBUG >= 2
895 0 0 if $DEBUG >= 2
902 0 142 if $DEBUG >= 2
906 12 130 if (defined $timeout)
913 1 141 if (my $ocsp_result = do { *$self }->{'_SSL_ocsp_verify'}) { }
0 141 elsif ($ctx->{'ocsp_mode'} & 2) { }
915 1 0 if ($ocsp_result->[0] > 0) { }
0 0 elsif ($ocsp_result->[0] < 0) { }
916 0 1 if $DEBUG >= 3
922 0 0 if $DEBUG >= 3
926 0 0 if $DEBUG >= 3
936 12 130 if (not %sess_cb and $ctx->{'session_cache'} and my $session = &Net::SSLeay::get1_session($ssl))
959 0 96 if ($af == 10) { }
979 58 0 unless ($socket)
981 0 58 if $DEBUG >= 2
983 0 58 if $DEBUG >= 2
987 16 42 if (defined $sh and not $sh)
993 0 16 if $DEBUG >= 2
994 0 16 wantarray ? :
998 3 39 unless $self->accept_SSL($socket)
999 0 39 if $DEBUG >= 2
1001 2 37 wantarray ? :
1006 42 80 @_ && UNIVERSAL::isa($_[0], 'IO::Handle') ? :
1007 9 113 @_ > 1 ? :
1010 119 3 unless (do { *$self }->{'_SSL_opening'})
1011 0 119 if $DEBUG >= 2
1013 42 77 if ($socket != $self)
1022 0 119 unless defined $fileno
1028 0 119 if $use_threads
1032 0 119 unless &Net::SSLeay::set_fd($ssl, $fileno)
1043 9 113 exists $args->{'Timeout'} ? :
1044 14 108 if (defined $timeout and $timeout > 0 and $socket->blocking(0)) { }
1050 0 108 if $auto_retry
1059 0 136 if $DEBUG >= 3
1060 21 115 if ($rv < 0) { }
13 102 elsif ($rv == 0) { }
1061 3 18 if (my $err = $socket->_skip_rw_error($ssl, $rv))
1070 3 15 unless defined $timeout
1074 15 0 if ($timeout > 0) { }
1077 0 0 $IO::Socket::SSL::SSL_ERROR == 50929960 ? :
15 0 $IO::Socket::SSL::SSL_ERROR == 50903888 ? :
1084 1 14 unless ($rv)
1107 0 102 if $DEBUG >= 2
1111 12 90 if (defined $timeout)
1140 1 0 defined $rwerr ? :
0 1 if (my $err = $self->_skip_rw_error($ssl, defined $rwerr ? $rwerr : -1))
1143 0 0 if (not $! and $err == $Net_SSLeay_ERROR_SSL || $err == $Net_SSLeay_ERROR_SYSCALL)
1154 6088 28 unless defined $$buffer
1156 1 6115 if ($offset > length $$buffer)
1166 5 1 $self->blocking ? :
6 0 if do { *$self }->{'_SSL_object'}
1178 6110 0 if do { *$self }->{'_SSL_object'}
1188 1 5 if do { *$self }->{'_SSL_object'}
1193 0 5 unless defined CORE::recv($self, my $buf, $_[1], 2)
1194 0 5 $_[2] ? :
1208 0 7742 if $offset > $buf_len
1210 0 7742 if $offset == $buf_len
1214 59 7683 if ($write_all) { }
1215 0 59 $length < $buf_len - $offset ? :
1218 0 59 if not $written and $errs
1222 4 7679 if $written <= 0
1224 4 7738 unless (defined $written)
1225 2 2 if (my $err = $self->_skip_rw_error($ssl, -1))
1227 2 0 if $err == $Net_SSLeay_ERROR_SYSCALL
1240 60 0 if do { *$self }->{'_SSL_object'}
1251 7682 0 if do { *$self }->{'_SSL_object'}
1270 2 0 if $self->read($buffer, 1, 0)
1275 0 83 unless do { *$self }->{'_SSL_object'}
1277 7 76 if (not defined $/ or wantarray)
1283 0 14 if (not defined $rv) { }
7 7 elsif (not $rv) { }
1284 0 0 if $! == 4
1285 0 0 if $! == 11 or $! == 11
1292 2 5 if (not defined $/) { }
1 4 elsif (ref $/) { }
1 3 elsif ($/ eq '') { }
1296 0 1 unless $size > 0
1306 1 75 if (ref $/)
1309 0 1 unless $size > 0
1313 0 1 if (not defined $rv) { }
0 1 elsif (not $rv) { }
1314 0 0 if $! == 4
1315 0 0 if $! == 11 or $! == 11
1324 1 74 $/ eq '' ? :
1329 0 75 unless my $ssl = $self->_get_ssl_object
1334 21 58 if (not defined $poke or $poke eq "")
1335 1 20 if $! == 4
1342 58 20 if ($pending and (my $pb = &Net::SSLeay::peek($ssl, $pending)) ne '') { }
1346 19 1 $buf eq '' ? :
1348 58 0 unless ($eod)
1350 3 55 if ($pos < 0) { }
1357 55 3 if ($eod)
1358 1 54 if ($delim1 ne "")
1369 58 0 if ($self->sysread(my $p, $skip, 0))
1373 0 0 unless $! == 4
1376 55 0 if ($eod and $delim1 eq '' || $eod < length $buf)
1386 0 245 ref $_[0] eq 'HASH' ? :
1388 0 245 unless $self->stop_SSL("SSL_fast_shutdown", 1, %$close_args, "_SSL_ioclass_downgrade", 0)
1394 51 194 unless ($close_args->{'_SSL_in_DESTROY'})
1409 0 291 ref $_[0] eq 'HASH' ? :
1410 1 290 unless do { *$self }->{'_SSL_opened'}
1412 289 2 if (my $ssl = do { *$self }->{'_SSL_object'})
1413 0 289 if (delete do { *$self }->{'_SSL_opening'}) { }
94 195 elsif (not $stop_args->{'SSL_no_shutdown'}) { }
1421 0 85 exists $stop_args->{'Timeout'} ? :
9 85 !$self->blocking ? :
1422 3 91 if ($timeout)
1428 49 10 if ($status & 1 and $status & 2 || $stop_args->{'SSL_fast_shutdown'})
1435 45 59 if ((do { *$self }->{'_SSL_opened'} || 0) <= 0)
1445 0 59 if ($rv < 0)
1447 0 0 unless ($timeout)
1448 0 0 if (my $err = $self->_skip_rw_error($ssl, $rv))
1450 0 0 if $err == $Net_SSLeay_ERROR_SYSCALL
1460 0 0 if $wait <= 0
1463 0 0 if ($err == $Net_SSLeay_ERROR_WANT_READ) { }
0 0 elsif ($err == $Net_SSLeay_ERROR_WANT_READ) { }
1473 10 49 if $rv > 0
1475 3 91 if $timeout
1481 35 254 if (my $cert = delete do { *$self }->{'_SSL_certificate'})
1491 3 288 if ($stop_args->{'SSL_ctx_free'})
1493 3 0 if $ctx
1497 97 194 unless ($stop_args->{'_SSL_in_DESTROY'})
1500 46 51 if ($downgrade or not defined $downgrade)
1502 39 7 if (my $orig_class = delete do { *$self }->{'_SSL_ioclass_upgraded'})
1507 39 0 if @sslkeys
1518 7733 114 defined $fn ? :
1550 0 156 unless ref $socket
1551 1 155 @_ == 1 ? :
1552 11 145 exists $arg_hash->{'Timeout'} ? :
1554 0 156 unless ($original_class)
1555 0 0 unless $socket = ($original_class = $IO::Socket::SSL::ISA[0])->new_from_fd($socket, "<+")
1559 156 0 UNIVERSAL::can($socket, 'fileno') ? :
1561 1 155 unless defined $original_fileno
1565 0 155 unless $socket->configure_SSL($arg_hash)
1568 154 1 if $class ne $original_class
1572 151 4 if (not defined $start_handshake or $start_handshake) { }
1574 0 151 if $DEBUG >= 2
1577 57 94 do { *$socket }->{'_SSL_arguments'}{'SSL_server'} ? :
1579 113 38 if ($result) { }
1580 0 113 unless $was_blocking
1584 38 0 if ($original_class)
1586 0 38 if not $was_blocking and $socket->can("blocking")
1592 0 4 if $DEBUG >= 2
1601 1 0 if (length $_[0] < 4)
1603 1 0 unless length $mode
1626 0 3 if @chain and not $self->peer_certificate
1627 0 3 if (do { *$self }->{'_SSL_arguments'}{'SSL_server'})
1631 0 0 if (my $peer = &Net::SSLeay::get_peer_certificate($ssl))
1664 0 80 unless my $ssl = $self->_get_ssl_object
1667 0 0 if $reload and do { *$self }->{'_SSL_certificate'}
1669 0 80 unless my $cert = (do { *$self }->{'_SSL_certificate'} ||= &Net::SSLeay::get_peer_certificate($ssl))
1672 14 66 if ($field) { }
1673 0 14 unless my $sub = $dispatcher{$field}
1686 4 2 if ($field) { }
1687 0 4 unless my $sub = $dispatcher{$field}
1793 203 0 unless (ref $scheme)
1794 0 203 if $DEBUG >= 3
1798 0 203 unless %$scheme
1804 0 203 if $DEBUG >= 3
1806 0 203 if (my $sub = $scheme->{'callback'})
1814 12 191 if ($identity =~ /:/) { }
46 145 elsif (my(@ip) = $identity =~ /^(\d+)(?:\.(\d+)\.(\d+)\.(\d+)|[\d\.]*)$/) { }
1816 3 9 if $identity =~ /[^\da-fA-F:\.]/
1817 0 9 unless $ipn = inet_pton(10, $identity)
1820 178 6 if defined $_
3 43 if 4 != @ip or 4 != grep({$_ < 256 if defined $_;} @ip)
1824 5 140 if ($identity =~ /[^a-zA-Z0-9_.\-]/)
1825 0 5 if $identity =~ /\0/
1826 0 5 unless $identity = idn_to_ascii($identity)
1828 2 3 if $identity =~ /[^a-zA-Z0-9_.\-]/
1837 1 309 if $name eq ""
1849 116 193 if ($wtyp eq 'anywhere' and $name =~ /^([a-zA-Z0-9_\-]*)\*(.+)/) { }
26 167 elsif ($wtyp =~ /^(?:full_label|leftmost)$/ and $name =~ /^\*(\..+)$/) { }
1850 4 112 if $1 ne "" and substr($identity, 0, 4) eq "xn--"
1858 56 82 if ($identity =~ /$pattern/)
1859 56 0 unless defined $publicsuffix
1861 0 56 if $publicsuffix eq ""
1864 56 0 $tld ? :
41 15 if @labels > ($tld ? 0 + @$tld : 1)
1873 42 319 if ($ipn and $type == GEN_IPADD()) { }
222 147 elsif (not $ipn and $type == GEN_DNS()) { }
1876 35 7 if $ipn eq $name
1881 41 181 if &$check_name($name, $identity, $scheme->{'wildcards_in_alt'}, $publicsuffix)
1886 105 14 if ($scheme->{'check_cn'} eq "always" or $scheme->{'check_cn'} eq "when_only" and not $alt_dnsNames)
1888 88 17 if (not $ipn) { }
17 0 elsif ($scheme->{'ip_in_cn'}) { }
1889 44 44 if &$check_name($commonName, $identity, $scheme->{'wildcards_in_cn'}, $publicsuffix)
1892 5 12 if ($identity eq $commonName)
1895 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)
1916 0 8 unless my $ssl = $self->_get_ssl_object
1924 8 14 $key_only ? :
1932 0 22 unless my $fp = get_fingerprint_bin($self, $algo, $cert, $key_only)
1933 8 14 $key_only ? :
1943 0 28 unless my $version = &Net::SSLeay::version($ssl)
1945 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 ? :
1976 1 1 $ctx->{'ocsp_mode'} & 8 ? :
0 2 @_ ? :
1985 46 0 $oe ? :
1993 1 44 if (defined $error_trap and ref $error_trap eq 'CODE') { }
36 8 elsif (do { *$self }->{'_SSL_ioclass_upgraded'} or do { *$self }->{'_SSL_arguments'}{'SSL_keepSocketOnError'}) { }
1998 0 36 if $DEBUG >= 3
2004 45 0 if $saved_error
2030 19 56 if not ref $self and $CURRENT_SSL_OBJECT
2031 72 3 if (ref $self) { }
2033 47 25 if (not $oe or $oe->[1] <= $severity) { }
2036 0 47 if $DEBUG
2038 0 25 if $DEBUG
2042 0 3 if $DEBUG
2053 0 44 if $DEBUG >= 2
2055 44 3 if @err
2056 47 0 if $error
2081 0 284 unless my $self = shift()
2082 194 90 if (my $ssl = do { *$self }->{'_SSL_object'})
2084 194 0 if (not $use_threads or delete $CREATED_IN_THIS_THREAD{$ssl})
2102 0 2 ref $_[0] eq 'HASH' ? :
2154 0 0 if (ref $sub) { }
0 0 elsif ($sub eq 'use_defaults') { }
2160 0 0 $is_server ? :
2170 0 2 unless $can_npn
2177 0 2 unless $can_alpn
2199 1 0 if wantarray
2270 269 7 ref $_[0] eq 'HASH' ? :
2273 101 175 $is_server ? :
2276 6 270 if ($defaults{'SSL_reuse_ctx'})
2279 0 6 if grep {/^SSL_(?!verifycn_name|hostname)$/;} keys %$arg_hash
2281 276 0 if %defaults
2283 26 250 if (my $ctx = $arg_hash->{'SSL_reuse_ctx'})
2284 24 2 if ($ctx->isa('IO::Socket::SSL::SSL_Context') and $ctx->{'context'}) { }
2 0 elsif ($ctx = do { *$ctx }->{'_SSL_ctx'}) { }
2296 6 153 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")
2304 32 218 if ($arg_hash->{'SSL_ca'}) { }
0 218 elsif ($arg_hash->{'SSL_ca_path'}) { }
61 157 elsif ($arg_hash->{'SSL_ca_file'}) { }
2314 240 10 unless defined $arg_hash->{'SSL_use_cert'}
2326 0 2000 if defined $arg_hash->{$_} and $arg_hash->{$_} eq ""
2329 368 132 unless defined(my $file = $arg_hash->{$_})
2330 12 120 ref $file eq 'HASH' ? :
2331 0 164 unless open my $fh, "<", $f
2336 87 163 if ($verify_mode != $Net_SSLeay_VERIFY_NONE) { }
0 163 elsif ($verify_mode ne '0') { }
2349 84 0 if (not $is_server and $verify_mode & 1 and !$vcn_scheme || $vcn_scheme ne 'none')
2359 4 179 if $vcb
2360 14 169 unless $ok
2362 85 84 if $depth != 0
2365 0 84 unless ($host)
2366 0 0 if ($vcn_scheme)
2381 19 65 unless ($rv)
2389 89 161 if ($is_server)
2390 0 89 if ($arg_hash->{'SSL_ticket_keycb'} and not $can_tckt_keycb)
2401 0 710 unless m[^(!?)(?:(SSL(?:v2|v3|v23|v2/3))|(TLSv1(?:_?[123])?))$]i
2405 460 250 if ($not) { }
2408 0 250 if $ver and $v ne $ver
2416 4 240 $ver eq 'TLSv1_2' ? :
2 244 $ver eq 'TLSv1_1' ? :
2 246 $ver eq 'TLSv1' ? :
1 248 $ver eq 'SSLv3' ? :
0 249 $ver eq 'SSLv2' ? :
1 249 $ver eq 'TLSv1_3' ? :
2 248 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")))))
2430 89 159 if ($is_server)
2433 183 173 unless my $val = $arg_hash->{$opt}
2434 12 161 if (ref $val eq "HASH")
2441 2 20 $host =~ /%/ ? :
2444 242 6 unless %ctx
2449 2 262 if ($host =~ /^([^%]*)%/)
2450 0 2 unless $ctx = $ctx{$1}
2452 0 2 if (my(@k) = grep({not /^SSL_(?:cert|key)(?:_file)?$/;} keys %$arg_hash))
2457 0 2 unless $can_multi_cert
2463 0 262 unless $ctx = &$ctx_new_sub()
2465 0 262 if $use_threads
2469 99 163 if $arg_hash->{'SSL_honor_cipher_order'}
2471 19 243 if ($ver eq "SSLv23" and not $ssl_op & $SSL_OP_NO{'SSLv3'})
2479 0 262 if $IO::Socket::SSL::DEBUG >= 2 and $set_msg_callback
2483 0 262 if $check_partial_chain
2489 9 253 if ($arg_hash->{'SSL_server'} and my $id = $arg_hash->{'SSL_session_id_context'} || $arg_hash->{'SSL_verify_mode'} & 1 && "$ctx")
2502 0 262 $arg_hash->{'SSL_mode_release_buffers'} ? :
2505 3 259 if (my $proto_list = $arg_hash->{'SSL_npn_protocols'})
2506 0 3 unless $can_npn
2508 2 1 if ($arg_hash->{'SSL_server'}) { }
2518 3 259 if (my $proto_list = $arg_hash->{'SSL_alpn_protocols'})
2519 0 3 unless $can_alpn
2521 2 1 if ($arg_hash->{'SSL_server'}) { }
2528 0 262 if ($arg_hash->{'SSL_ticket_keycb'})
2530 0 0 ref $cb eq 'CODE' ? :
2537 107 155 if ($arg_hash->{'SSL_ca'} or defined $arg_hash->{'SSL_ca_file'} or defined $arg_hash->{'SSL_ca_path'}) { }
155 0 elsif (my(%ca) = IO::Socket::SSL::default_ca()) { }
2541 0 107 if ref $file eq "SCALAR" and not $$file
2543 0 107 if ref $dir eq "SCALAR" and not $$dir
2544 32 75 if ($arg_hash->{'SSL_ca'})
2547 0 33 unless &Net::SSLeay::X509_STORE_add_cert($store, $_)
2552 0 107 if ref $dir
2553 0 107 if ($file || $dir and not &Net::SSLeay::CTX_load_verify_locations($ctx, scalar($file || ''), scalar($dir || '')))
2555 0 0 if $verify_mode != $Net_SSLeay_VERIFY_NONE
2562 0 155 if ref $dir
2563 0 155 if (not &Net::SSLeay::CTX_load_verify_locations($ctx, scalar($ca{'SSL_ca_file'} || ''), scalar($dir || '')) and $verify_mode != $Net_SSLeay_VERIFY_NONE)
2571 9 253 if ($is_server and $verify_mode & $Net_SSLeay_VERIFY_PEER)
2572 0 9 if ($arg_hash->{'SSL_client_ca'})
2574 0 0 unless &Net::SSLeay::CTX_add_client_CA($ctx, $_)
2579 0 9 if ($arg_hash->{'SSL_client_ca_file'})
2581 0 0 unless my $list = &Net::SSLeay::load_client_CA_file($arg_hash->{'SSL_client_ca_file'})
2589 0 262 if ($arg_hash->{'SSL_check_crl'})
2591 0 0 if ($arg_hash->{'SSL_crl_file'})
2595 0 0 if ($crl) { }
2605 262 0 if $X509_STORE_flags
2610 12 250 if $arg_hash->{'SSL_passwd_cb'}
2614 31 233 if (my $x509 = $arg_hash->{'SSL_cert'}) { }
80 153 elsif (my $f = $arg_hash->{'SSL_cert_file'}) { }
2618 1 30 ref $x509 eq 'ARRAY' ? :
2620 0 31 unless &Net::SSLeay::CTX_use_certificate($ctx, $cert)
2623 0 1 unless &Net::SSLeay::CTX_add_extra_chain_cert($ctx, $ca)
2630 77 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) }) { }
2641 1 0 if (not $cert and $arg_hash->{'SSL_passwd_cb'} and defined(my $pw = $arg_hash->{'SSL_passwd_cb'}->(0)))
2646 0 2 unless &Net::SSLeay::CTX_use_certificate($ctx, $cert)
2654 0 0 unless &Net::SSLeay::CTX_add_extra_chain_cert($ctx, $ca)
2657 0 2 if $key and not &Net::SSLeay::CTX_use_PrivateKey($ctx, $key)
2661 2 0 if $key
2662 2 0 if $cert
2663 2 0 if $key
2667 0 80 unless ($havecert)
2672 0 0 if @e
2678 155 109 if (not $havecert or $havekey) { }
28 81 elsif (my $pkey = $arg_hash->{'SSL_key'}) { }
81 0 elsif (my $f = $arg_hash->{'SSL_key_file'} || ($havecert eq 'PEM' ? $arg_hash->{'SSL_cert_file'} : undef)) { }
2682 0 28 unless &Net::SSLeay::CTX_use_PrivateKey($ctx, $pkey)
2688 81 1 if (&Net::SSLeay::CTX_use_PrivateKey_file($ctx, $f, $ft))
2689 80 1 $ft == 1 ? :
2693 0 81 unless $havekey
2697 0 0 if not $is_server and $can_pha and $havecert and $havekey
2701 89 159 if ($arg_hash->{'SSL_server'})
2703 0 89 if (my $f = $arg_hash->{'SSL_dh_file'}) { }
89 0 elsif (my $dh = $arg_hash->{'SSL_dh'}) { }
2708 0 0 unless $dh
2711 0 0 unless $rv = &Net::SSLeay::CTX_set_tmp_dh($_, $dh)
2714 0 0 unless $rv
2719 0 103 unless &Net::SSLeay::CTX_set_tmp_dh($_, $dh)
2725 89 159 if (my $curve = $arg_hash->{'SSL_ecdh_curve'})
2726 0 89 unless $can_ecdh
2731 0 103 if ($arg_hash->{'SSL_server'} and $curve eq 'auto') { }
0 103 elsif ($set_groups_list) { }
0 103 elsif ($curve =~ /:/) { }
103 0 elsif ($arg_hash->{'SSL_server'}) { }
2732 0 0 if ($can_ecdh eq 'can_auto') { }
0 0 elsif ($can_ecdh eq 'auto') { }
2733 0 0 unless Net::SSLeay::CTX_set_ecdh_auto($_, 1)
2744 0 0 unless &$set_groups_list($_, $curve)
2747 0 0 if $can_ecdh eq "can_auto"
2753 89 14 unless ($curve =~ /^\d+$/)
2759 0 103 unless my $ecdh = &Net::SSLeay::EC_KEY_new_by_curve_name($curve)
2763 0 155 unless &Net::SSLeay::CTX_set_tmp_ecdh($_, $ecdh)
2774 9 239 if (my $fp = $arg_hash->{'SSL_fingerprint'})
2775 2 7 ref $fp ? :
2776 0 11 unless my($algo, $pubkey, $digest) = /^(?:([\w-]+)\$)?(pub\$)?([a-f\d:]+)$/i
2779 0 0 length $digest == 64 ? :
0 0 length $digest == 40 ? :
0 0 length $digest == 32 ? :
2798 2 10 $_->[1] ? :
2825 0 248 if ($^O eq "darwin")
2830 0 0 $vcb ? :
2831 0 0 if ($rv != 1)
2842 150 9 if (not $is_server and $can_ocsp_staple and not $verify_fingerprint)
2846 0 78 unless my $iossl = $SSL_OBJECT{$ssl}
2848 0 78 if ($iossl->[1])
2859 0 78 if ($staple_callback)
2865 77 1 unless ($resp)
2866 0 77 if $IO::Socket::SSL::DEBUG >= 3
2869 0 1 if $IO::Socket::SSL::DEBUG >= 3
2871 0 1 if ($status != Net::SSLeay::OCSP_RESPONSE_STATUS_SUCCESSFUL())
2872 0 0 if $IO::Socket::SSL::DEBUG >= 3
2876 0 1 unless (eval { do { &Net::SSLeay::OCSP_response_verify($ssl, $resp) } })
2877 0 0 if $IO::Socket::SSL::DEBUG >= 3
2884 0 3 unless ($certid)
2885 0 0 if $IO::Socket::SSL::DEBUG >= 3
2890 1 2 if ($status and $status->[2])
2892 1 0 if (not $status->[1]) { }
0 0 elsif ($status->[2]{'statusType'} == Net::SSLeay::V_OCSP_CERTSTATUS_GOOD()) { }
2894 0 1 if $cache
2899 0 0 if $cache
2906 0 0 if $cache
2915 0 1 if ($hard_error) { }
1 0 elsif (@results and $chain[0] == $iossl->peer_certificate) { }
2925 248 0 if (my $cl = $arg_hash->{'SSL_cipher_list'})
2929 0 262 ref $cl ? :
0 262 unless &Net::SSLeay::CTX_set_cipher_list($ctx{$_}, scalar(ref $cl ? $cl->{$_} || $cl->{''} || $DEFAULT_SSL_ARGS{'SSL_cipher_list'} || (next) : $cl))
2933 0 248 if (my $cl = $arg_hash->{'SSL_ciphersuites'})
2934 0 0 unless $can_ciphersuites
2939 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)
2946 6 242 if (keys %ctx > 1 or not exists $ctx{''})
2947 0 6 unless $can_server_sni
2953 4 15 unless defined $host
2954 0 19 unless (my $snictx = $ctx{lc $host} || $ctx{''})
2955 0 0 if $IO::Socket::SSL::DEBUG > 1
2959 0 19 if $IO::Socket::SSL::DEBUG > 1
2960 9 10 if $snictx != $ctx
2965 0 248 if (my $cb = $arg_hash->{'SSL_create_ctx_callback'})
2973 85 161 $self->{'verify_mode'} ? :
2 246 defined $arg_hash->{'SSL_ocsp_mode'} ? :
2975 0 248 if $IO::Socket::SSL::DEBUG >= 3
2977 0 248 if (my $cache = $arg_hash->{'SSL_session_cache'}) { }
3 245 elsif (my $size = $arg_hash->{'SSL_session_cache_size'}) { }
2985 0 248 if ($self->{'session_cache'} and %sess_cb)
2996 0 0 unless (my $key = $args->{'SSL_session_key'})
3000 0 0 if $IO::Socket::SSL::DEBUG >= 3
3006 0 0 if $IO::Socket::SSL::DEBUG >= 3
3023 246 5 if (my $ctx = $self->{'context'})
3024 0 246 if $IO::Socket::SSL::DEBUG >= 3
3025 246 0 if (not $use_threads or delete $CTX_CREATED_IN_THIS_THREAD{$ctx})
3027 86 160 if ($self->{'verify_mode'})
3028 0 86 if $IO::Socket::SSL::DEBUG >= 3
3031 0 246 if ($self->{'ocsp_error_ref'})
3032 0 0 if $IO::Socket::SSL::DEBUG >= 3
3035 0 246 if $IO::Socket::SSL::DEBUG >= 3
3055 0 3 unless $size > 0
3070 0 16 if $IO::Socket::SSL::DEBUG >= 3
3083 1 0 $key ? :
3087 3 0 if (not $session) { }
0 0 elsif ($v->[0] == $session) { }
3094 1 2 if $v == $head
3096 0 0 $key ? :
0 0 $session ? :
0 1 if $IO::Socket::SSL::DEBUG >= 3
3102 0 3 if $_->[0]
3111 3 13 if ($session)
3114 0 3 if $IO::Socket::SSL::DEBUG >= 3
3115 3 0 if $v->[0] == $session
3117 0 0 if $v == $shead
3120 12 4 if ($v)
3124 0 0 $session ? :
0 0 $v ? :
0 16 if $IO::Socket::SSL::DEBUG >= 3
3137 38 18 if ($$rhead) { }
3151 1 27 if ($self->{'room'} < 0)
3154 0 1 if $l->[0]
3166 0 32 unless $$rhead
3169 8 24 if ($v != $$rhead) { }
12 12 elsif ($v->[$inext] == $v) { }
3173 10 2 if ($inext == 4) { }
3192 0 0 if exists $v2i{$v}
3195 0 0 if $v == $self->{'ghead'}
3205 0 0 if $v == $self->{'ghead'}
3217 0 0 if $v == $shead
3228 6 1 if $v->[0]
3247 2 0 unless my $e = $self->{$id}
3249 0 0 if ($e->{'expire'} and time < $e->{'expire'})
3253 0 0 if ($e->{'nextUpdate'} and time < $e->{'nextUpdate'})
3265 0 2 if ($del > 0)
3287 2 2 unless (my $uri = &Net::SSLeay::P_X509_get_ocsp_uri($cert))
3288 0 2 if $IO::Socket::SSL::DEBUG > 2
3292 0 2 unless (my $certid = eval { do { &Net::SSLeay::OCSP_cert2ids($ssl, $cert) } })
3293 0 0 if $IO::Socket::SSL::DEBUG > 2
3297 2 0 if (not $done = $cache->get($certid)) { }
0 0 elsif ($done->{'hard_error'}) { }
0 0 elsif ($done->{'soft_error'}) { }
3314 0 2 unless %todo
3315 1 1 @soft_error ? :
3340 0 2 if not $todo or $self->{'error'}
3345 0 2 if (not $resp) { }
0 2 elsif (not eval { do { $resp = &Net::SSLeay::d2i_OCSP_RESPONSE($resp) } }) { }
0 2 elsif ((my $status = &Net::SSLeay::OCSP_response_status($resp)) != Net::SSLeay::OCSP_RESPONSE_STATUS_SUCCESSFUL()) { }
0 2 elsif (not eval { do { $req = &Net::SSLeay::d2i_OCSP_REQUEST($todo->{'req'}); &Net::SSLeay::OCSP_response_verify($self->{'ssl'}, $resp, $req) } }) { }
2 0 elsif (my(@result) = &Net::SSLeay::OCSP_response_results($resp, @{$$todo{'ids'};})) { }
3377 0 0 if ($@) { }
3385 0 0 unless @soft_error
3398 2 0 if ($rv->[2]) { }
3400 2 0 if (not $rv->[1]) { }
0 0 elsif ($rv->[2]{'statusType'} == Net::SSLeay::V_OCSP_CERTSTATUS_GOOD()) { }
3423 0 2 if (@miss and @found)
3430 0 0 if $IO::Socket::SSL::DEBUG >= 2
3442 2 0 if $req
3443 0 2 if ($self->{'failhard'})
3447 0 2 if (@soft_error)
3448 0 0 if $self->{'soft_error'}
3451 0 2 if (@hard_error) { }
2 0 elsif (not %{$self->{'todo'};}) { }
3464 0 2 unless eval { do { require HTTP::Tiny } }
3468 0 2 if $IO::Socket::SSL::DEBUG
3473 0 2 if $IO::Socket::SSL::DEBUG
3475 2 0 if defined $self->add_response($uri, $resp->{'success'} && $resp->{'content'})
3479 0 2 if $IO::Socket::SSL::DEBUG >= 2
3614 0 0 unless $IO::Socket::SSL::DEBUG >= 2
3623 0 0 if ($ssl_ver and $content_type != $trace_constants{'SSL3_RT_INNER_CONTENT_TYPE'})
3633 0 0 $ssl_ver == $trace_constants{'SSL3_VERSION_MAJOR'} && $content_type ? :
3638 0 0 if ($content_type == $trace_constants{'SSL3_RT_CHANGE_CIPHER_SPEC'}) { }
0 0 elsif ($content_type == $trace_constants{'SSL3_RT_ALERT'}) { }
3649 0 0 $direction ? :