| 1 | package Net::SSH::Perl::Buffer; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 8 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 8 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 8 | ▶ | use constant MAX_BIGNUM => 2048; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | { | ||||||||||||||||||||||||||||||||||||||||||
| 8 | 7 | my %MP_MAP = ( | |||||||||||||||||||||||||||||||||||||||||
| 9 | SSH1 => [ "use Math::GMP;", \&_get_mp_int_ssh1, \&_put_mp_int_ssh1 ], | ||||||||||||||||||||||||||||||||||||||||||
| 10 | SSH2 => [ "1;", \&get_bignum2_bytes, \&put_bignum2_bytes], | ||||||||||||||||||||||||||||||||||||||||||
| 11 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | sub new { | ||||||||||||||||||||||||||||||||||||||||||
| 14 | 19 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 19 | my $buf = bless { buf => '', offset => 0 }, $class; | |||||||||||||||||||||||||||||||||||||||||
| 16 | 19 | my %param = @_; | |||||||||||||||||||||||||||||||||||||||||
| 17 | 19 | ▶ | my $mp = $MP_MAP{ $param{MP} || 'SSH1' }; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$param{'MP'} || 'SSH1'
MC/DC100%1/1
$param{'MP'} || 'SSH1'
$param{'MP'}
Truth table100%2/2
A
A= $param{'MP'}
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 19 | ▶ | die "Unrecognized SSH protocol $param{MP}" unless $mp; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 19 | ▶ | eval $mp->[0]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 19 | $buf->{_get_mp_int} = $mp->[1]; | |||||||||||||||||||||||||||||||||||||||||
| 21 | 19 | $buf->{_put_mp_int} = $mp->[2]; | |||||||||||||||||||||||||||||||||||||||||
| 22 | 19 | $buf; | |||||||||||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 7 | sub empty { | |||||||||||||||||||||||||||||||||||||||||
| 27 | 3 | ▶ | my $buf = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
empty: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 3 | $buf->{buf} = ""; | |||||||||||||||||||||||||||||||||||||||||
| 29 | 3 | $buf->{offset} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | sub append { | ||||||||||||||||||||||||||||||||||||||||||
| 33 | 11 | ▶ | my $buf = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
append: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 11 | $buf->{buf} .= $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | sub consume { | ||||||||||||||||||||||||||||||||||||||||||
| 38 | 1 | ▶ | my $buf = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
consume: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | 1 | my $len = shift; | |||||||||||||||||||||||||||||||||||||||||
| 40 | 1 | substr $buf->{buf}, 0, $len, ''; | |||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | sub bytes { | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 80 | ▶ | my $buf = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bytes: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | 80 | my($off, $len, $rep) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 46 | 80 | ▶ | $off ||= 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$off ||= 0
MC/DC100%1/1
$off ||= 0
$off
Truth table100%2/2
A
A= $off
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 80 | ▶ | $len = length $buf->{buf} unless defined $len; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | return defined $rep ? | ||||||||||||||||||||||||||||||||||||||||||
| 49 | substr($buf->{buf}, $off, $len, $rep) : | ||||||||||||||||||||||||||||||||||||||||||
| 50 | 80 | ▶ | substr($buf->{buf}, $off, $len); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | 39 | ▶ | sub length { length $_[0]->{buf} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
length: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | 3 | ▶ | sub offset { $_[0]->{offset} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
offset: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | sub dump { | ||||||||||||||||||||||||||||||||||||||||||
| 57 | 4 | ▶ | my $buf = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dump: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | 4 | my @r; | |||||||||||||||||||||||||||||||||||||||||
| 59 | 4 | for my $c (split //, $buf->bytes(@_)) { | |||||||||||||||||||||||||||||||||||||||||
| 60 | 4 | push @r, sprintf "%02x", ord $c; | |||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||
| 62 | 4 | join ' ', @r | |||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | sub insert_padding { | ||||||||||||||||||||||||||||||||||||||||||
| 66 | 6 | ▶ | my $buf = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
insert_padding: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 6 | my $pad = 8 - ($buf->length + 4 - 8) % 8; | |||||||||||||||||||||||||||||||||||||||||
| 68 | 6 | my $junk = join '', map chr rand 128, 0..$pad-1; | |||||||||||||||||||||||||||||||||||||||||
| 69 | 6 | $buf->bytes(0, 0, $junk); | |||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | sub get_int8 { | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 2 | ▶ | my $buf = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_int8: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | 2 | ▶ | my $off = defined $_[0] ? shift : $buf->{offset}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | 2 | $buf->{offset} += 1; | |||||||||||||||||||||||||||||||||||||||||
| 76 | 2 | unpack "c", $buf->bytes($off, 1); | |||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | sub put_int8 { | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 7 | ▶ | my $buf = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
put_int8: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 7 | $buf->{buf} .= pack "c", $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | sub get_int16 { | ||||||||||||||||||||||||||||||||||||||||||
| 85 | 1 | ▶ | my $buf = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_int16: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 1 | ▶ | my $off = defined $_[0] ? shift : $buf->{offset}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | 1 | $buf->{offset} += 2; | |||||||||||||||||||||||||||||||||||||||||
| 88 | 1 | unpack "n", $buf->bytes($off, 2); | |||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | sub put_int16 { | ||||||||||||||||||||||||||||||||||||||||||
| 92 | 2 | ▶ | my $buf = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
put_int16: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 93 | 2 | $buf->{buf} .= pack "n", $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | sub get_int32 { | ||||||||||||||||||||||||||||||||||||||||||
| 97 | 5 | ▶ | my $buf = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_int32: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | 5 | ▶ | my $off = defined $_[0] ? shift : $buf->{offset}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | 5 | $buf->{offset} += 4; | |||||||||||||||||||||||||||||||||||||||||
| 100 | 5 | unpack "N", $buf->bytes($off, 4); | |||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | sub put_int32 { | ||||||||||||||||||||||||||||||||||||||||||
| 104 | 15 | ▶ | my $buf = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
put_int32: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | 15 | $buf->{buf} .= pack "N", $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | sub get_char { | ||||||||||||||||||||||||||||||||||||||||||
| 109 | 1 | ▶ | my $buf = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_char: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | 1 | ▶ | my $off = defined $_[0] ? shift : $buf->{offset}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | 1 | $buf->{offset}++; | |||||||||||||||||||||||||||||||||||||||||
| 112 | 1 | $buf->bytes($off, 1); | |||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | sub put_char { | ||||||||||||||||||||||||||||||||||||||||||
| 116 | 7 | ▶ | my $buf = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
put_char: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | 7 | $buf->{buf} .= $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||
| 119 | 7 | *put_chars = \&put_char; | |||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | sub get_str { | ||||||||||||||||||||||||||||||||||||||||||
| 122 | 4 | ▶ | my $buf = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_str: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | 4 | ▶ | my $off = defined $_[0] ? shift : $buf->{offset}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 124 | 4 | my $len = $buf->get_int32; | |||||||||||||||||||||||||||||||||||||||||
| 125 | 4 | $buf->{offset} += $len; | |||||||||||||||||||||||||||||||||||||||||
| 126 | 4 | $buf->bytes($off+4, $len); | |||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | sub put_str { | ||||||||||||||||||||||||||||||||||||||||||
| 130 | 4 | ▶ | my $buf = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
put_str: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | 4 | my $str = shift; | |||||||||||||||||||||||||||||||||||||||||
| 132 | 4 | ▶ | $str = "" unless defined $str; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | 4 | $buf->put_int32(CORE::length($str)); | |||||||||||||||||||||||||||||||||||||||||
| 134 | 4 | $buf->{buf} .= $str; | |||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | 1 | ▶ | sub get_mp_int { $_[0]->{_get_mp_int}->(@_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_mp_int: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 138 | 1 | ▶ | sub put_mp_int { $_[0]->{_put_mp_int}->(@_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
put_mp_int: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | sub _get_mp_int_ssh1 { | ||||||||||||||||||||||||||||||||||||||||||
| 141 | 1 | ▶ | my $buf = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_mp_int_ssh1: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | 1 | ▶ | my $off = defined $_[0] ? shift : $buf->{offset}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 143 | 1 | my $bits = unpack "n", $buf->bytes($off, 2); | |||||||||||||||||||||||||||||||||||||||||
| 144 | 1 | my $bytes = int(($bits + 7) / 8); | |||||||||||||||||||||||||||||||||||||||||
| 145 | 1 | my $hex = join '', map { sprintf "%02x", ord } split //, | |||||||||||||||||||||||||||||||||||||||||
| 146 | $buf->bytes($off+2, $bytes); | ||||||||||||||||||||||||||||||||||||||||||
| 147 | 1 | $buf->{offset} += 2 + $bytes; | |||||||||||||||||||||||||||||||||||||||||
| 148 | 1 | Math::GMP->new("0x$hex"); | |||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | sub _put_mp_int_ssh1 { | ||||||||||||||||||||||||||||||||||||||||||
| 152 | 1 | ▶ | my $buf = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_put_mp_int_ssh1: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 153 | 1 | my $int = shift; | |||||||||||||||||||||||||||||||||||||||||
| 154 | 1 | my $bits = Math::GMP::sizeinbase_gmp($int, 2); | |||||||||||||||||||||||||||||||||||||||||
| 155 | 1 | my $hex_size = Math::GMP::sizeinbase_gmp($int, 16); | |||||||||||||||||||||||||||||||||||||||||
| 156 | 1 | my $tmp = Math::GMP::get_str_gmp($int, 16); | |||||||||||||||||||||||||||||||||||||||||
| 157 | 1 | ▶ | $tmp = "0$tmp" if CORE::length($tmp) % 2; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | 1 | $tmp =~ s/(..)/ chr hex $1 /ge; | |||||||||||||||||||||||||||||||||||||||||
| 159 | 1 | $buf->put_int16($bits); | |||||||||||||||||||||||||||||||||||||||||
| 160 | 1 | $buf->put_chars($tmp); | |||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | sub put_bignum2_bytes { | ||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | ▶ | my $buf = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
put_bignum2_bytes: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | my $num = shift; | |||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | # skip leading zero bytes | ||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | substr($num,0,1,'') while ord(substr($num,0,1)) == 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | # prepend a zero byte if mosting significant bit is set | ||||||||||||||||||||||||||||||||||||||||||
| 171 | # (to avoid interpretation as a negative number) | ||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | $num = "\0" . $num | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 173 | if (ord(substr($num,0,1))) & 0x80; | ||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | $buf->put_str($num); | |||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | sub get_bignum2_bytes { | ||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | ▶ | my $buf = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_bignum2_bytes: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | my $num = $buf->get_str; | |||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | my $len = CORE::length($num); | |||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | return unless $len; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 183 | # refuse negative (MSB set) bignums | ||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | ▶ | return if ord(substr($num,0,1)) & 0x80; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 185 | # refuse overlong bignums, allow prepended \0 to avoid MSB set | ||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | return if $len > MAX_BIGNUM+1 || | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$len > 2049 or $len == 2049 and ord substr($num, 0, 1) != 0
$len == 2049 and ord substr($num, 0, 1) != 0
MC/DC0%0/3
$len > 2049 or $len == 2049 and ord substr($num, 0, 1) != 0
$len > 2049
$len == 2049
ord substr($num, 0, 1) != 0
Truth table0%0/4
A or B and C
A= $len > 2049B= $len == 2049C= ord substr($num, 0, 1) != 0
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | ($len == MAX_BIGNUM+1 && | ||||||||||||||||||||||||||||||||||||||||||
| 188 | ord(substr($num,0,1)) != 0); | ||||||||||||||||||||||||||||||||||||||||||
| 189 | # trim leading zero bytes | ||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | substr($num,0,1,'') while ord(substr($num,0,1)) == 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | return $num; | |||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | 7 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 195 | __END__ | ||||||||||||||||||||||||||||||||||||||||||