From 93370d61ba1df61db4d3010f9040ba9c34f57245 Mon Sep 17 00:00:00 2001 From: Jon Simons Date: Mon, 3 Feb 2014 22:37:25 -0800 Subject: session: add getters for session cipher names Reviewed-by: Andreas Schneider --- src/session.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src') diff --git a/src/session.c b/src/session.c index b26eb969..9256bbc9 100644 --- a/src/session.c +++ b/src/session.c @@ -309,6 +309,38 @@ const char* ssh_get_serverbanner(ssh_session session) { return session->serverbanner; } +/** + * @brief get the name of the input for the given session. + * + * @param[in] session The SSH session. + * + * @return Returns cipher name or NULL. + */ +const char* ssh_get_cipher_in(ssh_session session) { + if ((session != NULL) && + (session->current_crypto != NULL) && + (session->current_crypto->in_cipher != NULL)) { + return session->current_crypto->in_cipher->name; + } + return NULL; +} + +/** + * @brief get the name of the output cipher for the given session. + * + * @param[in] session The SSH session. + * + * @return Returns cipher name or NULL. + */ +const char* ssh_get_cipher_out(ssh_session session) { + if ((session != NULL) && + (session->current_crypto != NULL) && + (session->current_crypto->out_cipher != NULL)) { + return session->current_crypto->out_cipher->name; + } + return NULL; +} + /** * @brief Disconnect impolitely from a remote host by closing the socket. * -- cgit