GPGME status callback not working for need entropy

Werner Koch wk at
Wed Aug 22 10:38:52 CEST 2018

On Wed,  1 Aug 2018 21:28, tookmund at said:
> generating a key without enough randomness, the whole application just
> locks up with no indication of what is happening. Is there anything else
> I could query to inform the user of what's occurring in this scenario?

You need to install a progress callback.  Something like:

--8<---------------cut here---------------start------------->8---
static void
progress_cb (void *opaque, const char *what, int type, int current, int total)

  if (total)
    fprintf (stderr, "progress for '%s' %u%% (%d of %d)\n",
             nonnull (what),
             (unsigned)(((double)current / total) * 100), current, total);
    fprintf (stderr, "progress for '%s' %d\n", nonnull(what), current);
  fflush (stderr);

  gpgme_set_progress_cb (ctx, progress_cb, NULL);
--8<---------------cut here---------------end--------------->8---

See gpgme/tests/run-genkey.c for a test program.



#  Please read:  Daniel Ellsberg - The Doomsday Machine  #
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <>

More information about the Gnupg-users mailing list