|
@@ -1,17 +1,19 @@
|
|
|
-#ifndef WINSCP_VS
|
|
|
#include <stdio.h>
|
|
|
#include <string.h>
|
|
|
|
|
|
#include "puttymem.h"
|
|
|
#include "tree234.h"
|
|
|
+#ifndef WINSCP_VS
|
|
|
#include "network.h"
|
|
|
+#endif
|
|
|
#include "int64.h"
|
|
|
#include "misc.h"
|
|
|
|
|
|
+#ifndef WINSCP_VS
|
|
|
struct ssh_channel;
|
|
|
typedef struct ssh_tag *Ssh;
|
|
|
|
|
|
-extern int sshfwd_write(struct ssh_channel *c, char *, int);
|
|
|
+extern int sshfwd_write(struct ssh_channel *c, const void *, int);
|
|
|
extern void sshfwd_write_eof(struct ssh_channel *c);
|
|
|
extern void sshfwd_unclean_close(struct ssh_channel *c, const char *err);
|
|
|
extern void sshfwd_unthrottle(struct ssh_channel *c, int bufsize);
|
|
@@ -23,11 +25,139 @@ void sshfwd_x11_sharing_handover(struct ssh_channel *c,
|
|
|
const void *initial_data, int initial_len);
|
|
|
void sshfwd_x11_is_local(struct ssh_channel *c);
|
|
|
|
|
|
-extern Socket ssh_connection_sharing_init(const char *host, int port,
|
|
|
- Conf *conf, Ssh ssh, void **state);
|
|
|
+/*
|
|
|
+ * Buffer management constants. There are several of these for
|
|
|
+ * various different purposes:
|
|
|
+ *
|
|
|
+ * - SSH1_BUFFER_LIMIT is the amount of backlog that must build up
|
|
|
+ * on a local data stream before we throttle the whole SSH
|
|
|
+ * connection (in SSH-1 only). Throttling the whole connection is
|
|
|
+ * pretty drastic so we set this high in the hope it won't
|
|
|
+ * happen very often.
|
|
|
+ *
|
|
|
+ * - SSH_MAX_BACKLOG is the amount of backlog that must build up
|
|
|
+ * on the SSH connection itself before we defensively throttle
|
|
|
+ * _all_ local data streams. This is pretty drastic too (though
|
|
|
+ * thankfully unlikely in SSH-2 since the window mechanism should
|
|
|
+ * ensure that the server never has any need to throttle its end
|
|
|
+ * of the connection), so we set this high as well.
|
|
|
+ *
|
|
|
+ * - OUR_V2_WINSIZE is the default window size we present on SSH-2
|
|
|
+ * channels.
|
|
|
+ *
|
|
|
+ * - OUR_V2_BIGWIN is the window size we advertise for the only
|
|
|
+ * channel in a simple connection. It must be <= INT_MAX.
|
|
|
+ *
|
|
|
+ * - OUR_V2_MAXPKT is the official "maximum packet size" we send
|
|
|
+ * to the remote side. This actually has nothing to do with the
|
|
|
+ * size of the _packet_, but is instead a limit on the amount
|
|
|
+ * of data we're willing to receive in a single SSH2 channel
|
|
|
+ * data message.
|
|
|
+ *
|
|
|
+ * - OUR_V2_PACKETLIMIT is actually the maximum size of SSH
|
|
|
+ * _packet_ we're prepared to cope with. It must be a multiple
|
|
|
+ * of the cipher block size, and must be at least 35000.
|
|
|
+ */
|
|
|
+
|
|
|
+#define SSH1_BUFFER_LIMIT 32768
|
|
|
+#define SSH_MAX_BACKLOG 32768
|
|
|
+#define OUR_V2_WINSIZE 16384
|
|
|
+#define OUR_V2_BIGWIN 0x7fffffff
|
|
|
+#define OUR_V2_MAXPKT 0x4000UL
|
|
|
+#define OUR_V2_PACKETLIMIT 0x9000UL
|
|
|
+
|
|
|
+typedef struct PacketQueueNode PacketQueueNode;
|
|
|
+struct PacketQueueNode {
|
|
|
+ PacketQueueNode *next, *prev;
|
|
|
+};
|
|
|
+
|
|
|
+typedef struct PktIn {
|
|
|
+ int refcount;
|
|
|
+ int type;
|
|
|
+ unsigned long sequence; /* SSH-2 incoming sequence number */
|
|
|
+ long encrypted_len; /* for SSH-2 total-size counting */
|
|
|
+ PacketQueueNode qnode; /* for linking this packet on to a queue */
|
|
|
+ BinarySource_IMPLEMENTATION;
|
|
|
+} PktIn;
|
|
|
+
|
|
|
+#endif
|
|
|
+typedef struct PktOut {
|
|
|
+ long prefix; /* bytes up to and including type field */
|
|
|
+ long length; /* total bytes, including prefix */
|
|
|
+ int type;
|
|
|
+ long minlen; /* SSH-2: ensure wire length is at least this */
|
|
|
+ unsigned char *data; /* allocated storage */
|
|
|
+ long maxlen; /* amount of storage allocated for `data' */
|
|
|
+ long encrypted_len; /* for SSH-2 total-size counting */
|
|
|
+
|
|
|
+ /* Extra metadata used in SSH packet logging mode, allowing us to
|
|
|
+ * log in the packet header line that the packet came from a
|
|
|
+ * connection-sharing downstream and what if anything unusual was
|
|
|
+ * done to it. The additional_log_text field is expected to be a
|
|
|
+ * static string - it will not be freed. */
|
|
|
+ unsigned downstream_id;
|
|
|
+ const char *additional_log_text;
|
|
|
+
|
|
|
+ BinarySink_IMPLEMENTATION;
|
|
|
+} PktOut;
|
|
|
+#ifndef WINSCP_VS
|
|
|
+
|
|
|
+typedef struct PacketQueue {
|
|
|
+ PacketQueueNode end;
|
|
|
+} PacketQueue;
|
|
|
+
|
|
|
+void pq_init(struct PacketQueue *pq);
|
|
|
+void pq_push(struct PacketQueue *pq, PktIn *pkt);
|
|
|
+void pq_push_front(struct PacketQueue *pq, PktIn *pkt);
|
|
|
+PktIn *pq_peek(struct PacketQueue *pq);
|
|
|
+PktIn *pq_pop(struct PacketQueue *pq);
|
|
|
+void pq_clear(struct PacketQueue *pq);
|
|
|
+int pq_empty_on_to_front_of(struct PacketQueue *src, struct PacketQueue *dest);
|
|
|
+
|
|
|
+/*
|
|
|
+ * Packet type contexts, so that ssh2_pkt_type can correctly decode
|
|
|
+ * the ambiguous type numbers back into the correct type strings.
|
|
|
+ */
|
|
|
+typedef enum {
|
|
|
+ SSH2_PKTCTX_NOKEX,
|
|
|
+ SSH2_PKTCTX_DHGROUP,
|
|
|
+ SSH2_PKTCTX_DHGEX,
|
|
|
+ SSH2_PKTCTX_ECDHKEX,
|
|
|
+ SSH2_PKTCTX_GSSKEX,
|
|
|
+ SSH2_PKTCTX_RSAKEX
|
|
|
+} Pkt_KCtx;
|
|
|
+typedef enum {
|
|
|
+ SSH2_PKTCTX_NOAUTH,
|
|
|
+ SSH2_PKTCTX_PUBLICKEY,
|
|
|
+ SSH2_PKTCTX_PASSWORD,
|
|
|
+ SSH2_PKTCTX_GSSAPI,
|
|
|
+ SSH2_PKTCTX_KBDINTER
|
|
|
+} Pkt_ACtx;
|
|
|
+
|
|
|
+typedef struct PacketLogSettings {
|
|
|
+ int omit_passwords, omit_data;
|
|
|
+ Pkt_KCtx kctx;
|
|
|
+ Pkt_ACtx actx;
|
|
|
+} PacketLogSettings;
|
|
|
+
|
|
|
+#define MAX_BLANKS 4 /* no packet needs more censored sections than this */
|
|
|
+int ssh1_censor_packet(
|
|
|
+ const PacketLogSettings *pls, int type, int sender_is_client,
|
|
|
+ ptrlen pkt, logblank_t *blanks);
|
|
|
+int ssh2_censor_packet(
|
|
|
+ const PacketLogSettings *pls, int type, int sender_is_client,
|
|
|
+ ptrlen pkt, logblank_t *blanks);
|
|
|
+
|
|
|
+PktOut *ssh_new_packet(void);
|
|
|
+void ssh_unref_packet(PktIn *pkt);
|
|
|
+void ssh_free_pktout(PktOut *pkt);
|
|
|
+
|
|
|
+extern Socket ssh_connection_sharing_init(
|
|
|
+ const char *host, int port, Conf *conf, Ssh ssh, Plug sshplug,
|
|
|
+ void **state);
|
|
|
int ssh_share_test_for_upstream(const char *host, int port, Conf *conf);
|
|
|
void share_got_pkt_from_server(void *ctx, int type,
|
|
|
- unsigned char *pkt, int pktlen);
|
|
|
+ const void *pkt, int pktlen);
|
|
|
void share_activate(void *state, const char *server_verstring);
|
|
|
void sharestate_free(void *state);
|
|
|
int share_ndownstreams(void *state);
|
|
@@ -38,6 +168,8 @@ unsigned ssh_alloc_sharing_channel(Ssh ssh, void *sharing_ctx);
|
|
|
void ssh_delete_sharing_channel(Ssh ssh, unsigned localid);
|
|
|
int ssh_alloc_sharing_rportfwd(Ssh ssh, const char *shost, int sport,
|
|
|
void *share_ctx);
|
|
|
+void ssh_remove_sharing_rportfwd(Ssh ssh, const char *shost, int sport,
|
|
|
+ void *share_ctx);
|
|
|
void ssh_sharing_queue_global_request(Ssh ssh, void *share_ctx);
|
|
|
struct X11FakeAuth *ssh_sharing_add_x11_display(Ssh ssh, int authtype,
|
|
|
void *share_cs,
|
|
@@ -71,35 +203,29 @@ void share_setup_x11_channel(void *csv, void *chanv,
|
|
|
#define SSH_CIPHER_3DES 3
|
|
|
#define SSH_CIPHER_BLOWFISH 6
|
|
|
|
|
|
-#ifdef MSCRYPTOAPI
|
|
|
-#define APIEXTRA 8
|
|
|
-#else
|
|
|
-#define APIEXTRA 0
|
|
|
-#endif
|
|
|
-
|
|
|
#ifndef BIGNUM_INTERNAL
|
|
|
typedef void *Bignum;
|
|
|
#endif
|
|
|
|
|
|
+typedef struct ssh_keyalg ssh_keyalg;
|
|
|
+typedef const struct ssh_keyalg *ssh_key;
|
|
|
+
|
|
|
struct RSAKey {
|
|
|
int bits;
|
|
|
int bytes;
|
|
|
-#ifdef MSCRYPTOAPI
|
|
|
- unsigned long exponent;
|
|
|
- unsigned char *modulus;
|
|
|
-#else
|
|
|
Bignum modulus;
|
|
|
Bignum exponent;
|
|
|
Bignum private_exponent;
|
|
|
Bignum p;
|
|
|
Bignum q;
|
|
|
Bignum iqmp;
|
|
|
-#endif
|
|
|
char *comment;
|
|
|
+ ssh_key sshk;
|
|
|
};
|
|
|
|
|
|
struct dss_key {
|
|
|
Bignum p, q, g, y, x;
|
|
|
+ ssh_key sshk;
|
|
|
};
|
|
|
|
|
|
struct ec_curve;
|
|
@@ -153,48 +279,52 @@ struct ec_curve {
|
|
|
};
|
|
|
};
|
|
|
|
|
|
-const struct ssh_signkey *ec_alg_by_oid(int len, const void *oid,
|
|
|
+const ssh_keyalg *ec_alg_by_oid(int len, const void *oid,
|
|
|
const struct ec_curve **curve);
|
|
|
-const unsigned char *ec_alg_oid(const struct ssh_signkey *alg, int *oidlen);
|
|
|
+const unsigned char *ec_alg_oid(const ssh_keyalg *alg, int *oidlen);
|
|
|
extern const int ec_nist_curve_lengths[], n_ec_nist_curve_lengths;
|
|
|
int ec_nist_alg_and_curve_by_bits(int bits,
|
|
|
const struct ec_curve **curve,
|
|
|
- const struct ssh_signkey **alg);
|
|
|
+ const ssh_keyalg **alg);
|
|
|
int ec_ed_alg_and_curve_by_bits(int bits,
|
|
|
const struct ec_curve **curve,
|
|
|
- const struct ssh_signkey **alg);
|
|
|
-
|
|
|
-struct ssh_signkey;
|
|
|
+ const ssh_keyalg **alg);
|
|
|
|
|
|
struct ec_key {
|
|
|
- const struct ssh_signkey *signalg;
|
|
|
struct ec_point publicKey;
|
|
|
Bignum privateKey;
|
|
|
+ ssh_key sshk;
|
|
|
};
|
|
|
|
|
|
struct ec_point *ec_public(const Bignum privateKey, const struct ec_curve *curve);
|
|
|
|
|
|
-int makekey(const unsigned char *data, int len, struct RSAKey *result,
|
|
|
- const unsigned char **keystr, int order);
|
|
|
-int makeprivate(const unsigned char *data, int len, struct RSAKey *result);
|
|
|
-int rsaencrypt(unsigned char *data, int length, struct RSAKey *key);
|
|
|
-Bignum rsadecrypt(Bignum input, struct RSAKey *key);
|
|
|
-void rsasign(unsigned char *data, int length, struct RSAKey *key);
|
|
|
+/*
|
|
|
+ * SSH-1 never quite decided which order to store the two components
|
|
|
+ * of an RSA key. During connection setup, the server sends its host
|
|
|
+ * and server keys with the exponent first; private key files store
|
|
|
+ * the modulus first. The agent protocol is even more confusing,
|
|
|
+ * because the client specifies a key to the server in one order and
|
|
|
+ * the server lists the keys it knows about in the other order!
|
|
|
+ */
|
|
|
+typedef enum { RSA_SSH1_EXPONENT_FIRST, RSA_SSH1_MODULUS_FIRST } RsaSsh1Order;
|
|
|
+
|
|
|
+void BinarySource_get_rsa_ssh1_pub(
|
|
|
+ BinarySource *src, struct RSAKey *result, RsaSsh1Order order);
|
|
|
+void BinarySource_get_rsa_ssh1_priv(
|
|
|
+ BinarySource *src, struct RSAKey *rsa);
|
|
|
+int rsa_ssh1_encrypt(unsigned char *data, int length, struct RSAKey *key);
|
|
|
+Bignum rsa_ssh1_decrypt(Bignum input, struct RSAKey *key);
|
|
|
void rsasanitise(struct RSAKey *key);
|
|
|
int rsastr_len(struct RSAKey *key);
|
|
|
void rsastr_fmt(char *str, struct RSAKey *key);
|
|
|
-void rsa_fingerprint(char *str, int len, struct RSAKey *key);
|
|
|
+char *rsa_ssh1_fingerprint(struct RSAKey *key);
|
|
|
int rsa_verify(struct RSAKey *key);
|
|
|
-unsigned char *rsa_public_blob(struct RSAKey *key, int *len);
|
|
|
-int rsa_public_blob_len(void *data, int maxlen);
|
|
|
+void rsa_ssh1_public_blob(BinarySink *bs, struct RSAKey *key,
|
|
|
+ RsaSsh1Order order);
|
|
|
+int rsa_ssh1_public_blob_len(void *data, int maxlen);
|
|
|
void freersakey(struct RSAKey *key);
|
|
|
#endif // WINSCP_VS
|
|
|
|
|
|
-#ifndef PUTTY_UINT32_DEFINED
|
|
|
-/* This makes assumptions about the int type. */
|
|
|
-typedef unsigned int uint32;
|
|
|
-#define PUTTY_UINT32_DEFINED
|
|
|
-#endif
|
|
|
typedef uint32 word32;
|
|
|
|
|
|
#ifndef WINSCP_VS
|
|
@@ -211,25 +341,22 @@ int detect_attack(void *handle, unsigned char *buf, uint32 len,
|
|
|
* SSH2 RSA key exchange functions
|
|
|
*/
|
|
|
struct ssh_hash;
|
|
|
-struct ssh_rsa_kex_extra {
|
|
|
- int minklen;
|
|
|
-};
|
|
|
-void *ssh_rsakex_newkey(char *data, int len);
|
|
|
-void ssh_rsakex_freekey(void *key);
|
|
|
-int ssh_rsakex_klen(void *key);
|
|
|
+struct RSAKey *ssh_rsakex_newkey(const void *data, int len);
|
|
|
+void ssh_rsakex_freekey(struct RSAKey *key);
|
|
|
+int ssh_rsakex_klen(struct RSAKey *key);
|
|
|
void ssh_rsakex_encrypt(const struct ssh_hash *h, unsigned char *in, int inlen,
|
|
|
- unsigned char *out, int outlen,
|
|
|
- void *key);
|
|
|
+ unsigned char *out, int outlen, struct RSAKey *key);
|
|
|
|
|
|
/*
|
|
|
* SSH2 ECDH key exchange functions
|
|
|
*/
|
|
|
struct ssh_kex;
|
|
|
const char *ssh_ecdhkex_curve_textname(const struct ssh_kex *kex);
|
|
|
-void *ssh_ecdhkex_newkey(const struct ssh_kex *kex);
|
|
|
-void ssh_ecdhkex_freekey(void *key);
|
|
|
-char *ssh_ecdhkex_getpublic(void *key, int *len);
|
|
|
-Bignum ssh_ecdhkex_getkey(void *key, char *remoteKey, int remoteKeyLen);
|
|
|
+struct ec_key *ssh_ecdhkex_newkey(const struct ssh_kex *kex);
|
|
|
+void ssh_ecdhkex_freekey(struct ec_key *key);
|
|
|
+void ssh_ecdhkex_getpublic(struct ec_key *key, BinarySink *bs);
|
|
|
+Bignum ssh_ecdhkex_getkey(struct ec_key *key,
|
|
|
+ const void *remoteKey, int remoteKeyLen);
|
|
|
|
|
|
/*
|
|
|
* Helper function for k generation in DSA, reused in ECDSA
|
|
@@ -242,19 +369,14 @@ typedef struct {
|
|
|
} MD5_Core_State;
|
|
|
|
|
|
struct MD5Context {
|
|
|
-#ifdef MSCRYPTOAPI
|
|
|
- unsigned long hHash;
|
|
|
-#else
|
|
|
MD5_Core_State core;
|
|
|
unsigned char block[64];
|
|
|
int blkused;
|
|
|
uint32 lenhi, lenlo;
|
|
|
-#endif
|
|
|
+ BinarySink_IMPLEMENTATION;
|
|
|
};
|
|
|
|
|
|
void MD5Init(struct MD5Context *context);
|
|
|
-void MD5Update(struct MD5Context *context, unsigned char const *buf,
|
|
|
- unsigned len);
|
|
|
void MD5Final(unsigned char digest[16], struct MD5Context *context);
|
|
|
void MD5Simple(void const *p, unsigned len, unsigned char output[16]);
|
|
|
|
|
@@ -264,6 +386,8 @@ void hmacmd5_key(void *handle, void const *key, int len);
|
|
|
void hmacmd5_do_hmac(void *handle, unsigned char const *blk, int len,
|
|
|
unsigned char *hmac);
|
|
|
|
|
|
+int supports_sha_ni(void);
|
|
|
+
|
|
|
#ifdef MPEXT
|
|
|
// Resolve ambiguity with OpenSSL
|
|
|
#define SHA_Init putty_SHA_Init
|
|
@@ -274,29 +398,31 @@ void hmacmd5_do_hmac(void *handle, unsigned char const *blk, int len,
|
|
|
#define SHA512_Final putty_SHA512_Final
|
|
|
#endif
|
|
|
|
|
|
-typedef struct {
|
|
|
+typedef struct SHA_State {
|
|
|
uint32 h[5];
|
|
|
unsigned char block[64];
|
|
|
int blkused;
|
|
|
uint32 lenhi, lenlo;
|
|
|
+ void (*sha1)(struct SHA_State * s, const unsigned char *p, int len);
|
|
|
+ BinarySink_IMPLEMENTATION;
|
|
|
} SHA_State;
|
|
|
void SHA_Init(SHA_State * s);
|
|
|
-void SHA_Bytes(SHA_State * s, const void *p, int len);
|
|
|
void SHA_Final(SHA_State * s, unsigned char *output);
|
|
|
void SHA_Simple(const void *p, int len, unsigned char *output);
|
|
|
|
|
|
void hmac_sha1_simple(void *key, int keylen, void *data, int datalen,
|
|
|
unsigned char *output);
|
|
|
#endif // WINSCP_VS
|
|
|
-typedef struct {
|
|
|
+typedef struct SHA256_State {
|
|
|
uint32 h[8];
|
|
|
unsigned char block[64];
|
|
|
int blkused;
|
|
|
uint32 lenhi, lenlo;
|
|
|
+ void (*sha256)(struct SHA256_State * s, const unsigned char *p, int len);
|
|
|
+ BinarySink_IMPLEMENTATION;
|
|
|
} SHA256_State;
|
|
|
#ifndef WINSCP_VS
|
|
|
void SHA256_Init(SHA256_State * s);
|
|
|
-void SHA256_Bytes(SHA256_State * s, const void *p, int len);
|
|
|
void SHA256_Final(SHA256_State * s, unsigned char *output);
|
|
|
void SHA256_Simple(const void *p, int len, unsigned char *output);
|
|
|
|
|
@@ -305,14 +431,13 @@ typedef struct {
|
|
|
unsigned char block[128];
|
|
|
int blkused;
|
|
|
uint32 len[4];
|
|
|
+ BinarySink_IMPLEMENTATION;
|
|
|
} SHA512_State;
|
|
|
#define SHA384_State SHA512_State
|
|
|
void SHA512_Init(SHA512_State * s);
|
|
|
-void SHA512_Bytes(SHA512_State * s, const void *p, int len);
|
|
|
void SHA512_Final(SHA512_State * s, unsigned char *output);
|
|
|
void SHA512_Simple(const void *p, int len, unsigned char *output);
|
|
|
void SHA384_Init(SHA384_State * s);
|
|
|
-#define SHA384_Bytes(s, p, len) SHA512_Bytes(s, p, len)
|
|
|
void SHA384_Final(SHA384_State * s, unsigned char *output);
|
|
|
void SHA384_Simple(const void *p, int len, unsigned char *output);
|
|
|
|
|
@@ -320,9 +445,9 @@ struct ssh_mac;
|
|
|
struct ssh_cipher {
|
|
|
void *(*make_context)(void);
|
|
|
void (*free_context)(void *);
|
|
|
- void (*sesskey) (void *, unsigned char *key); /* for SSH-1 */
|
|
|
- void (*encrypt) (void *, unsigned char *blk, int len);
|
|
|
- void (*decrypt) (void *, unsigned char *blk, int len);
|
|
|
+ void (*sesskey) (void *, const void *key); /* for SSH-1 */
|
|
|
+ void (*encrypt) (void *, void *blk, int len);
|
|
|
+ void (*decrypt) (void *, void *blk, int len);
|
|
|
int blksize;
|
|
|
const char *text_name;
|
|
|
};
|
|
@@ -330,13 +455,13 @@ struct ssh_cipher {
|
|
|
struct ssh2_cipher {
|
|
|
void *(*make_context)(void);
|
|
|
void (*free_context)(void *);
|
|
|
- void (*setiv) (void *, unsigned char *key); /* for SSH-2 */
|
|
|
- void (*setkey) (void *, unsigned char *key);/* for SSH-2 */
|
|
|
- void (*encrypt) (void *, unsigned char *blk, int len);
|
|
|
- void (*decrypt) (void *, unsigned char *blk, int len);
|
|
|
+ void (*setiv) (void *, const void *iv); /* for SSH-2 */
|
|
|
+ void (*setkey) (void *, const void *key);/* for SSH-2 */
|
|
|
+ void (*encrypt) (void *, void *blk, int len);
|
|
|
+ void (*decrypt) (void *, void *blk, int len);
|
|
|
/* Ignored unless SSH_CIPHER_SEPARATE_LENGTH flag set */
|
|
|
- void (*encrypt_length) (void *, unsigned char *blk, int len, unsigned long seq);
|
|
|
- void (*decrypt_length) (void *, unsigned char *blk, int len, unsigned long seq);
|
|
|
+ void (*encrypt_length) (void *, void *blk, int len, unsigned long seq);
|
|
|
+ void (*decrypt_length) (void *, void *blk, int len, unsigned long seq);
|
|
|
const char *name;
|
|
|
int blksize;
|
|
|
/* real_keybits is the number of bits of entropy genuinely used by
|
|
@@ -369,13 +494,13 @@ struct ssh_mac {
|
|
|
/* Passes in the cipher context */
|
|
|
void *(*make_context)(void *);
|
|
|
void (*free_context)(void *);
|
|
|
- void (*setkey) (void *, unsigned char *key);
|
|
|
+ void (*setkey) (void *, const void *key);
|
|
|
/* whole-packet operations */
|
|
|
- void (*generate) (void *, unsigned char *blk, int len, unsigned long seq);
|
|
|
- int (*verify) (void *, unsigned char *blk, int len, unsigned long seq);
|
|
|
+ void (*generate) (void *, void *blk, int len, unsigned long seq);
|
|
|
+ int (*verify) (void *, const void *blk, int len, unsigned long seq);
|
|
|
/* partial-packet operations */
|
|
|
void (*start) (void *);
|
|
|
- void (*bytes) (void *, unsigned char const *, int);
|
|
|
+ BinarySink *(*sink) (void *);
|
|
|
void (*genresult) (void *, unsigned char *);
|
|
|
int (*verresult) (void *, unsigned char const *);
|
|
|
const char *name, *etm_name;
|
|
@@ -386,7 +511,7 @@ struct ssh_mac {
|
|
|
struct ssh_hash {
|
|
|
void *(*init)(void); /* also allocates context */
|
|
|
void *(*copy)(const void *);
|
|
|
- void (*bytes)(void *, const void *, int);
|
|
|
+ BinarySink *(*sink) (void *);
|
|
|
void (*final)(void *, unsigned char *); /* also frees context */
|
|
|
void (*free)(void *);
|
|
|
int hlen; /* output length in bytes */
|
|
@@ -395,7 +520,7 @@ struct ssh_hash {
|
|
|
|
|
|
struct ssh_kex {
|
|
|
const char *name, *groupname;
|
|
|
- enum { KEXTYPE_DH, KEXTYPE_RSA, KEXTYPE_ECDH } main_type;
|
|
|
+ enum { KEXTYPE_DH, KEXTYPE_RSA, KEXTYPE_ECDH, KEXTYPE_GSS } main_type;
|
|
|
const struct ssh_hash *hash;
|
|
|
const void *extra; /* private to the kex methods */
|
|
|
};
|
|
@@ -405,39 +530,48 @@ struct ssh_kexes {
|
|
|
const struct ssh_kex *const *list;
|
|
|
};
|
|
|
|
|
|
-struct ssh_signkey {
|
|
|
- void *(*newkey) (const struct ssh_signkey *self,
|
|
|
- const char *data, int len);
|
|
|
- void (*freekey) (void *key);
|
|
|
- char *(*fmtkey) (void *key);
|
|
|
- unsigned char *(*public_blob) (void *key, int *len);
|
|
|
- unsigned char *(*private_blob) (void *key, int *len);
|
|
|
- void *(*createkey) (const struct ssh_signkey *self,
|
|
|
- const unsigned char *pub_blob, int pub_len,
|
|
|
- const unsigned char *priv_blob, int priv_len);
|
|
|
- void *(*openssh_createkey) (const struct ssh_signkey *self,
|
|
|
- const unsigned char **blob, int *len);
|
|
|
- int (*openssh_fmtkey) (void *key, unsigned char *blob, int len);
|
|
|
- /* OpenSSH private key blobs, as created by openssh_fmtkey and
|
|
|
- * consumed by openssh_createkey, always (at least so far...) take
|
|
|
- * the form of a number of SSH-2 strings / mpints concatenated
|
|
|
- * end-to-end. Because the new-style OpenSSH private key format
|
|
|
- * stores those blobs without a containing string wrapper, we need
|
|
|
- * to know how many strings each one consists of, so that we can
|
|
|
- * skip over the right number to find the next key in the file.
|
|
|
- * openssh_private_npieces gives that information. */
|
|
|
- int openssh_private_npieces;
|
|
|
- int (*pubkey_bits) (const struct ssh_signkey *self,
|
|
|
- const void *blob, int len);
|
|
|
- int (*verifysig) (void *key, const char *sig, int siglen,
|
|
|
- const char *data, int datalen);
|
|
|
- unsigned char *(*sign) (void *key, const char *data, int datalen,
|
|
|
- int *siglen);
|
|
|
- const char *name;
|
|
|
- const char *keytype; /* for host key cache */
|
|
|
- const void *extra; /* private to the public key methods */
|
|
|
+struct ssh_keyalg {
|
|
|
+ /* Constructors that create an ssh_key */
|
|
|
+ ssh_key *(*new_pub) (const ssh_keyalg *self, ptrlen pub);
|
|
|
+ ssh_key *(*new_priv) (const ssh_keyalg *self, ptrlen pub, ptrlen priv);
|
|
|
+ ssh_key *(*new_priv_openssh) (const ssh_keyalg *self, BinarySource *);
|
|
|
+
|
|
|
+ /* Methods that operate on an existing ssh_key */
|
|
|
+ void (*freekey) (ssh_key *key);
|
|
|
+ void (*sign) (ssh_key *key, const void *data, int datalen, BinarySink *);
|
|
|
+ int (*verify) (ssh_key *key, ptrlen sig, ptrlen data);
|
|
|
+ void (*public_blob)(ssh_key *key, BinarySink *);
|
|
|
+ void (*private_blob)(ssh_key *key, BinarySink *);
|
|
|
+ void (*openssh_blob) (ssh_key *key, BinarySink *);
|
|
|
+ char *(*cache_str) (ssh_key *key);
|
|
|
+
|
|
|
+ /* 'Class methods' that don't deal with an ssh_key at all */
|
|
|
+ int (*pubkey_bits) (const ssh_keyalg *self, ptrlen blob);
|
|
|
+
|
|
|
+ /* Constant data fields giving information about the key type */
|
|
|
+ const char *ssh_id; /* string identifier in the SSH protocol */
|
|
|
+ const char *cache_id; /* identifier used in PuTTY's host key cache */
|
|
|
+ const void *extra; /* private to the public key methods */
|
|
|
};
|
|
|
|
|
|
+#define ssh_key_new_pub(alg, data) ((alg)->new_pub(alg, data))
|
|
|
+#define ssh_key_new_priv(alg, pub, priv) ((alg)->new_priv(alg, pub, priv))
|
|
|
+#define ssh_key_new_priv_openssh(alg, bs) ((alg)->new_priv_openssh(alg, bs))
|
|
|
+
|
|
|
+#define ssh_key_free(key) ((*(key))->freekey(key))
|
|
|
+#define ssh_key_sign(key, data, len, bs) ((*(key))->sign(key, data, len, bs))
|
|
|
+#define ssh_key_verify(key, sig, data) ((*(key))->verify(key, sig, data))
|
|
|
+#define ssh_key_public_blob(key, bs) ((*(key))->public_blob(key, bs))
|
|
|
+#define ssh_key_private_blob(key, bs) ((*(key))->private_blob(key, bs))
|
|
|
+#define ssh_key_openssh_blob(key, bs) ((*(key))->openssh_blob(key, bs))
|
|
|
+#define ssh_key_cache_str(key) ((*(key))->cache_str(key))
|
|
|
+
|
|
|
+#define ssh_key_public_bits(alg, blob) ((alg)->pubkey_bits(alg, blob))
|
|
|
+
|
|
|
+#define ssh_key_alg(key) (*(key))
|
|
|
+#define ssh_key_ssh_id(key) ((*(key))->ssh_id)
|
|
|
+#define ssh_key_cache_id(key) ((*(key))->cache_id)
|
|
|
+
|
|
|
struct ssh_compress {
|
|
|
const char *name;
|
|
|
/* For [email protected]: if non-NULL, this name will be considered once
|
|
@@ -445,19 +579,18 @@ struct ssh_compress {
|
|
|
const char *delayed_name;
|
|
|
void *(*compress_init) (void);
|
|
|
void (*compress_cleanup) (void *);
|
|
|
- int (*compress) (void *, unsigned char *block, int len,
|
|
|
- unsigned char **outblock, int *outlen);
|
|
|
+ void (*compress) (void *, unsigned char *block, int len,
|
|
|
+ unsigned char **outblock, int *outlen,
|
|
|
+ int minlen);
|
|
|
void *(*decompress_init) (void);
|
|
|
void (*decompress_cleanup) (void *);
|
|
|
int (*decompress) (void *, unsigned char *block, int len,
|
|
|
unsigned char **outblock, int *outlen);
|
|
|
- int (*disable_compression) (void *);
|
|
|
const char *text_name;
|
|
|
};
|
|
|
|
|
|
struct ssh2_userkey {
|
|
|
- const struct ssh_signkey *alg; /* the key algorithm */
|
|
|
- void *data; /* the key data */
|
|
|
+ ssh_key *key; /* the key itself */
|
|
|
char *comment; /* the key comment */
|
|
|
};
|
|
|
|
|
@@ -480,14 +613,15 @@ extern const struct ssh_hash ssh_sha512;
|
|
|
extern const struct ssh_kexes ssh_diffiehellman_group1;
|
|
|
extern const struct ssh_kexes ssh_diffiehellman_group14;
|
|
|
extern const struct ssh_kexes ssh_diffiehellman_gex;
|
|
|
+extern const struct ssh_kexes ssh_gssk5_sha1_kex;
|
|
|
extern const struct ssh_kexes ssh_rsa_kex;
|
|
|
extern const struct ssh_kexes ssh_ecdh_kex;
|
|
|
-extern const struct ssh_signkey ssh_dss;
|
|
|
-extern const struct ssh_signkey ssh_rsa;
|
|
|
-extern const struct ssh_signkey ssh_ecdsa_ed25519;
|
|
|
-extern const struct ssh_signkey ssh_ecdsa_nistp256;
|
|
|
-extern const struct ssh_signkey ssh_ecdsa_nistp384;
|
|
|
-extern const struct ssh_signkey ssh_ecdsa_nistp521;
|
|
|
+extern const ssh_keyalg ssh_dss;
|
|
|
+extern const ssh_keyalg ssh_rsa;
|
|
|
+extern const ssh_keyalg ssh_ecdsa_ed25519;
|
|
|
+extern const ssh_keyalg ssh_ecdsa_nistp256;
|
|
|
+extern const ssh_keyalg ssh_ecdsa_nistp384;
|
|
|
+extern const ssh_keyalg ssh_ecdsa_nistp521;
|
|
|
extern const struct ssh_mac ssh_hmac_md5;
|
|
|
extern const struct ssh_mac ssh_hmac_sha1;
|
|
|
extern const struct ssh_mac ssh_hmac_sha1_buggy;
|
|
@@ -497,13 +631,13 @@ extern const struct ssh_mac ssh_hmac_sha256;
|
|
|
|
|
|
void *aes_make_context(void);
|
|
|
void aes_free_context(void *handle);
|
|
|
-void aes128_key(void *handle, unsigned char *key);
|
|
|
-void aes192_key(void *handle, unsigned char *key);
|
|
|
-void aes256_key(void *handle, unsigned char *key);
|
|
|
-void aes_iv(void *handle, unsigned char *iv);
|
|
|
-void aes_ssh2_encrypt_blk(void *handle, unsigned char *blk, int len);
|
|
|
-void aes_ssh2_decrypt_blk(void *handle, unsigned char *blk, int len);
|
|
|
-void aes_ssh2_sdctr(void *handle, unsigned char *blk, int len);
|
|
|
+void aes128_key(void *handle, const void *key);
|
|
|
+void aes192_key(void *handle, const void *key);
|
|
|
+void aes256_key(void *handle, const void *key);
|
|
|
+void aes_iv(void *handle, const void *iv);
|
|
|
+void aes_ssh2_encrypt_blk(void *handle, void *blk, int len);
|
|
|
+void aes_ssh2_decrypt_blk(void *handle, void *blk, int len);
|
|
|
+void aes_ssh2_sdctr(void *handle, void *blk, int len);
|
|
|
|
|
|
/*
|
|
|
* PuTTY version number formatted as an SSH version string.
|
|
@@ -521,8 +655,29 @@ extern
|
|
|
*/
|
|
|
extern int ssh_fallback_cmd(void *handle);
|
|
|
|
|
|
-#ifndef MSCRYPTOAPI
|
|
|
void SHATransform(word32 * digest, word32 * data);
|
|
|
+
|
|
|
+/*
|
|
|
+ * Check of compiler version
|
|
|
+ */
|
|
|
+#ifdef _FORCE_SHA_NI
|
|
|
+# define COMPILER_SUPPORTS_SHA_NI
|
|
|
+#elif defined(__clang__)
|
|
|
+# if __has_attribute(target) && __has_include(<shaintrin.h>) && (defined(__x86_64__) || defined(__i386))
|
|
|
+# define COMPILER_SUPPORTS_SHA_NI
|
|
|
+# endif
|
|
|
+#elif defined(__GNUC__)
|
|
|
+# if ((__GNUC__ >= 5) && (defined(__x86_64__) || defined(__i386)))
|
|
|
+# define COMPILER_SUPPORTS_SHA_NI
|
|
|
+# endif
|
|
|
+#elif defined (_MSC_VER)
|
|
|
+# if (defined(_M_X64) || defined(_M_IX86)) && _MSC_VER >= 1900
|
|
|
+# define COMPILER_SUPPORTS_SHA_NI
|
|
|
+# endif
|
|
|
+#endif
|
|
|
+
|
|
|
+#ifdef _FORCE_SOFTWARE_SHA
|
|
|
+# undef COMPILER_SUPPORTS_SHA_NI
|
|
|
#endif
|
|
|
|
|
|
int random_byte(void);
|
|
@@ -542,7 +697,7 @@ void ssh_send_port_open(void *channel, const char *hostname, int port,
|
|
|
extern char *pfd_connect(struct PortForwarding **pf, char *hostname, int port,
|
|
|
void *c, Conf *conf, int addressfamily);
|
|
|
extern void pfd_close(struct PortForwarding *);
|
|
|
-extern int pfd_send(struct PortForwarding *, char *data, int len);
|
|
|
+extern int pfd_send(struct PortForwarding *, const void *data, int len);
|
|
|
extern void pfd_send_eof(struct PortForwarding *);
|
|
|
extern void pfd_confirm(struct PortForwarding *);
|
|
|
extern void pfd_unthrottle(struct PortForwarding *);
|
|
@@ -622,7 +777,7 @@ void x11_free_fake_auth(struct X11FakeAuth *auth);
|
|
|
struct X11Connection; /* opaque outside x11fwd.c */
|
|
|
struct X11Connection *x11_init(tree234 *authtree, void *, const char *, int);
|
|
|
extern void x11_close(struct X11Connection *);
|
|
|
-extern int x11_send(struct X11Connection *, char *, int);
|
|
|
+extern int x11_send(struct X11Connection *, const void *, int);
|
|
|
extern void x11_send_eof(struct X11Connection *s);
|
|
|
extern void x11_unthrottle(struct X11Connection *s);
|
|
|
extern void x11_override_throttle(struct X11Connection *s, int enable);
|
|
@@ -652,8 +807,8 @@ char *platform_get_x_display(void);
|
|
|
*/
|
|
|
void x11_get_auth_from_authfile(struct X11Display *display,
|
|
|
const char *authfilename);
|
|
|
-int x11_identify_auth_proto(const char *proto);
|
|
|
-void *x11_dehexify(const char *hex, int *outlen);
|
|
|
+int x11_identify_auth_proto(ptrlen protoname);
|
|
|
+void *x11_dehexify(ptrlen hex, int *outlen);
|
|
|
|
|
|
Bignum copybn(Bignum b);
|
|
|
Bignum bn_power_2(int n);
|
|
@@ -665,17 +820,13 @@ Bignum modmul(Bignum a, Bignum b, Bignum mod);
|
|
|
Bignum modsub(const Bignum a, const Bignum b, const Bignum n);
|
|
|
void decbn(Bignum n);
|
|
|
extern Bignum Zero, One;
|
|
|
-Bignum bignum_from_bytes(const unsigned char *data, int nbytes);
|
|
|
-Bignum bignum_from_bytes_le(const unsigned char *data, int nbytes);
|
|
|
+Bignum bignum_from_bytes(const void *data, int nbytes);
|
|
|
+Bignum bignum_from_bytes_le(const void *data, int nbytes);
|
|
|
Bignum bignum_random_in_range(const Bignum lower, const Bignum upper);
|
|
|
-int ssh1_read_bignum(const unsigned char *data, int len, Bignum * result);
|
|
|
int bignum_bitcount(Bignum bn);
|
|
|
-int ssh1_bignum_length(Bignum bn);
|
|
|
-int ssh2_bignum_length(Bignum bn);
|
|
|
int bignum_byte(Bignum bn, int i);
|
|
|
int bignum_bit(Bignum bn, int i);
|
|
|
void bignum_set_bit(Bignum bn, int i, int value);
|
|
|
-int ssh1_write_bignum(void *data, Bignum bn);
|
|
|
Bignum biggcd(Bignum a, Bignum b);
|
|
|
unsigned short bignum_mod_short(Bignum number, unsigned short modulus);
|
|
|
Bignum bignum_add_long(Bignum number, unsigned long addend);
|
|
@@ -693,6 +844,11 @@ int bignum_cmp(Bignum a, Bignum b);
|
|
|
char *bignum_decimal(Bignum x);
|
|
|
Bignum bignum_from_decimal(const char *decimal);
|
|
|
|
|
|
+void BinarySink_put_mp_ssh1(BinarySink *, Bignum);
|
|
|
+void BinarySink_put_mp_ssh2(BinarySink *, Bignum);
|
|
|
+Bignum BinarySource_get_mp_ssh1(BinarySource *);
|
|
|
+Bignum BinarySource_get_mp_ssh2(BinarySource *);
|
|
|
+
|
|
|
#ifdef DEBUG
|
|
|
void diagbn(char *prefix, Bignum md);
|
|
|
#endif
|
|
@@ -705,13 +861,13 @@ Bignum dh_create_e(void *, int nbits);
|
|
|
const char *dh_validate_f(void *handle, Bignum f);
|
|
|
Bignum dh_find_K(void *, Bignum f);
|
|
|
|
|
|
-int loadrsakey(const Filename *filename, struct RSAKey *key,
|
|
|
- const char *passphrase, const char **errorstr);
|
|
|
-int rsakey_encrypted(const Filename *filename, char **comment);
|
|
|
-int rsakey_pubblob(const Filename *filename, void **blob, int *bloblen,
|
|
|
- char **commentptr, const char **errorstr);
|
|
|
-
|
|
|
-int saversakey(const Filename *filename, struct RSAKey *key, char *passphrase);
|
|
|
+int rsa_ssh1_encrypted(const Filename *filename, char **comment);
|
|
|
+int rsa_ssh1_loadpub(const Filename *filename, BinarySink *bs,
|
|
|
+ char **commentptr, const char **errorstr);
|
|
|
+int rsa_ssh1_loadkey(const Filename *filename, struct RSAKey *key,
|
|
|
+ const char *passphrase, const char **errorstr);
|
|
|
+int rsa_ssh1_savekey(const Filename *filename, struct RSAKey *key,
|
|
|
+ char *passphrase);
|
|
|
|
|
|
extern int base64_decode_atom(const char *atom, unsigned char *out);
|
|
|
extern int base64_lines(int datalen);
|
|
@@ -727,13 +883,13 @@ int ssh2_userkey_encrypted(const Filename *filename, char **comment);
|
|
|
struct ssh2_userkey *ssh2_load_userkey(const Filename *filename,
|
|
|
const char *passphrase,
|
|
|
const char **errorstr);
|
|
|
-unsigned char *ssh2_userkey_loadpub(const Filename *filename, char **algorithm,
|
|
|
- int *pub_blob_len, char **commentptr,
|
|
|
- const char **errorstr);
|
|
|
+int ssh2_userkey_loadpub(const Filename *filename, char **algorithm,
|
|
|
+ BinarySink *bs,
|
|
|
+ char **commentptr, const char **errorstr);
|
|
|
int ssh2_save_userkey(const Filename *filename, struct ssh2_userkey *key,
|
|
|
char *passphrase);
|
|
|
-const struct ssh_signkey *find_pubkey_alg(const char *name);
|
|
|
-const struct ssh_signkey *find_pubkey_alg_len(int namelen, const char *name);
|
|
|
+const ssh_keyalg *find_pubkey_alg(const char *name);
|
|
|
+const ssh_keyalg *find_pubkey_alg_len(ptrlen name);
|
|
|
|
|
|
enum {
|
|
|
SSH_KEYTYPE_UNOPENABLE,
|
|
@@ -785,13 +941,13 @@ void ssh2_write_pubkey(FILE *fp, const char *comment,
|
|
|
const void *v_pub_blob, int pub_len,
|
|
|
int keytype);
|
|
|
char *ssh2_fingerprint_blob(const void *blob, int bloblen);
|
|
|
-char *ssh2_fingerprint(const struct ssh_signkey *alg, void *data);
|
|
|
+char *ssh2_fingerprint(ssh_key *key);
|
|
|
int key_type(const Filename *filename);
|
|
|
const char *key_type_to_str(int type);
|
|
|
#ifdef MPEXT
|
|
|
-unsigned char *openssh_loadpub_line(char * line, char **algorithm,
|
|
|
- int *pub_blob_len, char **commentptr,
|
|
|
- const char **errorstr);
|
|
|
+int openssh_loadpub_line(char * line, char **algorithm,
|
|
|
+ BinarySink *bs,
|
|
|
+ char **commentptr, const char **errorstr);
|
|
|
#endif
|
|
|
|
|
|
int import_possible(int type);
|
|
@@ -806,21 +962,17 @@ int export_ssh1(const Filename *filename, int type,
|
|
|
int export_ssh2(const Filename *filename, int type,
|
|
|
struct ssh2_userkey *key, char *passphrase);
|
|
|
|
|
|
-void des3_decrypt_pubkey(unsigned char *key, unsigned char *blk, int len);
|
|
|
-void des3_encrypt_pubkey(unsigned char *key, unsigned char *blk, int len);
|
|
|
-void des3_decrypt_pubkey_ossh(unsigned char *key, unsigned char *iv,
|
|
|
- unsigned char *blk, int len);
|
|
|
-void des3_encrypt_pubkey_ossh(unsigned char *key, unsigned char *iv,
|
|
|
- unsigned char *blk, int len);
|
|
|
-void aes256_encrypt_pubkey(unsigned char *key, unsigned char *blk,
|
|
|
- int len);
|
|
|
-void aes256_decrypt_pubkey(unsigned char *key, unsigned char *blk,
|
|
|
- int len);
|
|
|
-
|
|
|
-void des_encrypt_xdmauth(const unsigned char *key,
|
|
|
- unsigned char *blk, int len);
|
|
|
-void des_decrypt_xdmauth(const unsigned char *key,
|
|
|
- unsigned char *blk, int len);
|
|
|
+void des3_decrypt_pubkey(const void *key, void *blk, int len);
|
|
|
+void des3_encrypt_pubkey(const void *key, void *blk, int len);
|
|
|
+void des3_decrypt_pubkey_ossh(const void *key, const void *iv,
|
|
|
+ void *blk, int len);
|
|
|
+void des3_encrypt_pubkey_ossh(const void *key, const void *iv,
|
|
|
+ void *blk, int len);
|
|
|
+void aes256_encrypt_pubkey(const void *key, void *blk, int len);
|
|
|
+void aes256_decrypt_pubkey(const void *key, void *blk, int len);
|
|
|
+
|
|
|
+void des_encrypt_xdmauth(const void *key, void *blk, int len);
|
|
|
+void des_decrypt_xdmauth(const void *key, void *blk, int len);
|
|
|
|
|
|
void openssh_bcrypt(const char *passphrase,
|
|
|
const unsigned char *salt, int saltbytes,
|
|
@@ -857,8 +1009,8 @@ void *zlib_compress_init(void);
|
|
|
void zlib_compress_cleanup(void *);
|
|
|
void *zlib_decompress_init(void);
|
|
|
void zlib_decompress_cleanup(void *);
|
|
|
-int zlib_compress_block(void *, unsigned char *block, int len,
|
|
|
- unsigned char **outblock, int *outlen);
|
|
|
+void zlib_compress_block(void *, unsigned char *block, int len,
|
|
|
+ unsigned char **outblock, int *outlen, int minlen);
|
|
|
int zlib_decompress_block(void *, unsigned char *block, int len,
|
|
|
unsigned char **outblock, int *outlen);
|
|
|
|
|
@@ -952,6 +1104,13 @@ void platform_ssh_share_cleanup(const char *name);
|
|
|
#define SSH2_MSG_KEX_DH_GEX_GROUP 31 /* 0x1f */
|
|
|
#define SSH2_MSG_KEX_DH_GEX_INIT 32 /* 0x20 */
|
|
|
#define SSH2_MSG_KEX_DH_GEX_REPLY 33 /* 0x21 */
|
|
|
+#define SSH2_MSG_KEXGSS_INIT 30 /* 0x1e */
|
|
|
+#define SSH2_MSG_KEXGSS_CONTINUE 31 /* 0x1f */
|
|
|
+#define SSH2_MSG_KEXGSS_COMPLETE 32 /* 0x20 */
|
|
|
+#define SSH2_MSG_KEXGSS_HOSTKEY 33 /* 0x21 */
|
|
|
+#define SSH2_MSG_KEXGSS_ERROR 34 /* 0x22 */
|
|
|
+#define SSH2_MSG_KEXGSS_GROUPREQ 40 /* 0x28 */
|
|
|
+#define SSH2_MSG_KEXGSS_GROUP 41 /* 0x29 */
|
|
|
#define SSH2_MSG_KEXRSA_PUBKEY 30 /* 0x1e */
|
|
|
#define SSH2_MSG_KEXRSA_SECRET 31 /* 0x1f */
|
|
|
#define SSH2_MSG_KEXRSA_DONE 32 /* 0x20 */
|
|
@@ -988,6 +1147,13 @@ void platform_ssh_share_cleanup(const char *name);
|
|
|
#define SSH2_MSG_USERAUTH_GSSAPI_ERRTOK 65
|
|
|
#define SSH2_MSG_USERAUTH_GSSAPI_MIC 66
|
|
|
|
|
|
+/* Virtual packet type, for packets too short to even have a type */
|
|
|
+#define SSH_MSG_NO_TYPE_CODE 0x100
|
|
|
+
|
|
|
+/* Given that virtual packet types exist, this is how big the dispatch
|
|
|
+ * table has to be */
|
|
|
+#define SSH_MAX_MSG 0x101
|
|
|
+
|
|
|
/*
|
|
|
* SSH-1 agent messages.
|
|
|
*/
|
|
@@ -1042,6 +1208,9 @@ void platform_ssh_share_cleanup(const char *name);
|
|
|
|
|
|
#define SSH2_EXTENDED_DATA_STDERR 1 /* 0x1 */
|
|
|
|
|
|
+const char *ssh1_pkt_type(int type);
|
|
|
+const char *ssh2_pkt_type(Pkt_KCtx pkt_kctx, Pkt_ACtx pkt_actx, int type);
|
|
|
+
|
|
|
/*
|
|
|
* Need this to warn about support for the original SSH-2 keyfile
|
|
|
* format.
|