Branch Coverage

blib/lib/Crypt/PKCS11/Easy.pm
Criterion Covered Total %
branch 1 136 0.7


line true false branch
199 2 0 unless $pkcs11->load($self->_module)
203 0 0 unless $pkcs11->Initialize
214 0 0 unless ($self->has_key)
237 0 0 if ($self->has_token)
242 0 0 unless my $slot_ids = $self->_pkcs11->GetSlotList(1)
245 0 0 if (scalar @$slot_ids > 1)
261 0 0 if ($self->rw) { }
269 0 0 unless my $session = $self->_pkcs11->OpenSession($self->slot, $flags)
282 0 0 if ($_ =~ /^(firmware|hardware|library|cryptoki)Version$/u)
288 0 0 if ref $h->{$_}
293 0 0 if length $h->{$_} == 0
303 0 0 unless my $info = $self->_pkcs11->GetInfo
316 0 0 unless my $token = $self->_pkcs11->GetTokenInfo($slot_id)
324 0 0 $token->{'flags'} & $f ? :
336 0 0 unless (defined $arg{'id'} or defined $arg{'token'})
342 0 0 if (defined $arg{'id'}) { }
0 0 elsif ($arg{'token'}) { }
346 0 0 unless $slot = $self->_pkcs11->GetSlotInfo($arg{'id'})
356 0 0 if ($_->{'token'}{'label'} and $arg{'token'} eq $_->{'token'}{'label'})
362 0 0 unless $slot
372 0 0 $slot->{'flags'} & $f ? :
377 0 0 if ($slot->{'flag'}{'token_present'})
387 0 0 if ($self->_has_session) { }
390 0 0 unless $session = $self->_pkcs11->OpenSession($slot_id, 4)
408 0 0 unless my $slot_ids = $self->_pkcs11->GetSlotList($with_token)
438 0 0 unless $pin
443 0 0 unless $self->_session->Login(1, $pin)
457 0 0 unless my $objects = $self->_session->FindObjects(1)
464 0 0 if (scalar @$objects == 0)
518 0 0 unless ($sig_length)
531 0 0 $hash eq 'SHA1' ? :
535 0 0 if ($r != 0)
541 0 0 if ($r != 0)
550 0 0 if ($r != 0)
575 0 0 $hash eq 'SHA1' ? :
579 0 0 if ($r != 0)
588 0 0 if ($r != 0)
601 0 0 unless (exists $args->{'file'} or exists $args->{'data'})
606 0 0 if ($args->{'file'})
610 0 0 if (not ref $file) { }
0 0 elsif (ref $file ne 'Path::Tiny') { }
618 0 0 unless exists $args->{'mech'}
641 0 0 if ($params)
644 0 0 if ($r != 0)
661 0 0 unless ($args{'mech'})
669 0 0 unless $self->_session->SignInit($args{'mech'}, $self->_key)
672 0 0 if ($data_len < 1024)
674 0 0 unless my $sig = $self->_session->Sign($args{'data'})
681 0 0 unless $self->_session->SignUpdate($chunk)
685 0 0 unless my $sig = $self->_session->SignFinal
708 0 0 unless $args{'sig'}
711 0 0 unless ($args{'mech'})
719 0 0 unless $self->_session->VerifyInit($args{'mech'}, $self->_key)
722 0 0 if ($data_len < 1024)
724 0 0 unless $v
731 0 0 unless $self->_session->VerifyUpdate($chunk)
736 0 0 unless my $v = $self->_session->VerifyFinal($args{'sig'})
747 0 0 unless ($args{'mech'})
753 0 0 unless $self->_session->DigestInit($args{'mech'})
756 0 0 unless $d
774 0 0 unless $1
785 0 0 unless my $mech_info = $self->_pkcs11->GetMechanismInfo($slot_id, $_)
790 0 0 $mech_info->{'flags'} & $f ? :
808 0 0 unless my $mech_list = $self->_pkcs11->GetMechanismList($slot_id)
812 0 0 $Crypt::PKCS11::Easy::CKM_NAME{$_} ? :
824 0 0 unless ($args{'mech'})
832 0 0 unless $self->_session->EncryptInit($args{'mech'}, $self->_key)
836 0 0 unless my $encrypted_data = $self->_session->Encrypt($args{'data'})