diff --git a/tests/client/torture_rekey.c b/tests/client/torture_rekey.c index e7813e1e..ce31325e 100644 --- a/tests/client/torture_rekey.c +++ b/tests/client/torture_rekey.c @@ -38,6 +38,8 @@ #include #include +#define KEX_RETRY 32 + static uint64_t bytes = 2048; /* 2KB (more than the authentication phase) */ static int sshd_setup(void **state) @@ -499,9 +501,15 @@ static void torture_rekey_different_kex(void **state) * to make sure the rekey it completes with all different ciphers (paddings */ memset(data, 0, sizeof(data)); memset(data, 'A', 128); - for (i = 0; i < 20; i++) { + for (i = 0; i < KEX_RETRY; i++) { ssh_send_ignore(s->ssh.session, data); - ssh_handle_packets(s->ssh.session, 50); + ssh_handle_packets(s->ssh.session, 100); + + c = s->ssh.session->current_crypto; + /* SHA256 len */ + if (c->digest_len != 32) { + break; + } } /* The rekey limit was restored in the new crypto to the same value */ @@ -571,9 +579,15 @@ static void torture_rekey_server_different_kex(void **state) * to make sure the rekey it completes with all different ciphers (paddings */ memset(data, 0, sizeof(data)); memset(data, 'A', 128); - for (i = 0; i < 25; i++) { + for (i = 0; i < KEX_RETRY; i++) { ssh_send_ignore(s->ssh.session, data); - ssh_handle_packets(s->ssh.session, 50); + ssh_handle_packets(s->ssh.session, 100); + + c = s->ssh.session->current_crypto; + /* SHA256 len */ + if (c->digest_len != 32) { + break; + } } /* Check that the secret hash is different than initially */