Skip Menu |

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

Report information
The Basics
Id: 29084
Status: open
Priority: 0/
Queue: Crypt-DH

People
Owner: Nobody in particular
Requestors: jeffrey.klein [...] priorityhealth.com
Cc:
AdminCc:

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



Subject: _makerandom() fails on HPUX; retry sysread(urandom)
This is perl, v5.8.7 built for PA-RISC2.0-thread-multi-LP64 _makerandom attempts to sysread from urandom. HP-UX only supports reading up to 256 bytes at a time, so the test suite fails. Working code follows: sub _makerandom { my $size = shift; my $bytes = int($size / 8) + ($size % 8 ? 1 : 0); my $rand = ''; if (-e "/dev/urandom") { my $fh; open($fh, '/dev/urandom') or die "Couldn't open /dev/urandom"; while ( ( my $len = length($rand) ) < $bytes ) { my $got = sysread $fh, $rand, $bytes - $len, $len; die "Didn't read all bytes from urandom" unless $got; } close $fh; } else { for (1..$bytes) { $rand .= chr(int(rand(256))); } } my $bits = unpack("b*", $rand); die unless length($bits) >= $size; Math::BigInt->new('0b' . substr($bits, 0, $size)); }
From: markhensler [...] pointloma.edu
KLEINJ, This worked for me. (perl, v5.8.8 built for PA-RISC2.0-thread-multi on HP-UX B.11.23) Thanks!