[OTR-dev] Re: Requirements for libotr4

Ian Goldberg ian at cypherpunks.ca
Sun Jul 6 18:09:07 EDT 2008


On Sat, Jun 21, 2008 at 10:52:05AM -0400, Ian Goldberg wrote:
> With the specified division of threads, the callbacks are now
> unnecessary.

I've checked in the support for background privkey generation.  Here are the
new functions in privkey.h.

Uli, does this do what you want?

   - Ian

/* Begin a private key generation that will potentially take place in
 * a background thread.  This routine must be called from the main
 * thread.  It will set *newkeyp, which you can pass to
 * otrl_privkey_generate_calculate in a background thread.  If it
 * returns gcry_error(GPG_ERR_EEXIST), then a privkey creation for
 * this accountname/protocol is already in progress, and *newkeyp will
 * be set to NULL. */
gcry_error_t otrl_privkey_generate_start(OtrlUserState us,
       const char *accountname, const char *protocol, void **newkeyp);

/* Do the private key generation calculation.  You may call this from a
 * background thread.  When it completes, call
 * otrl_privkey_generate_finish from the _main_ thread. */
gcry_error_t otrl_privkey_generate_calculate(void *newkey);

/* Call this from the main thread only.  It will write the newly created
 * private key into the given file and store it in the OtrlUserState. */
gcry_error_t otrl_privkey_generate_finish(OtrlUserState us,
       void *newkey, const char *filename);

/* Call this from the main thread only.  It will write the newly created
 * private key into the given FILE* (which must be open for reading and
 * writing) and store it in the OtrlUserState. */
gcry_error_t otrl_privkey_generate_finish_FILEp(OtrlUserState us,
      void *newkey, FILE *privf);



More information about the OTR-dev mailing list