[PATCH] Caching symmetric encryption passphrase with gpg-agent
Daiki Ueno
ueno at unixuser.org
Sat May 9 12:02:17 CEST 2009
>>>>> In <87ab5o7x3z.fsf at broken.deisui.org>
>>>>> Daiki Ueno <ueno at unixuser.org> wrote:
> Hi,
> The attached is a new patch for caching symmetric encryption passphrase
> using a S2K salt as a cache key, as I proposed a couple of months ago.
Sorry, the patch contains a memory leak.
> --- g10/passphrase.c (revision 4996)
> +++ g10/passphrase.c (working copy)
> + char *cacheid = NULL;
> +
> + if ((mode == 3 || mode == 4) && (s2k->mode == 1 || s2k->mode == 3))
> + {
> + cacheid = xmalloc (18);
> + *cacheid = 'S';
> + bin2hex (s2k->salt, 8, cacheid + 1);
> + }
Those lines should be:
char *cacheid = NULL, buf[18];
if ((mode == 3 || mode == 4) && (s2k->mode == 1 || s2k->mode == 3))
{
memset (buf, 0, sizeof(buf));
*buf = 'S';
bin2hex (s2k->salt, 8, buf + 1);
cacheid = buf;
}
Regards,
--
Daiki Ueno
More information about the Gnupg-devel
mailing list