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

4645 Коммитов

Автор SHA1 Сообщение Дата
Andreas Schneider
d41042f92d pki: Avoid a possible segfaults in error paths
Found by csbuild.

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-26 14:21:26 +01:00
Andreas Schneider
9b2eefe62c dh-gex: Add error check for ssh_packet_send() in ssh_packet_server_dhgex_request
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-26 14:15:01 +01:00
Andreas Schneider
8ec80d1f5d libcrypto: Use size_t for size calculations
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-26 14:09:44 +01:00
Anderson Toshiyuki Sasaki
8ddbe7bec6 sftp: Add NULL check in sftp_ext_free()
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-26 13:56:25 +01:00
Anderson Toshiyuki Sasaki
61ad276a87 sftp: Reformat sftp_ext_free()
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-26 13:56:22 +01:00
Anderson Toshiyuki Sasaki
9c5a1967c3 tests: Add NULL checks in pki tests
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-26 13:56:22 +01:00
Anderson Toshiyuki Sasaki
27caaa000b tests: Prefer assert_non_null() over assert_false()
This also replaces some occurrences of assert_true() with assert_null()

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-26 13:56:22 +01:00
Anderson Toshiyuki Sasaki
bdf968c178 tests: Added NULL checks in torture_list.c
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-26 13:56:22 +01:00
Anderson Toshiyuki Sasaki
603b6d7222 tests: Prefer assert_non_null over assert_true
This also replaces some occurrences of assert_true with assert_null.

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-26 13:56:22 +01:00
Anderson Toshiyuki Sasaki
89f58decb6 misc: Add NULL checks before accessing lists
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-26 13:56:22 +01:00
Anderson Toshiyuki Sasaki
5ed5e97114 messages: Fix NULL check, preventing SEGFAULT
The wrong conditional check for newly allocated memory would make the
function to fail when the allocation was successful and access invalid
memory when the allocation failed.

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-26 13:56:15 +01:00
Andreas Schneider
6dacc8b26c gitlab-ci: Add (disabled) target with MemorySanitizer
We can't enable this till we can ignore OpenSSL.

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-25 16:08:04 +01:00
Andreas Schneider
d41fd0c465 cmake: Add support for MemorySanitizer
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-25 16:07:50 +01:00
Andreas Schneider
d598e4e52a packet_crypt: Make sure we always operate on initilized memory
Found by MemorySanitizer.

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-25 16:07:50 +01:00
Andreas Schneider
932102bd13 session: Initialize allocated memory
Found by MemorySanitizer.

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-25 14:13:10 +01:00
Andreas Schneider
e260a591f4 gitlab-ci: Fix UndefinedSanitizer
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-25 11:36:07 +01:00
Baruch Siach
6c7eaa9e12 buffer: Convert argc to size_t in ssh_buffer_unpack() as well
Commit c306a693f3 ("buffer: Use size_t for argc argument in
ssh_buffer_(un)pack()") mentioned unpack in the commit log, but it only
touches the pack variants. Extend the conversion to unpack.

Pre-initialize the p pointer to avoid possible use before
initialization in case of early argc check failure.

This fixes build failure:

.../libssh-0.8.6/src/buffer.c: In function 'ssh_buffer_unpack_va':
.../libssh-0.8.6/src/buffer.c:1229:16: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]
             if (argc == -1){
		^

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-24 17:48:08 +01:00
Eric Bentley
83d86ef6a5 examples: add public key auth for specific key
There was no example of using a specific key for authentication so I added
one.

Signed-off-by: Eric Bentley <ebentley66@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-24 17:48:08 +01:00
Eric Bentley
db67fcbe88 examples: add public key authentication to ssh_server_fork
I noticed that there was no example showing server side public key encryption in the examples
so I added this one. I used authorizedkeys as a global to minimize the changes to the original
code as well as I was not sure the correct methodology of determining the .ssh directory location
for a user not using Linux. One code using the user parameter to determine the location to use
instead if desired.

Signed-off-by: Eric Bentley <ebentley66@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-24 17:48:04 +01:00
Jakub Jelen
be9943132e tests: Extend negative test cases for config Match keyword
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-24 15:15:39 +01:00
Jakub Jelen
893510db35 tests: Use assert_ssh_return_code() in config test
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-24 15:15:35 +01:00
Jakub Jelen
e989c4afff config: Add new Match final keyword from OpenSSH 8.0
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-24 15:15:18 +01:00
Jakub Jelen
3ce31532eb config: Fail if there is missing argument for some of the match keywords
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-24 15:13:30 +01:00
Aris Adamantiadis
3b5f9ef8d6 pkd: dh-group-exchange testcases 2019-01-24 13:06:33 +01:00
Aris Adamantiadis
53c88375fe dh-gex: Add server implementation
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-24 13:06:33 +01:00
Aris Adamantiadis
40faa98c5e wrapper: Move dh cleanup into dh.c
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-24 12:56:14 +01:00
Aris Adamantiadis
9407065879 tests: Added moduli file parsing tests
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-24 12:56:09 +01:00
Aris Adamantiadis
b36219369d dh-gex: Add support for moduli file parsing
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-24 12:51:54 +01:00
Aris Adamantiadis
31da8025b2 tests: Add dh-group-exchange algorithm tests
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-24 11:56:23 +01:00
Aris Adamantiadis
574bfb5459 dh-gex: Add client implementation
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-24 11:56:23 +01:00
Aris Adamantiadis
154eb91914 dh: move state changes inside DH code
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-24 11:56:23 +01:00
Aris Adamantiadis
9c88769707 dh: Do some basic refactoring
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-24 11:56:23 +01:00
Aris Adamantiadis
a6c47099b7 buffer: Support bignums in ssh_buffer_unpack()
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-24 11:53:22 +01:00
Aris Adamantiadis
2f8239ade3 mbedcrypto: fixed nasty RNG bugs 2019-01-24 11:53:22 +01:00
Aris Adamantiadis
afe2673cfa bignum: harmonize gcrypt, libcrypto and libmcrypt bignum
Ensure most of the abstraction around the 3 libs are consistent.

Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-24 11:04:44 +01:00
Aris Adamantiadis
43a4f86b6e dh: move unrelated functions out of dh.c
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-24 09:34:18 +01:00
Aris Adamantiadis
e42a423a24 kex: use runtime callbacks (server)
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-24 09:19:59 +01:00
Aris Adamantiadis
602a1defea kex: use runtime callbacks (client)
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-24 09:11:30 +01:00
Anderson Toshiyuki Sasaki
fd5770973f tests: Add test for server interactive authentication
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
2019-01-22 13:12:26 +01:00
Anderson Toshiyuki Sasaki
416d03b19e tests: Add test for server auth method none
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-22 13:12:26 +01:00
Anderson Toshiyuki Sasaki
db1a999852 tests: Test server pubkey authentication
The default pubkey authentication callback is not checking
anything.

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-22 13:12:25 +01:00
Anderson Toshiyuki Sasaki
29445e4ff1 tests: Added functions to get the default callbacks
This makes easier to create test cases using callbacks based on the
default callbacks (e.g. using the default callbacks but replacing one
specific callback)

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-22 13:12:25 +01:00
Anderson Toshiyuki Sasaki
13aa791e7b tests: Provide the server state to callbacks
This aims to make it easier to implement custom callbacks.

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-22 13:12:25 +01:00
Jakub Jelen
7f18a27504 tests: Reproducer for cockpit issue, where server provides an invalid signature
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-22 13:12:25 +01:00
Jakub Jelen
2113dc9d23 tests: Check return values
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2019-01-22 13:12:25 +01:00
Jakub Jelen
1f7a15ffb1 tests: Initialize allocated memory
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2019-01-22 13:12:25 +01:00
Anderson Toshiyuki Sasaki
37262b98ef tests: Added test server
The server can be configured through command line options or by
providing a state structure with the desired values set.

Currently supports only password based authentication.

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
2019-01-22 13:12:25 +01:00
Andreas Schneider
e91e221d02 pcap: Correctly initialize sockaddr_in in ssh_pcap_context_set_file()
Error: CLANG_WARNING:
src/pcap.c:329:22: warning: The left operand of '!=' is a garbage value

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-22 13:12:25 +01:00
Andreas Schneider
79fe88bfb8 pcap: Reformat ssh_pcap_context_connect()
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-22 13:12:25 +01:00
Andreas Schneider
98a8bf771d tests: Fix uninitialized warning in torture_threads_pki_rsa
Error: CLANG_WARNING: tests/unittests/torture_threads_pki_rsa.c:520:5:
warning: 1st function call argument is an uninitialized value

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-22 13:12:25 +01:00