Condition Coverage

blib/lib/IO/Socket/SSL.pm
Criterion Covered Total %
condition 308 534 57.6


and 2 conditions

line l !l condition
1455 0 0 do { *$self }->{'_SSL_object'} && 1
1611 0 0 bless $socket, $original_class and return
2122 1 0 $check_partial_chain && 1
2868 164 84 ($verify_cb || @accept_fp) && sub { my($ok, $ctx_store) = @_; my($certname, $cert, $error, $depth); if ($ctx_store) { $cert = &Net::SSLeay::X509_STORE_CTX_get_current_cert($ctx_store); $error = &Net::SSLeay::X509_STORE_CTX_get_error($ctx_store); $depth = &Net::SSLeay::X509_STORE_CTX_get_error_depth($ctx_store); $certname = &Net::SSLeay::X509_NAME_oneline(scalar &Net::SSLeay::X509_get_issuer_name($cert)) . &Net::SSLeay::X509_NAME_oneline(scalar &Net::SSLeay::X509_get_subject_name($cert)); $error &&= &Net::SSLeay::ERR_error_string($error); } ; DEBUG("ok=$ok [$depth] $certname") if $IO::Socket::SSL::DEBUG >= 3; $ok = &$verify_cb($ok, $ctx_store, $certname, $error, $cert, $depth) if $verify_cb; $ok = &$verify_fingerprint($ok, $cert, $depth) if $verify_fingerprint and $cert; return $ok; }

and 3 conditions

