mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-07 18:50:27 +09:00
pki: add security key identities to session options
Signed-off-by: Praneeth Sarode <praneethsarode@gmail.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Eshan Kelkar <eshankelkar@galorithm.com>
This commit is contained in:
@@ -392,6 +392,8 @@ int ssh_options_set_algo(ssh_session session,
|
||||
* the identity list.\n
|
||||
* \n
|
||||
* By default id_rsa, id_ecdsa and id_ed25519 files are used.\n
|
||||
* If libssh is built with FIDO2/U2F support, id_ecdsa_sk and\n
|
||||
* id_ed25519_sk files are also used by default.\n
|
||||
* \n
|
||||
* The identity used to authenticate with public key will be
|
||||
* prepended to the list.
|
||||
|
||||
@@ -190,6 +190,29 @@ ssh_session ssh_new(void)
|
||||
goto err;
|
||||
}
|
||||
|
||||
#ifdef WITH_FIDO2
|
||||
/* Add security key identities */
|
||||
id = strdup("%d/id_ed25519_sk");
|
||||
if (id == NULL) {
|
||||
goto err;
|
||||
}
|
||||
rc = ssh_list_append(session->opts.identity_non_exp, id);
|
||||
if (rc == SSH_ERROR) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
#ifdef HAVE_ECC
|
||||
id = strdup("%d/id_ecdsa_sk");
|
||||
if (id == NULL) {
|
||||
goto err;
|
||||
}
|
||||
rc = ssh_list_append(session->opts.identity_non_exp, id);
|
||||
if (rc == SSH_ERROR) {
|
||||
goto err;
|
||||
}
|
||||
#endif /* HAVE_ECC */
|
||||
#endif /* WITH_FIDO2 */
|
||||
|
||||
/* Explicitly initialize states */
|
||||
session->session_state = SSH_SESSION_STATE_NONE;
|
||||
session->pending_call_state = SSH_PENDING_CALL_NONE;
|
||||
|
||||
Reference in New Issue
Block a user