mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-07-31 00:03:07 +03:00
tests: Fix rekey test so it passes on build systems
The test failed on Fedora Koji and openSUSE Build Service on i686 only. Probably the rekey on the server needs longer here to collect enough entropy. So we need to try harder before we stop :-) Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
@ -38,6 +38,8 @@
|
||||
#include <fcntl.h>
|
||||
#include <pwd.h>
|
||||
|
||||
#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 */
|
||||
|
Reference in New Issue
Block a user