gpapa key generation

Markus Gerwinski markus@gerwinski.de
Thu, 4 Jan 2001 19:28:15 +0100


Hello Folks!

Bernhard Herzog wrote:

> Why are publicKey and secretKey initialized at all? The implementation
> of gpapa_create_key_pair overwrites them anyway without ever looking at
> the values passed into it. That's at least a memory leak.
Back when I wrote that code, the implementation of gpapa_create_key_pair wasn't yet complete, thus to be able to test the rest of the function I had to allocate publicKey and secretKey myself. These lines of code are obsolete now, that's right. (Usually, whenever I mark a line with "/*!!!*/", this means they're just a workaround or debugging code.)
> Later in keys_generateKey_generate, dummyKey, publicKey and secretKey
> are free'd:
>
> gpapa_key_release (dummyKey, gpa_callback, keeperGenerate->window); /*!!! */
> free (publicKey); /*!!! */
> free (secretKey); /*!!! */
>
> Is it even correct to do that?
It was necessary back then to avoid the memory leak you mentioned. If I recall everything right, these lines should be obsolete now, too. Yours Markus P.S.: Due to some travelling, I'll be cut from the net for a while, so if you answer to that mail, don't wonder about my silence.