summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* tests: introduce pkd_helloJon Simons2014-10-1210-0/+1416
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a sample public-key testing daemon to the 'pkd' test directory, and add support code for cycling through various combinations of different key exchange, cipher, and MAC algorithms. The goal of the 'pkd_hello' test is to make it easy to test interactions between non-libssh clients and a libssh-server, and to provide a starting point for testing new implementations for key types, ciphers, MACs, and so on. The thinking is that testing a new algorithm should be as simple as adding a new line for it in the PKDTESTS_* lists. Macros are used to generate the tests and helper functions for a couple of clients -- here, OpenSSH and dropbear are included for the first cut. If binaries are found for these clients, their test lists will be enabled; when binaries are not found for a given client, those tests are skipped. Tests are run in one large batch by default, but can also be run individually to help with tracking down things like signature bugs that may take many iterations to reproduce. Each test logs its stdout and stderr to its own file, which is cleaned up when a test succeeds. For failures, those logs can be combined with verbose libssh output from pkd itself to start debugging things. Some example usages: pkd_hello Run all tests with default number of iterations. pkd_hello --list List available individual test names. pkd_hello -i 1000 -t torture_pkd_openssh_ecdsa_256_ecdh_sha2_nistp256 Run only the torture_pkd_openssh_ecdsa_256_ecdh_sha2_nistp256 testcase 1000 times. pkd_hello -v -v -v -v -e -o Run all tests with maximum libssh and pkd logging. Included in the tests are passes for all existing kex, cipher, and MAC algorithms. BUG: https://red.libssh.org/issues/144 Signed-off-by: Jon Simons <jon@jonsimons.org> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
* pki_gcrypt: Initialize 'type_c' in 'pki_do_sign_sessionid'Artyom V. Poptsov2014-10-021-0/+1
| | | | | | | | | | | Add missing initialization of 'type_c' field of a SSH signature in 'pki_do_sign_sessionid' procedure. If libssh is compiled with GCrypt, 'dh_handshake_server' fails with "Could not sign the session id" error. The change fixes that. Signed-off-by: Artyom V. Poptsov <poptsov.artyom@gmail.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
* server: fix auth_interactive_request replyJon Simons2014-10-021-1/+1
| | | | | | | | Fix a missing 'buffer_pack' formatter in 'ssh_message_auth_interactive_request'. With this fix the 'examples/samplesshd-kbdint' program is working again for me. Signed-off-by: Jon Simons <jon@jonsimons.org> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
* ed25519: fix leak in pki_ed25519_signJon Simons2014-10-021-2/+2
| | | | | Signed-off-by: Jon Simons <jon@jonsimons.org> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
* pki: check ssh_buffer_pack return in ssh_pki_do_signJon Simons2014-10-021-5/+10
| | | | | | | Check the 'ssh_buffer_pack' return in ssh_pki_do_sign for the ED25519 case. Signed-off-by: Jon Simons <jon@jonsimons.org> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
* pki: fail when pubkey buffer length is not ED25519_PK_LENJon Simons2014-10-021-1/+5
| | | | | | | | | Fail fast in 'pki_import_pubkey_buffer' for the ED25519 case if a buffer sized ED25519_PK_LEN can not be retrieved. Before, the 'memcpy' could have read beyond the bounds of 'ssh_string_data(pubkey)'. Signed-off-by: Jon Simons <jon@jonsimons.org> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
* crypto: check malloc return in ssh_mac_ctx_initJon Simons2014-10-022-2/+10
| | | | | Signed-off-by: Jon Simons <jon@jonsimons.org> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
* wrapper: fix z_stream leakJon Simons2014-10-021-0/+3
| | | | | | | | Ensure to free the z_stream structures as allocated from the gzip.c initcompress, initdecompress functions. Signed-off-by: Jon Simons <jon@jonsimons.org> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
* string: Correctly burn the string buffer.Andreas Schneider2014-09-151-4/+5
| | | | | Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Aris Adamantiadis <aris@0xbadc0de.be>
* ed25519: Generate, sign and verify keys.Aris2014-09-076-2/+460
| | | | Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
* crypto: Add ed25519 implementation from OpenSSH.Aris Adamantiadis2014-09-0712-1/+2507
| | | | Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
* base64: Use a secure buffer.Aris Adamantiadis2014-09-071-0/+5
| | | | Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
* buffer: Add a secure buffer mechanism to avoid memory spillsAris Adamantiadis2014-09-073-9/+43
| | | | Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
* buffer: Implement "t" for text in ssh_buffer_pack().Aris Adamantiadis2014-09-072-3/+11
| | | | Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
* dh: Fix packing a pointer into the buffer.Andreas Schneider2014-08-251-2/+2
| | | | | | Thanks to Giovanni Panozzo <giovanni@panozzo.it>. Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
* tests: Fix writing the '\0'.Andreas Schneider2014-08-181-2/+2
| | | | Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
* ec: Fix build on CentOS.Andreas Schneider2014-08-182-0/+2
| | | | Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
* tests: Use public testkey passphrase function in pki test.Andreas Schneider2014-08-151-7/+6
| | | | | Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Aris Adamantiadis <aris@0xbadc0de.be>
* torture: Add public testkey passphrase function.Andreas Schneider2014-08-152-0/+6
| | | | | Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Aris Adamantiadis <aris@0xbadc0de.be>
* tests: Use public testkeys in pki test.Andreas Schneider2014-08-151-178/+74
| | | | | Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Aris Adamantiadis <aris@0xbadc0de.be>
* torture: Add public testkey functions.Andreas Schneider2014-08-152-0/+218
| | | | | Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Aris Adamantiadis <aris@0xbadc0de.be>
* tests: Make write file a public torture function.Andreas Schneider2014-08-153-30/+32
| | | | | Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Aris Adamantiadis <aris@0xbadc0de.be>
* auth: Fix a memory leak in agent publickey auth.Andreas Schneider2014-08-151-1/+2
| | | | | | | CID: 1230358 Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Aris Adamantiadis <aris@0xbadc0de.be>
* tests: Make sure we null terminate the buffer.Andreas Schneider2014-08-151-3/+4
| | | | | | | CID: 1230359 Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Aris Adamantiadis <aris@0xbadc0de.be>
* packet: Check return value of ssh_buffer_unpack().Andreas Schneider2014-08-151-7/+16
| | | | | | | CID: 1230357 Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Aris Adamantiadis <aris@0xbadc0de.be>
* messages: Check return value of ssh_buffer_unpack().Andreas Schneider2014-08-151-1/+6
| | | | | | | CID: 1230356 Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Aris Adamantiadis <aris@0xbadc0de.be>
* tests: Fix memory leak in buffer test.Andreas Schneider2014-08-151-0/+2
| | | | | Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Aris Adamantiadis <aris@0xbadc0de.be>
* buffer: Make sure rc is initialized.Andreas Schneider2014-08-151-2/+2
| | | | | Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Aris Adamantiadis <aris@0xbadc0de.be>
* libgcrypt: Fix initializer name.Andreas Schneider2014-08-151-22/+22
| | | | | Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Aris Adamantiadis <aris@0xbadc0de.be>
* bignum: Add missing include.Andreas Schneider2014-08-151-0/+2
| | | | | Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Aris Adamantiadis <aris@0xbadc0de.be>
* messages: Fix two ssh_buffer_unpack().Andreas Schneider2014-08-071-10/+11
| | | | | Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Aris Adamantiadis <aris@0xbadc0de.be>
* Fix sftp endianess bugsAris Adamantiadis2014-08-061-29/+32
| | | | Reviewed-by: Andreas Schneider <asn@samba.org>
* bignums: detach bignum-related functions from dh.c.Aris Adamantiadis2014-08-067-76/+130
| | | | Reviewed-by: Andreas Schneider <asn@samba.org>
* crypto: fix secure burning, structure members namingAris Adamantiadis2014-08-062-7/+6
| | | | Reviewed-by: Andreas Schneider <asn@samba.org>
* torture_pki: avoid generating keys with ssh-keygenAris Adamantiadis2014-08-061-96/+212
| | | | | | | | ssh-keygen makes the tests very slow because new keys are generated at the start of every test. ssh-keygen on OSX doesn't support ecdsa keys, even if libcrypto does. Reviewed-by: Andreas Schneider <asn@samba.org>
* tests: test the canary feature in buffer_(un)pack()Aris Adamantiadis2014-08-061-1/+27
| | | | Reviewed-by: Andreas Schneider <asn@samba.org>
* buffer: add a hidden canary to detect format errorsAris Adamantiadis2014-08-062-5/+23
| | | | Reviewed-by: Andreas Schneider <asn@samba.org>
* buffers: adapt sftpserver.c to ssh_buffer_(un)pack()Aris Adamantiadis2014-08-061-73/+41
| | | | Reviewed-by: Andreas Schneider <asn@samba.org>
* buffers: adapt sftp.c to ssh_buffer_(un)pack()Aris Adamantiadis2014-08-062-378/+230
| | | | Reviewed-by: Andreas Schneider <asn@samba.org>
* buffers: adapt session.c to ssh_buffer_(un)pack()Aris Adamantiadis2014-08-061-37/+15
| | | | Reviewed-by: Andreas Schneider <asn@samba.org>
* buffers: adapt server.c to ssh_buffer_(un)pack()Aris Adamantiadis2014-08-061-178/+108
| | | | Signed-off-by: Andreas Schneider <asn@samba.org>
* buffers: adapt pcap.c to ssh_buffer_(un)pack()Aris Adamantiadis2014-08-061-96/+53
| | | | Reviewed-by: Andreas Schneider <asn@samba.org>
* buffers: adapt ecdh.c to ssh_buffer_(un)pack()Aris Adamantiadis2014-08-061-23/+9
| | | | Reviewed-by: Andreas Schneider <asn@samba.org>
* buffers: adapt packet.c to ssh_buffer_(un)pack()Aris Adamantiadis2014-08-061-13/+12
| | | | Reviewed-by: Andreas Schneider <asn@samba.org>
* buffers: adapt messages.c to ssh_buffer_(un)pack()Aris Adamantiadis2014-08-061-425/+161
| | | | Reviewed-by: Andreas Schneider <asn@samba.org>
* buffers: adapt gssapi.c to ssh_buffer_(un)pack()Aris Adamantiadis2014-08-061-133/+47
|
* buffers: adapt curve25519.c to ssh_buffer_(un)pack()Aris Adamantiadis2014-08-061-15/+8
| | | | Reviewed-by: Andreas Schneider <asn@samba.org>
* buffers: adapt client.c to ssh_buffer_(un)pack()Aris Adamantiadis2014-08-061-28/+14
| | | | Reviewed-by: Andreas Schneider <asn@samba.org>
* buffers: adapt channels.c to ssh_buffer_(un)pack()Aris Adamantiadis2014-08-061-406/+201
| | | | Reviewed-by: Andreas Schneider <asn@samba.org>
* buffer: adapt dh.c to new ssh_buffer_(un)pack()Aris Adamantiadis2014-08-061-96/+40
| | | | Reviewed-by: Andreas Schneider <asn@samba.org>