.gitignore: Ignore files like src/libssh2_config.h.in~
openssl: initialise the digest context before calling EVP_DigestInit()

When using the OpenSSL libraries in FIPS mode, the function call
EVP_DigestInit() is actually #defined to FIPS_digestinit().
Unfortunately wheres EVP_DigestInit() initialises the context and then
calls EVP_DigestInit_ex(), this function assumes that the context has
been pre-initialised and crashes when it isn't.

Bug: https://trac.libssh2.org/ticket/279

Fixes #279
Fix missing `_libssh2_error` in `_libssh2_channel_write`.

In one case, the error code from `_libssh2_transport_read` was being returned from `_libssh2_channel_write` without setting it as the last error by calling `_libssh2_error`.  This commit fixes that.

Found when using a session whose socket had been inadvertently destroyed.  The calling code got confused because via `libssh2_session_last_error` it appeared no error had occurred, despite one being returned from the previous function.
Fixed two potential use-after-frees of the payload buffer

The first might occur if _libssh2_packet_add returns an error, as
fullpacket_state wasn't reset to idle so if it were possible for
fullpacket to be called again, it would return to the same state
handler and re-use the freed p->packet buffer.

The second could occur if decrypt returned an error, as it freed the
packet buffer but did not clear total_num, meaning that freed buffer
could be written into again later.
Fixed a few memory leaks in error paths
userauth: Fixed an attempt to free from stack on error
Fixed a few typos
agent_list_identities: Fixed memory leak on OOM
knownhosts: Abort if the hosts buffer is too small

This could otherwise cause a match on the wrong host
knownhost: Fix DSS keys being detected as unknown.

I missing `else` meant ssh-dss format keys were being re-detected as unknown format.
knownhost: Restore behaviour of `libssh2_knownhost_writeline` with short buffer.

Commit 85c6627c changed the behaviour of `libssh2_knownhost_writeline` so that it stopped returning the number of bytes needed when the given buffer was too small.  Also, the function changed such that is might write to part of the buffer before realising it is too small.

This commit restores the original behaviour, whilst keeping the unknown-key-type functionality that 85c6627c.  Instead of writing to the buffer piecemeal, the length of the various parts is calculated up front and the buffer written only if there is enough space.  The calculated necessary size is output in `outlen` regardless of whether the buffer was written to.

The main use-case for the original behaviour that this commit restores is to allow passing in a NULL buffer to get the actual buffer size needed, before calling the function again with the buffer allocated to the exact size required.
sftp_close_handle: ensure the handle is always closed

Errors are reported on return, but otherwise the close path is
completed as much as possible and the handle is freed on exit.
channel_close: Close the channel even in the case of errors