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

33 Коммитов

Автор SHA1 Сообщение Дата
Andreas Schneider
b0af812710 tests: Move torture keys to own file
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-01-10 22:31:02 +01:00
Juraj Vijtiuk
778652460f add mbedtls crypto support
Summary:
This patch adds support for mbedTLS as a crypto backend for libssh.
mbedTLS is an SSL/TLS library that has been designed to mainly be used
in embedded systems.  It is loosely coupled and has a low memory
footprint.  mbedTLS also provides a cryptography library (libmbedcrypto)
that can be used without the TLS modules.
The patch is unfortunately quite big, since several new files had to
be added.
DSA is disabled at compile time, since mbedTLS doesn't support DSA
Patch review and feedback would be appreciated, and if any issues or
suggestions appear, I'm willing to work on them.

Signed-off-by: Juraj Vijtiuk <juraj.vijtiuk@sartura.hr>

Test Plan:
* The patch has been tested with a Debug and MinSizeRel build, with
libssh unit tests, client tests and the pkd tests.
* All the tests have been run with valgrind's memcheck, drd and helgrind
tools.
* The examples/samplessh client works when built with the patch.

Reviewers: asn, aris

Subscribers: simonsj

Differential Revision: https://bugs.libssh.org/D1
2017-12-28 11:17:39 +01:00
Jakub Jelen
5c7b8802f2 tests: HostkeyAlgorithms passed from config to options
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2017-12-21 11:43:19 +01:00
Jakub Jelen
110da49504 config: support for MACs
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2017-12-15 12:00:49 +01:00
Jakub Jelen
78a3ab2eaa tests/options: Verify key exchange algorithms are set properly
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2017-12-15 12:00:49 +01:00
Aris Adamantiadis
f818e63f8f Add new options
Pair-Programmed-With: Jakub Jelen <jjelen@redhat.com>
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2017-12-15 12:00:49 +01:00
Andreas Schneider
f0ddde4826 Fix config.h includes
We need stdlib.h and string.h in priv.h for free() and memset().

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2017-10-28 14:31:37 +02:00
Nikos Mavrogiannopoulos
316ee071cf torture_options: test the setting of ciphers and MACs
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
2017-08-24 18:01:41 +02:00
Jon Simons
a4dc74064c tests: plug leak in torture_bind_options_import_key
Summary:
Hello, this is a resend for a quick memory leak fix for one of the unit
tests, originally sent to the mailing list here:

 * https://www.libssh.org/archive/libssh/2017-07/0000017.html

Test Plan:
 * Before the fix and running the test with valgrind:

```
[simonsj@simonsj-lx5 : unittests] valgrind --leak-check=full ./torture_options >/dev/null
==93134== Memcheck, a memory error detector
==93134== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==93134== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==93134== Command: ./torture_options
==93134==
[  PASSED  ] 10 test(s).
[  PASSED  ] 1 test(s).
==93134==
==93134== HEAP SUMMARY:
==93134==     in use at exit: 80 bytes in 1 blocks
==93134==   total heap usage: 977 allocs, 976 frees, 75,029 bytes allocated
==93134==
==93134== 80 bytes in 1 blocks are definitely lost in loss record 1 of 1
==93134==    at 0x4C28C20: malloc (vg_replace_malloc.c:296)
==93134==    by 0x41BAB0: ssh_key_new (pki.c:107)
==93134==    by 0x40DF90: torture_bind_options_import_key (torture_options.c:222)
==93134==    by 0x4E3AA3A: cmocka_run_one_test_or_fixture (cmocka.c:2304)
==93134==    by 0x4E3ACEA: cmocka_run_one_tests (cmocka.c:2412)
==93134==    by 0x4E3B036: _cmocka_run_group_tests (cmocka.c:2517)
==93134==    by 0x40E9E3: torture_run_tests (torture_options.c:276)
==93134==    by 0x40DE68: main (torture.c:1100)
==93134==
==93134== LEAK SUMMARY:
==93134==    definitely lost: 80 bytes in 1 blocks
==93134==    indirectly lost: 0 bytes in 0 blocks
==93134==      possibly lost: 0 bytes in 0 blocks
==93134==    still reachable: 0 bytes in 0 blocks
==93134==         suppressed: 0 bytes in 0 blocks
==93134==
==93134== For counts of detected and suppressed errors, rerun with: -v
==93134== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
```

 * And after:

