[OTR-dev] Re: Requirements for libotr4
Uli M
a.sporto+bee at gmail.com
Wed Jul 9 05:56:01 EDT 2008
On Sun 06.07.08 18:09, Ian Goldberg wrote:
> 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?
Yeah, that looks good. There's just one problem I see: there's no
cancel method. So when the background generation fails or is aborted
and then at a later point in time generate_start is called again for
the same accountname/protocol pair I guess it will return
GPG_ERR_EEXIST (because generate_finish hasn't been called for this
pair).
One could work around this in the app by storing the newkey pointers
of aborted generations for later reuse in generate_calculate calls but
a cancel method would be better.
Uli
P.S.: sry for the last empty message
>
> - 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);
> _______________________________________________
> OTR-dev mailing list
> OTR-dev at lists.cypherpunks.ca
> http://lists.cypherpunks.ca/mailman/listinfo/otr-dev
More information about the OTR-dev
mailing list