1
1
Граф коммитов

283 Коммитов

Автор SHA1 Сообщение Дата
Jakub Jelen
c004b43fde tests: Unsupported and unknown configuration options do not crash
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2018-08-16 17:51:05 +02:00
Andreas Schneider
8ce4004260 tests: Free memory of tmp_file in torture_knownhosts_parsing
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-08-08 15:04:59 +02:00
Andreas Schneider
8c11367410 tests: Fix memory leak in torture_knownhosts_read_file()
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-08-08 15:04:59 +02:00
Andreas Schneider
460026459b tests: Do not leak memory when freeing ed25519 keys
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-08-08 15:04:59 +02:00
Andreas Schneider
ab7c5c448c tests: Add additional NULL checks
CID 1393894

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-08-06 09:43:51 +02:00
Andreas Schneider
f6fe7488e3 tests: Add some null checks
CID 1393898

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-08-06 09:36:50 +02:00
Andreas Schneider
fbfe002460 tests: Check for memory allocation error in torture_pki_ed25519_sign()
CID 1393899

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-08-06 09:36:47 +02:00
Andreas Schneider
1509693cce tests: null terminate buffer in torture_read_one_line()
CID 1393902

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-08-06 08:52:42 +02:00
Andreas Schneider
67ef808a95 tests: Add additional NULL check in torture_pki_rsa_write_privkey()
CID 1393904
CID 1393903

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-08-06 08:50:11 +02:00
Andreas Schneider
aeefcd8199 tests: Initialize readfds in torture_channel_select()
CID 1393905

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-08-06 08:46:37 +02:00
Andreas Schneider
9bc050d07d tests: Check return code of ssh_pki_import_privkey_base64
CID 1393906

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-08-06 08:44:28 +02:00
Andreas Schneider
c2776f70c1 tests: Improve test checks
CID 1394620

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-08-06 08:32:07 +02:00
Anderson Toshiyuki Sasaki
9305762fcd Remove internal calls to ssh_init
Since the call is made automatically when the library is loaded, these
calls are no longer required (if the library is not linked statically).

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-08-03 16:43:03 +02:00
Anderson Toshiyuki Sasaki
e0e0d62a71 tests: Run thread tests on Windows
When pthreads is available, run the threads tests on Windows

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-08-03 16:43:03 +02:00
Anderson Toshiyuki Sasaki
708f127788 tests: Add test for RSA PKI running on threads
Run the tests from torture_pki_rsa.c on threads.  Tests requiring files
to be removed are not tested, since they would require the access to
the files to be synchronized.

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-08-03 16:43:03 +02:00
Anderson Toshiyuki Sasaki
dd3d867452 tests: Add test for crypto running on threads
The test run crypto test on multiple threads.

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-08-03 16:43:03 +02:00
Anderson Toshiyuki Sasaki
5443863723 tests: Add test for buffer running on threads
The test run buffer tests on multiple threads.

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-08-03 16:43:03 +02:00
Anderson Toshiyuki Sasaki
edcdef94ee tests: Add test for init running on threads
The test runs ssh_init()/ssh_finalize() on multiple threads.

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-08-03 16:43:03 +02:00
Anderson Toshiyuki Sasaki
83b43443e5 threads: Automatically call ssh_init on load
This makes unnecessary to call ssh_init() when the library is
dynamically loaded.  Also removes the threads shared library.  The used
threads implementation is chosen in configuration time, changing the
ssh_threads_get_default() depending on the available threads library.

Internally, it is expected a threads implementation providing:

- void ssh_mutex_lock(void **mutex);
- void ssh_mutex_unlock(void **mutex);
- struct ssh_threads_callbacks_struct *ssh_threads_get_default(void);

and a crypto implementation providing:

- int crypto_thread_init(struct ssh_threads_callbacks_struct *user_callbacks);
- void crypto_thread_finalize(void);

