diff options
Diffstat (limited to 'perl')
-rw-r--r-- | perl/MANIFEST | 17 | ||||
-rw-r--r-- | perl/Makefile.PL | 25 | ||||
-rw-r--r-- | perl/OpenSSL.xs | 63 | ||||
-rw-r--r-- | perl/SSLeay.pm | 78 | ||||
-rw-r--r-- | perl/SSLeay.xs | 63 | ||||
-rw-r--r-- | perl/b.pl | 21 | ||||
-rw-r--r-- | perl/bio.pl | 28 | ||||
-rw-r--r-- | perl/bio.txt | 36 | ||||
-rw-r--r-- | perl/bio.xs | 448 | ||||
-rw-r--r-- | perl/bn.pl | 23 | ||||
-rw-r--r-- | perl/bn.txt | 38 | ||||
-rw-r--r-- | perl/bn.xs | 589 | ||||
-rw-r--r-- | perl/callback.c | 103 | ||||
-rw-r--r-- | perl/cipher.pl | 39 | ||||
-rw-r--r-- | perl/cipher.txt | 10 | ||||
-rw-r--r-- | perl/cipher.xs | 152 | ||||
-rw-r--r-- | perl/dh.pl | 40 | ||||
-rw-r--r-- | perl/digest.txt | 7 | ||||
-rw-r--r-- | perl/digest.xs | 83 | ||||
-rw-r--r-- | perl/err.txt | 2 | ||||
-rw-r--r-- | perl/err.xs | 46 | ||||
-rw-r--r-- | perl/f.pl | 25 | ||||
-rw-r--r-- | perl/g.pl | 18 | ||||
-rw-r--r-- | perl/gen_rsa.pl | 49 | ||||
-rw-r--r-- | perl/mul.pl | 56 | ||||
-rw-r--r-- | perl/openssl.h | 96 | ||||
-rw-r--r-- | perl/openssl_bio.xs | 448 | ||||
-rw-r--r-- | perl/openssl_bn.xs | 589 | ||||
-rw-r--r-- | perl/openssl_cb.c | 103 | ||||
-rw-r--r-- | perl/openssl_cipher.xs | 152 | ||||
-rw-r--r-- | perl/openssl_digest.xs | 83 | ||||
-rw-r--r-- | perl/openssl_err.xs | 46 | ||||
-rw-r--r-- | perl/openssl_ssl.xs | 474 | ||||
-rw-r--r-- | perl/openssl_x509.xs | 74 | ||||
-rw-r--r-- | perl/p5SSLeay.h | 96 | ||||
-rw-r--r-- | perl/r.pl | 56 | ||||
-rw-r--r-- | perl/s.pl | 72 | ||||
-rw-r--r-- | perl/s2.pl | 49 | ||||
-rw-r--r-- | perl/server.pem | 369 | ||||
-rw-r--r-- | perl/ss.pl | 64 | ||||
-rw-r--r-- | perl/ssl.pl | 71 | ||||
-rw-r--r-- | perl/ssl.txt | 43 | ||||
-rw-r--r-- | perl/ssl.xs | 474 | ||||
-rw-r--r-- | perl/ssl_srvr.pl | 35 | ||||
-rw-r--r-- | perl/sslbio.pl | 40 | ||||
-rw-r--r-- | perl/t.pl | 12 | ||||
-rw-r--r-- | perl/test | 32 | ||||
-rw-r--r-- | perl/test.pl | 30 | ||||
-rw-r--r-- | perl/test.txt | 36 | ||||
-rw-r--r-- | perl/test2.pl | 28 | ||||
-rw-r--r-- | perl/test3.pl | 19 | ||||
-rw-r--r-- | perl/test8.pl | 19 | ||||
-rw-r--r-- | perl/test9.pl | 38 | ||||
-rw-r--r-- | perl/testbn.pl | 23 | ||||
-rw-r--r-- | perl/testdec.pl | 14 | ||||
-rw-r--r-- | perl/testmd.pl | 26 | ||||
-rw-r--r-- | perl/tt.pl | 15 | ||||
-rw-r--r-- | perl/typemap | 96 | ||||
-rw-r--r-- | perl/x509.txt | 6 | ||||
-rw-r--r-- | perl/x509.xs | 74 | ||||
-rw-r--r-- | perl/xstmp.c | 102 | ||||
-rw-r--r-- | perl/y.pl | 7 | ||||
-rw-r--r-- | perl/yy.pl | 19 | ||||
-rw-r--r-- | perl/z.pl | 32 | ||||
-rw-r--r-- | perl/zz.pl | 22 |
65 files changed, 6143 insertions, 0 deletions
diff --git a/perl/MANIFEST b/perl/MANIFEST new file mode 100644 index 0000000000..992db5ed4c --- /dev/null +++ b/perl/MANIFEST @@ -0,0 +1,17 @@ +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 diff --git a/perl/Makefile.PL b/perl/Makefile.PL new file mode 100644 index 0000000000..f9998e0a61 --- /dev/null +++ b/perl/Makefile.PL @@ -0,0 +1,25 @@ +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', + } + ); diff --git a/perl/OpenSSL.xs b/perl/OpenSSL.xs new file mode 100644 index 0000000000..582b5705aa --- /dev/null +++ b/perl/OpenSSL.xs @@ -0,0 +1,63 @@ +#include "p5SSLeay.h" + +SV *new_ref(type,obj,mort) +char *type; +char *obj; + { + SV *ret; + + if (mort) + ret=sv_newmortal(); + else + ret=newSViv(0); + 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); + 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/SSLeay.pm b/perl/SSLeay.pm new file mode 100644 index 0000000000..f7710039d2 --- /dev/null +++ b/perl/SSLeay.pm @@ -0,0 +1,78 @@ +package SSLeay; + +use Exporter; +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); + +@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); + + +@SSLeay::MD::names=qw(md2 md5 sha sha1 ripemd160 mdc2); + +@SSLeay::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 + desx-cbc rc4 rc4-40 + idea-ecb idea-cfb idea-ofb idea-cbc + rc2-ecb rc2-cbc rc2-40-cbc rc2-cfb rc2-ofb + bf-ecb bf-cfb bf-ofb bf-cbc + cast5-ecb cast5-cfb cast5-ofb cast5-cbc + rc5-ecb rc5-cfb rc5-ofb rc5-cbc + ); + +sub SSLeay::SSL::CTX::new_ssl { SSLeay::SSL::new($_[0]); } + +sub SSLeay::ERR::error + { + my($o)=@_; + my($s,$ret); + + while (($s=$o->get_error()) != 0) + { + $ret.=$s."\n"; + } + return($ret); + } + +@SSLeay::Cipher::aliases=qw(des desx des3 idea rc2 bf cast); + +package SSLeay::BN; + +sub bnfix { (ref($_[0]) ne "SSLeay::BN")?SSLeay::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]); }, +"*" => 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 { bn2dec($_[0]); }, +'0+' => sub { dec2bn($_[0]); }, +"bool" => sub { ref($_[0]) eq "SSLeay::BN"; }; + +sub SSLeay::BIO::do_accept { SSLeay::BIO::do_handshake(@_); } +1; diff --git a/perl/SSLeay.xs b/perl/SSLeay.xs new file mode 100644 index 0000000000..582b5705aa --- /dev/null +++ b/perl/SSLeay.xs @@ -0,0 +1,63 @@ +#include "p5SSLeay.h" + +SV *new_ref(type,obj,mort) +char *type; +char *obj; + { + SV *ret; + + if (mort) + ret=sv_newmortal(); + else + ret=newSViv(0); + 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); + 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 new file mode 100644 index 0000000000..ac1e52de79 --- /dev/null +++ b/perl/b.pl @@ -0,0 +1,21 @@ +#!/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 new file mode 100644 index 0000000000..be27581c02 --- /dev/null +++ b/perl/bio.pl @@ -0,0 +1,28 @@ +#!/usr/local/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + +$cmd=<<"EOF"; + +EOF + +$conn="localhost:4433"; +$conn=$ARGV[0] if $#ARGV >= 0; +$bio=SSLeay::BIO::new("connect"); +$bio->set_callback(sub {print STDERR $_[0]->number_read."\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 new file mode 100644 index 0000000000..5b46c9f5ee --- /dev/null +++ b/perl/bio.txt @@ -0,0 +1,36 @@ +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 new file mode 100644 index 0000000000..3782d42062 --- /dev/null +++ b/perl/bio.xs @@ -0,0 +1,448 @@ +#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(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=new_ref("SSLeay::BIO",(char *)bio,0); + PUSHs(arg); + BIO_set_ex_data(bio,p5_bio_ex_bio_ptr,(char *)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=new_ref("SSLeay::BIO",(char *)bio,0); + PUSHs(arg); + BIO_set_ex_data(bio,p5_bio_ex_bio_ptr,(char *)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=new_ref("SSLeay::BIO",(char *)bio,0); + PUSHs(arg); + BIO_set_ex_data(bio,p5_bio_ex_bio_ptr,(char *)arg); + +int +p5_BIO_hostname(bio,name) + BIO *bio; + char *name; + CODE: + RETVAL=BIO_set_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); + PUSHs(arg); + BIO_set_ex_data(bio,p5_bio_ex_bio_ptr,(char *)arg); + } + else + { + /* it was pushed in */ + SvREFCNT_inc(arg); + PUSHs(arg); + if (bio->references < 1) + abort(); + /* decrement the reference count */ + BIO_free(bio); + } + } + +int +p5_BIO_sysread(bio,in,num, ...) + BIO *bio; + SV *in; + int num; + PREINIT: + int i,n,olen; + int offset; + char *p; + CODE: + offset=0; + if (!SvPOK(in)) + sv_setpvn(in,"",0); + SvPV(in,olen); + if (items > 3) + { + offset=SvIV(ST(3)); + if (offset < 0) + { + if (-offset > olen) + croad("Offset outside string"); + offset+=olen; + } + } + if ((num+offset) > olen) + { + SvGROW(in,num+offset+1); + p=SvPV(in,i); + memset(&(p[olen]),0,(num+offset)-olen+1); + } + p=SvPV(in,n); + + i=BIO_read(bio,p+offset,num); + RETVAL=i; + if (i <= 0) i=0; + SvCUR_set(in,offset+i); + OUTPUT: + RETVAL + +int +p5_BIO_syswrite(bio,in, ...) + BIO *bio; + SV *in; + PREINIT: + char *ptr; + int len,in_len; + int offset=0; + int n; + CODE: + ptr=SvPV(in,in_len); + if (items > 2) + { + len=SvOK(ST(2))?SvIV(ST(2)):in_len; + if (items > 3) + { + offset=SvIV(ST(3)); + if (offset < 0) + { + if (-offset > in_len) + croak("Offset outside string"); + offset+=in_len; + } + else if ((offset >= in_len) && (in_len > 0)) + croak("Offset outside string"); + } + if (len >= (in_len-offset)) + len=in_len-offset; + } + else + len=in_len; + + RETVAL=BIO_write(bio,ptr+offset,len); + OUTPUT: + RETVAL + +void +p5_BIO_getline(bio) + BIO *bio; + PREINIT: + int i; + char *p; + PPCODE: + pr_name("p5_BIO_gets"); + EXTEND(sp,1); + PUSHs(sv_newmortal()); + sv_setpvn(ST(0),"",0); + SvGROW(ST(0),1024); + p=SvPV(ST(0),na); + i=BIO_gets(bio,p,1024); + if (i < 0) i=0; + SvCUR_set(ST(0),i); + +int +p5_BIO_flush(bio) + BIO *bio; + CODE: + RETVAL=BIO_flush(bio); + OUTPUT: + RETVAL + +char * +p5_BIO_type(bio) + BIO *bio; + CODE: + RETVAL=bio->method->name; + OUTPUT: + RETVAL + +void +p5_BIO_next_bio(b) + BIO *b + PREINIT: + BIO *bio; + char *type; + SV *arg; + PPCODE: + bio=b->next_bio; + if (bio != NULL) + { + arg=(SV *)BIO_get_ex_data(bio,p5_bio_ex_bio_ptr); + if (arg == NULL) + { + arg=new_ref("SSLeay::BIO",(char *)bio,0); + PUSHs(arg); + BIO_set_ex_data(bio,p5_bio_ex_bio_ptr,(char *)arg); + } + else + { + SvREFCNT_inc(arg); + PUSHs(arg); + } + } + +int +p5_BIO_puts(bio,in) + BIO *bio; + SV *in; + PREINIT: + char *ptr; + CODE: + ptr=SvPV(in,na); + RETVAL=BIO_puts(bio,ptr); + OUTPUT: + RETVAL + |