From 8b8a8b246c443d5631a88ec59b88edf00aa0ff51 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 1 Feb 2023 09:27:28 +0100 Subject: ssh: Allow to define the order in which keys are returned. * agent/findkey.c (public_key_from_file): Add arg r_sshorder. (agent_ssh_key_from_file): Ditto. * agent/command-ssh.c (struct key_collection_item_s): New. (struct key_collection_s): New. (search_control_file): Add art r_lnr. (add_to_key_array): New. (free_key_array): New. (compare_key_collection_items): New. (ssh_send_available_keys): Rewrite to return the keys in the user given order. -- GnuPG-bug-id: 6212 We now first return the keys from active cards, followed by keys listed in sshcontrol, finally from those with the "Use-for-ssh" key attribute. Keys from active cards are returned sorted by their S/N. Keys from sshcontrol are returned in the order they are given in that file. Use-for-ssh keys are ordered by the value assigned to that key attribute. The values for the latter are clamped at 99999. --- agent/agent.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'agent/agent.h') diff --git a/agent/agent.h b/agent/agent.h index ee5c67568..303f92e50 100644 --- a/agent/agent.h +++ b/agent/agent.h @@ -479,7 +479,7 @@ gpg_error_t agent_public_key_from_file (ctrl_t ctrl, gcry_sexp_t *result); gpg_error_t agent_ssh_key_from_file (ctrl_t ctrl, const unsigned char *grip, - gcry_sexp_t *result); + gcry_sexp_t *result, int *r_order); int agent_pk_get_algo (gcry_sexp_t s_key); int agent_is_tpm2_key(gcry_sexp_t s_key); int agent_key_available (const unsigned char *grip); -- cgit v1.2.3