summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf S. Engelschall <rse@openssl.org>1999-02-10 09:38:31 +0000
committerRalf S. Engelschall <rse@openssl.org>1999-02-10 09:38:31 +0000
commit8073036dd62848b616c6a817c155c3255074ec83 (patch)
tree8ae62e46c555ccc9e65b5dffd43cff25234c96af
parent0517335e3cdc565edbecb53dec8ef9091c936763 (diff)
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)
-rw-r--r--CHANGES9
-rw-r--r--perl/.cvsignore12
-rw-r--r--perl/MANIFEST25
-rw-r--r--perl/Makefile.PL58
-rw-r--r--perl/OpenSSL.pm (renamed from perl/SSLeay.pm)58
-rw-r--r--perl/OpenSSL.xs22
-rw-r--r--perl/SSLeay.xs65
-rw-r--r--perl/b.pl21
-rw-r--r--perl/bio.pl30
-rw-r--r--perl/bio.txt36
-rw-r--r--perl/bio.xs450
-rw-r--r--perl/bn.pl23
-rw-r--r--perl/bn.txt38
-rw-r--r--perl/bn.xs589
-rw-r--r--perl/callback.c103
-rw-r--r--perl/cipher.pl39
-rw-r--r--perl/cipher.txt10
-rw-r--r--perl/cipher.xs152
-rw-r--r--perl/dh.pl40
-rw-r--r--perl/digest.txt7
-rw-r--r--perl/digest.xs83
-rw-r--r--perl/err.txt2
-rw-r--r--perl/err.xs46
-rw-r--r--perl/f.pl11
-rw-r--r--perl/g.pl18
-rw-r--r--perl/gen_rsa.pl49
-rw-r--r--perl/mul.pl56
-rw-r--r--perl/openssl.h2
-rw-r--r--perl/openssl_bio.xs27
-rw-r--r--perl/openssl_bn.xs75
-rw-r--r--perl/openssl_cb.c1
-rw-r--r--perl/openssl_cipher.xs9
-rw-r--r--perl/openssl_digest.xs11
-rw-r--r--perl/openssl_err.xs5
-rw-r--r--perl/openssl_ssl.xs35
-rw-r--r--perl/openssl_x509.xs7
-rw-r--r--perl/p5SSLeay.h96
-rw-r--r--perl/r.pl56
-rw-r--r--perl/s.pl72
-rw-r--r--perl/s2.pl49
-rw-r--r--perl/server.pem369
-rw-r--r--perl/ss.pl64
-rw-r--r--perl/ssl.pl71
-rw-r--r--perl/ssl.txt43
-rw-r--r--perl/ssl.xs474
-rw-r--r--perl/ssl_srvr.pl35
-rw-r--r--perl/sslbio.pl40
-rw-r--r--perl/t.pl12
-rw-r--r--perl/test32
-rw-r--r--perl/test.pl30
-rw-r--r--perl/test.txt36
-rw-r--r--perl/test2.pl28
-rw-r--r--perl/test3.pl19
-rw-r--r--perl/test8.pl19
-rw-r--r--perl/test9.pl38
-rw-r--r--perl/testbn.pl23
-rw-r--r--perl/testdec.pl14
-rw-r--r--perl/testmd.pl26
-rw-r--r--perl/tt.pl15
-rw-r--r--perl/typemap52
-rw-r--r--perl/x509.txt6
-rw-r--r--perl/x509.xs74
-rw-r--r--perl/xstmp.c102
-rw-r--r--perl/y.pl7
-rw-r--r--perl/yy.pl19
-rw-r--r--perl/z.pl32
-rw-r--r--perl/zz.pl22
67 files changed, 226 insertions, 3973 deletions
diff --git a/CHANGES b/CHANGES
index c6f97d5fdf..df4d3e25a7 100644
--- a/CHANGES
+++ b/CHANGES
@@ -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.
diff --git a/perl/.cvsignore b/perl/.cvsignore
new file mode 100644
index 0000000000..e3f4b2ec4e
--- /dev/null
+++ b/perl/.cvsignore
@@ -0,0 +1,12 @@
+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
diff --git a/perl/MANIFEST b/perl/MANIFEST
index 992db5ed4c..6acbc10af4 100644
--- a/perl/MANIFEST
+++ b/perl/MANIFEST
@@ -1,17 +1,14 @@
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
diff --git a/perl/Makefile.PL b/perl/Makefile.PL
index f9998e0a61..77d5af5f21 100644
--- a/perl/Makefile.PL
+++ b/perl/Makefile.PL
@@ -1,25 +1,37 @@
+##
+## 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',
- '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',
- }
- );
+ 'OPTIMIZE' => '',
+ 'DISTNAME' => 'OpenSSL-0.9.2',
+ 'NAME' => 'OpenSSL',
+ 'VERSION_FROM' => 'OpenSSL.pm',
+ 'LIBS' => ['-L.. -lssl -lcrypto'],
+ 'DEFINE' => '',
+ 'INC' => '-I../include',
+ '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',
+ },
+);
+
diff --git a/perl/SSLeay.pm b/perl/OpenSSL.pm
index f7710039d2..21c05a44cf 100644
--- a/perl/SSLeay.pm
+++ b/perl/OpenSSL.pm
@@ -1,4 +1,8 @@
-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;
diff --git a/perl/OpenSSL.xs b/perl/OpenSSL.xs
index 3e3d1debeb..6a975be515 100644
--- a/perl/OpenSSL.xs
+++ b/perl/OpenSSL.xs
@@ -1,4 +1,8 @@
-#include "p5SSLeay.h"
+/*
+** OpenSSL.xs
+*/
+
+#include "openssl.h"
SV *new_ref(type,obj,mort)
char *type;
@@ -47,7 +51,7 @@ fprintf(stderr,"ex_cleanup %08X %s\n",obj,argp);
SvREFCNT_dec((SV *)data);
}
-MODULE = SSLeay PACKAGE = SSLeay
+MODULE = OpenSSL PACKAGE = OpenSSL
BOOT:
boot_bio();
@@ -55,11 +59,11 @@ BOOT:
boot_digest();
boot_err();
boot_ssl();
- boot_SSLeay__BN();
- boot_SSLeay__BIO();
- boot_SSLeay__Cipher();
- boot_SSLeay__MD();
- boot_SSLeay__ERR();
- boot_SSLeay__SSL();
- boot_SSLeay__X509();
+ boot_OpenSSL__BN();
+ boot_OpenSSL__BIO();
+ boot_OpenSSL__Cipher();
+ boot_OpenSSL__MD();
+ boot_OpenSSL__ERR();
+ boot_OpenSSL__SSL();
+ boot_OpenSSL__X509();
diff --git a/perl/SSLeay.xs b/perl/SSLeay.xs
deleted file mode 100644
index 3e3d1debeb..0000000000
--- a/perl/SSLeay.xs
+++ /dev/null
@@ -1,65 +0,0 @@
-#include "p5SSLeay.h"
-
-SV *new_ref(type,obj,mort)
-char *type;
-char *obj;
- {
- SV *ret;
-
- if (mort)
- ret=sv_newmortal();
- else
- ret=newSViv(0);
-printf(">new_ref %d\n",type);
- sv_setref_pv(ret,type,(void *)obj);
- return(ret);
- }
-
-int ex_new(obj,data,ad,idx,argl,argp)
-char *obj;
-SV *data;
-CRYPTO_EX_DATA *ad;
-int idx;
-long argl;
-char *argp;
- {
- SV *sv;
-
-fprintf(stderr,"ex_new %08X %s\n",obj,argp);
- sv=sv_newmortal();
- sv_setref_pv(sv,argp,(void *)obj);
-printf("%d>new_ref '%s'\n",sv,argp);
- CRYPTO_set_ex_data(ad,idx,(char *)sv);
- return(1);
- }
-
-void ex_cleanup(obj,data,ad,idx,argl,argp)
-char *obj;
-SV *data;
-CRYPTO_EX_DATA *ad;
-int idx;
-long argl;
-char *argp;
- {
- pr_name("ex_cleanup");
-fprintf(stderr,"ex_cleanup %08X %s\n",obj,argp);
- if (data != NULL)
- SvREFCNT_dec((SV *)data);
- }
-
-MODULE = SSLeay PACKAGE = SSLeay
-
-BOOT:
- boot_bio();
- boot_cipher();
- boot_digest();
- boot_err();
- boot_ssl();
- boot_SSLeay__BN();
- boot_SSLeay__BIO();
- boot_SSLeay__Cipher();
- boot_SSLeay__MD();
- boot_SSLeay__ERR();
- boot_SSLeay__SSL();
- boot_SSLeay__X509();
-
diff --git a/perl/b.pl b/perl/b.pl
deleted file mode 100644
index ac1e52de79..0000000000
--- a/perl/b.pl
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/local/bin/perl
-
-use ExtUtils::testlib;
-
-use SSLeay;
-
-$cmd=<<"EOF";
-
-EOF
-
-$conn="localhost:4433";
-$conn=$ARGV[0] if $#ARGV >= 0;
-print "X\n";
-$bio=BIO->new("connect");
-print "XX\n";
-$bio->set_callback(sub {print STDERR $_[0]->number_read."\n"; $_[$#_] });
-print "XXX\n";
-$bio->hostname($conn) || die $ssl->error();
-print "XXXX\n";
-
-#$ssl=BIO->new("ssl");
diff --git a/perl/bio.pl b/perl/bio.pl
deleted file mode 100644
index 70a97e7925..0000000000
--- a/perl/bio.pl
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/local/bin/perl
-
-use ExtUtils::testlib;
-
-use SSLeay;
-
-$cmd=<<"EOF";
-GET / HTTP/1.0
-
-EOF
-
-$conn="localhost:4433";
-$conn=$ARGV[0] if $#ARGV >= 0;
-$bio=SSLeay::BIO::new("connect");
-#$bio->set_callback(sub {print STDERR SSLeay::BIO::number_read($_[0])."\n"; $_[$#_] });
-#$bio->set_callback(sub {print STDERR "$#_:".$_[0].":$_[1]:$_[2]:$_[3]:$_[4]:\n"; $_[$#_] });
-$bio->hostname($conn) || die $ssl->error();
-
-
-(($ret=$bio->do_handshake()) > 0) || die $bio->error();
-
-(($ret=$bio->syswrite($cmd)) > 0) || die $bio->error();
-
-while (1)
- {
- $ret=$bio->sysread($buf,10240);
- last if ($ret <= 0);
- print $buf;
- }
-
diff --git a/perl/bio.txt b/perl/bio.txt
deleted file mode 100644
index 5b46c9f5ee..0000000000
--- a/perl/bio.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-BIO::new(type)
- "connect"
- "accept"
- "ssl"
- "buffer"
-
-"connect"
- BIO::hostname(name) host:port to connect to
-
-"accept"
- BIO::set_accept_port(port) port to connect too.
-
-"connect", "accept", "ssl"
- BIO::do_andshake do protocol
-
-"ssl"
- BIO::set_ssl(ssl)
- BIO::get_ssl()
-
-BIO::push(bio)
-BIO::pop; return BIO
-BIO::number_read()
-BIO::number_written()
-BIO::references()
-
-BIO::sysread(buf,len[,offset])
-BIO::syswrite(in[,len][,offset])
-BIO::getline()
-BIO::puts(in)
-BIO::flush()
-BIO::type()
-BIO::next_bio();
-BIO::set_callback(callback[, args])
-
-BIO::new_buffer_ssl_connect(SSL_CTX)
-BIO::new_ssl_connect(SSL_CTX)
diff --git a/perl/bio.xs b/perl/bio.xs
deleted file mode 100644
index a9d32d8408..0000000000
--- a/perl/bio.xs
+++ /dev/null
@@ -1,450 +0,0 @@
-#include "p5SSLeay.h"
-
-static int p5_bio_ex_bio_ptr=0;
-static int p5_bio_ex_bio_callback=0;
-static int p5_bio_ex_bio_callback_data=0;
-
-static long p5_bio_callback(bio,state,parg,cmd,larg,ret)
-BIO *bio;
-int state;
-char *parg;
-int cmd;
-long larg;
-int ret;
- {
- int i;
- SV *me,*cb;
-
- me=(SV *)BIO_get_ex_data(bio,p5_bio_ex_bio_ptr);
- cb=(SV *)BIO_get_ex_data(bio,p5_bio_ex_bio_callback);
- if (cb != NULL)
- {
- dSP;
-
- ENTER ;
- SAVETMPS;
-
- PUSHMARK(sp);
- XPUSHs(sv_2mortal(newSViv(me)));
- XPUSHs(sv_2mortal(newSViv(state)));
- XPUSHs(sv_2mortal(newSViv(cmd)));
- if ((state == BIO_CB_READ) || (state == BIO_CB_WRITE))
- {
- XPUSHs(sv_2mortal(newSVpv(parg,larg)));
- }
- else
- XPUSHs(&sv_undef);
- /* ptr one */
- XPUSHs(sv_2mortal(newSViv(larg)));
- XPUSHs(sv_2mortal(newSViv(ret)));
- PUTBACK;
-
- i=perl_call_sv(cb,G_SCALAR);
-
- SPAGAIN;
- if (i == 1)
- ret=POPi;
- else
- ret=1;
- PUTBACK;
- FREETMPS;
- LEAVE;
- }
- else
- {
- croak("Internal error in SSL p5_ssl_info_callback");
- }
- return(ret);
- }
-
-int boot_bio()
- {
- p5_bio_ex_bio_ptr=
- BIO_get_ex_new_index(0,"SSLeay::BIO",ex_new,NULL,
- ex_cleanup);
- p5_bio_ex_bio_callback=
- BIO_get_ex_new_index(0,"bio_callback",NULL,NULL,
- ex_cleanup);
- p5_bio_ex_bio_callback_data=
- BIO_get_ex_new_index(0,"bio_callback_data",NULL,NULL,
- ex_cleanup);
- return(1);
- }
-
-MODULE = SSLeay::BIO PACKAGE = SSLeay::BIO PREFIX = p5_BIO_
-
-VERSIONCHECK: DISABLE
-
-void
-p5_BIO_new_buffer_ssl_connect(...)
- PREINIT:
- SSL_CTX *ctx;
- BIO *bio;
- SV *arg;
- PPCODE:
- if (items == 1)
- arg=ST(0);
- else if (items == 2)
- arg=ST(1);
- else
- arg=NULL;
-
- if ((arg == NULL) || !(sv_derived_from(arg,"SSLeay::SSL::CTX")))
- croak("Usage: SSLeay::BIO::new_buffer_ssl_connect(SSL_CTX)");
- else
- {
- IV tmp=SvIV((SV *)SvRV(arg));
- ctx=(SSL_CTX *)tmp;
- }
- EXTEND(sp,1);
- bio=BIO_new_buffer_ssl_connect(ctx);
- arg=(SV *)BIO_get_ex_data(bio,p5_bio_ex_bio_ptr);
- PUSHs(arg);
-
-void
-p5_BIO_new_ssl_connect(...)
- PREINIT:
- SSL_CTX *ctx;
- BIO *bio;
- SV *arg;
- PPCODE:
- if (items == 1)
- arg=ST(0);
- else if (items == 2)
- arg=ST(1);
- else
- arg=NULL;
-
- if ((arg == NULL) || !(sv_derived_from(arg,"SSLeay::SSL::CTX")))
- croak("Usage: SSLeay::BIO::new_ssl_connect(SSL_CTX)");
- else
- {
- IV tmp=SvIV((SV *)SvRV(arg));
- ctx=(SSL_CTX *)tmp;
- }
- EXTEND(sp,1);
- bio=BIO_new_ssl_connect(ctx);
- arg=(SV *)BIO_get_ex_data(bio,p5_bio_ex_bio_ptr);
- PUSHs(arg);
-
-void
-p5_BIO_new(...)
- PREINIT:
- BIO *bio;
- char *type;
- SV *arg;
- PPCODE:
- pr_name("p5_BIO_new");
- if ((items == 1) && SvPOK(ST(0)))
- type=SvPV(ST(0),na);
- else if ((items == 2) && SvPOK(ST(1)))
- type=SvPV(ST(1),na);
- else
- croak("Usage: SSLeay::BIO::new(type)");
-
- EXTEND(sp,1);
- if (strcmp(type,"connect") == 0)
- bio=BIO_new(BIO_s_connect());
- else if (strcmp(type,"accept") == 0)
- bio=BIO_new(BIO_s_accept());
- else if (strcmp(type,"ssl") == 0)
- bio=BIO_new(BIO_f_ssl());
- else if (strcmp(type,"buffer") == 0)
- bio=BIO_new(BIO_f_buffer());
- else
- croak("unknown BIO type");
- arg=(SV *)BIO_get_ex_data(bio,p5_bio_ex_bio_ptr);
- PUSHs(arg);
-
-int
-p5_BIO_hostname(bio,name)
- BIO *bio;
- char *name;
- CODE:
- RETVAL=BIO_set_conn_hostname(bio,name);
- OUTPUT:
- RETVAL
-
-int
-p5_BIO_set_accept_port(bio,str)
- BIO *bio;
- char *str;
- CODE:
- RETVAL=BIO_set_accept_port(bio,str);
- OUTPUT:
- RETVAL
-
-int
-p5_BIO_do_handshake(bio)
- BIO *bio;
- CODE:
- RETVAL=BIO_do_handshake(bio);
- OUTPUT:
- RETVAL
-
-BIO *
-p5_BIO_push(b,bio)
- BIO *b;
- BIO *bio;
- CODE:
- /* This reference will be reduced when the reference is
- * let go, and then when the BIO_free_all() is called
- * inside the SSLeay library by the BIO with this
- * pushed into */
- bio->references++;
- RETVAL=BIO_push(b,bio);
- OUTPUT:
- RETVAL
-
-void
-p5_BIO_pop(b)
- BIO *b
- PREINIT:
- BIO *bio;
- char *type;
- SV *arg;
- PPCODE:
- bio=BIO_pop(b);
- if (bio != NULL)
- {
- /* This BIO will either be one created in the
- * perl library, in which case it will have a perl
- * SV, otherwise it will have been created internally,
- * inside SSLeay. For the 'pushed in', it needs
- * the reference count decememted. */
- arg=(SV *)BIO_get_ex_data(bio,p5_bio_ex_bio_ptr);
- if (arg == NULL)
- {
- arg=new_ref("SSLeay::BIO",(char *)bio,0);
- BIO_set_ex_data(bio,p5_bio_ex_bio_ptr,(char *)arg);
- PUSHs(arg);
- }
- else
- {
- /* it was pushed in */
- SvREFCNT_inc(arg);
- PUSHs(arg);
-#if 0 /* This does not need to be done. */
- if (bio->references < 1)
- abort();
- /* decrement the reference count */
- BIO_free(bio);
-#endif