line !l l&&!r l&&r condition
87 0 0 80 defined &Net::SSLeay::P_next_proto_negotiated && !&Net::SSLeay::constant('LIBRESSL_VERSION_NUMBER')
92 0 0 80 defined &Net::SSLeay::CTX_set_tmp_ecdh && ($openssl_version != 268439631 || length pack('P', 0) == 4)
105 0 0 80 $can_ecdh && $openssl_version >= 268443648
107 0 0 80 defined &Net::SSLeay::OCSP_cert2ids && ($netssleay_version < 1.75 || $netssleay_version > 1.77)
110 0 0 80 $can_ocsp && defined &Net::SSLeay::set_tlsext_status_type
112 0 0 80 defined &Net::SSLeay::CTX_set_tlsext_ticket_getkey_cb && $netssleay_version >= 1.8
120 80 0 0 $session_upref and defined &Net::SSLeay::CTX_sess_set_new_cb
80 0 0 $session_upref and defined &Net::SSLeay::CTX_sess_set_new_cb and defined &Net::SSLeay::CTX_sess_set_remove_cb
129 80 0 0 defined &Net::SSLeay::CTX_get0_param && eval { do { Net::SSLeay::X509_V_FLAG_PARTIAL_CHAIN() } }
596 45 0 0 not %default_ca and do { local $SIG{'__DIE__'}; eval { do { require Mozilla::CA; 1 } } }
702 0 0 68 $IOCLASS eq 'IO::Socket::IP' and not defined $arg_hash->{'GetAddrInfoFlags'}
707 104 0 2 defined $blocking and not $blocking
773 62 0 12 defined $sh and not $sh
867 160 4 8 $ctx->{'session_cache'} and my $session = $ctx->{'session_cache'}->get_session($arg_hash->{'SSL_session_key'})
880 159 0 17 defined $timeout and $timeout > 0
159 0 17 defined $timeout and $timeout > 0 and $self->blocking(0)
890 159 0 17 defined $timeout && time
986 0 132 12 not %sess_cb and $ctx->{'session_cache'}
132 0 12 not %sess_cb and $ctx->{'session_cache'} and my $session = &Net::SSLeay::get1_session($ssl)
1037 42 0 16 defined $sh and not $sh
1056 71 9 42 @_ && UNIVERSAL::isa($_[0], 'IO::Handle')
1094 108 0 14 defined $timeout and $timeout > 0
108 0 14 defined $timeout and $timeout > 0 and $socket->blocking(0)
1103 108 0 14 defined $timeout && time
1269 51 0 0 not $written and $errs
1393 20 0 44 $pending and (my $pb = &Net::SSLeay::peek($ssl, $pending)) ne ''
1427 3 39 2 $eod and $delim1 eq '' || $eod < length $buf
1479 92 20 41 $status & 1 and $status & 2 || $stop_args->{'SSL_fast_shutdown'}
1580 0 0 0 $ctx_object && $ctx_object->{'context'}
1632 36 0 0 not $was_blocking and $socket->can('blocking')
1672 0 4 0 @chain and not $self->peer_certificate
1713 82 0 0 $reload and do { *$self }->{'_SSL_certificate'}
1895 106 89 116 $wtyp eq 'anywhere' and $name =~ /^([a-zA-Z0-9_\-]*)\*(.+)/
99 70 26 $wtyp =~ /^(?:full_label|leftmost)$/ and $name =~ /^\*(\..+)$/
1896 82 30 4 $1 ne '' and substr($identity, 0, 4) eq 'xn--'
1919 263 6 13 $ipn and $type == GEN_IPADD()
6 47 216 not $ipn and $type == GEN_DNS()
1932 0 14 91 $scheme->{'check_cn'} eq 'when_only' and not $alt_dnsNames
2030 0 0 44 ref $self && do { *$self }->{'_SSL_last_err'}
2038 42 0 1 defined $error_trap and ref $error_trap eq 'CODE'
2074 51 3 17 not ref $self and $CURRENT_SSL_OBJECT
2228 1 4 0 IO::Handle::opened($self) && do { *$self }->{'_SSL_opened'}
2328 2 0 24 $ctx->isa('IO::Socket::SSL::SSL_Context') and $ctx->{'context'}
2340 91 153 6 not $is_server || defined $arg_hash->{'SSL_use_cert'} and grep {$arg_hash->{$_};} 'SSL_cert', 'SSL_cert_file'
244 0 6 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'
2370 1707 293 0 defined $arg_hash->{$_} and $arg_hash->{$_} eq ''
2393 89 77 84 not $is_server and $verify_mode & 1
166 42 42 not $is_server and $verify_mode & 1 and !$vcn_scheme || $vcn_scheme ne 'none'
2409 42 13 29 not $vcn_scheme and $host =~ /^[\d.]+$|:/
2437 89 0 0 $arg_hash->{'SSL_ticket_keycb'} and not $can_tckt_keycb
2455 250 0 0 $ver and $v ne $ver
2518 8 235 19 $ver eq 'SSLv23' and not $ssl_op & $SSL_OP_NO{'SSLv3'}
2534 159 94 9 $arg_hash->{'SSL_server'} and my $id = $arg_hash->{'SSL_session_id_context'} || $arg_hash->{'SSL_verify_mode'} & 1 && "$ctx"
2586 107 0 0 ref $file eq 'SCALAR' and not $$file
2588 107 0 0 ref $dir eq 'SCALAR' and not $$dir
2598 32 75 0 $file || $dir and not &Net::SSLeay::CTX_load_verify_locations($ctx, scalar($file || ''), scalar($dir || ''))
2608 155 0 0 not &Net::SSLeay::CTX_load_verify_locations($ctx, scalar($ca{'SSL_ca_file'} || ''), scalar($dir || '')) and $verify_mode != $Net_SSLeay_VERIFY_NONE
2616 159 94 9 $is_server and $verify_mode & $Net_SSLeay_VERIFY_PEER
2686 1 0 1 not $cert and $arg_hash->{'SSL_passwd_cb'}
0 0 1 not $cert and $arg_hash->{'SSL_passwd_cb'} and defined(my $pw = $arg_hash->{'SSL_passwd_cb'}->(0))
2702 0 2 0 $key and not &Net::SSLeay::CTX_use_PrivateKey($ctx, $key)
2742 105 159 0 not $is_server and $can_pha
264 0 0 not $is_server and $can_pha and $havecert
159 0 0 not $is_server and $can_pha and $havecert and $havekey
2776 0 103 0 $arg_hash->{'SSL_server'} and $curve eq 'auto'
2834 239 0 9 @accept_fp && do { my $fail; sub { my($ok, $cert, $depth) = @_; $fail = 1 unless $ok; return 1 if $depth > 0; my %fp; foreach $_ (@accept_fp) { my $fp = ($fp{join $;, $_->[0], $_->[1]} ||= $_->[1] ? &Net::SSLeay::X509_pubkey_digest($cert, scalar &$algo2digest($_->[0])) : &Net::SSLeay::X509_digest($cert, scalar &$algo2digest($_->[0]))); next if $fp ne $_->[2]; return 1; } ; return !$fail; } }
2862 164 0 19 $error &&= &Net::SSLeay::ERR_error_string($error)
2887 89 0 159 not $is_server and $can_ocsp_staple
89 9 150 not $is_server and $can_ocsp_staple and not $verify_fingerprint
2935 0 2 2 $status and $status->[2]
2960 0 0 1 @results and $chain[0] == $iossl->peer_certificate
3020 245 3 0 $self->{'session_cache'} and %sess_cb
3161 4 12 0 $v && $v->[0]
3282 0 0 0 $e->{'expire'} and time < $e->{'expire'}
3286 0 0 0 $e->{'nextUpdate'} and time < $e->{'nextUpdate'}
3456 3 0 0 @miss and @found
3508 0 0 3 $resp->{'success'} && $resp->{'content'}

