channels: Fix checking for fatal errors.

We need this that we don't end up in and infinite poll loop.
session: Fix timeout handling.

-2 now means to use the timeout specified in options. It wasn't used
earlier and poll only knows -1 and 0 anyway for special meanings.
channels: Fix an endless loop in case of a channel_open error.
client: Fix another source of endless wait.
Fixed ssh_scp_write so it works when doing recursive copy

There where two issues with ssh_scp_write:
1) It did not write a status message after the last write and OpenSSH
   would then give up after the write finished.
2) OpenSSH would sometimes write a status message, after near ends write.
   If scp_write didn't handle it, and subsequent status message. The remote
   window would shrink to zero and ssh_channel_write would start returning 0.

Signed-off-by: Einar Floystad Dorum <einarfd@mailthief.com>
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
pki: Move keyfiles to pki_gcrypt.c.
pki: Add pki_crypto.c.
pki: Add placeholder for ecdsa and certs.
pki: Add pki_privatekey_type_from_string().
pki: Improve ssh_pki_import_privkey_base64().
pki: Improve ssh_key_import_private().
pki: Create pki_publickey_from_privatekey().
pki: Move _privatekey_from_file to legacy.c.
pki: Add ssh_pki_convert_key_to_privatekey().
bind: Use ssh_key_import_private().
pki: Add pki_do_sign().
pki: Add ssh_pki_import_pubkey_base64().
pki: Use a consistent name scheme.

Rename ssh_key_import_private to ssh_pki_import_privkey_file.
Fix "status -5 inflating zlib packet"

Signed-off-by: Mark Riordan <mriordan@ipswitch.com>
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
channels: Handle SSH_AGAIN in channel_open().