Hello,
> Just to add to the list below:
> 
> OpenSSL> version
> OpenSSL 0.9.8b 04 May 2006
> OpenSSL> prime 2
> 2 is prime

To be sure we should use another library:

$ cat gmp5.c
#include <stdio.h>
#include <gmp.h>

int main()
{
        mpz_t t;
        int rc;

        mpz_init_set_str(t,  "2", 10);
        rc = mpz_probab_prime_p(t, 1000);
        printf("rc=%d\n", rc);

        return(0);
}

$ gcc -o gmp5 gmp5.c -lgmp
$ ./gmp5
rc=2

and return code 2 in GMP means "definitely prime".

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Victor Duchovni
> Sent: Monday, March 05, 2007 4:24 PM
> To: openssl-users@openssl.org
> Subject: Re: 2 is not prime?
> 
> On Mon, Mar 05, 2007 at 02:06:19PM -0800, Brandon Ooi wrote:
> 
> > Hi,
> > 
> > Sorry if this is a dumb question but I couldn't find the openssl 
> > bugzilla (or equivalent) to look for this. I was using openssl to 
> > check primes and kept running into these weird issues until I found
> this...
> > 
> > $ openssl version
> > OpenSSL 0.9.7f 22 Mar 2005
> > $ openssl prime 2
> > 2 is not prime
> 
>     $ 0.9.6/bin/openssl version
>     OpenSSL 0.9.6m 17 Mar 2004
>     $ 0.9.6/bin/openssl prime 2
>     openssl:Error: 'prime' is an invalid command.
>     ... copious usage ...
> 
>     $ 0.9.7/bin/openssl version
>     OpenSSL 0.9.7l 28 Sep 2006
>     $ 0.9.7/bin/openssl prime 2
>     2 is not prime
> 
>     $ 0.9.8/bin/openssl version
>     OpenSSL 0.9.8d 28 Sep 2006
>     $ 0.9.8/bin/openssl prime 2
>     2 is prime
> 
>     $ 0.9.9/bin/openssl version
>     OpenSSL 0.9.9-dev XX xxx XXXX
>     $ openssl prime 2
>     2 is prime
> 
> > But.. 2 is prime right?
> 
> Yes.
> 
> > Anyways, it's not a huge issue but this could be a bigger bug?
> 
> Not likely, just a failure in 0.9.7 to exclude 2 from the set of
> composite even numbers.
> 
-- 
Marek Marcola <[EMAIL PROTECTED]>

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to