GPGME status callback not working for need entropy

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


On Wed,  1 Aug 2018 21:28, tookmund at gmail.com 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)
{
  (void)opaque;
  (void)type;

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


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


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


Shalom-Salam,

   Werner

-- 
#  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: <https://lists.gnupg.org/pipermail/gnupg-users/attachments/20180822/c756870b/attachment.sig>


More information about the Gnupg-users mailing list