| 1 | package Crypt::Sodium::XS::secretstream; | ||
| 2 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 2 | ▶ | use Crypt::Sodium::XS; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 2 | ▶ | use Exporter 'import'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 2 | _define_constants(); | |
| 9 | |||
| 10 | { | ||
| 11 | 2 | my @constant_bases = qw( | |
| 12 | ABYTES | ||
| 13 | HEADERBYTES | ||
| 14 | KEYBYTES | ||
| 15 | MESSAGEBYTES_MAX | ||
| 16 | TAG_MESSAGE | ||
| 17 | TAG_PUSH | ||
| 18 | TAG_REKEY | ||
| 19 | TAG_FINAL | ||
| 20 | ); | ||
| 21 | |||
| 22 | 2 | my @bases = qw( | |
| 23 | init_decrypt | ||
| 24 | init_encrypt | ||
| 25 | keygen | ||
| 26 | ); | ||
| 27 | |||
| 28 | # NB: no generic functions for secretstream | ||
| 29 | |||
| 30 | my $xchacha20poly1305 = [ | ||
| 31 | 6 | (map { "secretstream_xchacha20poly1305_$_" } @bases), | |
| 32 | 2 | (map { "secretstream_xchacha20poly1305_$_" } @constant_bases), | |
| 33 | ]; | ||
| 34 | |||
| 35 | 2 | our %EXPORT_TAGS = ( | |
| 36 | all => [ @$xchacha20poly1305 ], | ||
| 37 | xchacha20poly1305 => $xchacha20poly1305, | ||
| 38 | ); | ||
| 39 | |||
| 40 | 2 | our @EXPORT_OK = @{$EXPORT_TAGS{all}}; | |
| 41 | } | ||
| 42 | |||
| 43 | package Crypt::Sodium::XS::OO::secretstream; | ||
| 44 | 2 | ▶ | use parent 'Crypt::Sodium::XS::OO::Base'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 45 | |||
| 46 | my %methods = ( | ||
| 47 | xchacha20poly1305 => { | ||
| 48 | ABYTES => \&Crypt::Sodium::XS::secretstream::secretstream_xchacha20poly1305_ABYTES, | ||
| 49 | HEADERBYTES => \&Crypt::Sodium::XS::secretstream::secretstream_xchacha20poly1305_HEADERBYTES, | ||
| 50 | KEYBYTES => \&Crypt::Sodium::XS::secretstream::secretstream_xchacha20poly1305_KEYBYTES, | ||
| 51 | MESSAGEBYTES_MAX => \&Crypt::Sodium::XS::secretstream::secretstream_xchacha20poly1305_MESSAGEBYTES_MAX, | ||
| 52 | 0 | ▶ | PRIMITIVE => sub { 'xchacha20poly1305' }, |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 53 | 2 | TAG_MESSAGE => \&Crypt::Sodium::XS::secretstream::secretstream_xchacha20poly1305_TAG_MESSAGE, | |
| 54 | TAG_PUSH => \&Crypt::Sodium::XS::secretstream::secretstream_xchacha20poly1305_TAG_PUSH, | ||
| 55 | TAG_REKEY => \&Crypt::Sodium::XS::secretstream::secretstream_xchacha20poly1305_TAG_REKEY, | ||
| 56 | TAG_FINAL => \&Crypt::Sodium::XS::secretstream::secretstream_xchacha20poly1305_TAG_FINAL, | ||
| 57 | init_decrypt => \&Crypt::Sodium::XS::secretstream::secretstream_xchacha20poly1305_init_decrypt, | ||
| 58 | init_encrypt => \&Crypt::Sodium::XS::secretstream::secretstream_xchacha20poly1305_init_encrypt, | ||
| 59 | keygen => \&Crypt::Sodium::XS::secretstream::secretstream_xchacha20poly1305_keygen, | ||
| 60 | }, | ||
| 61 | ); | ||
| 62 | |||
| 63 | 3 | ▶ | sub Crypt::Sodium::XS::secretstream::primitives { keys %methods } |
|
Subroutine
primitives: called CC=1 SCAR=0.0
Pod
documented
| |||
| 64 | 2 | *primitives = \&Crypt::Sodium::XS::secretstream::primitives; | |
| 65 | |||
| 66 | 1 | ▶ | sub ABYTES { my $self = shift; goto $methods{$self->{primitive}}->{ABYTES}; } |
|
Subroutine
ABYTES: called CC=1 SCAR=0.0
| |||
| 67 | 5 | ▶ | sub HEADERBYTES { my $self = shift; goto $methods{$self->{primitive}}->{HEADERBYTES}; } |
|
Subroutine
HEADERBYTES: called CC=1 SCAR=0.0
| |||
| 68 | 1 | ▶ | sub KEYBYTES { my $self = shift; goto $methods{$self->{primitive}}->{KEYBYTES}; } |
|
Subroutine
KEYBYTES: called CC=1 SCAR=0.0
| |||
| 69 | 1 | ▶ | sub MESSAGEBYTES_MAX { my $self = shift; goto $methods{$self->{primitive}}->{MESSAGEBYTES_MAX}; } |
|
Subroutine
MESSAGEBYTES_MAX: called CC=1 SCAR=0.0
| |||
| 70 | 0 | ▶ | sub PRIMITIVE { my $self = shift; goto $methods{$self->{primitive}}->{PRIMITIVE}; } |
|
Subroutine
PRIMITIVE: not called CC=1 SCAR=6.9
| |||
| 71 | 5 | ▶ | sub TAG_MESSAGE { my $self = shift; goto $methods{$self->{primitive}}->{TAG_MESSAGE}; } |
|
Subroutine
TAG_MESSAGE: called CC=1 SCAR=0.0
| |||
| 72 | 5 | ▶ | sub TAG_PUSH { my $self = shift; goto $methods{$self->{primitive}}->{TAG_PUSH}; } |
|
Subroutine
TAG_PUSH: called CC=1 SCAR=0.0
| |||
| 73 | 1 | ▶ | sub TAG_REKEY { my $self = shift; goto $methods{$self->{primitive}}->{TAG_REKEY}; } |
|
Subroutine
TAG_REKEY: called CC=1 SCAR=0.0
| |||
| 74 | 1 | ▶ | sub TAG_FINAL { my $self = shift; goto $methods{$self->{primitive}}->{TAG_FINAL}; } |
|
Subroutine
TAG_FINAL: called CC=1 SCAR=0.0
| |||
| 75 | 8 | ▶ | sub init_decrypt { my $self = shift; goto $methods{$self->{primitive}}->{init_decrypt}; } |
|
Subroutine
init_decrypt: called CC=1 SCAR=0.0
| |||
| 76 | 0 | ▶ | sub init_pull { my $self = shift; goto $methods{$self->{primitive}}->{init_decrypt}; } |
|
Subroutine
init_pull: not called CC=1 SCAR=6.9
| |||
| 77 | 4 | ▶ | sub init_encrypt { my $self = shift; goto $methods{$self->{primitive}}->{init_encrypt}; } |
|
Subroutine
init_encrypt: called CC=1 SCAR=0.0
| |||
| 78 | 0 | ▶ | sub init_push { my $self = shift; goto $methods{$self->{primitive}}->{init_encrypt}; } |
|
Subroutine
init_push: not called CC=1 SCAR=6.9
| |||
| 79 | 4 | ▶ | sub keygen { my $self = shift; goto $methods{$self->{primitive}}->{keygen}; } |
|
Subroutine
keygen: called CC=1 SCAR=0.0
| |||
| 80 | |||
| 81 | 2 | 1; | |
| 82 | |||
| 83 | __END__ | ||