```
[simonsj@simonsj-lx5 : unittests] valgrind --leak-check=full ./torture_options >/dev/null
==93294== Memcheck, a memory error detector
==93294== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==93294== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==93294== Command: ./torture_options
==93294==
[  PASSED  ] 10 test(s).
[  PASSED  ] 1 test(s).
==93294==
==93294== HEAP SUMMARY:
==93294==     in use at exit: 0 bytes in 0 blocks
==93294==   total heap usage: 977 allocs, 977 frees, 75,029 bytes allocated
==93294==
==93294== All heap blocks were freed -- no leaks are possible
==93294==
==93294== For counts of detected and suppressed errors, rerun with: -v
==93294== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
```

Reviewers: asn

Reviewed By: asn

Differential Revision: https://bugs.libssh.org/D3
2017-08-17 09:33:13 +02:00
Andreas Schneider
d9ff44b46e tests: Fix endif
Ups.

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2017-07-14 08:53:15 +02:00
Andreas Schneider
c480ac8522 tests: Only run ssh_bind test if we build with server support
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2017-07-14 08:52:08 +02:00
Alfredo Mazzinghi
9dc650b7fb server: Add option SSH_BIND_OPTIONS_IMPORT_KEY to server
This sets the bind private key directly from an ssh_key struct instead
of reading a file.

Signed-off-by: Alfredo Mazzinghi <am2419@cl.cam.ac.uk>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2017-04-11 10:00:13 +02:00
Andreas Schneider
82a80b205b tests: Migrate to new cmocka API
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-09-07 10:40:12 +02:00
Aris Adamantiadis
d42a1a35b0 tests: allow conditionnal execution on pattern
Option can be used to filter out irrelevant tests
usage: ./torture_pki '*ed25519'

Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2015-02-02 17:34:15 +01:00
Andreas Schneider
e52cc613e4 BUG 103: Disable proxy command if set to 'none'.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2013-07-11 15:34:50 +02:00
Andreas Schneider
b219d1890c tests: Don't leak memory in options test. 2012-10-07 22:15:20 +02:00
Andreas Schneider
ee774479de session: Use a struct for all options. 2012-02-05 11:50:49 +01:00
Lee Hambley
17f396ffab Improve ssh_options_get(ssh_session, enum ssh_options_e, char**).
* Use SSH_ERROR and SSH_OK instead of `-1` and `0`.
 * Re-factor for code duplication
 * No longer call `ssh_set_error_invalid(ssh_session)` when the
   ssh_session is NULL.
2011-11-03 18:24:02 +01:00
Andreas Schneider
2cc48db673 tests: Fix build warning. 2011-10-29 19:58:10 +02:00
Lee Hambley
e797781bb5 Implement ssh_options_get_port(ssh_session, unsigned int*). 2011-10-28 12:15:12 +02:00
Lee Hambley
6bd95b50f5 Implement ssh_options_get(ssh_session, enum ssh_options_e, char**). 2011-10-28 12:14:34 +02:00
Andreas Schneider
ae1f87e37a options: Fix NULL value handling. 2011-09-06 09:16:54 +02:00
Aris Adamantiadis
a17472ff2b Fix unit tests for opensolaris 2011-01-11 17:55:12 +01:00
Aris Adamantiadis
3f538b3ddd Call ssh_init()/ssh_finalize bf/af each testcase 2011-01-02 17:25:51 +01:00
Andreas Schneider
52d6b7b914 tests: Fixed includes of torture_options for windows. 2011-01-01 20:53:54 +01:00
Andreas Schneider
1f47730a82 tests: Fixed Windows build of torture_options. 2011-01-01 19:14:49 +01:00
Andreas Schneider
d04ce30b03 tests: Migrated torture_options to cmockery. 2010-12-28 22:14:47 +01:00
Andreas Schneider
937268eb3e torture: Fixed fd check. 2010-06-17 13:38:13 +02:00
Andreas Schneider
216cabc563 tests: Move getpwuid_r to a setup function. 2010-06-03 16:44:47 +02:00
Aris Adamantiadis
f95157297e Factorize all the main functions in unit tests 2010-05-18 22:25:06 +02:00
Aris Adamantiadis
89993dd757 Fixed unittest name 2010-05-18 22:11:41 +02:00
Andreas Schneider
833903e8ec torture: Fix compiling options test if NSS_BUFLEN_PASSWD isn't defined.
Thanks to Xi Wang for the patch.
2010-04-20 13:30:07 +02:00
Andreas Schneider
72058bfbcc Added tests for ssh options. 2010-03-13 14:21:23 +01:00