Branch Coverage

blib/lib/Crypt/CBC.pm
Criterion Covered Total %
branch 97 194 50.0


line true false branch
17 0 15 if (ref $_[0] eq 'HASH') { }
13 2 elsif ($_[0] =~ /^-[a-zA-Z_]{1,20}$/) { }
41 0 15 if ($cipher_object_provided) { }
0 15 elsif (not defined $pass) { }
42 0 0 if defined $pass
53 0 15 if exists $$options{'prepend_iv'} and not $$options{'prepend_iv'}
54 0 15 if exists $$options{'add_header'} and not $$options{'add_header'}
56 0 15 unless $valid_modes{$header_mode}
58 0 15 if exists $$options{'salt'} and $header_mode ne 'salt'
62 0 15 unless $cipher
65 15 0 unless (ref $cipher)
66 0 15 $cipher =~ /^Crypt::/ ? :
67 0 15 unless $cipher->can('encrypt') or eval "require $cipher; 1"
69 5 10 unless $cipher->can('keysize')
84 5 0 $cipherclass =~ /blowfish/i ? :
91 0 15 if exists $$options{'literal_key'} and exists $$options{'regenerate_key'}
94 0 15 if $$options{'literal_key'}
95 0 15 if exists $$options{'regenerate_key'} and not $$options{'regenerate_key'}
99 15 0 unless defined $salt and $salt ne '1'
100 0 15 if defined $salt and length $salt != 8 and $salt ne '1'
104 15 0 unless defined $iv
105 0 15 if defined $iv and length $iv != $bs
111 0 15 if ($padding and ref $padding eq 'CODE') { }
115 0 0 unless $rbs == $bs
119 6 0 $padding eq 'standard' ? :
3 6 $padding eq 'oneandzeroes' ? :
3 9 $padding eq 'space' ? :
3 12 $padding eq 'null' ? :
128 15 0 if ($header_mode eq 'salt') { }
0 0 elsif ($header_mode eq 'randomiv') { }
0 0 elsif ($header_mode eq 'none') { }
129 0 15 if $$options{'literal_key'}
130 0 15 if exists $$options{'iv'}
133 0 0 unless $bs == 8 or $legacy_hack
136 0 0 unless exists $$options{'iv'}
140 0 15 if (defined $key and length $key != $ks)
145 0 15 if (defined $iv and length $iv != $bs)
197 0 870 unless $operation =~ /^[ed]/i
210 0 870 unless exists $$self{'buffer'}
215 870 0 unless ($$self{'civ'})
216 435 435 if $d
217 435 435 unless $d
225 129 741 unless length $$self{'buffer'} >= $bs
230 426 315 if ($d) { }
231 426 0 length $blocks[-1] < $bs ? :
233 315 0 if length $blocks[-1] < $bs
237 1758 1785 if ($d) { }
239 1758 0 unless $$self{'pcbc'}
243 0 3543 if $$self{'pcbc'}
253 870 0 defined $$self{'buffer'} ? :
258 435 435 if ($$self{'decrypt'}) { }
259 426 9 length $block ? :
261 426 9 if (length $block) { }
270 399 36 length $block ? :
289 0 435 if ($header_mode eq 'none') { }
435 0 elsif ($header_mode eq 'salt') { }
0 0 elsif ($header_mode eq 'randomiv') { }
290 0 0 unless exists $$self{'iv'}
298 0 435 unless defined $salt
308 0 0 unless defined $iv
309 0 0 unless $self->blocksize == 8 or $self->legacy_hack
321 0 435 unless $$self{'key'} and $$self{'civ'}
325 0 435 ref $$self{'cipher'} ? :
0 435 unless $$self{'crypt'} = ref $$self{'cipher'} ? $$self{'cipher'} : $$self{'cipher'}->new($$self{'key'})
338 0 435 if ($header_mode eq 'none') { }
435 0 elsif ($header_mode eq 'salt') { }
0 0 elsif ($header_mode eq 'randomiv') { }
339 0 0 unless exists $$self{'iv'}
346 435 0 if $$self{'make_random_salt'}
347 0 435 unless defined(my $salt = $$self{'salt'})
348 0 435 unless length $salt == 8
356 0 0 unless $blocksize == 8
359 0 0 if $$self{'make_random_iv'}
360 0 0 unless length $$self{'iv'} == 8
365 0 435 unless defined $$self{'key'} and defined $$self{'civ'}
367 0 435 ref $$self{'cipher'} ? :
0 435 unless $$self{'crypt'} = ref $$self{'cipher'} ? $$self{'cipher'} : $$self{'cipher'}->new($$self{'key'})
378 0 0 if $$self{'literal_key'}
391 0 870 unless length $salt == 8
410 0 0 unless my $bytes = shift @_
419 435 0 if (-r '/dev/urandom' and open F, '/dev/urandom') { }
430 324 24 length $b ? :
431 174 174 if ($decrypt eq 'd')
441 12 159 unless length $b
442 159 0 length $b ? :
443 84 75 if ($decrypt eq 'd')
452 12 159 unless length $b
453 159 0 length $b ? :
454 84 75 if ($decrypt eq 'd')
463 12 159 unless length $b
464 159 0 length $b ? :
465 84 75 if ($decrypt eq 'd')
482 0 0 unless length $iv == $bs
489 0 0 if @_
496 0 0 if @_
503 0 0 if @_
510 0 0 if (@_)