Skip Menu |

This queue is for tickets about the Crypt-SSLeay CPAN distribution.

Report information
The Basics
Id: 52408
Status: resolved
Priority: 0/
Queue: Crypt-SSLeay

People
Owner: nanis [...] runu.moc.invalid
Requestors: kmx [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.57_02



Subject: [PATCH] Openssl-1.0.0 version detection fix
Hi, this OpenSSL 1.0.0 issue is related to a version detection routine in Makefile.pl that is not ready for version numbers starting with 1. The current code detects "undef" version and based on that we define: #define CRYPT_SSLEAY_free free instead of #define CRYPT_SSLEAY_free OPENSSL_free Which ends at least on Win32/strawberry perl with some nasty perl.exe crashes. Here is a simple patch for Makefile.PL that solves it: my $version; my $type; while (<VERSION_FILE>) { - if (/^#define\s+$version_match\s+0x0+(\d\d\d)/) { + if (/^#define\s+$version_match\s+0x(\d\d\d\d\d)/) { $version = $1; - $version =~ s/(\d)0(\d)/$1$2/; + $version =~ s/^(\d)0(\d)0(\d)/$1$2$3/; $type = ($version > 92) ? "OpenSSL" : "SSLeay"; - $version = join('.', split(//, "0$version")); + $version = join('.', split(//, $version)); last; } } Please consider this patch as without it Crypt::SSLeay does not work on Win32 with openssl-1.0.0 -- kmx
Could you please give me a feedback on the proposed patch described above.

Thanks.

--
kmx

03 December 2009 16:05:18, KMX:
Show quoted text
> ...
> Here is a simple patch for Makefile.PL that solves it:
>
>   my $version;
>   my $type;
>   while (<VERSION_FILE>) {
> -   if (/^#define\s+$version_match\s+0x0+(\d\d\d)/) {
> +   if (/^#define\s+$version_match\s+0x(\d\d\d\d\d)/) {
>       $version = $1;
> -     $version =~ s/(\d)0(\d)/$1$2/;
> +     $version =~ s/^(\d)0(\d)0(\d)/$1$2$3/;
>       $type = ($version > 92) ? "OpenSSL" : "SSLeay";
> -     $version = join('.', split(//, "0$version"));
> +     $version = join('.', split(//, $version));
>       last;
>     }
>   }

Hello,

can I do something for getting the proposed simple patch to at least some dev release of Crypt::SSLeay?

For our project (strawberry perl) it is quite crutial as on 64bit MS Windows openssl before 1.0.0 is not supported and we are including Crypt::SSLeay into base strawberry release - which we currently are not able with upcoming 64bit strawberry perl.

Thanks for any help.

--
kmx
03 December 2009 16:05:18, KMX:
Show quoted text
> ...
> Here is a simple patch for Makefile.PL that solves it:
>
>   my $version;
>   my $type;
>   while (<VERSION_FILE>) {
> -   if (/^#define\s+$version_match\s+0x0+(\d\d\d)/) {
> +   if (/^#define\s+$version_match\s+0x(\d\d\d\d\d)/) {
>       $version = $1;
> -     $version =~ s/(\d)0(\d)/$1$2/;
> +     $version =~ s/^(\d)0(\d)0(\d)/$1$2$3/;
>       $type = ($version > 92) ? "OpenSSL" : "SSLeay";
> -     $version = join('.', split(//, "0$version"));
> +     $version = join('.', split(//, $version));
>       last;
>     }
>   }

Can I do something to attract your attention to my proposed 3-line patch which is necessary for Crypt::SSLeay to work with openssl-1.0.0.

Any short message welcome - just to make me sure that my "crying" here does not go to /dev/null.

--
kmx
03 December 2009 16:05:18, KMX:
Show quoted text
> ...
> Here is a simple patch for Makefile.PL that solves it:
>
>   my $version;
>   my $type;
>   while (<VERSION_FILE>) {
> -   if (/^#define\s+$version_match\s+0x0+(\d\d\d)/) {
> +   if (/^#define\s+$version_match\s+0x(\d\d\d\d\d)/) {
>       $version = $1;
> -     $version =~ s/(\d)0(\d)/$1$2/;
> +     $version =~ s/^(\d)0(\d)0(\d)/$1$2$3/;
>       $type = ($version > 92) ? "OpenSSL" : "SSLeay";
> -     $version = join('.', split(//, "0$version"));
> +     $version = join('.', split(//, $version));
>       last;
>     }
>   }

OpenSSL 1.0.0 (stable, no beta) was already released. Could you please consider the patch above to make Crypt::SSLeay compatible with the latest openssl?

Why I am pusshing on you since December is that our project (strawberryperl.com) needs this patch as openssl 0.9.x does not have support for MSWindows/64-bit gcc compiler therefore our only option is to use openssl-1.0.0 which currently prevents our Win/64bit users from using Crypt::SSLeay.

I would really appreciate any feedback.

--
kmx
Can anybody please give a feedback to my patch proposed in this RT.

--
kmx

On Mon Jul 12 14:18:41 2010, KMX wrote: Show quoted text
> Can anybody please give a feedback to my patch proposed in this RT.
Hello: I am just getting involved in clearing up the RT queue for Crypt-SSLeay. I hope to have this and some other straightforward fixes done soon. Sinan
Subject: [rt.cpan.org #52408] Alternative patch to detect OpenSSL version
Date: Mon, 26 Jul 2010 09:29:00 -0700
To: bug-Crypt-SSLeay [...] rt.cpan.org
From: Sander Temme <sander [...] temme.net>
I have a slightly more elaborate patch that follows the version number rules set forth in opensslv.h: --- Makefile.PL-dist 2010-07-23 10:09:33.000000000 -0700 +++ Makefile.PL 2010-07-25 22:06:59.000000000 -0700 @@ -342,11 +342,29 @@ my $version; my $type; while (<VERSION_FILE>) { - if (/^#define\s+$version_match\s+0x0+(\d\d\d)/) { - $version = $1; - $version =~ s/(\d)0(\d)/$1$2/; - $type = ($version > 92) ? "OpenSSL" : "SSLeay"; - $version = join('.', split(//, "0$version")); + # From include/openssl/opensslv.h: + # /* Numeric release version identifier: + # * MNNFFPPS: major minor fix patch status + # * The status nibble has one of the values 0 for development, 1 to e for betas + # * 1 to 14, and f for release. The patch level is exactly that. + # */ + # M N N F F P P S + if (/^#define\s+$version_match\s+0x(\d)(\d\d)(\d\d)([[:xdigit:]][[:xdigit:]])([[:xdigit:]])/) { + my $major = $1; + my $minor = $2; + my $fix = $3; + # Patch level, if present, is expressed as a lowercase letter + my $patch = hex $4 == 0x0 ? "" : chr 96 + hex $4; + my $status = hex $5; + $type = ($major == 0 && $minor == 9 && $fix < 3) ? "SSLeay" : "OpenSSL"; + $version = sprintf "%u.%u.%u%s", $major, $minor, $fix, $patch; + if ($status == 0) { + $version .= '-devel'; + } elsif ($status == 15) { + # Final release, no addition + } else { + $version .= "b$status"; + } last; } } Tested on MacOSX 10.6 with Perl 5.12.1 and various OpenSSL beta and release versions. S. -- sander@temme.net http://www.temme.net/sander/ PGP FP: FC5A 6FC6 2E25 2DFD 8007 EE23 9BB8 63B0 F51B B88A

Message body is not shown because sender requested not to inline it.

Thank you. I had come up with a similar idea, but I was ignoring the patch and status parts as they did not seem to matter in terms of building the module (although they are useful for informative purposes). I am going to use your version. -- Sinan On Mon Jul 26 12:29:27 2010, sander@temme.net wrote: Show quoted text
> I have a slightly more elaborate patch that follows the version number > rules set forth in opensslv.h: > > --- Makefile.PL-dist 2010-07-23 10:09:33.000000000 -0700 > +++ Makefile.PL 2010-07-25 22:06:59.000000000 -0700 > @@ -342,11 +342,29 @@ > my $version; > my $type; > while (<VERSION_FILE>) { > - if (/^#define\s+$version_match\s+0x0+(\d\d\d)/) { > - $version = $1; > - $version =~ s/(\d)0(\d)/$1$2/; > - $type = ($version > 92) ? "OpenSSL" : "SSLeay"; > - $version = join('.', split(//, "0$version")); > + # From include/openssl/opensslv.h: > + # /* Numeric release version identifier: > + # * MNNFFPPS: major minor fix patch status > + # * The status nibble has one of the values 0 for > development, 1 to e for betas > + # * 1 to 14, and f for release. The patch level is exactly > that. > + # */ > + # M N N F F P > P S > + if >
(/^#define\s+$version_match\s+0x(\d)(\d\d)(\d\d)([[:xdigit:]][[:xdigit:]])([[:xdigit:]])/) Show quoted text
> { > + my $major = $1; > + my $minor = $2; > + my $fix = $3; > + # Patch level, if present, is expressed as a lowercase > letter > + my $patch = hex $4 == 0x0 ? "" : chr 96 + hex $4; > + my $status = hex $5; > + $type = ($major == 0 && $minor == 9 && $fix < 3) ? > "SSLeay" : "OpenSSL"; > + $version = sprintf "%u.%u.%u%s", $major, $minor, $fix, > $patch; > + if ($status == 0) { > + $version .= '-devel'; > + } elsif ($status == 15) { > + # Final release, no addition > + } else { > + $version .= "b$status"; > + } > last; > } > } > > Tested on MacOSX 10.6 with Perl 5.12.1 and various OpenSSL beta and > release versions. > > S. >
RT-Send-CC: sander [...] temme.net
Hello: In the end, I realized trying to handle all variations in the version number encoding inline in the body of the loop was getting too intractable, so I went with a different approach than suggested in the submitted patches. This seems to work on my ArchLinux and Windows machines. The 0.57_02 development release is available at: ftp://pause.perl.org/pub/PAUSE/authors/id/N/NA/NANIS/Crypt-SSLeay-0.57_02.tar.gz Please give it a try and tell me if I have destroyed the universe as we know it. -- Sinan On Thu Dec 03 16:05:18 2009, KMX wrote: Show quoted text
> Hi, > > this OpenSSL 1.0.0 issue is related to a version detection routine in > Makefile.pl that is not ready for version numbers starting with 1. > > The current code detects "undef" version and based on that we define: > #define CRYPT_SSLEAY_free free > instead of > #define CRYPT_SSLEAY_free OPENSSL_free > > Which ends at least on Win32/strawberry perl with some nasty perl.exe > crashes. > > Here is a simple patch for Makefile.PL that solves it: > > my $version; > my $type; > while (<VERSION_FILE>) { > - if (/^#define\s+$version_match\s+0x0+(\d\d\d)/) { > + if (/^#define\s+$version_match\s+0x(\d\d\d\d\d)/) { > $version = $1; > - $version =~ s/(\d)0(\d)/$1$2/; > + $version =~ s/^(\d)0(\d)0(\d)/$1$2$3/; > $type = ($version > 92) ? "OpenSSL" : "SSLeay"; > - $version = join('.', split(//, "0$version")); > + $version = join('.', split(//, $version)); > last; > } > } > > Please consider this patch as without it Crypt::SSLeay does not work on > Win32 with openssl-1.0.0 > > -- > kmx
Hi,

thanks a lot for fixing this issue. I confirm that 0.57_02 works for me (Windows 32/64bit, openssl 1.0.0).

--
kmx

RT-Send-CC: sander [...] temme.net
Thank you kmx. I am glad it works. It looks like I am missing co-maint permissions on Crypt::SSLeay::Err and Net::SSL included in the tarball, so this development release ended up being tagged as 'unauthorized'. http://search.cpan.org/~nanis/Crypt-SSLeay-0.57_02/ I was looking forward to some CPAN Testers results. If you or Sander Temme have a chance to test it in other environments, I would love to find out how that goes. -- Sinan On Sun Aug 08 16:39:37 2010, KMX wrote: Show quoted text
> Hi, > > thanks a lot for fixing this issue. I confirm that 0.57_02 works for me > (Windows 32/64bit, openssl 1.0.0). > > -- > kmx