Last Comment Bug 59438 - mpp_pprime() says 15 is prime!
: mpp_pprime() says 15 is prime!
Product: NSS
Classification: Components
Component: Libraries (show other bugs)
: 3.1
: All All
: P3 critical (vote)
: 3.1.1
Assigned To: Nelson Bolyard (seldom reads bugmail)
: Sonja Mirtitsch
Depends on:
  Show dependency treegraph
Reported: 2000-11-07 16:12 PST by Nelson Bolyard (seldom reads bugmail)
Modified: 2000-12-04 16:02 PST (History)
1 user (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---


Description Nelson Bolyard (seldom reads bugmail) 2000-11-07 16:12:10 PST
When given any number that is equal to 3 mod 4, mpp_pprime says
that number is prime.  

The bug is simply that "res" is not set to MP_NO prior to the 
for (jx = 1; jx < b; jx++)
loop, and if that loop executes zero times (because b is 1),
the result is MP_OK, not MP_NO.

Also, HoAC suggests using sequential values of a, rather than
random values of a.
Comment 1 Nelson Bolyard (seldom reads bugmail) 2000-11-07 16:18:29 PST
mpp_pprime is the Miller Rabin pseudo-primality test.  
I will check in a fix shortly.
I'm also going to do some other cleanup to the code.
Comment 2 Nelson Bolyard (seldom reads bugmail) 2000-11-07 18:20:24 PST
I believe this bug is fixed in revision 1.13 of mpprime.c.
It passes the new test case I added to mpi-test
Comment 3 Nelson Bolyard (seldom reads bugmail) 2000-12-04 16:02:10 PST
Changed target milestone to show this bug was fixed in NSS 3.1.1

Note You need to log in before you can comment on or make changes to this bug.