aboutsummaryrefslogtreecommitdiffstats
path: root/agent/protect.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2013-02-12 18:17:42 +0000
committerWerner Koch <[email protected]>2013-02-12 18:17:42 +0000
commitcaddeef4a7ffe5f2eb6453d364b6ae152e0f6625 (patch)
tree5894e3f0e365b0c9035efecea2bbd5ad3042ca51 /agent/protect.c
parentkbx: Switch from MD5 to SHA-1 for the checksum. (diff)
parentgpg: Implement card_store_subkey again. (diff)
downloadgnupg-caddeef4a7ffe5f2eb6453d364b6ae152e0f6625.tar.gz
gnupg-caddeef4a7ffe5f2eb6453d364b6ae152e0f6625.zip
Merge branch 'master' into key-storage-work
Diffstat (limited to '')
-rw-r--r--agent/protect.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/agent/protect.c b/agent/protect.c
index d26573d11..3e2cbb94e 100644
--- a/agent/protect.c
+++ b/agent/protect.c
@@ -1075,7 +1075,11 @@ hash_passphrase (const char *passphrase, int hashalgo,
unsigned long s2kcount,
unsigned char *key, size_t keylen)
{
-
+ /* The key derive function does not support a zero length string for
+ the passphrase in the S2K modes. Return a better suited error
+ code than GPG_ERR_INV_DATA. */
+ if (!passphrase || !*passphrase)
+ return gpg_error (GPG_ERR_NO_PASSPHRASE);
return gcry_kdf_derive (passphrase, strlen (passphrase),
s2kmode == 3? GCRY_KDF_ITERSALTED_S2K :
s2kmode == 1? GCRY_KDF_SALTED_S2K :