Thanks for reporting this bug. This was previously reported, but my earlier fix (in CVS) missed the first case.
On Thu, Feb 05, 2004 at 01:36:56PM +0100, Dirk Moermans wrote: > Hi, > > I tried to generate some small RSA keys using > InvertibleRSAFunction::GenerateRandom. I am using crypto++5.1. > For small keys (modulus length = 16 bits, the minimum allowed size), the > program often asserts with assert(m_d.IsPositive()). > m_d turned out to be zero quite often. > This happens because RSAPrimeSelector selector(m_e) is not called for > primes that fit in the small-prime table. > > Following patch adds the check in nbtheory.cpp in the FirstPrime method. > > 425c425 > < return true; > --- > > return (!pSelector || pSelector->IsAcceptable(p)); > 449c449 > < return p <= max; > --- > > return (p <= max) && (!pSelector || > pSelector->IsAcceptable(p)); > > It passes regression tests using Visual Studio 7.1 and works for 16 bit > modulus-lengths. > > Regards > Dirk Moermans > > > > ----------------------------------------- > CONFIDENTIALITY NOTICE > This E-mail message and any documents which accompany it are intended only for the > use of the individual or entity to which addressed, and may contain information that > is privileged, confidential or exempt from disclosure under applicable law. If the > reader is not the intended recipient, any disclosure, distribution or other use of > this E-mail message is prohibited. If you have received this E-mail message in > error, please delete and notify the sender immediately. Thank you.
