lib/Noise.pm

filter: Statementstmt 80.0% 8 / 10 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 85.7% 12 / 14 CC 1 SCAR 2.2
CC
1
Cov
80%
BEGIN
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« blib/lib/Noise/Pattern.pm ↑ Summary lib/Noise/CipherState.pm »
1 3 ▶use v5.42.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 3 ▶use feature 'class';
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶no warnings 'experimental::class';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 #
5 class Noise v0.0.2 {
6 0 ▶ use Noise::HandshakeState;
Subroutine BEGIN: called CC=1 SCAR=6.9
7 use Noise::CipherState;
8 use Noise::SymmetricState;
9 use Noise::Pattern;
10 use Crypt::PK::X25519;
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;
« blib/lib/Noise/Pattern.pm ↑ Summary lib/Noise/CipherState.pm »