Jakub Jelen
8f887e82c7
config: Reformat local_parse_file
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-12-07 14:07:31 +01:00
Jakub Jelen
993e24a361
config: Reformat ssh_config_parse_file
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-12-07 14:07:31 +01:00
Jakub Jelen
cf6f1e7a64
tests: Cover also compression with unit tests
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-12-07 14:07:31 +01:00
Jakub Jelen
31bc83f366
tests: Do not recreate unnecessary files for every test case
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-12-07 13:57:03 +01:00
Jakub Jelen
42ce989488
tests: Cover missing parts of the config parsing
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-12-07 13:28:11 +01:00
Andreas Schneider
4282f3c664
gitlab-ci: Fix csbuild to run latest 20 commits
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-30 18:52:40 +01:00
Andreas Schneider
3784226fd8
sftp: Do not overwrite errors set by channel functions
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-30 18:52:40 +01:00
Andreas Schneider
cf24048f02
libcrypto: Fix integer comparison in evp_cipher_aead_encrypt()
...
src/libcrypto.c:773:27: warning: comparison of integer expressions of
different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’}
[-Wsign-compare] <--[cc]
if (rc != 1 || outlen != len - aadlen) {
^~
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-30 18:47:25 +01:00
Anderson Toshiyuki Sasaki
f427a975b8
tests: Fix a clang possible memory leak warning
...
clang was reporting a possible memory leak after mkdtemp() call, which
was a false positive, since mkdtemp() returns the same pointer provided
as the parameter, in case of success. This changes the code so that the
static analyser don't get confused.
Found by csbuild runner.
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-30 18:28:40 +01:00
Anderson Toshiyuki Sasaki
c413834764
tests: Test calling ssh_init() after ssh_finalize()
...
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-30 18:26:55 +01:00
Anderson Toshiyuki Sasaki
41b0d263d6
libcrypto: Fix access violation in ssh_init()
...
This fixes an access violation when ssh_init() was called after
ssh_finalize() in Windows when using OpenSSL 1.0.2 and libssh statically
linked.
Fixes T120
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-30 18:26:55 +01:00
Andreas Schneider
a08a97f9c7
tests: Use UNUSED macros in torture_threads_init
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-30 18:25:12 +01:00
Andreas Schneider
c0ae59e102
bignum: Use UNUSED macros
2018-11-30 18:25:12 +01:00
Andreas Schneider
109a203453
include: Add macro for unused arguments and variables
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-30 18:25:12 +01:00
Andreas Schneider
ac8b954019
bignum: Use size_t in ssh_make_string_bn*
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-30 18:25:12 +01:00
Andreas Schneider
c6ca62d7e1
crypto: Use size_t for len argument in encrypt and decrpyt fn
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-30 18:25:12 +01:00
Anderson Toshiyuki Sasaki
6d3672911b
gitlab-ci: Added builds for native Windows
...
This uses a runner configured with the tag "vs2017 or windows".
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-30 18:25:12 +01:00
Tilo Eckert
95f83c2391
src: Fix multiple typos
...
Signed-off-by: Tilo Eckert <tilo.eckert@flam.de >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-30 16:29:17 +01:00
Jakub Jelen
130256c348
tests: Verify that signatures are sane and can not be verified by non-matching key
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-30 16:26:48 +01:00
Jakub Jelen
b72c9eead6
pki: Sanitize input to verification
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-30 16:26:07 +01:00
Jakub Jelen
c7628fbfea
pki: Return default RSA key type for DIGEST_AUTO
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-30 16:24:21 +01:00
Jakub Jelen
783e5fd206
pki: Verify the provided public key has expected type
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-30 16:24:14 +01:00
Jakub Jelen
c79c33e224
pki: Sanity-check signature matches base key type
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-30 16:22:51 +01:00
Jakub Jelen
968fdf4e18
tests: Do not require base RSA type for SHA2 extension whitelist
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-30 16:22:13 +01:00
Jakub Jelen
bc91fa98ea
packet_cb: Properly verify the signature type
...
Issue reported by Tilo Eckert <tilo.eckert@flam.de >
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-30 16:21:52 +01:00
Jakub Jelen
d2434c69c0
pki: Separate signature extraction and verification
...
Initial solution proposed by Tilo Eckert <tilo.eckert@flam.de >
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-30 16:21:18 +01:00
Jakub Jelen
7f83a1efae
pki: Set correct type for imported signatures
...
Issue reported by Tilo Eckert <tilo.eckert@flam.de >
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-30 16:20:19 +01:00
Jakub Jelen
7b725e6bc7
pki: Use self-explanatory variable names
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-30 16:20:10 +01:00
Jakub Jelen
46d8840f7e
The largest ECDSA key has 521 bits
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-30 16:20:04 +01:00
Jakub Jelen
c1fdb56d23
pki_gcrypt: Do not abort on bad signature
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-30 16:19:59 +01:00
Jakub Jelen
57bdc9cb20
Whitespace cleanup
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-29 14:22:08 +01:00
Anderson Toshiyuki Sasaki
312084731e
tests: Use temporary directories in torture_pki_ed25519.c
...
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-28 15:51:06 +01:00
Anderson Toshiyuki Sasaki
500bf54a34
tests: Use temporary directories in torture_pki_ecdsa.c
...
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-28 15:51:06 +01:00
Anderson Toshiyuki Sasaki
a56fa14fda
tests: Use temporary directories in torture_pki_dsa.c
...
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-28 15:51:06 +01:00
Anderson Toshiyuki Sasaki
ac1377148f
tests: Use temporary directories in torture_threads_pki_rsa.c
...
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-28 15:51:06 +01:00
Anderson Toshiyuki Sasaki
f38c6fcc6e
tests: Use temporary directories in torture_pki_rsa.c
...
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-28 15:51:06 +01:00
Anderson Toshiyuki Sasaki
0dd2b375c7
tests: Introduce functions to change directories
...
This introduces torture_get_current_working_dir() and
torture_change_dir() to allow changing directories in tests.
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-28 15:51:06 +01:00
Anderson Toshiyuki Sasaki
77be4ce905
tests: use torture_create_temp_file() in torture_knownhosts_parsing
...
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-28 15:51:06 +01:00
Anderson Toshiyuki Sasaki
78b1f0ead3
tests: Introduce torture_create_temp_file()
...
Introduced torture_create_temp_file() and torture_close_fp() to allow
creating temprary files transparently in Unix and Windows environment.
This also adds a unit test for the added functions.
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-28 15:51:06 +01:00
Anderson Toshiyuki Sasaki
31527d4105
tests: Use torture_make_temp_dir() in torture_setup_socket_dir()
...
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-28 15:51:06 +01:00
Anderson Toshiyuki Sasaki
65e16b8d9e
tests: Introduce torture_make_temp_dir()
...
Introduces a function to create temporary dir for testing purposes.
Also adds a minimal test for the temporary directory creation.
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-28 15:51:06 +01:00
Anderson Toshiyuki Sasaki
1f6b929735
tests: Replace tests filtering with cmocka builtin filter
...
This completely removes the tests filter code from torture.c and calls
cmocka_set_test_filter() instead, if available. The checks for required
libraries, headers, and the availability of cmocka_set_test_filter()
were added to the cmake configuration.
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-28 15:51:06 +01:00
Anderson Toshiyuki Sasaki
74285d3aca
tests: Define flags not present in Windows
...
Define flags S_IRWXO and S_IRWXG in torture_knownhosts_parsing.c when
building for Windows. These flags don't exist in Windows and are not
used.
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-28 11:10:29 +01:00
Anderson Toshiyuki Sasaki
7960fbaabb
tests: Add Windows alternatives for low level I/O
...
In Windows environment, there are available low level I/O operations in
io.h, such as _read(), _write(), _open(), and _close().
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-28 11:10:10 +01:00
Anderson Toshiyuki Sasaki
a2baf6e97b
tests: Include config.h in torture_pki.c
...
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-27 11:52:12 +01:00
Anderson Toshiyuki Sasaki
f9ff53b494
tests: Include unistd.h only if available
...
Include the header in tests/torture_pki.c only if it is available. It
is not available in Windows environment.
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-27 11:52:12 +01:00
Andreas Schneider
98487f464b
gitlab-ci: If there is not old sha check last 20 commits
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-23 17:30:16 +01:00
Jakub Jelen
b214f84538
tests: Avoid warnings about unused arguments
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-23 17:30:16 +01:00
Jakub Jelen
05417665b9
tests: Drop duplicate log level setup
...
Already done in the setup phase.
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-23 17:30:16 +01:00
Jakub Jelen
e639c9d0d8
kex,packet,packet_cb: Reformat
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-23 17:30:16 +01:00