summaryrefslogtreecommitdiffstats
path: root/src/session.c
diff options
context:
space:
mode:
authorDirkjan Bussink <d.bussink@gmail.com>2014-04-20 10:09:39 +0000
committerAndreas Schneider <asn@cryptomilk.org>2014-04-22 10:57:18 +0200
commit6c74d6f891bab99f68fffdb78dec66de369898c7 (patch)
tree3873f820ee92ef9e6696ac27d63590e6b2ceb3f6 /src/session.c
parent262c82ac0661bb0be46477006ed366e401c1620f (diff)
downloadlibssh-6c74d6f891bab99f68fffdb78dec66de369898c7.tar.gz
libssh-6c74d6f891bab99f68fffdb78dec66de369898c7.tar.xz
libssh-6c74d6f891bab99f68fffdb78dec66de369898c7.zip
Add options support for setting and getting HMAC algorithms
BUG: https://red.libssh.org/issues/91 Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/session.c')
-rw-r--r--src/session.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/session.c b/src/session.c
index 204adad6..3a0a90d4 100644
--- a/src/session.c
+++ b/src/session.c
@@ -311,7 +311,7 @@ const char* ssh_get_serverbanner(ssh_session session) {
}
/**
- * @brief get the name of the input for the given session.
+ * @brief get the name of the input cipher for the given session.
*
* @param[in] session The SSH session.
*
@@ -343,6 +343,36 @@ const char* ssh_get_cipher_out(ssh_session session) {
}
/**
+ * @brief get the name of the input HMAC algorithm for the given session.
+ *
+ * @param[in] session The SSH session.
+ *
+ * @return Returns HMAC algorithm name or NULL if unknown.
+ */
+const char* ssh_get_hmac_in(ssh_session session) {
+ if ((session != NULL) &&
+ (session->current_crypto != NULL)) {
+ return ssh_hmac_type_to_string(session->current_crypto->in_hmac);
+ }
+ return NULL;
+}
+
+/**
+ * @brief get the name of the output HMAC algorithm for the given session.
+ *
+ * @param[in] session The SSH session.
+ *
+ * @return Returns HMAC algorithm name or NULL if unknown.
+ */
+const char* ssh_get_hmac_out(ssh_session session) {
+ if ((session != NULL) &&
+ (session->current_crypto != NULL)) {
+ return ssh_hmac_type_to_string(session->current_crypto->out_hmac);
+ }
+ return NULL;
+}
+
+/**
* @brief Disconnect impolitely from a remote host by closing the socket.
*
* Suitable if you forked and want to destroy this session.