diff options
author | seb <seb@pkgsrc.org> | 2004-03-29 13:49:42 +0000 |
---|---|---|
committer | seb <seb@pkgsrc.org> | 2004-03-29 13:49:42 +0000 |
commit | 490f011eb46318b2b80933e0c3b0ad9efe980c14 (patch) | |
tree | 95879f2422cc3bac813ec5750626b4cf1e22a18d /security/openssl/patches | |
parent | 03ee8ebe464cfa92495e6b6cb2ffd640aaca151a (diff) | |
download | pkgsrc-490f011eb46318b2b80933e0c3b0ad9efe980c14.tar.gz |
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 (limited to 'security/openssl/patches')
-rw-r--r-- | security/openssl/patches/patch-ak | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/security/openssl/patches/patch-ak b/security/openssl/patches/patch-ak new file mode 100644 index 00000000000..203ba06dce8 --- /dev/null +++ b/security/openssl/patches/patch-ak @@ -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++) + { |