| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
3
|
|
|
3
|
|
575828
|
use v5.42.0; |
|
|
3
|
|
|
|
|
10
|
|
|
2
|
3
|
|
|
3
|
|
14
|
use feature 'class'; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
586
|
|
|
3
|
3
|
|
|
3
|
|
23
|
no warnings 'experimental::class'; |
|
|
3
|
|
|
|
|
17
|
|
|
|
3
|
|
|
|
|
373
|
|
|
4
|
|
|
|
|
|
|
# |
|
5
|
|
|
|
|
|
|
class Noise v0.0.2 { |
|
6
|
3
|
|
|
3
|
|
1693
|
use Noise::HandshakeState; |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
139
|
|
|
7
|
3
|
|
|
3
|
|
23
|
use Noise::CipherState; |
|
|
3
|
|
|
|
|
4
|
|
|
|
3
|
|
|
|
|
61
|
|
|
8
|
3
|
|
|
3
|
|
10
|
use Noise::SymmetricState; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
52
|
|
|
9
|
3
|
|
|
3
|
|
10
|
use Noise::Pattern; |
|
|
3
|
|
|
|
|
4
|
|
|
|
3
|
|
|
|
|
51
|
|
|
10
|
3
|
|
|
3
|
|
11
|
use Crypt::PK::X25519; |
|
|
3
|
|
|
|
|
4
|
|
|
|
3
|
|
|
|
|
1572
|
|
|
11
|
|
|
|
|
|
|
# |
|
12
|
|
|
|
|
|
|
field $handshake_state : reader; |
|
13
|
|
|
|
|
|
|
field $prologue : param //= ''; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
method initialize_handshake (%params) { |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# Params: pattern, initiator, s, e, rs, re |
|
18
|
|
|
|
|
|
|
$handshake_state = Noise::HandshakeState->new( |
|
19
|
|
|
|
|
|
|
prologue => $prologue, |
|
20
|
|
|
|
|
|
|
pattern => $params{pattern} // 'XX', |
|
21
|
|
|
|
|
|
|
initiator => $params{initiator} // 1, |
|
22
|
|
|
|
|
|
|
s => $params{s}, |
|
23
|
|
|
|
|
|
|
e => $params{e}, |
|
24
|
|
|
|
|
|
|
rs => $params{rs}, |
|
25
|
|
|
|
|
|
|
re => $params{re}, |
|
26
|
|
|
|
|
|
|
psks => $params{psks} // [] |
|
27
|
|
|
|
|
|
|
); |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Wrapper methods for compatibility/convenience |
|
31
|
|
|
|
|
|
|
method write_message ( $payload //= '' ) { $handshake_state->write_message($payload); } |
|
32
|
|
|
|
|
|
|
method read_message ($message) { $handshake_state->read_message($message); } |
|
33
|
|
|
|
|
|
|
method split () { $handshake_state->split(); } |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# For backward compatibility with the old specific XX impl (if needed) |
|
36
|
|
|
|
|
|
|
method initialize_state ( $proto_name //= 'Noise_XX_25519_ChaChaPoly_SHA256' ) { |
|
37
|
|
|
|
|
|
|
my ($p_name) = $proto_name =~ /Noise_([^_]+)_/; |
|
38
|
|
|
|
|
|
|
$self->initialize_handshake( pattern => $p_name // 'XX' ); |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# Expose internal states for debugging/tests |
|
42
|
|
|
|
|
|
|
method h () { $handshake_state->symmetric_state->h } |
|
43
|
|
|
|
|
|
|
method ck () { $handshake_state->symmetric_state->ck } |
|
44
|
|
|
|
|
|
|
}; |
|
45
|
|
|
|
|
|
|
# |
|
46
|
|
|
|
|
|
|
1; |