Skip to content

Commit

Permalink
Add setters for the allowed HMAC algorithms
Browse files Browse the repository at this point in the history
  • Loading branch information
fmang authored and fwininger committed Sep 11, 2023
1 parent c540a85 commit 73abba8
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions ext/libssh_ruby/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,28 @@ static VALUE m_set_key_exchange(VALUE self, VALUE kex) {
return set_comma_separated_option(self, SSH_OPTIONS_KEY_EXCHANGE, kex);
}

/*
* @overload hmac_c_s=(methods)
* Set the allowed HMAC algorithms from the client to the server.
* @param [Array<String>] methods
* @return [nil]
* @see http://api.libssh.org/stable/group__libssh__session.html ssh_options_set(SSH_OPTIONS_HMAC_C_S)
*/
static VALUE m_set_hmac_c_s(VALUE self, VALUE algos) {
return set_comma_separated_option(self, SSH_OPTIONS_HMAC_C_S, algos);
}

/*
* @overload hmac_s_c=(methods)
* Set the allowed HMAC algorithms from the server to the client.
* @param [Array<String>] methods
* @return [nil]
* @see http://api.libssh.org/stable/group__libssh__session.html ssh_options_set(SSH_OPTIONS_HMAC_S_C)
*/
static VALUE m_set_hmac_s_c(VALUE self, VALUE algos) {
return set_comma_separated_option(self, SSH_OPTIONS_HMAC_S_C, algos);
}

/*
* @overload hostkeys=(key_types)
* Set the preferred server host key types
Expand Down Expand Up @@ -763,6 +785,10 @@ void Init_libssh_session() {
RUBY_METHOD_FUNC(m_set_protocol), 1);
rb_define_method(rb_cLibSSHSession, "key_exchange=",
RUBY_METHOD_FUNC(m_set_key_exchange), 1);
rb_define_method(rb_cLibSSHSession, "hmac_c_s=",
RUBY_METHOD_FUNC(m_set_hmac_c_s), 1);
rb_define_method(rb_cLibSSHSession, "hmac_s_c=",
RUBY_METHOD_FUNC(m_set_hmac_s_c), 1);
rb_define_method(rb_cLibSSHSession, "hostkeys=",
RUBY_METHOD_FUNC(m_set_hostkeys), 1);
rb_define_method(rb_cLibSSHSession, "compression=",
Expand Down

0 comments on commit 73abba8

Please sign in to comment.