agent,ssh: Tighten condition for EdDSA.

* agent/command-ssh.c (ssh_key_to_blob): Prepare for non-prefixed
point representation of EdDSA.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2020-06-05 09:20:21 +09:00
parent 2e988546c5
commit a7d46c78e2
1 changed files with 1 additions and 2 deletions

View File

@ -1955,14 +1955,13 @@ ssh_key_to_blob (gcry_sexp_t sexp, int with_secret,
}
if ((key_spec.flags & SPEC_FLAG_IS_EdDSA))
{
data = gcry_sexp_nth_data (value_pair, 1, &datalen);
if (!data)
{
err = gpg_error (GPG_ERR_INV_SEXP);
goto out;
}
if (*p_elems == 'q' && datalen)
if (*p_elems == 'q' && (datalen & 1) && *data == 0x40)
{ /* Remove the prefix 0x40. */
data++;
datalen--;