chiark / gitweb /
Fix key error variable.
[catacomb-perl] / Catacomb.pm
1 # -*-perl-*-
2 #
3 # $Id$
4 #
5 # Perl interface to Catacomb crypto library
6 #
7 # (c) 2001 Straylight/Edgeware
8 #
9
10 #----- Licensing notice -----------------------------------------------------
11 #
12 # This file is part of the Perl interface to Catacomb.
13 #
14 # Catacomb/Perl is free software; you can redistribute it and/or modify
15 # it under the terms of the GNU General Public License as published by
16 # the Free Software Foundation; either version 2 of the License, or
17 # (at your option) any later version.
18
19 # Catacomb/Perl is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 # GNU General Public License for more details.
23
24 # You should have received a copy of the GNU General Public License
25 # along with Catacomb/Perl; if not, write to the Free Software Foundation,
26 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27
28 #----- Basic stuff ----------------------------------------------------------
29
30 package Catacomb;
31 use Catacomb::Base;
32
33 $VERSION = "1.0.0";
34
35 BEGIN { @EXPORT_OK = (); }
36
37 use Catacomb::MP;
38 use Catacomb::GF;
39 use Catacomb::Field;
40 use Catacomb::EC;
41 use Catacomb::Group;
42 use Catacomb::Rand;
43 use Catacomb::Crypto;
44 use Catacomb::Key;
45
46 foreach $_ (qw(Catacomb::MP::mp Catacomb::GF::gf
47                Catacomb::MP::newprime
48                Catacomb::MP::mp_loadl Catacomb::MP::mp_loadb
49                Catacomb::MP::mp_loadl2c Catacomb::MP::mp_loadb2c
50                Catacomb::MP::mp_fromstring
51                Catacomb::GF::gf_loadl Catacomb::GF::gf_loadb
52                Catacomb::GF::gf_fromstring
53                Catacomb::MP::Prime::primegen
54                Catacomb::MP::Prime::limleegen
55                Catacomb::MP::Prime::Filter::filterstepper)) {
56   my $new;
57   my $proc;
58   if (m:^(.*)/(.*)$:) {
59     $proc = $1;
60     $new = $2;
61   } elsif (/:(\w+)$/) {
62     $new = $1;
63     $proc = $_;
64   } else {
65     next;
66   }
67   *{$new} = \&{$proc};
68 }
69
70 $rabin_tester = Catacomb::MP::Prime::Rabin->tester();
71 $pg_events = Catacomb::MP::Prime::Gen::Proc->ev();
72 $pg_evspin = Catacomb::MP::Prime::Gen::Proc->evspin();
73 $pg_subev = Catacomb::MP::Prime::Gen::Proc->subev();
74
75 $EXPORT_TAGS{"const"} = [Catacomb::_constants()];
76 $EXPORT_TAGS{"random"} = [qw($random)];
77 $EXPORT_TAGS{"mp"} = [qw(mp gf mp_loadb mp_loadl mp_loadb2c mp_loadl2c
78                          mp_fromstring gf_loadb gf_loadl gf_fromstring)];
79 $EXPORT_TAGS{"pgen"} = [qw(newprime primegen limleegen
80                            filterstepper $rabin_tester
81                            $pg_events $pg_evspin $pg_subev)];
82 $EXPORT_TAGS{"key"} = [qw($keyerror)];
83
84 Exporter::export_ok_tags(keys %EXPORT_TAGS);
85
86 #----- That's all, folks ----------------------------------------------------
87
88 1;