This adds internal threads implementation for pthreads and noop.

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-08-03 16:43:03 +02:00
Jakub Jelen
ed738bee34 test: Fix text labels (copy & paste error)
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-08-01 16:03:17 +02:00
Andreas Schneider
afa4021ded tests: Add umask() around mkstemp()
CID 1391450

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-07-07 11:38:59 +02:00
Andreas Schneider
c866768da4 torture_pki_dsa: Improve torture_pki_dsa_publickey_base64
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-07-05 13:15:14 +02:00
Andreas Schneider
c503bb572e crytpo: Make sure we check return of ssh_get_random() correctly
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-07-05 12:12:14 +02:00
Andreas Schneider
613dcc95e6 knownhosts: Fix return codes
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-07-03 15:08:40 +02:00
Andreas Schneider
c98b00a5f4 log: Make global variables static
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-06-30 14:37:04 +02:00
Tilo Eckert
a2a6dddacf tests: adjust test for kex string "curve25519"
Signed-off-by: Tilo Eckert <tilo.eckert@flam.de>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-06-29 15:57:57 +02:00
Andreas Schneider
206f3ff895 Rest in Peace SSHv1
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2018-06-29 14:41:14 +02:00
Andreas Schneider
10728f8577 cmake: Disable torture_packet on Windows
The test uses socketpair().

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-06-29 10:57:36 +02:00
Andreas Schneider
f4ddf9df53 tests: Fix key parsing in torture_pki_dsa_publickey_base64
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-06-29 10:05:06 +02:00
Andreas Schneider
d7477dc745 tests: Remove system includes from torture_packet
This fixes the build on Windows. Those come in via the include of
socket.c anyway.

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-06-29 09:35:54 +02:00
Andreas Schneider
1444ae5add pki: Fix random memory corruption
Fixes T78

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-06-29 09:30:59 +02:00
Jon Simons
f827833d82 tests: fix torture_packet.c test_data
Make the `test_data` larger so that tests do not read beyond
its length.  Observed in testing with an `-fsanitize=address`
build locally.

Signed-off-by: Jon Simons <jon@jonsimons.org>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-06-28 09:06:30 +02:00
Alberto Aguirre
26734a547a torture_packet: Set encryption/decryption keys
Signed-off-by: Alberto Aguirre <albaguirre@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-06-28 09:06:30 +02:00
Aris Adamantiadis
321ec2cb1c tests: packet encryption unit testing
That code is really ugly, but it wasn't meant to be modular at all in the
first place.

Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-06-28 09:06:30 +02:00
Andreas Schneider
c4f3bf4ffa torture: Remove unused variable
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-06-28 09:05:58 +02:00
Andreas Schneider
f3de2974a9 tests: Disable ssh_is_ipaddr("255.255.255") on Win32
Till we get the issue fixed in Wine.

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-06-28 08:36:54 +02:00
Andreas Schneider
1b8ce5a6ed tests: Workaround for a Wine bug
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-06-28 08:27:08 +02:00
Jon Simons
732818ebb2 tests: fix -Wunused-function warning in torture_pki_ecdsa.c
Wrap some function definitions with `HAVE_LIBCRYPTO` ifdefs to
match their usages in `torture_run_tests`.

Fixes this warning I observe when building locally:

    torture_pki_ecdsa.c:341:13: warning:
         ‘torture_pki_ecdsa_write_privkey’ defined but not used
         [-Wunused-function]

Signed-off-by: Jon Simons <jon@jonsimons.org>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-06-27 21:25:30 +02:00
Andreas Schneider
963c46e4fb knownhosts: Add ssh_session_has_known_hosts_entry()
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-06-04 11:20:28 +02:00
Andreas Schneider
32c49ea134 misc: Add ssh_list_count()
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-06-04 11:20:28 +02:00
Andreas Schneider
a465ea2d49 knownhosts: Add ssh_known_hosts_read_entries()
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-06-04 11:20:28 +02:00
Andreas Schneider
702e9e8ad5 knownhosts: Introduce new known hosts managing functions
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-06-04 11:20:28 +02:00
Andreas Schneider
816234350d pki: Fix duplicating ed25519 public keys
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-04-25 16:25:32 +02:00
Nikos Mavrogiannopoulos
f3a19d8c96 torture_path_expand_tilde_unix: use getpwuid() if no env variables
This allows operating under environments where the username variables
are not present.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-04-17 17:59:14 +02:00
Andreas Schneider
467d78a442 tests: Fix mixed code compiler warning in torture_rand
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-03-21 20:41:16 +01:00
Juraj Vijtiuk
d11869bdb6 pki: Add mbedTLS ECDSA key comparison support
Signed-off-by: Juraj Vijtiuk <juraj.vijtiuk@sartura.hr>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-03-07 15:44:05 +01:00
jvijtiuk
963111b836 tests: Fix segfault with mbedTLS built without threading support
torture_rand and torture_server_x11 call ssh_init without checking
the return value. If mbedTLS is built without threading support
ssh_init fails but the tests continue and then segfault since threading
wasn't correctly initialised.

Add a section that documents requirements for mbedTLS usage in a
multi threaded environment to README.mbedtls.

Signed-off-by: Juraj Vijtiuk <juraj.vijtiuk@sartura.hr>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-02-12 20:05:49 +01:00
Andreas Schneider
e9073a6bdb torture_pki_ed25519: Add tests for private key with passphrase
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-01-10 22:31:02 +01:00
Andreas Schneider
9086d5ca33 torture_pki_ecdsa: Add tests for private key with passphrase
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-01-10 22:31:02 +01:00
Andreas Schneider
f9b1dece41 torture_pki_dsa: Add tests for private key with passphrase
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-01-10 22:31:02 +01:00