line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Protocol::TLS::Crypto; |
2
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
110
|
|
3
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
68
|
|
4
|
2
|
|
|
2
|
|
10
|
use Module::Runtime qw(compose_module_name require_module); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
10
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# TODO: select backend |
7
|
|
|
|
|
|
|
our $BACKEND = 'CryptX'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $crypto = undef; |
10
|
|
|
|
|
|
|
my @methods = (qw(PRF PRF_hash random rsa_encrypt cert_pubkey)); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
4
|
50
|
|
4
|
0
|
13
|
return $crypto if $crypto; |
14
|
4
|
|
|
|
|
23
|
my $module = compose_module_name( 'Protocol::TLS::Crypto', $BACKEND ); |
15
|
4
|
|
|
|
|
341
|
require_module $module; |
16
|
4
|
|
|
|
|
77
|
my $crypto = $module->new; |
17
|
4
|
|
|
|
|
11
|
for (@methods) { |
18
|
20
|
50
|
|
|
|
84
|
die ref($crypto) . " backend doesn't implement method $_\n" |
19
|
|
|
|
|
|
|
unless $crypto->can($_); |
20
|
|
|
|
|
|
|
} |
21
|
4
|
|
|
|
|
87
|
$crypto; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
1 |