[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 11/20] tests: send more packets of various sizes


From: Aris Adamantiadis <aris@xxxxxxxxxxxx>

---
 tests/client/torture_algorithms.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/tests/client/torture_algorithms.c b/tests/client/torture_algorithms.c
index 685ab305..59288269 100644
--- a/tests/client/torture_algorithms.c
+++ b/tests/client/torture_algorithms.c
@@ -26,6 +26,7 @@
 #include "torture.h"
 #include "libssh/libssh.h"
 #include "libssh/priv.h"
+#include "libssh/session.h"
 
 #include <errno.h>
 #include <sys/types.h>
@@ -49,7 +50,6 @@ static int session_setup(void **state) {
     int verbosity = torture_libssh_verbosity();
     struct passwd *pwd;
     int rc;
-
     pwd = getpwnam("bob");
     assert_non_null(pwd);
 
@@ -84,6 +84,10 @@ static void test_algorithm(ssh_session session,
                            const char *cipher,
                            const char *hmac) {
     int rc;
+    char data[256];
+    size_t len_to_test[] = {1,2,3,4,5,6,7,8,10,12,15,16,20,31,32,33,63,64,65,
+            100,127,128};
+    unsigned int i;
 
     int verbosity = torture_libssh_verbosity();
     ssh_options_set(session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity);
@@ -110,6 +114,14 @@ static void test_algorithm(ssh_session session,
     rc = ssh_connect(session);
     assert_int_equal(rc, SSH_OK);
 
+    /* send ignore packets of all sizes */
+    memset(data,0,sizeof(data));
+    for (i=0;i<(sizeof(len_to_test) / sizeof(size_t));++i){
+        memset(data,'A', len_to_test[i]);
+        ssh_send_ignore(session, data);
+        ssh_handle_packets(session, 50);
+    }
+
     rc = ssh_userauth_none(session, NULL);
     if (rc != SSH_OK) {
         rc = ssh_get_error_code(session);
-- 
2.14.1


References:
[PATCH 00/20] Add chacha20-poly1305 supportAlberto Aguirre <albaguirre@xxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org