# -*-perl-*-
#
# $Id$
#
# Perl interface to Catacomb crypto library
#
# (c) 2001 Straylight/Edgeware
#

#----- Licensing notice -----------------------------------------------------
#
# This file is part of the Perl interface to Catacomb.
#
# Catacomb/Perl is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# Catacomb/Perl is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with Catacomb/Perl; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

#----- Basic stuff ----------------------------------------------------------

package Catacomb;
use Catacomb::Base;

$VERSION = "1.0.0";

BEGIN { @EXPORT_OK = (); }

use Catacomb::MP;
use Catacomb::GF;
use Catacomb::Field;
use Catacomb::EC;
use Catacomb::Group;
use Catacomb::Rand;
use Catacomb::Crypto;
use Catacomb::Key;

foreach $_ (qw(Catacomb::MP::mp Catacomb::GF::gf
	       Catacomb::MP::newprime
	       Catacomb::MP::mp_loadl Catacomb::MP::mp_loadb
	       Catacomb::MP::mp_loadl2c Catacomb::MP::mp_loadb2c
	       Catacomb::MP::mp_fromstring
	       Catacomb::GF::gf_loadl Catacomb::GF::gf_loadb
	       Catacomb::GF::gf_fromstring
	       Catacomb::MP::Prime::primegen
	       Catacomb::MP::Prime::limleegen
	       Catacomb::MP::Prime::Filter::filterstepper)) {
  my $new;
  my $proc;
  if (m:^(.*)/(.*)$:) {
    $proc = $1;
    $new = $2;
  } elsif (/:(\w+)$/) {
    $new = $1;
    $proc = $_;
  } else {
    next;
  }
  *{$new} = \&{$proc};
}

$rabin_tester = Catacomb::MP::Prime::Rabin->tester();
$pg_events = Catacomb::MP::Prime::Gen::Proc->ev();
$pg_evspin = Catacomb::MP::Prime::Gen::Proc->evspin();
$pg_subev = Catacomb::MP::Prime::Gen::Proc->subev();

$EXPORT_TAGS{"const"} = [Catacomb::_constants()];
$EXPORT_TAGS{"random"} = [qw($random)];
$EXPORT_TAGS{"mp"} = [qw(mp gf mp_loadb mp_loadl mp_loadb2c mp_loadl2c
			 mp_fromstring gf_loadb gf_loadl gf_fromstring)];
$EXPORT_TAGS{"pgen"} = [qw(newprime primegen limleegen
			   filterstepper $rabin_tester
			   $pg_events $pg_evspin $pg_subev)];
$EXPORT_TAGS{"key"} = [qw($keyerror)];

Exporter::export_ok_tags(keys %EXPORT_TAGS);

#----- That's all, folks ----------------------------------------------------

1;
