pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/security/openssl Fix build on NetBSD sparc64 with perl...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/a3ebfd82ad33
branches:  trunk
changeset: 471606:a3ebfd82ad33
user:      seb <seb%pkgsrc.org@localhost>
date:      Mon Mar 29 13:49:42 2004 +0000

description:
Fix build on NetBSD sparc64 with perl 5.8.

usage of perl's int() causes trouble with perl 5.8.3 (5.8*?) on at least
NetBSD sparc64/1.6.2.

The perl script openssl-0.9.6m/crypto/bn/bn_prime.pl uses the perl
function int() to truncate the return of sqrt() function.
On the above mentioned platform this leads to execution error:
...
/usr/pkg/bin/perl bn_prime.pl >bn_prime.h
Illegal modulus zero at bn_prime.pl line 16.

Tracing the problem I've found that this int() usage may be the key
of the problem. Please note the following:

$ uname -srm; perl -v | grep 'This is perl'; perl -e 'print int(sqrt(3)),"\n"'
NetBSD 1.6.2 sparc64
This is perl, v5.8.3 built for sparc64-netbsd
2
And...

$ uname -srm; perl -v | grep 'This is perl'; perl -e 'print int(sqrt(3)),"\n"'
NetBSD 1.6.2 sparc64
This is perl, v5.6.1 built for sparc64-netbsd
1

Also note that perlfunc(3) warns about int() used for rounding and
recommends to use sprintf, printf, POSIX::floor or POSIX::ceil when
applicable.

My workaround is to use POSIX::floor() instead of int().

diffstat:

 security/openssl/distinfo         |   3 ++-
 security/openssl/patches/patch-ak |  22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletions(-)

diffs (40 lines):

diff -r ca81ca80effd -r a3ebfd82ad33 security/openssl/distinfo
--- a/security/openssl/distinfo Mon Mar 29 12:55:01 2004 +0000
+++ b/security/openssl/distinfo Mon Mar 29 13:49:42 2004 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.28 2004/03/26 08:13:24 jlam Exp $
+$NetBSD: distinfo,v 1.29 2004/03/29 13:49:42 seb Exp $
 
 SHA1 (openssl-0.9.6m.tar.gz) = 52414b8867944e2c35940142d38052544dab1358
 Size (openssl-0.9.6m.tar.gz) = 2184918 bytes
@@ -9,3 +9,4 @@
 SHA1 (patch-ae) = f4bf6ae5aa41b55d9978376e4e50ee10c10dd288
 SHA1 (patch-af) = f37700c5fc04e2e59e525b5fb37986ba27c0080a
 SHA1 (patch-aj) = e300ae91c19214faf3419e7499214a1b536aac18
+SHA1 (patch-ak) = 7f9960a97cbe83c381c2a4565ca3a6e4e661bf54
diff -r ca81ca80effd -r a3ebfd82ad33 security/openssl/patches/patch-ak
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/security/openssl/patches/patch-ak Mon Mar 29 13:49:42 2004 +0000
@@ -0,0 +1,22 @@
+$NetBSD: patch-ak,v 1.5 2004/03/29 13:49:42 seb Exp $
+
+--- crypto/bn/bn_prime.pl.orig Wed Feb 16 13:24:06 2000
++++ crypto/bn/bn_prime.pl
+@@ -1,6 +1,8 @@
+ #!/usr/local/bin/perl
+ # bn_prime.pl
+ 
++use POSIX;
++
+ $num=2048;
+ $num=$ARGV[0] if ($#ARGV >= 0);
+ 
+@@ -9,7 +11,7 @@ $p=1;
+ loop: while ($#primes < $num-1)
+       {
+       $p+=2;
+-      $s=int(sqrt($p));
++      $s=floor(sqrt($p));
+ 
+       for ($i=0; $primes[$i]<=$s; $i++)
+               {



Home | Main Index | Thread Index | Old Index