| 1 | package Crypt::Sodium::XS::sign; | ||
| 2 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 1 | ▶ | use Crypt::Sodium::XS; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | ▶ | use Exporter 'import'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 1 | _define_constants(); | |
| 9 | |||
| 10 | { | ||
| 11 | 1 | my @constant_bases = qw( | |
| 12 | BYTES | ||
| 13 | MESSAGEBYTES_MAX | ||
| 14 | PUBLICKEYBYTES | ||
| 15 | SECRETKEYBYTES | ||
| 16 | SEEDBYTES | ||
| 17 | ); | ||
| 18 | |||
| 19 | 1 | my @bases = qw( | |
| 20 | sign | ||
| 21 | detached | ||
| 22 | init | ||
| 23 | keypair | ||
| 24 | open | ||
| 25 | pk_to_curve25519 | ||
| 26 | sk_to_curve25519 | ||
| 27 | sk_to_pk | ||
| 28 | sk_to_seed | ||
| 29 | to_curve25519 | ||
| 30 | verify | ||
| 31 | ); | ||
| 32 | |||
| 33 | my $default = [ | ||
| 34 | "sign", | ||
| 35 | 11 | (map { "sign_$_" } @bases), | |
| 36 | 1 | (map { "sign_$_" } @constant_bases, "PRIMITIVE"), | |
| 37 | ]; | ||
| 38 | my $ed25519 = [ | ||
| 39 | "sign_ed25519", | ||
| 40 | 11 | (map { "sign_ed25519_$_" } @bases), | |
| 41 | 1 | (map { "sign_ed25519_$_" } @constant_bases), | |
| 42 | ]; | ||
| 43 | |||
| 44 | 1 | our %EXPORT_TAGS = ( | |
| 45 | all => [ @$default, @$ed25519 ], | ||
| 46 | default => $default, | ||
| 47 | ed25519 => $ed25519, | ||
| 48 | ); | ||
| 49 | |||
| 50 | 1 | our @EXPORT_OK = @{$EXPORT_TAGS{all}}; | |
| 51 | } | ||
| 52 | |||
| 53 | package Crypt::Sodium::XS::OO::sign; | ||
| 54 | 1 | ▶ | use parent 'Crypt::Sodium::XS::OO::Base'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 55 | |||
| 56 | my %methods = ( | ||
| 57 | default => { | ||
| 58 | BYTES => \&Crypt::Sodium::XS::sign::sign_BYTES, | ||
| 59 | MESSAGEBYTES_MAX => \&Crypt::Sodium::XS::sign::sign_MESSAGEBYTES_MAX, | ||
| 60 | PRIMITIVE => \&Crypt::Sodium::XS::sign::sign_PRIMITIVE, | ||
| 61 | PUBLICKEYBYTES => \&Crypt::Sodium::XS::sign::sign_PUBLICKEYBYTES, | ||
| 62 | SECRETKEYBYTES => \&Crypt::Sodium::XS::sign::sign_SECRETKEYBYTES, | ||
| 63 | SEEDBYTES => \&Crypt::Sodium::XS::sign::sign_SEEDBYTES, | ||
| 64 | detached => \&Crypt::Sodium::XS::sign::sign_detached, | ||
| 65 | init => \&Crypt::Sodium::XS::sign::sign_init, | ||
| 66 | keypair => \&Crypt::Sodium::XS::sign::sign_keypair, | ||
| 67 | open => \&Crypt::Sodium::XS::sign::sign_open, | ||
| 68 | pk_to_curve25519 => \&Crypt::Sodium::XS::sign::sign_pk_to_curve25519, | ||
| 69 | sign => \&Crypt::Sodium::XS::sign::sign, | ||
| 70 | sk_to_curve25519 => \&Crypt::Sodium::XS::sign::sign_sk_to_curve25519, | ||
| 71 | sk_to_pk => \&Crypt::Sodium::XS::sign::sign_sk_to_pk, | ||
| 72 | sk_to_seed => \&Crypt::Sodium::XS::sign::sign_sk_to_seed, | ||
| 73 | to_curve25519 => \&Crypt::Sodium::XS::sign::sign_to_curve25519, | ||
| 74 | verify => \&Crypt::Sodium::XS::sign::sign_verify, | ||
| 75 | }, | ||
| 76 | ed25519 => { | ||
| 77 | BYTES => \&Crypt::Sodium::XS::sign::sign_ed25519_BYTES, | ||
| 78 | MESSAGEBYTES_MAX => \&Crypt::Sodium::XS::sign::sign_ed25519_MESSAGEBYTES_MAX, | ||
| 79 | 0 | ▶ | PRIMITIVE => sub { 'ed25519' }, |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 80 | 1 | PUBLICKEYBYTES => \&Crypt::Sodium::XS::sign::sign_ed25519_PUBLICKEYBYTES, | |
| 81 | SECRETKEYBYTES => \&Crypt::Sodium::XS::sign::sign_ed25519_SECRETKEYBYTES, | ||
| 82 | SEEDBYTES => \&Crypt::Sodium::XS::sign::sign_ed25519_SEEDBYTES, | ||
| 83 | detached => \&Crypt::Sodium::XS::sign::sign_ed25519_detached, | ||
| 84 | init => \&Crypt::Sodium::XS::sign::sign_ed25519_init, | ||
| 85 | keypair => \&Crypt::Sodium::XS::sign::sign_ed25519_keypair, | ||
| 86 | open => \&Crypt::Sodium::XS::sign::sign_ed25519_open, | ||
| 87 | pk_to_curve25519 => \&Crypt::Sodium::XS::sign::sign_ed25519_pk_to_curve25519, | ||
| 88 | sign => \&Crypt::Sodium::XS::sign::sign_ed25519, | ||
| 89 | sk_to_curve25519 => \&Crypt::Sodium::XS::sign::sign_ed25519_sk_to_curve25519, | ||
| 90 | sk_to_pk => \&Crypt::Sodium::XS::sign::sign_ed25519_sk_to_pk, | ||
| 91 | sk_to_seed => \&Crypt::Sodium::XS::sign::sign_ed25519_sk_to_seed, | ||
| 92 | to_curve25519 => \&Crypt::Sodium::XS::sign::sign_ed25519_to_curve25519, | ||
| 93 | verify => \&Crypt::Sodium::XS::sign::sign_ed25519_verify, | ||
| 94 | }, | ||
| 95 | ); | ||
| 96 | |||
| 97 | 0 | ▶ | sub Crypt::Sodium::XS::sign::primitives { keys %methods } |
|
Subroutine
primitives: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 98 | 1 | *primitives = \&Crypt::Sodium::XS::sign::primitives; | |
| 99 | |||
| 100 | 0 | ▶ | sub BYTES { my $self = shift; goto $methods{$self->{primitive}}->{BYTES}; } |
|
Subroutine
BYTES: not called CC=1 SCAR=6.9
| |||
| 101 | 0 | ▶ | sub MESSAGEBYTES_MAX { my $self = shift; goto $methods{$self->{primitive}}->{MESSAGEBYTES_MAX}; } |
|
Subroutine
MESSAGEBYTES_MAX: not called CC=1 SCAR=6.9
| |||
| 102 | 0 | ▶ | sub PRIMITIVE { my $self = shift; goto $methods{$self->{primitive}}->{PRIMITIVE}; } |
|
Subroutine
PRIMITIVE: not called CC=1 SCAR=6.9
| |||
| 103 | 0 | ▶ | sub PUBLICKEYBYTES { my $self = shift; goto $methods{$self->{primitive}}->{PUBLICKEYBYTES}; } |
|
Subroutine
PUBLICKEYBYTES: not called CC=1 SCAR=6.9
| |||
| 104 | 0 | ▶ | sub SECRETKEYBYTES { my $self = shift; goto $methods{$self->{primitive}}->{SECRETKEYBYTES}; } |
|
Subroutine
SECRETKEYBYTES: not called CC=1 SCAR=6.9
| |||
| 105 | 0 | ▶ | sub SEEDBYTES { my $self = shift; goto $methods{$self->{primitive}}->{SEEDBYTES}; } |
|
Subroutine
SEEDBYTES: not called CC=1 SCAR=6.9
| |||
| 106 | 0 | ▶ | sub detached { my $self = shift; goto $methods{$self->{primitive}}->{detached}; } |
|
Subroutine
detached: not called CC=1 SCAR=6.9
| |||
| 107 | 0 | ▶ | sub init { my $self = shift; goto $methods{$self->{primitive}}->{init}; } |
|
Subroutine
init: not called CC=1 SCAR=6.9
| |||
| 108 | 0 | ▶ | sub keypair { my $self = shift; goto $methods{$self->{primitive}}->{keypair}; } |
|
Subroutine
keypair: not called CC=1 SCAR=6.9
| |||
| 109 | 0 | ▶ | sub open { my $self = shift; goto $methods{$self->{primitive}}->{open}; } |
|
Subroutine
open: not called CC=1 SCAR=6.9
| |||
| 110 | 0 | ▶ | sub pk_to_curve25519 { my $self = shift; goto $methods{$self->{primitive}}->{pk_to_curve25519}; } |
|
Subroutine
pk_to_curve25519: not called CC=1 SCAR=6.9
| |||
| 111 | 0 | ▶ | sub sign { my $self = shift; goto $methods{$self->{primitive}}->{sign}; } |
|
Subroutine
sign: not called CC=1 SCAR=6.9
| |||
| 112 | 0 | ▶ | sub sk_to_curve25519 { my $self = shift; goto $methods{$self->{primitive}}->{sk_to_curve25519}; } |
|
Subroutine
sk_to_curve25519: not called CC=1 SCAR=6.9
| |||
| 113 | 0 | ▶ | sub sk_to_pk { my $self = shift; goto $methods{$self->{primitive}}->{sk_to_pk}; } |
|
Subroutine
sk_to_pk: not called CC=1 SCAR=6.9
| |||
| 114 | 0 | ▶ | sub sk_to_seed { my $self = shift; goto $methods{$self->{primitive}}->{sk_to_seed}; } |
|
Subroutine
sk_to_seed: not called CC=1 SCAR=6.9
| |||
| 115 | 0 | ▶ | sub to_curve25519 { my $self = shift; goto $methods{$self->{primitive}}->{to_curve25519}; } |
|
Subroutine
to_curve25519: not called CC=1 SCAR=6.9
| |||
| 116 | 0 | ▶ | sub verify { my $self = shift; goto $methods{$self->{primitive}}->{verify}; } |
|
Subroutine
verify: not called CC=1 SCAR=6.9
| |||
| 117 | |||
| 118 | 1 | 1; | |
| 119 | |||
| 120 | __END__ | ||