line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Cryptoki; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
856
|
use 5.012005; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
35
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
5
|
1
|
|
|
1
|
|
14
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
6
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
95
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
require Exporter; |
9
|
1
|
|
|
1
|
|
1955
|
use AutoLoader; |
|
1
|
|
|
|
|
1494
|
|
|
1
|
|
|
|
|
5
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
14
|
|
|
|
|
|
|
rv_to_str |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
CK_NEED_ARG_LIST |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
TRUE |
19
|
|
|
|
|
|
|
NULL_PTR |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
CKR_OK |
22
|
|
|
|
|
|
|
CKR_PIN_INCORRECT |
23
|
|
|
|
|
|
|
CKR_ARGUMENTS_BAD |
24
|
|
|
|
|
|
|
CKR_ATTRIBUTE_READ_ONLY |
25
|
|
|
|
|
|
|
CKR_ATTRIBUTE_TYPE_INVALID |
26
|
|
|
|
|
|
|
CKR_ATTRIBUTE_VALUE_INVALID |
27
|
|
|
|
|
|
|
CKR_CRYPTOKI_NOT_INITIALIZED |
28
|
|
|
|
|
|
|
CKR_DEVICE_ERROR |
29
|
|
|
|
|
|
|
CKR_DEVICE_MEMORY |
30
|
|
|
|
|
|
|
CKR_DEVICE_REMOVED |
31
|
|
|
|
|
|
|
CKR_DOMAIN_PARAMS_INVALID |
32
|
|
|
|
|
|
|
CKR_FUNCTION_CANCELED |
33
|
|
|
|
|
|
|
CKR_FUNCTION_FAILED |
34
|
|
|
|
|
|
|
CKR_GENERAL_ERROR |
35
|
|
|
|
|
|
|
CKR_HOST_MEMORY |
36
|
|
|
|
|
|
|
CKR_MECHANISM_INVALID |
37
|
|
|
|
|
|
|
CKR_MECHANISM_PARAM_INVALID |
38
|
|
|
|
|
|
|
CKR_OPERATION_ACTIVE |
39
|
|
|
|
|
|
|
CKR_OPERATION_NOT_INITIALIZED |
40
|
|
|
|
|
|
|
CKR_PIN_EXPIRED |
41
|
|
|
|
|
|
|
CKR_SESSION_CLOSED |
42
|
|
|
|
|
|
|
CKR_SESSION_HANDLE_INVALID |
43
|
|
|
|
|
|
|
CKR_SESSION_READ_ONLY |
44
|
|
|
|
|
|
|
CKR_SESSION_READ_ONLY_EXISTS |
45
|
|
|
|
|
|
|
CKR_TEMPLATE_INCOMPLETE |
46
|
|
|
|
|
|
|
CKR_TEMPLATE_INCONSISTENT |
47
|
|
|
|
|
|
|
CKR_TOKEN_WRITE_PROTECTED |
48
|
|
|
|
|
|
|
CKR_USER_NOT_LOGGED_IN |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
CKF_SERIAL_SESSION |
51
|
|
|
|
|
|
|
CKF_RW_SESSION |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
CKU_USER |
54
|
|
|
|
|
|
|
CKU_SO |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
CKO_PRIVATE_KEY |
57
|
|
|
|
|
|
|
CKO_PUBLIC_KEY |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
CKK_RSA |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
CKS_RO_PUBLIC_SESSION |
62
|
|
|
|
|
|
|
CKS_RO_USER_FUNCTIONS |
63
|
|
|
|
|
|
|
CKS_RW_PUBLIC_SESSION |
64
|
|
|
|
|
|
|
CKS_RW_USER_FUNCTIONS |
65
|
|
|
|
|
|
|
CKS_RW_SO_FUNCTIONS |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
CKA_CLASS |
68
|
|
|
|
|
|
|
CKA_KEY_TYPE |
69
|
|
|
|
|
|
|
CKA_TOKEN |
70
|
|
|
|
|
|
|
CKA_PRIVATE |
71
|
|
|
|
|
|
|
CKA_SENSITIVE |
72
|
|
|
|
|
|
|
CKA_DECRYPT |
73
|
|
|
|
|
|
|
CKA_SIGN |
74
|
|
|
|
|
|
|
CKA_UNWRAP |
75
|
|
|
|
|
|
|
CKA_ENCRYPT |
76
|
|
|
|
|
|
|
CKA_VERIFY |
77
|
|
|
|
|
|
|
CKA_WRAP |
78
|
|
|
|
|
|
|
CKA_MODULUS_BITS |
79
|
|
|
|
|
|
|
CKA_PUBLIC_EXPONENT |
80
|
|
|
|
|
|
|
CKA_LABEL |
81
|
|
|
|
|
|
|
CKA_ID |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
CKM_RSA_PKCS_KEY_PAIR_GEN |
84
|
|
|
|
|
|
|
CKM_RSA_PKCS |
85
|
|
|
|
|
|
|
CKM_SHA256_RSA_PKCS |
86
|
|
|
|
|
|
|
CKM_SHA512_RSA_PKCS |
87
|
|
|
|
|
|
|
CKM_SHA256 |
88
|
|
|
|
|
|
|
CKM_SHA512 |
89
|
|
|
|
|
|
|
) ] ); |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
our $VERSION = '0.01_07'; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub AUTOLOAD { |
96
|
|
|
|
|
|
|
# This AUTOLOAD is used to 'autoload' constants from the constant() |
97
|
|
|
|
|
|
|
# XS function. |
98
|
|
|
|
|
|
|
|
99
|
28
|
|
|
28
|
|
27
|
my $constname; |
100
|
28
|
|
|
|
|
19
|
our $AUTOLOAD; |
101
|
28
|
|
|
|
|
105
|
($constname = $AUTOLOAD) =~ s/.*:://; |
102
|
28
|
50
|
|
|
|
53
|
croak "&Crypt::Cryptoki::constant not defined" if $constname eq 'constant'; |
103
|
28
|
|
|
|
|
59
|
my ($error, $val) = constant($constname); |
104
|
28
|
50
|
|
|
|
40
|
if ($error) { croak $error; } |
|
0
|
|
|
|
|
0
|
|
105
|
|
|
|
|
|
|
{ |
106
|
1
|
|
|
1
|
|
231
|
no strict 'refs'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
123
|
|
|
28
|
|
|
|
|
22
|
|
107
|
|
|
|
|
|
|
# Fixed between 5.005_53 and 5.005_61 |
108
|
|
|
|
|
|
|
#XXX if ($] >= 5.00561) { |
109
|
|
|
|
|
|
|
#XXX *$AUTOLOAD = sub () { $val }; |
110
|
|
|
|
|
|
|
#XXX } |
111
|
|
|
|
|
|
|
#XXX else { |
112
|
28
|
|
|
28
|
|
130
|
*$AUTOLOAD = sub { $val }; |
|
28
|
|
|
|
|
94
|
|
113
|
|
|
|
|
|
|
#XXX } |
114
|
|
|
|
|
|
|
} |
115
|
28
|
|
|
|
|
64
|
goto &$AUTOLOAD; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
require XSLoader; |
119
|
|
|
|
|
|
|
XSLoader::load('Crypt::Cryptoki', $VERSION); |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
# Preloaded methods go here. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
# Autoload methods go after =cut, and are processed by the autosplit program. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
my %rv_map; |
126
|
|
|
|
|
|
|
{ |
127
|
1
|
|
|
1
|
|
5
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
157
|
|
128
|
|
|
|
|
|
|
%rv_map = map { $_->() => $_ } grep { /^CKR/ } @EXPORT_OK; |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub rv_to_str { |
132
|
0
|
|
|
0
|
0
|
|
my ( $err_num ) = @_; |
133
|
0
|
|
0
|
|
|
|
return $rv_map{$err_num} || 'n/a ('.$err_num.')'; |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
1; |
137
|
|
|
|
|
|
|
__END__ |