1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

Obscure the cached passphrases.

This commit is contained in:
Werner Koch 2010-09-02 10:46:23 +00:00
parent a0b9ebfb7d
commit 90a4599c5e
10 changed files with 215 additions and 160 deletions

View file

@ -359,7 +359,7 @@ agent_genkey (ctrl_t ctrl, const char *cache_nonce,
membuf_t *outbuf)
{
gcry_sexp_t s_keyparam, s_key, s_private, s_public;
char *passphrase = NULL;
char *passphrase;
int rc;
size_t len;
char *buf;
@ -372,21 +372,7 @@ agent_genkey (ctrl_t ctrl, const char *cache_nonce,
}
/* Get the passphrase now, cause key generation may take a while. */
if (cache_nonce)
{
void *cache_marker = NULL;
const char *cache_value;
cache_value = agent_get_cache (cache_nonce, CACHE_MODE_NONCE,
&cache_marker);
if (cache_value)
{
passphrase = xtrymalloc_secure (strlen (cache_value)+1);
if (passphrase)
strcpy (passphrase, cache_value);
agent_unlock_cache_entry (&cache_marker);
}
}
passphrase = cache_nonce? agent_get_cache (cache_nonce, CACHE_MODE_NONCE):NULL;
if (passphrase)
rc = 0;
else