Skip Menu |
 

This queue is for tickets about the Tripletail CPAN distribution.

Report information
The Basics
Id: 21024
Status: resolved
Priority: 0/
Queue: Tripletail

People
Owner: HIO [...] cpan.org
Requestors: alexchorny [...] gmail.com
Cc:
AdminCc: HIO [...] cpan.org

Bug Information
Severity: Important
Broken in: 0.15
Fixed in: (no value)



Subject: patch to compile Tripletail::SMIME under Windows
Download (untitled) / with headers
text/plain 336b
Patched ext/Makefile.PL to look for openssl in c:/openssl and add directories for compiler. Patched ext/Tripletail-SMIME/Makefile.PL the same and to link correct libraries. This all will make compiling it under Windows possible and convinient. Patches and patched Makefiles.PL are included. ------- Alexandr Ciornii, http://chorny.net
Subject: ext-Tripletail-SMIME-Makefile.PL
use strict; use warnings; use ExtUtils::MakeMaker; my $OPENSSL_LIBS = $ENV{LDFLAGS} || ''; my $OPENSSL_CFLAGS = $ENV{CFLAGS} || ''; my $openssl_path=''; if($^O eq 'MSWin32') { $openssl_path='c:/openssl' if -x 'c:/openssl/bin/openssl.exe'; if ($openssl_path) { $OPENSSL_CFLAGS.=" -I$openssl_path/include"; $OPENSSL_LIBS.=" -L$openssl_path/lib -lssleay32 -llibeay32"; } } else { $OPENSSL_LIBS.=" -L$openssl_path/lib -lcrypto"; } WriteMakefile( NAME => 'Tripletail::SMIME', AUTHOR => 'Ymirlink <tl@tripletail.jp>', VERSION_FROM => 'SMIME.pm', ABSTRACT_FROM => 'SMIME.pm', PL_FILES => {}, PREREQ_PM => { 'Test::More' => 0, }, LIBS => ["$OPENSSL_LIBS"], INC => "$OPENSSL_CFLAGS", dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => 'Tripletail-SMIME-*' }, );
Subject: ext-Makefile.PL.patch
*** ext/Makefile.PL.dist Tue Aug 15 08:10:07 2006 --- ext/Makefile.PL Wed Aug 16 18:37:10 2006 *************** *** 46,53 **** use ExtUtils::Embed; my $cc = exists $argv{CC} ? $argv{CC} : $Config{cc}; my $ccopts = $argv{CCFLAGS}||ExtUtils::Embed::ccopts(); ! my $cmd = "$cc $ccopts $xstest_src -o $xstest_out"; print "Checking XS Compiling... : $cmd\n"; my $rc = 0xffff & system($cmd); unlink($xstest_out); --- 46,62 ---- use ExtUtils::Embed; my $cc = exists $argv{CC} ? $argv{CC} : $Config{cc}; my $ccopts = $argv{CCFLAGS}||ExtUtils::Embed::ccopts(); ! my $windows=0; ! my $openssl_path=''; my $cmd = "$cc $ccopts $xstest_src -o $xstest_out"; + if($^O eq 'MSWin32') { + $openssl_path='c:/openssl' if -x 'c:/openssl/bin/openssl.exe'; + $windows=1; + if ($openssl_path) { + $cmd = "$cc -I$openssl_path/include $ccopts $xstest_src -o $xstest_out -L$openssl_path/lib"; + } + } + print "Checking XS Compiling... : $cmd\n"; my $rc = 0xffff & system($cmd); unlink($xstest_out);
Subject: ext-Makefile.PL
Download ext-Makefile.PL
text/x-perl 2.1k
use strict; use warnings; use ExtUtils::MakeMaker; our %OPTS; &check_openssl(); WriteMakefile( NAME => 'Tripletail-ext', %OPTS, ); sub check_openssl { if( !openssl_is_available() ) { $OPTS{DIR} = ['Tripletail-HtmlFilter']; } } sub openssl_is_available { my $xstest_src = "openssl_check.c"; my $xstest_out = "openssl_check"; if( !open(FILE, "> $xstest_src") ) { return; } print FILE <<XSTEST_CODE; #include <string.h> #include <openssl/crypto.h> #include <openssl/pem.h> #include <openssl/err.h> #include <openssl/pkcs12.h> #include <openssl/x509.h> int main() { return 0; } XSTEST_CODE close(FILE); # compile. my %argv = map{ /^(\w+)=(.*)$/ } @ARGV; use Config; use ExtUtils::Embed; my $cc = exists $argv{CC} ? $argv{CC} : $Config{cc}; my $ccopts = $argv{CCFLAGS}||ExtUtils::Embed::ccopts(); my $windows=0; my $openssl_path=''; my $cmd = "$cc $ccopts $xstest_src -o $xstest_out"; if($^O eq 'MSWin32') { $openssl_path='c:/openssl' if -x 'c:/openssl/bin/openssl.exe'; $windows=1; if ($openssl_path) { $cmd = "$cc -I$openssl_path/include $ccopts $xstest_src -o $xstest_out -L$openssl_path/lib"; } } print "Checking XS Compiling... : $cmd\n"; my $rc = 0xffff & system($cmd); unlink($xstest_out); unlink($xstest_src); if( $rc ) { if( $rc == 0xffff ) { print " >> Here environment cannot use XS.\n"; print " >> Because : command failed : $!\n"; return; }elsif( $rc > 0x80 ) { print " >> Here environment cannot use XS.\n"; print " >> Because : ran with non-zero exit status $rc\n"; return; }elsif( $rc & 0x80 ) { $rc &= ~0x80; print " >> Compile failed..\n"; print " >> Because : ran with coredump from signal $rc\n"; exit 1; }else { print " >> Compile failed..\n"; print " >> Because : ran with signal $rc\n"; exit 1; } } print " >> ok, compile succeed.\n"; 1; } # ----------------------------------------------------------------------------- # End of File. # -----------------------------------------------------------------------------
Subject: ext-Tripletail-SMIME-Makefile.PL.patch
*** ext/Tripletail-SMIME/Makefile.PL.dist Wed Aug 16 18:36:18 2006 --- ext/Tripletail-SMIME/Makefile.PL Wed Aug 16 18:20:59 2006 *************** *** 5,10 **** --- 5,21 ---- my $OPENSSL_LIBS = $ENV{LDFLAGS} || ''; my $OPENSSL_CFLAGS = $ENV{CFLAGS} || ''; + my $openssl_path=''; + if($^O eq 'MSWin32') { + $openssl_path='c:/openssl' if -x 'c:/openssl/bin/openssl.exe'; + if ($openssl_path) { + $OPENSSL_CFLAGS.=" -I$openssl_path/include"; + $OPENSSL_LIBS.=" -L$openssl_path/lib -lssleay32 -llibeay32"; + } + } else { + $OPENSSL_LIBS.=" -L$openssl_path/lib -lcrypto"; + } + WriteMakefile( NAME => 'Tripletail::SMIME', AUTHOR => 'Ymirlink <tl@tripletail.jp>', *************** *** 14,20 **** PREREQ_PM => { 'Test::More' => 0, }, ! LIBS => ["$OPENSSL_LIBS -lcrypto"], INC => "$OPENSSL_CFLAGS", dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => 'Tripletail-SMIME-*' }, --- 25,31 ---- PREREQ_PM => { 'Test::More' => 0, }, ! LIBS => ["$OPENSSL_LIBS"], INC => "$OPENSSL_CFLAGS", dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => 'Tripletail-SMIME-*' },
Subject: patch for Tripletail::SMIME test under Windows
From: Alexandr Ciornii <alexchorny [...] gmail.com>
Download (untitled) / with headers
text/plain 282b
Patched smime.t to use c:\openssl\bin\openssl.exe and Windows nul. Test still fails for me, because my openssl cannot find it's configuration file (with error "Unable to load config info from /usr/local/ssl/openssl.cnf") on second call. ------- Alexandr Ciornii, http://chorny.net
Download smime.t
text/x-perl 2.5k
use Test::More tests => 23; use Test::Exception; use strict; use warnings; BEGIN { use Tripletail::SMIME; my $openssl = '/usr/local/ymir/perl/openssl/bin/openssl'; my $null='/dev/null'; if($^O eq 'MSWin32') { $openssl = 'c:\openssl\bin\openssl.exe'; $null='null'; } if (!-x $openssl) { $openssl = '/usr/bin/openssl'; } foreach my $i (1 .. 2) { system(qq{$openssl genrsa > tmp$i-$$.key 2>$null}) and die $!; system(qq{yes "" | $openssl req -new -key tmp$i-$$.key -out tmp$i-$$.csr 2>&1 >$null}) and die $!; system(qq{$openssl x509 -in tmp$i-$$.csr -out tmp$i-$$.crt -req -signkey tmp$i-$$.key 2>&1 >$null}) and die $!; } } END { foreach my $i (1 .. 2) { unlink "tmp$i-$$.key", "tmp$i-$$.csr", "tmp$i-$$.crt"; } } sub key { my $i = shift; local $/ = undef; open my $fh, '<', "tmp$i-$$.key"; <$fh>; } sub crt { my $i = shift; local $/ = undef; open my $fh, '<', "tmp$i-$$.crt"; <$fh>; } my $plain = q{From: alice@example.org To: bob@example.org Subject: Tripletail::SMIME test This is a test mail. Please ignore... }; $plain =~ s/\r?\n|\r/\r\n/g; my $verify = q{Subject: Tripletail::SMIME test This is a test mail. Please ignore... }; $verify =~ s/\r?\n|\r/\r\n/g; #----------------------- my $smime; ok($smime = Tripletail::SMIME->new, 'new'); ok($smime->setPrivateKey(key(1), crt(1)), 'setPrivateKey (without passphrase)'); dies_ok {$smime->sign} 'sign undef'; dies_ok {$smime->sign(\123)} 'sign ref'; dies_ok {$smime->signonly} 'signonly undef'; dies_ok {$smime->signonly(\123)} 'signonly ref'; dies_ok {$smime->encrypt} 'encrypt undef'; dies_ok {$smime->encrypt(\123)} 'encrypt ref'; dies_ok {$smime->isSigned} 'isSigned undef'; dies_ok {$smime->isSigned(\123)} 'isSigned ref'; dies_ok {$smime->isEncrypted} 'isEncrypted undef'; dies_ok {$smime->isEncrypted(\123)} 'isEncrypted ref'; my $signed; ok($signed = $smime->sign($plain), 'sign'); ok($smime->isSigned($signed), 'signed'); ok($smime->setPublicKey(crt(1)), 'setPublicKey (one key)'); my $checked; ok($checked = $smime->check($signed), 'check'); is($checked, $verify, '$verify eq check(sign($plain))'); ok($smime->setPublicKey([crt(1), crt(2)]), 'setPublicKey (two keys)'); my $encrypted; ok($encrypted = $smime->encrypt($plain), 'encrypt'); ok($smime->isEncrypted($encrypted), 'isEncrypted'); my $decrypted; ok($decrypted = $smime->decrypt($encrypted), 'decrypt (by sender\'s key)'); is($decrypted, $verify, '$plain eq decrypt(encrypt($plain))'); $smime->setPrivateKey(key(2), crt(2)); ok($decrypted = $smime->decrypt($encrypted), 'decrypt (by recipient\'s key)'); 1;
Download smime.t.patch
text/x-diff 1.3k
*** smime.t.dist Tue Aug 15 08:08:06 2006 --- smime.t Wed Aug 16 22:10:12 2006 *************** *** 6,19 **** BEGIN { use Tripletail::SMIME; my $openssl = '/usr/local/ymir/perl/openssl/bin/openssl'; if (!-x $openssl) { $openssl = '/usr/bin/openssl'; } foreach my $i (1 .. 2) { ! system(qq{$openssl genrsa > tmp$i-$$.key 2>/dev/null}) and die $!; ! system(qq{yes "" | $openssl req -new -key tmp$i-$$.key -out tmp$i-$$.csr 2>&1 >/dev/null}) and die $!; ! system(qq{$openssl x509 -in tmp$i-$$.csr -out tmp$i-$$.crt -req -signkey tmp$i-$$.key 2>&1 >/dev/null}) and die $!; } } --- 6,24 ---- BEGIN { use Tripletail::SMIME; my $openssl = '/usr/local/ymir/perl/openssl/bin/openssl'; + my $null='/dev/null'; + if($^O eq 'MSWin32') { + $openssl = 'c:\openssl\bin\openssl.exe'; + $null='null'; + } if (!-x $openssl) { $openssl = '/usr/bin/openssl'; } foreach my $i (1 .. 2) { ! system(qq{$openssl genrsa > tmp$i-$$.key 2>$null}) and die $!; ! system(qq{yes "" | $openssl req -new -key tmp$i-$$.key -out tmp$i-$$.csr 2>&1 >$null}) and die $!; ! system(qq{$openssl x509 -in tmp$i-$$.csr -out tmp$i-$$.crt -req -signkey tmp$i-$$.key 2>&1 >$null}) and die $!; } }
Download (untitled) / with headers
text/plain 185b
both problems are fixed. I used precompiled openssl library, and that runs well. my environment is: + Visual Studio .Net 2003 + ActivePerl 5.8.8 Build 817 + OpenSSL 0.9.8b thank you.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.