1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-04-08 21:40:10 +02:00

agent: Fix ssh-agent's request_identities for skipped keys.

* agent/command-ssh.c (ssh_send_available_keys): Adjust key counter
for skipped keys.
--

Fixes-commit: 8b8a8b246c443d5631a88ec59b88edf00aa0ff51
which introduced a regression due to an extra variable for counting
the keys.

The bug showed up for example if a card with a Brainpool Auth key was
also used.  Unfortunately OpenSSH still does not allow for Brainpool
keys.
This commit is contained in:
Werner Koch 2025-01-22 16:12:49 +01:00
parent b1857a2836
commit 2469dc5aae
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -2585,7 +2585,7 @@ ssh_send_available_keys (ctrl_t ctrl, estream_t key_blobs, u32 *r_key_counter)
struct card_key_info_s *keyinfo_on_cards, *l;
char *cardsn;
gcry_sexp_t key_public = NULL;
int count;
int count, skipped;
struct key_collection_s keyarray = { NULL };
err = open_control_file (&cf, 0);
@ -2753,6 +2753,7 @@ ssh_send_available_keys (ctrl_t ctrl, estream_t key_blobs, u32 *r_key_counter)
keyarray.items[count].key, keyarray.items[count].cardsn);
/* And print the keys. */
skipped = 0;
for (count=0; count < keyarray.nitems; count++)
{
err = ssh_send_key_public (key_blobs, keyarray.items[count].key,
@ -2767,12 +2768,13 @@ ssh_send_available_keys (ctrl_t ctrl, estream_t key_blobs, u32 *r_key_counter)
/* For example a Brainpool curve or a curve we don't
* support at all but a smartcard lists that curve.
* We ignore them. */
skipped++;
}
else
goto leave;
}
}
*r_key_counter = count;
*r_key_counter = count - skipped;
leave:
agent_card_free_keyinfo (keyinfo_on_cards);