or 2 conditions

line l !l condition
151 0 0 eval { do { Net::SSLeay::MODE_AUTO_RETRY() } } || 4
424 80 0 eval { do { require Socket; 'Socket'->VERSION(1.95); die unless Socket::inet_pton(10, '::1') and 10; 'Socket'->import('inet_pton', 'NI_NUMERICHOST', 'NI_NUMERICSERV'); *_getnameinfo = sub { return unless my($err, $host, $port) = Socket::getnameinfo(@_); return if $err; return $host, $port; } ; 'Socket' } } || eval { do { require Socket6; die unless Socket6::inet_pton(10, '::1') and 10; 'Socket6'->import('inet_pton', 'NI_NUMERICHOST', 'NI_NUMERICSERV'); *_getnameinfo = sub { return Socket6::getnameinfo(@_); } ; 'Socket6' } } || undef
502 0 240 UNIVERSAL::can('Net::SSLeay', $name) || sub { $value; }
714 0 269 $arg_hash->{'Proto'} ||= 'tcp'
717 18 172 $arg_hash->{'Listen'} || 0
745 60 0 $! ||= 11
754 74 0 shift() || (return _invalid_object())
781 0 174 $_[0] || {}
797 172 0 &Net::SSLeay::new($ctx->{'context'}) || (return $self->error('SSL structure creation failed'))
929 1 0 $! ||= 110
1025 58 0 shift() || (return _invalid_object())
1026 0 58 shift() || 'IO::Socket::SSL'
1032 58 0 $self->SUPER::accept($class) || (return)
1057 0 113 $_[0] || {}
1077 119 0 &Net::SSLeay::new(do { *$socket }->{'_SSL_ctx'}{'context'}) || (return $socket->error('SSL structure creation failed'))
1136 1 0 $! ||= 110
1184 6105 0 do { *$self }->{'_SSL_object'} || (return)
1206 11 6093 $offset ||= 0
1253 31841 0 do { *$self }->{'_SSL_object'} || (return)
1258 2 31839 $offset ||= 0
1278 2 0 $! ||= 32
1310 0 49 $, || ''
0 49 $\ || ''
1436 247 0 shift() || (return _invalid_object())
1459 291 0 shift() || (return _invalid_object())
1486 104 0 do { *$self }->{'_SSL_opened'} || 0
1590 1 0 (shift())->_get_ssl_object || (return)
1651 1 0 $IO::Socket::SSL::ISA[0]->new_from_fd($fd, '+<') || (return $class->error('Could not create socket from file descriptor.'))
1662 1 0 (shift())->_get_ssl_object || (return)
1670 4 0 $self->_get_ssl_object || (return)
1730 6 0 $self->_get_ssl_object || (return)
1731 6 0 &Net::SSLeay::get_certificate($ssl) || (return)
1837 161 13 shift() || 'default'
1884 301 10 $wtyp ||= ''
1970 9 0 $algo || 'sha256'
14 0 $algo || 'sha256'
1977 21 2 $algo ||= 'sha256'
1983 12 0 (shift())->_get_ssl_object || (return)
1988 28 0 (shift())->_get_ssl_object || (return)
2002 0 0 (shift())->_get_ssl_object || (return)
2007 3 0 (shift())->_get_ssl_object || (return)
2015 2 0 $self->_get_ssl_object || (return)
2031 0 0 $IO::Socket::SSL::SSL_ERROR || ''
2056 0 1 Net::SSLeay::print_errs('SSL error: ') || ''
2215 2 0 $self->_get_ssl_object || (return)
2222 2 0 $self->_get_ssl_object || (return)
2351 0 32 undef $arg_hash->{'SSL_ca_path'} ||= undef
2353 0 0 $arg_hash->{'SSL_ca_file'} ||= undef
2354 0 61 $arg_hash->{'SSL_ca_path'} ||= undef
2379 87 163 $arg_hash->{'SSL_verify_mode'} || 0
2382 22 152 $arg_hash->{$_} || (next)
2598 75 0 $file || ''
0 75 $dir || ''
2608 22 133 $ca{'SSL_ca_file'} || ''
133 22 $dir || ''
2749 0 0 &Net::SSLeay::BIO_new_file($f, 'r') || (return 'IO::Socket::SSL'->error("Failed to open DH file $f"))
2800 89 0 &Net::SSLeay::OBJ_txt2nid($curve) || (return 'IO::Socket::SSL'->error("cannot find NID for curve name '${curve}'"))
2831 1 10 $pubkey || ''
2974 0 0 $cl->{$_} || $cl->{''} || $DEFAULT_SSL_ARGS{'SSL_cipher_list'} || (next)
3131 0 0 ~~@del || 'none'
3274 0 2 $size || 100
3347 0 0 $hard_error ||= ''

