feat(pki): add ssh_pki_ctx to ssh_session

The session struct now contains an ssh_pki_ctx struct as its member to allow for passing user configured pki options across many functions.
The ssh_options_set API has been extended to allow users to set this member.

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:
Praneeth Sarode
2025-09-20 20:26:37 +05:30
parent d4b0de702b
commit 97e71606e0
4 changed files with 45 additions and 0 deletions

View File

@@ -108,6 +108,12 @@ ssh_session ssh_new(void)
goto err;
}
/* Initialise a default PKI context */
session->pki_context = ssh_pki_ctx_new();
if (session->pki_context == NULL) {
goto err;
}
/* OPTIONS */
session->opts.StrictHostKeyChecking = 1;
session->opts.port = 22;
@@ -266,6 +272,8 @@ void ssh_free(ssh_session session)
ssh_agent_free(session->agent);
SSH_PKI_CTX_FREE(session->pki_context);
ssh_key_free(session->srv.rsa_key);
session->srv.rsa_key = NULL;
ssh_key_free(session->srv.ecdsa_key);