summaryrefslogtreecommitdiff
path: root/perl
diff options
context:
space:
mode:
authorRalf S. Engelschall <rse@openssl.org>1998-12-21 11:00:56 +0000
committerRalf S. Engelschall <rse@openssl.org>1998-12-21 11:00:56 +0000
commitdfeab0689f69c0b4bd3480ffd37a9cacc2f17d9c (patch)
tree2f74e0cfd76a9e092548a9bf52e579aef984299b /perl
parent58964a492275ca9a59a0cd9c8155cb2491b4b909 (diff)
downloadopenssl-new-dfeab0689f69c0b4bd3480ffd37a9cacc2f17d9c.tar.gz
Import of old SSLeay release: SSLeay 0.9.1b (unreleased)SSLeay
Diffstat (limited to 'perl')
-rw-r--r--perl/OpenSSL.xs2
-rw-r--r--perl/SSLeay.xs2
-rw-r--r--perl/bio.pl4
-rw-r--r--perl/bio.xs26
-rw-r--r--perl/callback.c2
-rw-r--r--perl/f.pl24
-rw-r--r--perl/openssl_bio.xs26
-rw-r--r--perl/openssl_cb.c2
-rw-r--r--perl/openssl_ssl.xs2
-rw-r--r--perl/ssl.pl10
-rw-r--r--perl/ssl.xs2
11 files changed, 49 insertions, 53 deletions
diff --git a/perl/OpenSSL.xs b/perl/OpenSSL.xs
index 582b5705aa..3e3d1debeb 100644
--- a/perl/OpenSSL.xs
+++ b/perl/OpenSSL.xs
@@ -10,6 +10,7 @@ char *obj;
ret=sv_newmortal();
else
ret=newSViv(0);
+printf(">new_ref %d\n",type);
sv_setref_pv(ret,type,(void *)obj);
return(ret);
}
@@ -27,6 +28,7 @@ char *argp;
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);
}
diff --git a/perl/SSLeay.xs b/perl/SSLeay.xs
index 582b5705aa..3e3d1debeb 100644
--- a/perl/SSLeay.xs
+++ b/perl/SSLeay.xs
@@ -10,6 +10,7 @@ char *obj;
ret=sv_newmortal();
else
ret=newSViv(0);
+printf(">new_ref %d\n",type);
sv_setref_pv(ret,type,(void *)obj);
return(ret);
}
@@ -27,6 +28,7 @@ char *argp;
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);
}
diff --git a/perl/bio.pl b/perl/bio.pl
index be27581c02..70a97e7925 100644
--- a/perl/bio.pl
+++ b/perl/bio.pl
@@ -5,13 +5,15 @@ 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 $_[0]->number_read."\n"; $_[$#_] });
+#$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();
diff --git a/perl/bio.xs b/perl/bio.xs
index 3782d42062..a9d32d8408 100644
--- a/perl/bio.xs
+++ b/perl/bio.xs
@@ -25,7 +25,7 @@ int ret;
SAVETMPS;
PUSHMARK(sp);
- XPUSHs(me);
+ XPUSHs(sv_2mortal(newSViv(me)));
XPUSHs(sv_2mortal(newSViv(state)));
XPUSHs(sv_2mortal(newSViv(cmd)));
if ((state == BIO_CB_READ) || (state == BIO_CB_WRITE))
@@ -60,7 +60,8 @@ int ret;
int boot_bio()
{
p5_bio_ex_bio_ptr=
- BIO_get_ex_new_index(0,"SSLeay::BIO",ex_new,NULL,ex_cleanup);
+ 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);
@@ -97,9 +98,8 @@ p5_BIO_new_buffer_ssl_connect(...)
}
EXTEND(sp,1);
bio=BIO_new_buffer_ssl_connect(ctx);
- arg=new_ref("SSLeay::BIO",(char *)bio,0);
+ arg=(SV *)BIO_get_ex_data(bio,p5_bio_ex_bio_ptr);
PUSHs(arg);
- BIO_set_ex_data(bio,p5_bio_ex_bio_ptr,(char *)arg);
void
p5_BIO_new_ssl_connect(...)
@@ -124,9 +124,8 @@ p5_BIO_new_ssl_connect(...)
}
EXTEND(sp,1);
bio=BIO_new_ssl_connect(ctx);
- arg=new_ref("SSLeay::BIO",(char *)bio,0);
+ arg=(SV *)BIO_get_ex_data(bio,p5_bio_ex_bio_ptr);
PUSHs(arg);
- BIO_set_ex_data(bio,p5_bio_ex_bio_ptr,(char *)arg);
void
p5_BIO_new(...)
@@ -154,16 +153,15 @@ p5_BIO_new(...)
bio=BIO_new(BIO_f_buffer());
else
croak("unknown BIO type");
- arg=new_ref("SSLeay::BIO",(char *)bio,0);
+ arg=(SV *)BIO_get_ex_data(bio,p5_bio_ex_bio_ptr);
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);
+ RETVAL=BIO_set_conn_hostname(bio,name);
OUTPUT:
RETVAL
@@ -218,18 +216,20 @@ p5_BIO_pop(b)
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);
+ 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
}
}
@@ -253,7 +253,7 @@ p5_BIO_sysread(bio,in,num, ...)
if (offset < 0)
{
if (-offset > olen)
- croad("Offset outside string");
+ croak("Offset outside string");
offset+=olen;
}
}
@@ -356,8 +356,9 @@ p5_BIO_next_bio(b)
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);
+ bio->references++;
+ PUSHs(arg);
}
else
{
@@ -398,6 +399,7 @@ p5_BIO_set_callback(bio,cb,...)
arg=sv_mortalcopy(ST(1));
SvREFCNT_inc(arg);
BIO_set_ex_data(bio,p5_bio_ex_bio_callback,(char *)arg);
+ printf("%08lx < bio_ptr\n",BIO_get_ex_data(bio,p5_bio_ex_bio_ptr));
BIO_set_callback(bio,p5_bio_callback);
void
diff --git a/perl/callback.c b/perl/callback.c
index 01840abc85..4e39c16d70 100644
--- a/perl/callback.c
+++ b/perl/callback.c
@@ -80,7 +80,7 @@ char *argp;
{
SV *sv;
-fprintf(stderr,"ex_new %08X %s\n",obj,argp);
+fprintf(stderr,"ex_new idx=%d %08X %s\n",idx,obj,argp);
sv=sv_newmortal();
sv_setref_pv(sv,argp,(void *)obj);
CRYPTO_set_ex_data(ad,idx,(char *)sv);
diff --git a/perl/f.pl b/perl/f.pl
index a255931864..23f5edea54 100644
--- a/perl/f.pl
+++ b/perl/f.pl
@@ -4,22 +4,8 @@ use ExtUtils::testlib;
use SSLeay;
-$data=<>;
-
-#$b=SSLeay::BN::hex2bn($a);
-#$data=$b->bn2bin;
-
-#substr($data,0,8)="";
-#print $data;
-
-$md=SSLeay::MD::new("md5");
-$md->init();
-$md->update("test");
-$key=$md->final();
-
-$rc4=SSLeay::Cipher::new("rc4");
-$rc4->init($key,"",1);
-$out=$rc4->cipher($data);
-
-print $out;
-
+for (7 .. 7926)
+ {
+ my $num = SSLeay::BN::dec2bn($_);
+ print "$_ is ".($num->is_prime ? 'prime' : 'composite'), "\n";
+ }
diff --git a/perl/openssl_bio.xs b/perl/openssl_bio.xs
index 3782d42062..a9d32d8408 100644
--- a/perl/openssl_bio.xs
+++ b/perl/openssl_bio.xs
@@ -25,7 +25,7 @@ int ret;
SAVETMPS;
PUSHMARK(sp);
- XPUSHs(me);
+ XPUSHs(sv_2mortal(newSViv(me)));
XPUSHs(sv_2mortal(newSViv(state)));
XPUSHs(sv_2mortal(newSViv(cmd)));
if ((state == BIO_CB_READ) || (state == BIO_CB_WRITE))
@@ -60,7 +60,8 @@ int ret;
int boot_bio()
{
p5_bio_ex_bio_ptr=
- BIO_get_ex_new_index(0,"SSLeay::BIO",ex_new,NULL,ex_cleanup);
+ 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);
@@ -97,9 +98,8 @@ p5_BIO_new_buffer_ssl_connect(...)
}
EXTEND(sp,1);
bio=BIO_new_buffer_ssl_connect(ctx);
- arg=new_ref("SSLeay::BIO",(char *)bio,0);
+ arg=(SV *)BIO_get_ex_data(bio,p5_bio_ex_bio_ptr);
PUSHs(arg);
- BIO_set_ex_data(bio,p5_bio_ex_bio_ptr,(char *)arg);
void
p5_BIO_new_ssl_connect(...)
@@ -124,9 +124,8 @@ p5_BIO_new_ssl_connect(...)
}
EXTEND(sp,1);
bio=BIO_new_ssl_connect(ctx);
- arg=new_ref("SSLeay::BIO",(char *)bio,0);
+ arg=(SV *)BIO_get_ex_data(bio,p5_bio_ex_bio_ptr);
PUSHs(arg);
- BIO_set_ex_data(bio,p5_bio_ex_bio_ptr,(char *)arg);
void
p5_BIO_new(...)
@@ -154,16 +153,15 @@ p5_BIO_new(...)
bio=BIO_new(BIO_f_buffer());
else
croak("unknown BIO type");
- arg=new_ref("SSLeay::BIO",(char *)bio,0);
+ arg=(SV *)BIO_get_ex_data(bio,p5_bio_ex_bio_ptr);
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);
+ RETVAL=BIO_set_conn_hostname(bio,name);
OUTPUT:
RETVAL
@@ -218,18 +216,20 @@ p5_BIO_pop(b)
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);
+ 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
}
}
@@ -253,7 +253,7 @@ p5_BIO_sysread(bio,in,num, ...)
if (offset < 0)
{
if (-offset > olen)
- croad("Offset outside string");
+ croak("Offset outside string");
offset+=olen;
}
}
@@ -356,8 +356,9 @@ p5_BIO_next_bio(b)
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);
+ bio->references++;
+ PUSHs(arg);
}
else
{
@@ -398,6 +399,7 @@ p5_BIO_set_callback(bio,cb,...)
arg=sv_mortalcopy(ST(1));
SvREFCNT_inc(arg);
BIO_set_ex_data(bio,p5_bio_ex_bio_callback,(char *)arg);
+ printf("%08lx < bio_ptr\n",BIO_get_ex_data(bio,p5_bio_ex_bio_ptr));
BIO_set_callback(bio,p5_bio_callback);
void
diff --git a/perl/openssl_cb.c b/perl/openssl_cb.c
index 01840abc85..4e39c16d70 100644
--- a/perl/openssl_cb.c
+++ b/perl/openssl_cb.c
@@ -80,7 +80,7 @@ char *argp;
{
SV *sv;
-fprintf(stderr,"ex_new %08X %s\n",obj,argp);
+fprintf(stderr,"ex_new idx=%d %08X %s\n",idx,obj,argp);
sv=sv_newmortal();
sv_setref_pv(sv,argp,(void *)obj);
CRYPTO_set_ex_data(ad,idx,(char *)sv);
diff --git a/perl/openssl_ssl.xs b/perl/openssl_ssl.xs
index 6777cf7ada..05834797e3 100644
--- a/perl/openssl_ssl.xs
+++ b/perl/openssl_ssl.xs
@@ -241,7 +241,7 @@ p5_SSL_sysread(ssl,in,num, ...)
if (offset < 0)
{
if (-offset > olen)
- croad("Offset outside string");
+ croak("Offset outside string");
offset+=olen;
}
}
diff --git a/perl/ssl.pl b/perl/ssl.pl
index 4a5569fab1..d38b84d68e 100644
--- a/perl/ssl.pl
+++ b/perl/ssl.pl
@@ -6,11 +6,11 @@ use SSLeay;
$ssl_ctx=SSL::CTX->new("SSLv3");
-$ssl_ctx->set_options("-info_callback" =>
- sub {
- print STDERR $_[0]->state()."\n";
- }
- );
+#$ssl_ctx->set_options("-info_callback" =>
+# sub {
+# print STDERR $_[0]->state()."\n";
+# }
+# );
$conn="localhost:4433";
$conn=$ARGV[0] if $#ARGV >= 0;
diff --git a/perl/ssl.xs b/perl/ssl.xs
index 6777cf7ada..05834797e3 100644
--- a/perl/ssl.xs
+++ b/perl/ssl.xs
@@ -241,7 +241,7 @@ p5_SSL_sysread(ssl,in,num, ...)
if (offset < 0)
{
if (-offset > olen)
- croad("Offset outside string");
+ croak("Offset outside string");
offset+=olen;
}
}