Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: kmx [...] cpan.org
Cc:
AdminCc:

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



Subject: t/01-dh.t failure on Win32 Strawberry Perl
Hi,

I have experienced the following test failure:

t/01-dh.t .............. 1/12
Show quoted text
#   Failed test 'Shared secrets match'
#   at t/01-dh.t line 43.
#          got: '846835194335728115010915298276793143610660092658165291623709969
50763432081426444042964006143858308617241748770431977753961885694252794866301654
17413558826186806706544897520442578486776854498123663357565868826269812336887006
88140592608746635088041639473769138923945644711220785995013055004752635516500468
9535'
Show quoted text
#     expected: '846835194335728115010915298276793143610660092658165291623709969
50763432081426444042964006143858308617241748770431977753961885694252794866301654
17413558826186806706544897520442578486776854498123663357565868826269812336887006
88140592608746635088041639473769138923945644711220785995013055004752635516500468
95351c3⌂|▄c     '
t/01-dh.t .............. 10/12 # Looks like you failed 1 test of 12.
t/01-dh.t .............. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/12 subtests

My environment:
- Windows7
- Win32 Strawberry Perl 5.12.0 (32bit)
- gmp 5.0.1

Any feedback welcome.

--
kmx
That looks like misallocated buffer... but unfortunately I don't have windows handy :/
Even worse - it seems to be non-deterministic:

1/ t/01-dh.t does not fail always (my observation is 80% cases)

2/ sometimes also t/99-compat.t fails with Failed test 'Shared secrets match' (again non-deterministic approx 10% cases)

This issue will be quite hard to debug.

--
kmx

yeeeew. so I suppose it has to do with some precision fooey with gmp. well, I'd like to help you but currently I'm a life-crisis, and don't have tuits to look at it (and not a Windows machine ;) so it may be a while until I can get my hands on it...
I think the Renew call in PerlCryptDHGMP_mpz2sv_str is wrong (I don't actually get why it's even there, it seems to remove one byte from the allocated slot) and I would recommend following patch (seeing the same problem on openSUSE): --- Crypt-DH-GMP-0.00011.orig/xs/dh_gmp.c +++ Crypt-DH-GMP-0.00011/xs/dh_gmp.c @@ -30,7 +30,8 @@ PerlCryptDHGMP_mpz2sv_str(mpz_t *v, unsi buf_end = buf + len - 1; /* end of storage (-1) */ mpz_get_str(buf, base, *v); if (*buf_end == 0) { - Renew(buf, len - 1, char); /* got one shorter than expected */ + Renew(buf, len, char); /* got one shorter than expected */ + len--; } if (length != NULL)
Wow, I completely forgot about this ticket. Show quoted text
> I think the Renew call in PerlCryptDHGMP_mpz2sv_str is wrong (I don't > actually get why it's even there, it seems to remove one byte from the > allocated slot) and I would recommend following patch (seeing the same > problem on openSUSE): >
I VAGUELY remember that gmp returned something like "actual content followed by a blank", and I just hand waved it by doing that magical -1 I'll try your fix out now
uploaded Crypt::DH::GMP 0.00012