Crypt-MatrixSSL3
view release on metacpan or search on metacpan
sv_resetpvn|5.017005||Viu
SvRMAGICAL|5.003007||Viu
SvRMAGICAL_off|5.003007||Viu
SvRMAGICAL_on|5.003007||Viu
SvROK|5.003007|5.003007|
SvROK_off|5.003007|5.003007|
SvROK_on|5.003007|5.003007|
SvRV|5.003007|5.003007|
SvRV_const|5.010001||Viu
SvRV_set|5.009003|5.003007|p
sv_rvunweaken|5.027004|5.027004|
sv_rvweaken|5.006000|5.006000|
SvRVx|5.003007||Viu
SvRX|5.009005|5.003007|p
SvRXOK|5.009005|5.003007|p
SV_SAVED_COPY|5.009005||Viu
SvSCREAM|5.003007||Viu
SvSCREAM_off|5.003007||Viu
SvSCREAM_on|5.003007||Viu
sv_setbool|5.035004|5.035004|
sv_setbool_mg|5.035004|5.035004|
sv_setgid|5.019001||Viu
use warnings;
use strict;
use Carp;
use Test::More tests => 26;
use Test::Exception;
use Scalar::Util qw( weaken );
use Crypt::MatrixSSL3 qw( :DEFAULT :Validate :Alert get_ssl_alert get_ssl_error );
Crypt::MatrixSSL3::Open();
my $trustedCAbundle = $Crypt::MatrixSSL3::CA_CERTIFICATES;
my $trustedCAcertFiles = 't/cert/testCA.crt';
my $certFile = 't/cert/server.crt';
my $privFile = 't/cert/server.key';
my $privPass = undef;
SSL_ALERT_BAD_CERTIFICATE, SSL_ALERT_UNKNOWN_CA,
SSL_ALERT_UNSUPPORTED_CERTIFICATE, SSL_ALERT_CERTIFICATE_REVOKED,
SSL_ALERT_CERTIFICATE_EXPIRED, SSL_ALERT_CERTIFICATE_UNKNOWN,
SSL_ALERT_ACCESS_DENIED,
);
sub assert { croak 'assertion failed' if $_[0] }
my ($ref, $keys, $sessionId, $ssl);
{ my $x = 'x'; weaken($ref = \$x); $keys = \$x }
ok $ref;
$keys = Crypt::MatrixSSL3::Keys->new();
ok !$ref, 'Keys->new: old $keys freed';
undef $keys;
#ok(1, 'matrixSslClose'); # make sure matrixSslClose() doesn't crash
{ my $x = 'x'; weaken($ref = \$x); $sessionId = \$x; }
ok $ref;
$sessionId = Crypt::MatrixSSL3::SessID->new();
ok !$ref, 'SessID->new: old $sessionId freed';
{ my $x = 'x'; weaken($ref = \$x); $ssl = \$x; }
ok $ref;
$keys = Crypt::MatrixSSL3::Keys->new();
assert $keys->load_rsa(undef, undef, undef, $trustedCAcertFiles);
$ssl = Crypt::MatrixSSL3::Client->new($keys, $sessionId, undef, undef, undef, undef, undef);
ok !$ref, 'Client->new: old $ssl freed';
undef $ssl;
{ my $x = 'x'; weaken($ref = \$x); $ssl = \$x; }
ok $ref;
$keys = Crypt::MatrixSSL3::Keys->new();
assert $keys->load_rsa($certFile, $privFile, $privPass, undef);
$ssl = Crypt::MatrixSSL3::Server->new($keys, undef);
ok !$ref, 'Server->new: old $ssl freed';
undef $ssl;
leaktest('newkeys_deletekeys', test=>100000);
leaktest('loadrsakeys_client', test=>500);
leaktest('loadrsakeys_server');
( run in 0.537 second using v1.01-cache-2.11-cpan-65fba6d93b7 )