Commit 8073036d authored by Ralf S. Engelschall's avatar Ralf S. Engelschall
Browse files

Overhauled the Perl interface (perl/*):

- ported BN stuff to OpenSSL's different BN library

- made the perl/ source tree CVS-aware

- renamed the package from SSLeay to OpenSSL (the files still contain
  their history because I've copied them in the repository)

- removed obsolete files (the test scripts will be replaced
  by better Test::Harness variants in the future)
parent 0517335e
Loading
Loading
Loading
Loading
+9
Changes for CHANGES: 9 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -5,6 +5,15 @@

 Changes between 0.9.1c and 0.9.2

  *) Overhauled the Perl interface (perl/*):
     - ported BN stuff to OpenSSL's different BN library
     - made the perl/ source tree CVS-aware
     - renamed the package from SSLeay to OpenSSL (the files still contain
       their history because I've copied them in the repository)
     - removed obsolete files (the test scripts will be replaced
       by better Test::Harness variants in the future)
     [Ralf S. Engelschall]

  *) First cut for a very conservative source tree cleanup:
     1. merge various obsolete readme texts into doc/ssleay.txt
     where we collect the old documents and readme texts.
+12
Changes for perl/.cvsignore: 12 added lines, 0 removed lines.
Original line number Diff line number Diff line
Makefile
blib
pm_to_blib
OpenSSL.c
openssl_bio.c
openssl_bn.c
openssl_cipher.c
openssl_digest.c
openssl_err.c
openssl_ssl.c
openssl_x509.c
OpenSSL.bs
+11 −14
Changes for perl/MANIFEST: 11 added lines, 14 removed lines.
Original line number Diff line number Diff line
MANIFEST
Makefile.PL
SSLeay.pm
bio.xs
bn.xs
cipher.xs
digest.xs
err.xs
ssl.xs
x509.xs
test.pl
test2.pl
test3.pl
test9.pl
testbn.pl
testmd.pl
typemap
OpenSSL.pm
OpenSSL.xs
openssl.h
openssl_bio.xs
openssl_bn.xs
openssl_cipher.xs
openssl_digest.xs
openssl_err.xs
openssl_ssl.xs
openssl_x509.xs
openssl_cb.c
+31 −19
Changes for perl/Makefile.PL: 31 added lines, 19 removed lines.
Original line number Diff line number Diff line
##
##  Makefile.PL -- Perl MakeMaker specification
##

use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.

WriteMakefile(
	'OPTIMIZE'	=> '-g',
	'DISTNAME'	=> 'SSLeay-perl5-0.8.5',
	'NAME'		=> 'SSLeay',
	'VERSION_FROM'	=> 'SSLeay.pm',
    'OPTIMIZE'      => '',
    'DISTNAME'      => 'OpenSSL-0.9.2',
    'NAME'          => 'OpenSSL',
    'VERSION_FROM'  => 'OpenSSL.pm',
    'LIBS'          => ['-L.. -lssl -lcrypto'],
    'DEFINE'        => '',
    'INC'           => '-I../include',
	'C'		=> ['callback.c'],
	'H'		=> ['p5SSLeay.h'],
	'OBJECT'	=> "	SSLeay.o bio.o bn.o cipher.o digest.o err.o 
				ssl.o x509.o",
	'XS'		=> {	'SSLeay.xs'	=>	'SSLeay.c',
				'bio.xs'	=>	'bio.c',
				'bn.xs'		=>	'bn.c',
				'cipher.xs'	=>	'cipher.c',
				'digest.xs'	=>	'digest.c',
				'err.xs'	=>	'err.c',
				'ssl.xs'	=>	'ssl.c',
				'x509.xs'	=>	'x509.c',
				}
    'H'             => ['openssl.h'],
    'C'             => ['openssl_cb.c'],
    'OBJECT' =>
        'OpenSSL.o ' .
        'openssl_bio.o ' .
        'openssl_bn.o ' .
        'openssl_cipher.o ' .
        'openssl_digest.o ' .
        'openssl_err.o ' .
        'openssl_ssl.o ' .
        'openssl_x509.o ',
    'XS' => { 
        'OpenSSL.xs'        =>  'OpenSSL.c',
        'openssl_bio.xs'    =>  'openssl_bio.c',
        'openssl_bn.xs'     =>  'openssl_bn.c',
        'openssl_cipher.xs' =>  'openssl_cipher.c',
        'openssl_digest.xs' =>  'openssl_digest.c',
        'openssl_err.xs'    =>  'openssl_err.c',
        'openssl_ssl.xs'    =>  'openssl_ssl.c',
        'openssl_x509.xs'   =>  'openssl_x509.c',
    },
);
+30 −28
Changes for perl/OpenSSL.pm: 30 added lines, 28 removed lines.
Original line number Diff line number Diff line
package SSLeay;
##
##  OpenSSL.pm
##

package OpenSSL;

use Exporter;
use DynaLoader;
@@ -6,28 +10,26 @@ use DynaLoader;
@ISA = qw(Exporter DynaLoader);
@EXPORT = qw();

$VERSION='0.82';
$VERSION='0.82';
bootstrap SSLeay;

@SSLeay::BN::ISA=	qw(SSLeay::ERR);
@SSLeay::MD::ISA=	qw(SSLeay::ERR);
@SSLeay::Cipher::ISA=	qw(SSLeay::ERR);
@SSLeay::SSL::CTX::ISA=	qw(SSLeay::ERR);
@SSLeay::BIO::ISA=	qw(SSLeay::ERR);
@SSLeay::SSL::ISA=	qw(SSLeay::ERR);
$VERSION='0.92';
bootstrap penSSL;

@BN::ISA=	qw(SSLeay::BN);
@MD::ISA=	qw(SSLeay::MD);
@Cipher::ISA=	qw(SSLeay::Cipher);
@SSL::ISA=	qw(SSLeay::SSL);
@SSL::CTX::ISA=	qw(SSLeay::SSL::CTX);
@BIO::ISA=	qw(SSLeay::BIO);
@OpenSSL::BN::ISA=		qw(OpenSSL::ERR);
@OpenSSL::MD::ISA=		qw(OpenSSL::ERR);
@OpenSSL::Cipher::ISA=		qw(OpenSSL::ERR);
@OpenSSL::SSL::CTX::ISA=	qw(OpenSSL::ERR);
@OpenSSL::BIO::ISA=		qw(OpenSSL::ERR);
@OpenSSL::SSL::ISA=		qw(OpenSSL::ERR);

@BN::ISA=			qw(OpenSSL::BN);
@MD::ISA=		qw(OpenSSL::MD);
@Cipher::ISA=		qw(OpenSSL::Cipher);
@SSL::ISA=		qw(OpenSSL::SSL);
@SSL::CTX::ISA=		qw(OpenSSL::SSL::CTX);
@BIO::ISA=		qw(OpenSSL::BIO);

@SSLeay::MD::names=qw(md2 md5 sha sha1 ripemd160 mdc2);
@OpenSSL::MD::names=qw(md2 md5 sha sha1 ripemd160 mdc2);

@SSLeay::Cipher::names=qw(
@OpenSSL::Cipher::names=qw(
	des-ecb des-cfb des-ofb des-cbc
	des-ede des-ede-cfb des-ede-ofb des-ede-cbc
	des-ede3 des-ede3-cfb des-ede3-ofb des-ede3-cbc
@@ -39,9 +41,9 @@ bootstrap SSLeay;
	rc5-ecb rc5-cfb rc5-ofb rc5-cbc
	);

sub SSLeay::SSL::CTX::new_ssl { SSLeay::SSL::new($_[0]); }
sub OpenSSL::SSL::CTX::new_ssl { OpenSSL::SSL::new($_[0]); }

sub SSLeay::ERR::error
sub OpenSSL::ERR::error
	{
	my($o)=@_;
	my($s,$ret);
@@ -53,26 +55,26 @@ sub SSLeay::ERR::error
	return($ret);
	}

@SSLeay::Cipher::aliases=qw(des desx des3 idea rc2 bf cast);
@OpenSSL::Cipher::aliases=qw(des desx des3 idea rc2 bf cast);

package SSLeay::BN;
package OpenSSL::BN;

sub bnfix { (ref($_[0]) ne "SSLeay::BN")?SSLeay::BN::dec2bn($_[0]):$_[0]; }
sub bnfix { (ref($_[0]) ne "OpenSSL::BN")?OpenSSL::BN::dec2bn($_[0]):$_[0]; }
use overload
"="  => sub { dup($_[0]); },
"+"  => sub { add($_[0],$_[1]); },
"-"  => sub {	($_[1],$_[0])=($_[0],$_[1]) if $_[2];
		SSLeay::BN::sub($_[0],$_[1]); },
		OpenSSL::BN::sub($_[0],$_[1]); },
"*"  => sub { mul($_[0],$_[1]); },
"/"  => sub {  ($_[1],$_[0])=($_[0],$_[1]) if $_[2]; (div($_[0],$_[1]))[0]; },
"%"  => sub {  ($_[1],$_[0])=($_[0],$_[1]) if $_[2]; mod($_[0],$_[1]); },
"**" => sub { ($_[1],$_[0])=($_[0],$_[1]) if $_[2]; exp($_[0],$_[1]); },
"<<" => sub { lshift($_[0],$_[1]); },
">>" => sub { rshift($_[0],$_[1]); },
"<=>" => sub { SSLeay::BN::cmp($_[0],$_[1]); },
"<=>" => sub { OpenSSL::BN::cmp($_[0],$_[1]); },
'""' => sub { bn2dec($_[0]); },
'0+' => sub { dec2bn($_[0]); },
"bool" => sub { ref($_[0]) eq "SSLeay::BN"; };
"bool" => sub { ref($_[0]) eq "OpenSSL::BN"; };

sub SSLeay::BIO::do_accept { SSLeay::BIO::do_handshake(@_); }
sub OpenSSL::BIO::do_accept { OpenSSL::BIO::do_handshake(@_); }
1;
Loading