Index: Net_SSLeay/.cvsignore diff -u /dev/null Net_SSLeay/.cvsignore:1.1 --- /dev/null Tue Jun 1 09:40:54 1999 +++ Net_SSLeay/.cvsignore Tue Feb 9 18:24:11 1999 @@ -0,0 +1,7 @@ +ssleay_path +blib +Makefile +pm_to_blib +SSLeay.c +SSLeay.bs +sslecho.log Index: Net_SSLeay/Makefile.PL diff -u Net_SSLeay/Makefile.PL:1.1.1.1 Net_SSLeay/Makefile.PL:1.3 --- Net_SSLeay/Makefile.PL:1.1.1.1 Tue Feb 9 18:05:27 1999 +++ Net_SSLeay/Makefile.PL Fri May 28 17:04:09 1999 @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/local/bin/perl -w # 23.6.1998, Sampo Kellomaki # # Configuration script for Net::SSLeay.pm @@ -60,12 +60,12 @@ 'DEFINE' => '', # e.g., '-DHAVE_SOMETHING' 'DISTNAME' => 'Net_SSLeay.pm', 'dist' => { COMPRESS => 'gzip', SUFFIX => 'gz', }, - 'LIBS' => ["-L$ssleay_path -L$ssleay_path/lib -lssl -lcrypto"], + 'LIBS' => ["-L$ssleay_path -L$ssleay_path/lib -lssl -lcrypto -lRSAglue -L/usr/local/lib -lrsaref"], 'INC' => "-I$ssleay_path/include", # Uncomment (and edit) following for debugging with gdb # 'LIBS' => ['-L/usr/src/SSLeay-0.9.0 -lssl -lcrypto'], # 'INC' => '-I/usr/src/SSLeay-0.9.0/include', -# 'OPTIMIZE' => '-g', + 'OPTIMIZE' => '-g -O', ); exec "make test" if $test_it; Index: Net_SSLeay/SSLeay.pm diff -u Net_SSLeay/SSLeay.pm:1.1.1.1 Net_SSLeay/SSLeay.pm:1.2 --- Net_SSLeay/SSLeay.pm:1.1.1.1 Tue Feb 9 18:05:27 1999 +++ Net_SSLeay/SSLeay.pm Tue Feb 9 18:24:12 1999 @@ -255,6 +255,7 @@ accept clear connect + shutdown set_fd set_rfd set_wfd @@ -292,6 +293,7 @@ get_shared_ciphers get_peer_certificate set_verify + set_default_passwd_cb flush_sessions set_bio get_rbio @@ -1069,12 +1071,14 @@ RAND_seed(rand() + $$); # Stir it with time and pid - unless (-r $rn_seed_file || -r $random_device || $seed) { + unless (-r $random_device || -r $rn_seed_file || $seed) { warn "Random number generator not seeded!!!\n" if $trace; } - RAND_load_file($rn_seed_file, -s _) if -r $rn_seed_file; - RAND_seed($seed) if $seed; + if(defined($rn_seed_file) and -r $rn_seed_file) { + RAND_load_file($rn_seed_file, -s _); + } + if(defined($seed) and $seed) { RAND_seed($seed); } RAND_load_file($random_device, $how_random/8) if -r $random_device; } @@ -1158,12 +1162,12 @@ sub set_server_cert_and_key { my ($ctx, $cert_path, $key_path) = @_; - my $errs; + my $errs = ''; # Following will ask password unless private key is not encrypted CTX_use_RSAPrivateKey_file ($ctx, $key_path, &FILETYPE_PEM); - $errs .= print_errs("private key `$key_path' ($!)"); + $errs .= print_errs("private key `$key_path' ($!)") if defined; CTX_use_certificate_file ($ctx, $cert_path, &FILETYPE_PEM); - $errs .= print_errs("certificate `$cert_path' ($!)"); + $errs .= print_errs("certificate `$cert_path' ($!)") if defined; return wantarray ? (undef, $errs) : ($errs eq ''); } Index: Net_SSLeay/SSLeay.xs diff -u Net_SSLeay/SSLeay.xs:1.1.1.1 Net_SSLeay/SSLeay.xs:1.3 --- Net_SSLeay/SSLeay.xs:1.1.1.1 Tue Feb 9 18:05:27 1999 +++ Net_SSLeay/SSLeay.xs Fri May 28 17:04:11 1999 @@ -1504,6 +1504,53 @@ return POPi; } +static SV * ssleay_ctx_password_callback = (SV*)NULL; + +static int ssleay_ctx_password_callback_glue(char *buf, int num, int verify) +{ + dSP ; + SV *res; + char *res_string; + STRLEN res_len; + int count; + + ENTER ; + SAVETMPS; + + PUSHMARK(sp); + XPUSHs(sv_2mortal(newSViv(verify))); + PUTBACK ; + + if (ssleay_ctx_password_callback == NULL) + croak ("Net::SSLeay: ctx_password_callback called, but not " + "set to point to any perl function.\n"); + + count = perl_call_sv(ssleay_ctx_password_callback, G_SCALAR); + + SPAGAIN; + + if (count != 1) + croak ( "Net::SSLeay: ctx_password_callback " + "perl function did not return a scalar.\n"); + res = POPs; + + res_string = SvPV(res, res_len); + + if(res_len > num) + warn("Net::SSLeay: ctx_password_callback returned password " + "of length %d, but buffer has length %d - truncating.", + res_len, num); + + strncpy(buf, res_string, num); + + FREETMPS ; + LEAVE ; + + return res_len; +} + + + MODULE = Net::SSLeay PACKAGE = Net::SSLeay PREFIX = SSL_ PROTOTYPES: ENABLE @@ -1604,6 +1651,24 @@ SSL_CTX_set_verify(ctx,mode,NULL); } + +void +SSL_CTX_set_default_passwd_cb(ctx, callback) + SSL_CTX * ctx + SV * callback + CODE: + if (ssleay_ctx_password_callback == (SV*)NULL) { + ssleay_ctx_password_callback = newSVsv(callback); + } else { + SvSetSV (ssleay_ctx_password_callback, callback); + } + if (SvTRUE(ssleay_ctx_password_callback)) { + SSL_CTX_set_default_passwd_cb(ctx,&ssleay_ctx_password_callback_glue); + } else { + SSL_CTX_set_default_passwd_cb(ctx,NULL); + } + + #define REM10 "============= SSL functions ==============" SSL * @@ -1633,6 +1698,9 @@ SSL_connect(s) SSL * s +int +SSL_shutdown(s) + SSL * s int SSL_set_fd(s,fd) Index: Net_SSLeay/test.pl diff -u Net_SSLeay/test.pl:1.1.1.1 Net_SSLeay/test.pl:1.2 --- Net_SSLeay/test.pl:1.1.1.1 Tue Feb 9 18:05:27 1999 +++ Net_SSLeay/test.pl Tue Feb 9 18:24:14 1999 @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/local/bin/perl # 24.6.1998, 8.7.1998, Sampo Kellomaki # # Before `make install' is performed this script should be runnable with Index: Net_SSLeay/examples/.cvsignore diff -u /dev/null Net_SSLeay/examples/.cvsignore:1.1 --- /dev/null Tue Jun 1 09:40:55 1999 +++ Net_SSLeay/examples/.cvsignore Tue Feb 9 18:24:19 1999 @@ -0,0 +1,2 @@ +cert.pem +key.pem Index: Net_SSLeay/examples/get_page.pl diff -u Net_SSLeay/examples/get_page.pl:1.1.1.1 Net_SSLeay/examples/get_page.pl:1.2 --- Net_SSLeay/examples/get_page.pl:1.1.1.1 Tue Feb 9 18:05:27 1999 +++ Net_SSLeay/examples/get_page.pl Tue Feb 9 18:24:19 1999 @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/local/bin/perl # 8.6.1998, Sampo Kellomaki # Get a page via HTTP and print some info about it. Index: Net_SSLeay/examples/https-proxy-snif.pl diff -u Net_SSLeay/examples/https-proxy-snif.pl:1.1.1.1 Net_SSLeay/examples/https-proxy-snif.pl:1.2 --- Net_SSLeay/examples/https-proxy-snif.pl:1.1.1.1 Tue Feb 9 18:05:27 1999 +++ Net_SSLeay/examples/https-proxy-snif.pl Tue Feb 9 18:24:20 1999 @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/local/bin/perl # 5.6.1998, Sampo Kellomaki $usage = < # Make a self signed cert Index: Net_SSLeay/examples/ssl-inetd-serv.pl diff -u Net_SSLeay/examples/ssl-inetd-serv.pl:1.1.1.1 Net_SSLeay/examples/ssl-inetd-serv.pl:1.2 --- Net_SSLeay/examples/ssl-inetd-serv.pl:1.1.1.1 Tue Feb 9 18:05:27 1999 +++ Net_SSLeay/examples/ssl-inetd-serv.pl Tue Feb 9 18:24:21 1999 @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/local/bin/perl # ssl-inetd-serv.pl - SSL echo server run from inetd # # Copyright (c) 1996,1998 Sampo Kellomaki . All Rights Reserved. Index: Net_SSLeay/examples/ssl_diff.pl diff -u Net_SSLeay/examples/ssl_diff.pl:1.1.1.1 Net_SSLeay/examples/ssl_diff.pl:1.2 --- Net_SSLeay/examples/ssl_diff.pl:1.1.1.1 Tue Feb 9 18:05:27 1999 +++ Net_SSLeay/examples/ssl_diff.pl Tue Feb 9 18:24:21 1999 @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/local/bin/perl # 18.6.1998, Sampo Kellomaki # Tool used to sync SSLeay.xs with ssl.h. Prints what .h has that .xs doesn't. # Usage: examples/ssl_diff.pl *pat* SSLeay.xs /usr/local/ssl/include/ssl.h Index: Net_SSLeay/examples/sslecho.pl diff -u Net_SSLeay/examples/sslecho.pl:1.1.1.1 Net_SSLeay/examples/sslecho.pl:1.2 --- Net_SSLeay/examples/sslecho.pl:1.1.1.1 Tue Feb 9 18:05:27 1999 +++ Net_SSLeay/examples/sslecho.pl Tue Feb 9 18:24:22 1999 @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/local/bin/perl -w # sslecho.pl - Echo server using SSL # # Copyright (c) 1996,1998 Sampo Kellomaki , All Rights Reserved.