aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSahana Prasad <sahana@redhat.com>2020-08-26 12:02:29 +0200
committerSahana Prasad <sahana@redhat.com>2020-09-29 11:35:51 +0200
commitcc953ff7e4b50b9467fb1bb6b15c28648ebfcaeb (patch)
tree388bab8438887c0749e97bbead5cc8c713b4366b /tests
parentd10f971bbb7aaecd0ab82953027c462743814173 (diff)
downloadlibssh-cc953ff7e4b50b9467fb1bb6b15c28648ebfcaeb.tar.gz
libssh-cc953ff7e4b50b9467fb1bb6b15c28648ebfcaeb.tar.xz
libssh-cc953ff7e4b50b9467fb1bb6b15c28648ebfcaeb.zip
src/kex.c: removes DES and SHA1 from mac and kex algorithms by default.
Signed-off-by: Sahana Prasad <sahana@redhat.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/pkd/pkd_daemon.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/tests/pkd/pkd_daemon.c b/tests/pkd/pkd_daemon.c
index 239bdd36..5325a5de 100644
--- a/tests/pkd/pkd_daemon.c
+++ b/tests/pkd/pkd_daemon.c
@@ -247,10 +247,9 @@ static int pkd_exec_hello(int fd, struct pkd_daemon_args *args)
int level = args->opts.libssh_log_level;
enum pkd_hostkey_type_e type = args->type;
const char *hostkeypath = args->hostkeypath;
- const char *default_kex = NULL;
- char *all_kex = NULL;
- size_t kex_len = 0;
+ const char *all_kex = NULL;
const char *all_ciphers = NULL;
+ const char *all_macs = NULL;
const uint64_t rekey_data_limit = args->rekey_data_limit;
bool process_config = false;
@@ -302,17 +301,10 @@ static int pkd_exec_hello(int fd, struct pkd_daemon_args *args)
if (!ssh_fips_mode()) {
const char *all_hostkeys = NULL;
/* Add methods not enabled by default */
-#define GEX_SHA1 "diffie-hellman-group-exchange-sha1"
- default_kex = ssh_kex_get_default_methods(SSH_KEX);
- kex_len = strlen(default_kex) + strlen(GEX_SHA1) + 2;
- all_kex = malloc(kex_len);
- if (all_kex == NULL) {
- pkderr("Failed to alloc more memory.\n");
- goto outclose;
- }
- snprintf(all_kex, kex_len, "%s," GEX_SHA1, default_kex);
+
+ /* Enable all supported key exchange methods */
+ all_kex = ssh_kex_get_supported_method(SSH_KEX);
rc = ssh_bind_options_set(b, SSH_BIND_OPTIONS_KEY_EXCHANGE, all_kex);
- free(all_kex);
if (rc != 0) {
pkderr("ssh_bind_options_set kex methods: %s\n", ssh_get_error(b));
goto outclose;
@@ -341,6 +333,21 @@ static int pkd_exec_hello(int fd, struct pkd_daemon_args *args)
goto outclose;
}
+ /* Enable all message authentication codes */
+ all_macs = ssh_kex_get_supported_method(SSH_MAC_C_S);
+ rc = ssh_bind_options_set(b, SSH_BIND_OPTIONS_HMAC_C_S, all_macs);
+ if (rc != 0) {
+ pkderr("ssh_bind_options_set MACs C-S: %s\n", ssh_get_error(b));
+ goto outclose;
+ }
+
+ all_macs = ssh_kex_get_supported_method(SSH_MAC_S_C);
+ rc = ssh_bind_options_set(b, SSH_BIND_OPTIONS_HMAC_S_C, all_macs);
+ if (rc != 0) {
+ pkderr("ssh_bind_options_set MACs S-C: %s\n", ssh_get_error(b));
+ goto outclose;
+ }
+
}
s = ssh_new();