When the openssl(1) prime command is asked to check the primality of a
decimal number, it changes it to hex in the output which is a little
confusing:

$ openssl prime 976110468996539
377C46DC41DBB is prime

The following diff fixes this so that it will always show the original
number in the answer:

$ openssl prime 976110468996539
976110468996539 is prime

Hex values explicitly specified with -hex remain unchanged:

$ openssl prime -hex 377C46DC41DBB
377C46DC41DBB is prime

ok?


Index: prime.c
===================================================================
RCS file: /cvs/src/usr.bin/openssl/prime.c,v
retrieving revision 1.7
diff -u -p -u -p -r1.7 prime.c
--- prime.c     22 Aug 2015 16:36:05 -0000      1.7
+++ prime.c     8 Sep 2015 01:17:49 -0000
@@ -177,8 +177,7 @@ prime_main(int argc, char **argv)
                        }
                }
 
-               BN_print(bio_out, bn);
-               BIO_printf(bio_out, " is %sprime\n",
+               BIO_printf(bio_out, "%s is %sprime\n", prime,
                    BN_is_prime_ex(bn, prime_config.checks,
                        NULL, NULL) ? "" : "not ");
        }

Reply via email to