1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-10-21 16:13:39 +03:00

tests: Avoid prefix matching when selecting algorithmms

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Sahana Prasad <sahana@redhat.com>
This commit is contained in:
Jakub Jelen
2025-09-10 13:05:50 +02:00
parent 6ca59307d4
commit 3d3b12891f

View File

@@ -858,6 +858,7 @@ static void torture_rekey_guess_all_combinations(void **state)
const char *supported = NULL;
struct ssh_tokens_st *s_tok = NULL;
uint64_t rekey_limit = 0;
char *p = NULL;
int rc, i, j;
/* The rekey limit is 1/2 of the transferred file size so we will likely get
@@ -875,8 +876,12 @@ static void torture_rekey_guess_all_combinations(void **state)
s_tok = ssh_tokenize(supported, ',');
assert_non_null(s_tok);
for (i = 0; s_tok->tokens[i]; i++) {
/* Skip algorithms not supported by the OpenSSH server */
if (strstr(OPENSSH_KEX, s_tok->tokens[i]) == NULL) {
/* Skip algorithms not supported by the OpenSSH server.
* Check also for prefix matches to distinguish vendor-specific names
* such as sntrup761x25519-sha512 and the @openssh.com alias */
if ((p = strstr(OPENSSH_KEX, s_tok->tokens[i])) == NULL ||
(*(p + strlen(s_tok->tokens[i])) != ',' &&
*(p + strlen(s_tok->tokens[i])) != '\0')) {
SSH_LOG(SSH_LOG_INFO, "Server: %s [skipping]", s_tok->tokens[i]);
continue;
}