GPGME and custom memory allocators
wk at gnupg.org
Thu Oct 23 14:27:47 CEST 2014
On Wed, 22 Oct 2014 00:08, bjk at luxsci.net said:
> Well, at least there's the option. Both libassuan and libgcrypt provide
> this feature and I have used it with both without problems. I'm not sure
> why it isn't included in gpgme.
The reason why Libgcrypt has this function is that we have this "secure"
memory block which automagically works. However that requires that the
same allocation function is used everywhere.
GPGME does in general not handle the secret key stuff and thus Marcus
once decided to go with standard malloc. However, we later learned that
this sometimes also problematic: On Windows it may happen that DLLs use
different C-runtimes and the malloc functions won't interoperate and
lead to strange crashes. We fixed this by adding gpgme_free so that the
caller can release malloced memory returned from gpgme with the proper
BTW, I'd prefer to use a realloc based interface for the setting the
global malloc functions. See the PM I sent today.
Die Gedanken sind frei. Ausnahmen regelt ein Bundesgesetz.
More information about the Gnupg-devel