tests: Add test case for bug #147

Signed-off-by: Alan Dunn <amdunn@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 577840d7f72a3c69c09f2cb477b2c46eb2831f81)
tests: Check the the ecdsa_nid is the same.

(cherry picked from commit fbf73ede1eb4226ebe54698fefffb38ecd8f090b)
options: Allow use of host ECDSA key

Signed-off-by: Alan Dunn <amdunn@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 2a1089d6079c14da8d24c996402e24a689a9f5d3)
doc: Add ECDSA keys to docs, make key docs consistent

Signed-off-by: Alan Dunn <amdunn@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit f6276fe73940dd35bbd4f95d3cf902bcf69f23f3)
update gitignore file

The libssh library by default does not allow in-source build (with cmake
MacroEnsureOutOfSourceBuild macro). The INSTALL file (implicitly) suggests
creating a build directory. So lets add build to list of git ignore files to
avoid complaints from git.

Signed-off-by: Luka Perkov <luka.perkov@sartura.hr>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 48354f56ec86bcd23b0947e2eb4ce85b9cdebd0f)
pki_crypto: Replace deprecated RSA_generate_key() with RSA_generate_key_ex()

On Mar 16, 09:41, Aris Adamantiadis wrote:
> Hi Petar,
> I agree with the principle, but I don't think this code can work...
> RSA_generate_key takes an RSA* as parameter and in our code we probably
> have key->rsa==NULL. (if we don't then the old code had a memory leak).
>
> Does the test case work ?
>
> Aris
>

Yes, you are right. This works, tested with tests/unittests/torture_pki

Signed-off-by: Petar Koretic <petar.koretic@sartura.hr>
(cherry picked from commit 0b8d24f800bae5f4f86c0eaca41c609f40d7baef)
tests: torture_connect: fix coding style

Signed-off-by: Luka Perkov <luka.perkov@sartura.hr>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 0c5d4954a78714c35e18fef9ef1010b3f53ee094)
tests: torture_connect: add test for user provided socket

Signed-off-by: Luka Perkov <luka.perkov@sartura.hr>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 9423a3a065c947ed5ff89da615fbd6ad7f61f60a)
client: fix corner case when sockets are manually created

If the sockets are created manually and passed to libssh the internal session
state is set to SSH_SESSION_STATE_SOCKET_CONNECTED. Result of this fix can be
verified by running torture_connect test (torture_connect_socket) with -vvvv
flags.

Signed-off-by: Luka Perkov <luka.perkov@sartura.hr>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit dbb2de272b57c7327204adb7b7bdef5c98bfbfd6)
messages: use predefined macro for clearing sensitive data

Signed-off-by: Luka Perkov <luka.perkov@sartura.hr>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit a2fe341da558d27c348d55b1fbf9824f42ff2432)
session: fix comment typo

Signed-off-by: Luka Perkov <luka.perkov@sartura.hr>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 8ba94022824dadfec2b6650324a06106abaeac13)
pki_crypto: guard against NULL pubkey->rsa in signature extraction

Signed-off-by: Jon Simons <jon@jonsimons.org>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 10bc5ac203a428699508293f91faa460358ca6dc)
kex: enable more ECDSA hostkey algos

Signed-off-by: Jon Simons <jon@jonsimons.org>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 40d81bb7cafe528639cb201e893ba62db1e813bf)
channel: check for closed state in waitwindow loops

Signed-off-by: Jon Simons <jon@jonsimons.org>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit dee8e5688b4395ee379fd7f36f4a488d57fd0d6c)
libssh: libhpp: fix multiple definitions for acceptForward function

Defining a non inlined class function in a header will cause multiple
definitions when header is included in more that one file since for each
file function will get defined.

Signed-off-by: Petar Koretic <petar.koretic@sartura.hr>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 00d4fbe75336b66262fdca86430655094adb8322)

Conflicts:
	include/libssh/libsshpp.hpp
libssh: libhpp: avoid unnecessary call to ssh_channel_read

ssh_channel_read is a wrapper for ssh_channel_read_timeout with timeout
-1 (infinite) so we call that directly.

Signed-off-by: Petar Koretic <petar.koretic@sartura.hr>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit c51f42a566879f61c2349066bc4e8dd35bc5c311)
libssh: libhpp: overload read function to support timeout parameter

Signed-off-by: Petar Koretic <petar.koretic@sartura.hr>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 8e2590b5353f800a2dd11045a1e7ff4848fc8c25)
doc: Improve and consolidate ssh_bind_options_set docs

Signed-off-by: Alan Dunn <amdunn@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 47bd0b6d1f3176a4539c22741848d37b9357175b)
doc: Fix ssh_userauth_none() function signature.

Thanks to David Tibbe!

BUG: https://red.libssh.org/issues/151
(cherry picked from commit 04543c9dbc2e7fb3d43985cd913a0b1225be43d5)
packet: elide two buffer_prepend calls into one

In packet_send2, rather than issue two separate buffer_prepend_data calls
(each of which may entail realloc + memmove + memcpy), elide the prepend
work into a single buffer_prepend_data: the header information is computed
locally, and a single 5 byte prepend operation is now done instead of
prepending 1, then 4 bytes.

Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit aa05248ca81e3bd9e949ad724d45518707446e2c)

Conflicts:
	src/packet.c