or 3 conditions

line l !l&&r !l&&!r condition
568 0 45 0 $openssldir ||= &Net::SSLeay::SSLeay_version(5) =~ /^OPENSSLDIR: "(.+)"$/ ? $1 : (&Net::SSLeay::SSLeay_version(4) =~ /^OPENSSLDIR: "(.+)"$/ ? $1 : 'cannot-determine-openssldir-from-ssleay-version')
575 0 45 0 $ENV{'SSL_CERT_DIR'} || ($^O =~ /vms/i ? 'SSLCERTS:' : "$openssldir/certs")
587 0 45 0 $ENV{'SSL_CERT_FILE'} || ($^O =~ /vms/i ? 'SSLCERTS:cert.pem' : "$openssldir/cert.pem")
621 0 0 0 UNIVERSAL::isa($class, 'IO::Socket::INET6') or UNIVERSAL::isa($class, 'IO::Socket::IP')
696 68 0 44 $arg_hash->{'Domain'} || $arg_hash->{'Family'}
0 68 44 $arg_hash->{$family_key} ||= $arg_hash->{'Domain'} || $arg_hash->{'Family'}
803 6 6 0 $arg_hash->{'SSL_session_key'} ||= do { my $host = $arg_hash->{'PeerAddr'} || $arg_hash->{'PeerHost'} || $self->_update_peer; my $port = $arg_hash->{'PeerPort'} || $arg_hash->{'PeerService'}; $port ? "${host}:$port" : $host }
805 5 1 0 $arg_hash->{'PeerAddr'} || $arg_hash->{'PeerHost'} || $self->_update_peer
806 1 5 0 $arg_hash->{'PeerPort'} || $arg_hash->{'PeerService'}
816 2 60 87 $arg_hash->{'PeerAddr'} || $arg_hash->{'PeerHost'}
824 62 0 0 not $host =~ /[a-z_]/i or $host =~ /:/
841 2 75 95 $arg_hash->{'PeerAddr'} or $arg_hash->{'PeerHost'}
845 42 13 42 $arg_hash->{'SSL_verifycn_name'} || $arg_hash->{'SSL_hostname'}
847 21 21 0 $arg_hash->{'PeerAddr'} || $arg_hash->{'PeerHost'}
874 172 4 0 $ssl ||= do { *$self }->{'_SSL_object'}
961 143 2 0 $ctx ||= do { *$self }->{'_SSL_ctx'}
1086 119 3 0 $ssl ||= do { *$socket }->{'_SSL_object'}
1257 31789 52 0 $length ||= $buf_len
1328 2 6 62 not defined $/ or wantarray
1336 0 0 0 $! == 11 or $! == 11
1366 0 0 0 $! == 11 or $! == 11
1385 1 20 44 not defined $poke or $poke eq ''
1427 40 1 0 $delim1 eq '' || $eod < length $buf
1479 10 39 12 $status & 2 || $stop_args->{'SSL_fast_shutdown'}
1546 0 44 51 $downgrade or not defined $downgrade
1572 224 0 0 do { *$self }->{'_SSL_object'} || 'IO::Socket::SSL'->_internal_error('Undefined SSL object', 9)
1618 151 0 4 not defined $start_handshake or $start_handshake
1715 45 37 0 do { *$self }->{'_SSL_certificate'} ||= &Net::SSLeay::get_peer_certificate($ssl)
1841 174 0 0 $scheme{$scheme} || croak("scheme $scheme not defined")
1866 0 3 12 4 != @ip or 4 != grep({$_ < 256 if defined $_;} @ip)
1932 20 91 14 $scheme->{'check_cn'} eq 'always' or $scheme->{'check_cn'} eq 'when_only' and not $alt_dnsNames
1961 0 8 0 do { *$self }->{'_SSL_servername'} ||= do { return unless my $ssl = $self->_get_ssl_object; &Net::SSLeay::get_servername($ssl) }
1969 2 21 0 $cert ||= $self->peer_certificate
2022 1 1 0 $ctx->{'ocsp_cache'} ||= 'IO::Socket::SSL::OCSP_Cache'->new
2038 34 0 8 do { *$self }->{'_SSL_ioclass_upgraded'} or do { *$self }->{'_SSL_arguments'}{'SSL_keepSocketOnError'}
2077 41 4 23 not $oe or $oe->[1] <= $severity
2128 196 0 0 not $use_threads or delete $CREATED_IN_THIS_THREAD{$ssl}
2340 89 2 159 $is_server || defined $arg_hash->{'SSL_use_cert'}
2351 0 0 32 $arg_hash->{'SSL_ca_file'} ||= (undef $arg_hash->{'SSL_ca_path'} ||= undef)
2362 2699 1544 0 defined $arg_hash->{$_} or delete $arg_hash->{$_}
2393 42 42 0 !$vcn_scheme || $vcn_scheme ne 'none'
2408 84 0 0 $verify_name || ref $vcn_scheme && $vcn_scheme->{'callback'} && 'unknown'
2451 683 27 0 $2 || $3
2534 0 9 94 $arg_hash->{'SSL_session_id_context'} || $arg_hash->{'SSL_verify_mode'} & 1 && "$ctx"
2582 32 75 155 $arg_hash->{'SSL_ca'} or defined $arg_hash->{'SSL_ca_file'}
107 0 155 $arg_hash->{'SSL_ca'} or defined $arg_hash->{'SSL_ca_file'} or defined $arg_hash->{'SSL_ca_path'}
2598 75 0 32 $file || $dir
2723 153 2 109 not $havecert or $havekey
80 1 0 $arg_hash->{'SSL_key_file'} || ($havecert eq 'PEM' ? $arg_hash->{'SSL_cert_file'} : undef)
2824 11 0 0 $algo ||= length $digest == 32 ? 'md5' : (length $digest == 40 ? 'sha1' : (length $digest == 64 ? 'sha256' : (return 'IO::Socket::SSL'->_internal_error("cannot detect hash algorithm from fingerprint '${_}'", 9))))
2843 1 12 0 $fp{join $;, $_->[0], $_->[1]} ||= $_->[1] ? &Net::SSLeay::X509_pubkey_digest($cert, scalar &$algo2digest($_->[0])) : &Net::SSLeay::X509_digest($cert, scalar &$algo2digest($_->[0]))
2980 248 0 0 $ctx{''} || (values %ctx)[0]
2981 6 0 242 keys %ctx > 1 or not exists $ctx{''}
2989 13 6 0 $ctx{lc $host} || $ctx{''}
3026 0 0 0 $SSL_OBJECT{$ssl} || do { warn "callback session new: no known SSL object for $ssl"; return }
3060 246 0 0 not $use_threads or delete $CTX_CREATED_IN_THIS_THREAD{$ctx}
3373 0 0 3 not $todo or $self->{'error'}