57

When OpenSSL generates keys you'll always see a series of periods/dots (.) and pluses (+).

openssl dhparam -text -noout -outform PEM -5 2048

............+........+...................................................................................................................................................................+..........................+......+......+..........................................................................................................................................................................................+....................................................................................................................................................................+..............................................................................................................................+.............................................................................................................................+.......+............................................................................................................................+..+.......................................................+....................................................................................................................................+..................................+...........................................................+...........................................................................................................................................................................................................................................................................................................+.+...................................................................................................+................................................................................................+.....+....+.................+.......................................................+.............................................................................................+...............................................................................................................................................................+................+....................................................+....................................................................................+...........................................................................................................................................................................................................................................................................................................................................................................................................................................................+.......................................................................+......................................................................................................................................................................................................................+............................................................+...........................................................................+.............................................................+.......................................+....................................................................................+............................................................................................................................................................+..................+...........................................................+.......................................................................................+.....................................................................................................................+...............................................................................................+.............................+.....................................+..................+...........................................................................................................+...........................................+...+.............................................................................................................................................................................+....................................................+............+.............................................................................................................................................................+.....................................+.....+.........................+...........................................................+..........................................................................................+............................................................................................................................................+.................................................+..........................................................................................+.......................+..........................................................................................+......................................................................................................................................................................................+.................................................................................................+...........................................................+.............................................................................................................................+......................+.............................................................................................................................+........................................+..........................................................................+..............................................+............................................................+...+.................................................................................+............................................+................+..........+.........+.....................................+...........................................+..........................................................................................................+........................................................................................................................................................................................................................................................................................................................................................+...........................................................................+..........................+..................................+...........................................................+................................................................................+..+.........................+..................................................................................................................................+........................+.......................................................+..........................................................................................+..........................................+.+...................................................+............................................................................................................+.........................................................................................................................................................................................................+.................................................................................................+....................+.......................................................................................................................+...............................+............................................................................+...............................+....................................................................................................................................................................................................................................................................................................................................................................................................................................+.........................................+.....................+........................................................................+.....................+..........+...............................................................+...........+...............................+....++*++*

What do they mean?

1
  • I too was curious so I opened up the code and did some poking around. I found this information by looking at the openssl source code under apps/dhparam.c static int MS_CALLBACK dh_cb(int p, int n, BN_GENCB cb) { char c = ''; if (p == 0) c = '.'; if (p == 1) c = '+'; if (p == 2) c = ''; if (p == 3) c = '\n'; ... Which is used to a callback to BN_GENCB_set(&cb, dh_cb, bio_err); Which is defined in crypto/bn/bn.h / Macro to populate a BN_GENCB structure with a "new"-style callback */ # define BN_GENCB_set(gencb, callback, cb_arg) { \ BN_GENCB *tmp_gencb = (gencb); \ tmp_gencb->ver = 2; \ tmp_
    – sverasch
    Oct 15, 2015 at 20:00

2 Answers 2

77

When computing DHPARAM you will get these as the output while computing Diffie Hellman parameters:

. : A potential prime number was generated.
+ : Number is being tested for primality.
* : A prime number was found.

References:

2
  • I'm curious: where did you get this information? I don't doubt it's correct, but I haven't been able to find a manual page or other documentation about it. I did a Google search for "A potential prime number was generated" and found a blog that has the exact same verbatim information, so I assume it's quoted from somewhere, but I haven't found any official source (maybe source-code comments?).
    – apsillers
    Sep 9, 2013 at 15:08
  • The source can be found here: github.com/openssl/openssl/blob/…
    – coderjoe
    Oct 10, 2016 at 1:34
23

In the context of Diffie-Hellman parameter generation, . means a potential prime has been generated. + means one iteration of the Miller-Rabin primality test have been passed. * means a prime has been found that satisfies one iteration of the Miller-Rabin primality test.

Under default conditions, for generating a prime with at least 1300 bits, two iterations of the Miller-Rabin primality test are done. That's why you see ++*++* at the end. The first + means the prime p itself has passed one iteration of the Miller-Rabin primality test. The second + means the (p-1)/2 also has passed one iteration of the Miller-Rabin primality test. The first * indicates both p and (p-1)/2 has passed an iteration of the Miller-Rabin primality test.

Then both are retested again (since BN_prime_checks_for_size(2048) == 2 for two iterations), so you see ++* again.

Since p and (p-1)/2 passed both iterations of primality tests, the process stops and returns p.

So if you see one +, it means a candidate prime generated passed one iteration of the primality test but (p-1)/2 didn't. If you see ++* but not ++*++* it means both p and (p-1)/2 passed the first iteration of primality tests but one of them failed the second iteration (which in all likelihood, would never happen for 2048 bit keys and longer -- a cosmic ray flipping a bit during the calculation is more likely).

References:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .