line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::SSH::Perl::Util::SSH1MP; |
2
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
10
|
use Digest::MD5 qw( md5 ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
6
|
1
|
|
|
1
|
|
6
|
use Math::GMP; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
11
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub _compute_session_id { |
9
|
0
|
|
|
0
|
|
|
my($check_bytes, $host, $public) = @_; |
10
|
0
|
|
|
|
|
|
my $id; |
11
|
0
|
|
|
|
|
|
$id .= _mp_linearize($host->{rsa}{n}); |
12
|
0
|
|
|
|
|
|
$id .= _mp_linearize($public->{rsa}{n}); |
13
|
0
|
|
|
|
|
|
$id .= $check_bytes; |
14
|
0
|
|
|
|
|
|
md5($id); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub _mp_linearize { |
18
|
0
|
|
|
0
|
|
|
my($p, $l) = @_; |
19
|
0
|
|
0
|
|
|
|
$l ||= 0; |
20
|
0
|
|
|
|
|
|
my $base = Math::GMP->new(256); |
21
|
0
|
|
|
|
|
|
my $res = ''; |
22
|
|
|
|
|
|
|
{ |
23
|
0
|
|
|
|
|
|
my $r = $p % $base; |
|
0
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
my $d = Math::GMP->new($p-$r) / $base; |
25
|
0
|
|
|
|
|
|
$res = chr($r) . $res; |
26
|
0
|
0
|
|
|
|
|
if ($d >= $base) { |
|
|
0
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
$p = $d; |
28
|
0
|
|
|
|
|
|
redo; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
elsif ($d != 0) { |
31
|
0
|
|
|
|
|
|
$res = chr($d) . $res; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
0
|
0
|
|
|
|
|
$res = "\0" x ($l-length($res)) . $res |
35
|
|
|
|
|
|
|
if length($res) < $l; |
36
|
0
|
|
|
|
|
|
$res; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |