1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-02-02 16:43:03 +01:00

agent: Fix length detection of canonical formatted openpgp keys.

* agent/command.c (cmd_import_key): Pass 0 instead of KEYLEN to
gcry_sexp_canon_len.
--

We used to pass KEYLEN to the gcry_sexp_canon_len for no good reason:
convert_from_openpgp is guaranteed to return a valid canonical
S-expression and KEYLEN would thus act only as an upper limit.  This
is not a problem because usually the original input key is longer than
the returned unprotected key.  A future patch may change this
assertion and thus we better fix this bug now.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2013-05-21 13:00:16 +01:00
parent f2d8a14e1b
commit 0f0e0559f9

View File

@ -1924,7 +1924,7 @@ cmd_import_key (assuan_context_t ctx, char *line)
&key, &passphrase); &key, &passphrase);
if (err) if (err)
goto leave; goto leave;
realkeylen = gcry_sexp_canon_len (key, keylen, NULL, &err); realkeylen = gcry_sexp_canon_len (key, 0, NULL, &err);
if (!realkeylen) if (!realkeylen)
goto leave; /* Invalid canonical encoded S-expression. */ goto leave; /* Invalid canonical encoded S-expression. */
if (passphrase) if (passphrase)