blib/lib/Crypt/Mac.pm

filter: Statementstmt 97.0% 33 / 34 Branchbran 83.3% 10 / 12 Conditioncond 83.3% 5 / 6 MC/DCmcdc 75.0% 3 / 4 Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 88.8% 56 / 63 CC 9 SCAR 18.3
CC
9
Cov
92%
addfile
9.0
CLONE_SKIP
2.0
BEGIN
1.0
CRAP 6.2
« blib/lib/Crypt/Misc.pm ↑ Summary blib/lib/Crypt/Digest/SHAKE.pm »
1 package Crypt::Mac;
2  
3 16 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 16 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 16 our $VERSION = '0.091';
6  
7 16 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 16 $Carp::Internal{(__PACKAGE__)}++;
9 16 ▶use CryptX;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 3 ▶sub addfile {
Subroutine addfile: called CC=9 SCAR=22.0
Pod undocumented
12 3 my ($self, $file) = @_;
13  
14 3 my ($handle, $close_handle);
15 3 ▶ if (ref($file) && eval { defined fileno($file) }) {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $file and eval { do { defined fileno $file } }) { } 1 2 3
elsif (defined $file and not ref $file) { } 1 1 2
Condition100%3/3
ref $file and eval { do { defined fileno $file } }
!ll&&!rl&&r
111
MC/DC100%2/2
ref $file and eval { do { defined fileno $file } }
ref $file eval { do { defined fileno $file } }
Truth table100%3/3
A and B
A= ref $fileB= eval { do { defined fileno $file } }
ABresult
0X0
100
111
16 1 $handle = $file;
17 }
18 ▶ elsif (defined($file) && !ref($file)) {
Condition66%2/3
defined $file and not ref $file
!ll&&!rl&&r
011
MC/DC50%1/2
defined $file and not ref $file
defined $file not ref $file
Truth table66%2/3
A and not(B)
A= defined $fileB= not ref $file
ABresult
0X0
100
111
19 1 ▶ open($handle, "<", $file) || croak "FATAL: cannot open '$file': $!";
Branch: 1 branch
BranchTrueFalseTotal
open $handle, "<", $file or croak("FATAL: cannot open '${file}': $!") 1 0 1
20 1 binmode($handle);
21 1 $close_handle = 1;
22 }
23 else {
24 1 croak "FATAL: invalid handle";
25 }
26  
27 2 my $n;
28 2 my $buf = "";
29 {
30 2 local $SIG{__DIE__} = \&CryptX::_croak;
31 2 ▶ while (($n = read($handle, $buf, 32*1024))) {
Branch: 1 branch
BranchTrueFalseTotal
if ($n = read($handle, $buf, 32768)) 2 2 4
32 2 $self->add($buf);
33 }
34 2 ▶ croak "FATAL: read failed: $!" unless defined $n;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $n 0 2 2
35 }
36 2 ▶ close($handle) if $close_handle;
Branch: 1 branch
BranchTrueFalseTotal
if $close_handle 1 1 2
37  
38 2 return $self;
39 }
40  
41 0 ▶sub CLONE_SKIP { 1 } # prevent cloning
Subroutine CLONE_SKIP: not called CC=1 SCAR=6.9
42  
43 16 1;
44  
45 =pod
46  
47 =head1 NAME
48  
49 Crypt::Mac - [internal only]
50  
51 =head1 SYNOPSIS
52  
53 Do not use this module directly.
54  
55 Use a concrete MAC module instead.
56  
57 =head1 SEE ALSO
58  
59 =over
60  
61 =item * L<CryptX>
62  
63 =item * L<Crypt::Mac::HMAC>, L<Crypt::Mac::Poly1305>, L<Crypt::Mac::BLAKE2b>, L<Crypt::Mac::BLAKE2s>
64  
65 =item * L<Crypt::Mac::OMAC>, L<Crypt::Mac::PMAC>, L<Crypt::Mac::XCBC>, L<Crypt::Mac::F9>, L<Crypt::Mac::Pelican>
66  
67 =back
68  
69 =cut
« blib/lib/Crypt/Misc.pm ↑ Summary blib/lib/Crypt/Digest/SHAKE.pm »