Andreas Schneider
0cf1c85542
Revert "buffer: Validate the length before before memory allocation"
...
This reverts commit 57550e6211c19c634a319bed59d39b28d020dcd1.
2017-04-13 16:19:23 +02:00
Andreas Schneider
57550e6211
buffer: Validate the length before before memory allocation
...
Check if the size the other party sent is a valid size in the
transmitted buffer.
Thanks to Alex Gaynor for finding and reporting the issue.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2017-04-13 16:12:27 +02:00
Andreas Schneider
34bdc1ca78
buffer: Create ssh_buffer_validate_length()
...
This functions allows if a given length can be obtained from the buffer.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2017-04-13 16:12:27 +02:00
Alex Hermann
5f202d7ffa
config: Only use first occurence of each parameter
...
ssh_config's manpage says:
"For each parameter, the first obtained value will be used."
Make libssh adhere to this rule.
BUG: https://red.libssh.org/issues/256
Signed-off-by: Alex Hermann <alex@hexla.nl>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2017-04-13 16:08:20 +02:00
Alex Hermann
c3a8b5009f
config: Don't expand Host variable
...
Tokens are not allowed (according to the manpage).
Expansion was introduced by a wrong fix for #127 .
This commit reverts part of 6eea08a9ef
Signed-off-by: Alex Hermann <alex@hexla.nl>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2017-04-13 15:58:52 +02:00
Alex Hermann
9ef7e90821
config: Support expansion in the HostName variable
...
BUG: https://red.libssh.org/issues/127
The original "fix" for 127 was expanding the wrong variable: Host instead
of HostName.
Signed-off-by: Alex Hermann <alex@hexla.nl>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2017-04-13 15:55:12 +02:00
Yanis Kurganov
38cb19268a
session: Add SSH1 support in ssh_send_debug()
...
Signed-off-by: Yanis Kurganov <ykurganov@ptsecurity.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
2017-04-11 17:40:38 +02:00
Yanis Kurganov
72fdb4867e
session: Add SSH1 support in ssh_send_ignore()
...
Signed-off-by: Yanis Kurganov <ykurganov@ptsecurity.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
2017-04-11 17:40:30 +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
Max Bachmann
3ec8babfaf
messages: Utilize the message queue for SSH_REQUEST_GLOBAL.
...
Signed-off-by: Max Bachmann <mabahltm@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2017-04-11 09:55:22 +02:00
Andreas Schneider
462c7726c3
cmake: Fix GCRYPT_ROOT_DIR and check correct paths
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2017-04-11 09:42:53 +02:00
Andreas Schneider
e0fa48d2ed
Update SubmittingPatches
2017-02-27 11:49:10 +01:00
Andreas Schneider
73e8277072
libcrypto-compat: Check if EVP_CIPHER_CTX_new is needed
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2017-02-23 16:59:28 +01:00
Andreas Schneider
c7e9dc2ee3
cmake: Check for EVP_CIPHER_CTX_new
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2017-02-23 16:54:26 +01:00
Andreas Schneider
166b9f7709
buffer: Use calloc to allocate a zero'ed buffer
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2017-02-06 09:42:49 +01:00
Andreas Schneider
de369b46b1
pki: Use byte mode for fopen()
...
BUG: https://red.libssh.org/issues/251
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2017-02-03 13:18:16 +01:00
Justus Winter
043560d7dd
pki_gcrypt: Fix freeing of ECDSA signatures.
...
* src/pki.c (ssh_signature_free): Fix test for ECC using gcrypt.
Signed-off-by: Justus Winter <justus@g10code.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-09 18:20:40 +01:00
Justus Winter
4b33c6bb97
pki_gcrypt: Fix memory leak.
...
* src/pki_gcrypt.c (pki_key_ecdsa_to_nid): Release 'sexp'.
Signed-off-by: Justus Winter <justus@g10code.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-09 18:20:19 +01:00
Andreas Schneider
2f6a866373
cmake: Only build libcrypto and libcrypto-compat when needed
...
This also fixes the gcrypt build.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-08 10:31:20 +01:00
Andreas Schneider
f8ef200e76
tests: Fix session management of torture_knownhosts
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-08 08:16:20 +01:00
Andreas Schneider
3daf1760a1
cmake: Use configure check for CRYPTO_ctr128_encrypt
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-07 11:46:47 +01:00
Andreas Schneider
2dff359a33
threads: Use new API call for OpenSSL CRYPTO THREADID
...
BUG: https://red.libssh.org/issues/222
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-07 11:46:47 +01:00
Jakub Jelen
3341f49a49
pki_crypto: Use getters and setters for opaque keys and signatures
...
This is for OpenSSL 1.1.0 support.
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-07 11:46:47 +01:00
Jakub Jelen
5d2e9ee66e
libcrypto: Use a pointer for EVP_CIPHER_CTX
...
This has been made opaque and it needs to be a pointer.
This is for OpenSSL 1.1.0 support.
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-07 11:46:47 +01:00
Jakub Jelen
607c671f67
libcrypto: Use a pointer for EVP_MD_CTX
...
This is for OpenSSL 1.1.0 support.
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-07 11:46:41 +01:00
Jakub Jelen
cf1e808e2f
libcrypto: Use newer API for HMAC
...
This is for OpenSSL 1.1.0 support.
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-07 11:45:07 +01:00
Jakub Jelen
b6cfde8987
libcrypto: Introduce a libcrypto compat file
...
This is for OpenSSL 1.1.0 support.
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-07 11:42:06 +01:00
Jakub Jelen
d73f665edd
libcrypto: Remove AES_ctr128_encrypt()
...
This is for OpenSSL 1.1.0.
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-07 11:42:06 +01:00
Andreas Schneider
52efbc3a23
misc: Use simpler macros for htonll and ntohll
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-07 09:39:19 +01:00
Andreas Schneider
639dc3b5fd
tests: Fix typo in torture_crypto
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-07 07:50:24 +01:00
Andreas Schneider
cff7882391
log: Add missing config.h include
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-06 12:39:45 +01:00
Andreas Schneider
5d1a8cd88b
cmake: Check for io.h on Windows
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-06 11:57:52 +01:00
Andreas Schneider
528b9c5323
cmake: Correctly check for sys/[u]time.h
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-06 11:52:12 +01:00
Andreas Schneider
fab85b495e
cmake: Always check for strtoull
...
This fixes building with different compilers on Windows
BUG: https://red.libssh.org/issues/225
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-06 11:41:48 +01:00
Andreas Schneider
293ab4bd40
doc: Improve documentation for ssh_set_auth_methods()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-06 11:29:02 +01:00
Andreas Schneider
a45db022e9
bcrypt: Fix type of shalen
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-06 11:18:55 +01:00
Andreas Schneider
02be4802d5
pki_ed25519: Do paranoia checks before we allocate memory
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-06 11:15:23 +01:00
Andreas Schneider
5437deed1b
callbacks: Add support for MSVC
...
__typeof__ is GCC specific
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-05 20:00:02 +01:00
Andreas Schneider
422271bd40
connector: Fix build with Visual Studio
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-05 18:03:34 +01:00
Andreas Schneider
801bc29494
options: Fix log level documentation
...
BUG: https://red.libssh.org/issues/210
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-05 17:15:31 +01:00
Stef Walter
857ce2376e
known_hosts: Add ssh_dump_knownhost() function
...
This works similarly to ssh_write_knownhost(), but allows the caller
to get a line with the known_hosts line.
BUG: https://red.libssh.org/issues/207
Signed-off-by: Stef Walter <stefw@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-05 17:12:07 +01:00
Andreas Schneider
1bf6c965e4
cmake: Correctly check for *snprintf functions on Windows
...
BUG: https://red.libssh.org/issues/205
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-05 16:39:37 +01:00
Andreas Schneider
fa2332354b
examples: Reformat usage() function
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-05 15:53:20 +01:00
Andreas Schneider
e9aebb1198
tests: Fix memory leak in torture_auth_cert
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-05 11:13:43 +01:00
Andreas Schneider
fbe8ccdf3b
tests: Fix memory leak in torture_callbacks
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-04 08:33:33 +01:00
Andreas Schneider
34241cbb2b
tests: Reset output buffer in torture_crypto
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-04 08:31:43 +01:00
Andreas Schneider
e9ba2da9e9
tests: Some cleanup for torture_pki
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-04 08:21:39 +01:00
Andreas Schneider
5b84772343
tests: Fix memory leak in torture_auth_cert
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-04 08:15:38 +01:00
Andreas Schneider
d8474207b6
tests: Fix memory leaks in torture_knownhosts
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-04 08:11:50 +01:00
Andreas Schneider
b78f2ed75d
tests: Fix build warning with pkd_hello and cmocka 1.1.0
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-04 07:58:52 +01:00